diff --git a/apps/web/src/components/modals/basic.tsx b/apps/web/src/components/modals/basic.tsx index 8a7df3b..be3e967 100644 --- a/apps/web/src/components/modals/basic.tsx +++ b/apps/web/src/components/modals/basic.tsx @@ -31,12 +31,12 @@ export function Basic({ +
} @@ -52,7 +52,7 @@ export function Basic({

{user.display}

-
{extra}
+
{extra}
); diff --git a/apps/web/src/components/navbar.tsx b/apps/web/src/components/navbar.tsx index 1c9e3a7..162a057 100644 --- a/apps/web/src/components/navbar.tsx +++ b/apps/web/src/components/navbar.tsx @@ -23,6 +23,7 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) { const currentCalls = calls.filter((call) => call.call_members.some((member) => member === id), ); + //const currentCalls = ["leck", "schleck", "und", "eck"]; const [selectOpen, setSelectOpen] = useState(false); diff --git a/apps/web/src/components/sidebar.tsx b/apps/web/src/components/sidebar.tsx index 054aff7..f8ce056 100644 --- a/apps/web/src/components/sidebar.tsx +++ b/apps/web/src/components/sidebar.tsx @@ -220,7 +220,7 @@ export default function Sidebar() { diff --git a/apps/web/src/features/conversation/list/body.tsx b/apps/web/src/features/conversation/list/body.tsx index d240655..7092b6f 100644 --- a/apps/web/src/features/conversation/list/body.tsx +++ b/apps/web/src/features/conversation/list/body.tsx @@ -76,16 +76,6 @@ export default function List() {
); })} - diff --git a/apps/web/src/routes/app/home.tsx b/apps/web/src/routes/app/home.tsx index 3e2c477..90f6a26 100644 --- a/apps/web/src/routes/app/home.tsx +++ b/apps/web/src/routes/app/home.tsx @@ -11,12 +11,12 @@ import { useIsMobile, } from "@tensamin/ui"; import z from "zod"; +import { toast } from "@tensamin/shared/log"; import { useTTP } from "@tensamin/ttp"; import { useState } from "react"; import { Loader2 } from "lucide-react"; import { isTauri } from "@tauri-apps/api/core"; import { useStorage } from "@tensamin/storage/context"; -import { useSession } from "@tensamin/storage/session"; // The page export default function Page() { @@ -43,16 +43,11 @@ export default function Page() { // Add Conversation Button Component function AddConversationButton() { const { send } = useTTP(); - const { contacts, insertContact } = useSession(); const [loading, setLoading] = useState(false); - const [open, setOpen] = useState(false); - const [error, setError] = useState(null); - async function submit(username: string | null) { + function submit(username: string | null) { if (loading) return; - setError(null); - // username check const schema = z .string() .min(1, "Username is too short") @@ -61,50 +56,26 @@ function AddConversationButton() { const result = schema.safeParse(username?.toLowerCase().trim()); if (!result.success) { - setError(result.error.issues[0].message); + toast("error", result.error.issues[0].message); return; } - // user existence check - const user = await send("get_user_data", { - username: result.data, - }) - .then((data) => { - if (data.data.user_id === 0) { - throw new Error(); - } - - return data; - }) - .catch(() => { - setError("User not found"); - return; - }); - if (!user) return; - - // alrady added check - if (contacts.some((contact) => contact.user_id === user.data.user_id)) { - setError("Conversation already exists"); - return; - } - - // add the conv const timeout = setTimeout(() => setLoading(true), 500); send("add_conversation", { chat_partner_name: result.data, }) .then(() => { - insertContact(user.data.user_id); - setOpen(false); + toast("success", "Conversation added"); }) .catch((error) => { if (String(error).includes("error_not_found")) { - setError("User not found"); + toast("error", "User not found"); return; } - setError(String(error)); + toast("error", "Failed to add conversation, check console for details"); + console.error("Failed to add conversation", error); }) .finally(() => { clearTimeout(timeout); @@ -113,15 +84,7 @@ function AddConversationButton() { } return ( - { - if (value) { - setError(null); - } - setOpen(value); - }} - > + Add Conversation} /> @@ -147,10 +110,7 @@ function AddConversationButton() { name="username" placeholder="Enter username..." /> -
- {error && ( -

{error}

- )} +
Cancel} />

- GIFs are supported in decentralised mode or with Tensamin Premium. + GIFs are supported in decentralised mode or with Tensamin Premium
Maximum file size is 16mb.

@@ -166,16 +162,13 @@ export default function Page() { />