Formatted, updated convs & comms list to not depend on each other, updated legal & login screen for better mobile support
This commit is contained in:
parent
aa8dfe2fca
commit
741afdeaa9
9 changed files with 54 additions and 22 deletions
|
|
@ -107,18 +107,23 @@ export default function Form() {
|
|||
const response = await fetch(
|
||||
`https://omega.tensamin.net/api/get/id/${inputParse.data.username}`,
|
||||
);
|
||||
const data = await response.json();
|
||||
const parse = fetchedUser.safeParse(data);
|
||||
const rawData = await response.arrayBuffer();
|
||||
|
||||
const bytes = new Uint8Array(rawData);
|
||||
const jsonString = new TextDecoder().decode(bytes);
|
||||
const data = JSON.parse(jsonString);
|
||||
|
||||
const parse = fetchedUser.shape.data.safeParse(data);
|
||||
|
||||
if (!parse.success) {
|
||||
log(0, "Login", "red", "Invalid response from server");
|
||||
log(0, "Login", "red", "Invalid response from server", parse.error);
|
||||
toast("error", "Invalid response from server");
|
||||
return;
|
||||
}
|
||||
|
||||
const user = parse.data;
|
||||
|
||||
await save("user_id", user.data.user_id);
|
||||
await save("user_id", user.user_id);
|
||||
await save("private_key", inputParse.data.private_key);
|
||||
|
||||
navigate({ to: "/" });
|
||||
|
|
@ -131,7 +136,7 @@ export default function Form() {
|
|||
);
|
||||
|
||||
return (
|
||||
<div className="flex gap-15">
|
||||
<div className="flex md:flex-row flex-col gap-15">
|
||||
<div
|
||||
onClick={() => uploadRef.current?.click()}
|
||||
className="flex flex-col gap-3 cursor-pointer w-55 aspect-square bg-input/13 hover:bg-input/30 transition-all duration-300 ease-in-out border-3 items-center justify-center rounded-lg"
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ import List from "@/features/conversation/list/body";
|
|||
import {
|
||||
Sidebar as SidebarRoot,
|
||||
SidebarContent,
|
||||
SidebarFooter,
|
||||
} from "@tensamin/ui/cmp/sidebar";
|
||||
import { isTauri } from "@tauri-apps/api/core";
|
||||
import { useIsMobile } from "@tensamin/ui/utils";
|
||||
import { MobileNavbar } from "./navbar";
|
||||
import { useLocation } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* Renders the conversation sidebar with account summary and conversation list.
|
||||
|
|
@ -17,14 +21,19 @@ import { isTauri } from "@tauri-apps/api/core";
|
|||
export default function Sidebar() {
|
||||
const [userId, setUserId] = React.useState<undefined | number>(undefined);
|
||||
const { load } = useStorage();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
React.useEffect(() => {
|
||||
load("user_id").then(setUserId);
|
||||
}, [load]);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<SidebarRoot>
|
||||
<SidebarContent className={isTauri() ? "pt-[env(safe-area-inset-top)]" : "pt-2"}>
|
||||
<SidebarContent
|
||||
className={isTauri() ? "pt-[env(safe-area-inset-top)]" : "pt-2"}
|
||||
>
|
||||
<div className="h-full w-full flex flex-col gap-3 p-2 pt-0!">
|
||||
<div>
|
||||
<Wrapper
|
||||
|
|
@ -38,6 +47,11 @@ export default function Sidebar() {
|
|||
</div>
|
||||
</div>
|
||||
</SidebarContent>
|
||||
{isMobile && location.pathname === "/chat" && (
|
||||
<SidebarFooter className="p-0!">
|
||||
<MobileNavbar />
|
||||
</SidebarFooter>
|
||||
)}
|
||||
</SidebarRoot>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue