(wip): migrate ttp to mtp
This commit is contained in:
parent
b1e8af7ec3
commit
20018f09a9
163 changed files with 8342 additions and 2609 deletions
|
|
@ -105,7 +105,7 @@ export default function Form() {
|
|||
await save("user_id", parsed.userId);
|
||||
await save("private_key", parsed.privateKey);
|
||||
if (parsed.domain) {
|
||||
await save("ttp_url", `https://${parsed.domain}/`);
|
||||
await save("mtp_url", `https://${parsed.domain}/`);
|
||||
}
|
||||
|
||||
location.href = "/";
|
||||
|
|
@ -253,7 +253,7 @@ export default function Form() {
|
|||
await save("user_id", user.user_id);
|
||||
await save("private_key", inputParse.data.private_key);
|
||||
if (domain) {
|
||||
await save("ttp_url", `https://${domain}/`);
|
||||
await save("mtp_url", `https://${domain}/`);
|
||||
}
|
||||
|
||||
location.href = "/";
|
||||
|
|
@ -287,7 +287,7 @@ export default function Form() {
|
|||
await save("private_key", privateKey);
|
||||
|
||||
if (domain) {
|
||||
await save("ttp_url", `https://${domain}/`);
|
||||
await save("mtp_url", `https://${domain}/`);
|
||||
}
|
||||
|
||||
location.href = "/";
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ import { Ellipsis, Check } from "lucide-react";
|
|||
import { useState } from "react";
|
||||
import type { User } from "@tensamin/user/context";
|
||||
import type z from "zod";
|
||||
import { ttp } from "@tensamin/shared/data";
|
||||
import { useTTP } from "@tensamin/ttp";
|
||||
import { mtp } from "@tensamin/shared/data";
|
||||
import { useMTP } from "@tensamin/mtp";
|
||||
|
||||
type OnlineStatus = z.infer<
|
||||
typeof ttp.get_user_data.response.shape.online_status
|
||||
typeof mtp.get_user_data.response.shape.online_status
|
||||
>;
|
||||
|
||||
const onlineStatusLabels: Record<OnlineStatus, string> = {
|
||||
|
|
@ -73,7 +73,7 @@ function StatusDialog({
|
|||
user: User;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
send: ReturnType<typeof useTTP>["send"];
|
||||
send: ReturnType<typeof useMTP>["send"];
|
||||
draftStatus: string;
|
||||
setDraftStatus: (value: string) => void;
|
||||
draftOnlineStatus: OnlineStatus;
|
||||
|
|
@ -148,7 +148,7 @@ function StatusDialog({
|
|||
};
|
||||
|
||||
const validation =
|
||||
ttp.change_user_data.request.safeParse(payload);
|
||||
mtp.change_user_data.request.safeParse(payload);
|
||||
|
||||
if (!validation.success) {
|
||||
setSaveSucceeded(false);
|
||||
|
|
@ -194,7 +194,7 @@ export default function Sidebar() {
|
|||
const [statusErrorMessage, setStatusErrorMessage] = useState("");
|
||||
const [statusSaveSucceeded, setStatusSaveSucceeded] = useState(false);
|
||||
|
||||
const { send } = useTTP();
|
||||
const { send } = useMTP();
|
||||
|
||||
const content = (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import Login from "@/routes/screens/login";
|
|||
import CallPopout from "@tensamin/call/popout";
|
||||
import ChatContext from "@tensamin/chat/context";
|
||||
import { useInitializeCall } from "@tensamin/call/store";
|
||||
import { Provider as TTPProvider } from "@tensamin/ttp";
|
||||
import { Provider as MTPProvider } from "@tensamin/mtp";
|
||||
import UserContext from "@tensamin/user/context";
|
||||
import DeeplinkContext from "@tensamin/tauri/deeplinkHandler";
|
||||
import NotificationsProvider from "@tensamin/notifications/context";
|
||||
|
|
@ -177,59 +177,31 @@ function ThemeStorageBridge() {
|
|||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_color", themeColor);
|
||||
if (loadedRef.current) save("theme_color", themeColor);
|
||||
}, [save, themeColor]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_palette", themePalette);
|
||||
if (loadedRef.current) save("theme_palette", themePalette);
|
||||
}, [save, themePalette]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_primary_color", themePrimaryColor);
|
||||
if (loadedRef.current) save("theme_primary_color", themePrimaryColor);
|
||||
}, [save, themePrimaryColor]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_polarity", themePolarity);
|
||||
if (loadedRef.current) save("theme_polarity", themePolarity);
|
||||
}, [save, themePolarity]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_tint", themeTint);
|
||||
if (loadedRef.current) save("theme_tint", themeTint);
|
||||
}, [save, themeTint]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_border_radius", themeBorderRadius);
|
||||
if (loadedRef.current) save("theme_border_radius", themeBorderRadius);
|
||||
}, [save, themeBorderRadius]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
save("theme_custom_css", themeCustomCss);
|
||||
if (loadedRef.current) save("theme_custom_css", themeCustomCss);
|
||||
}, [save, themeCustomCss]);
|
||||
|
||||
return null;
|
||||
|
|
@ -266,9 +238,19 @@ function RootShell() {
|
|||
<LoginWrapper>
|
||||
<LegalWrapper>
|
||||
<Crypto>
|
||||
<DesktopMediaProvider>
|
||||
<Outlet />
|
||||
</DesktopMediaProvider>
|
||||
<MTPProvider>
|
||||
<Session>
|
||||
<UserContext>
|
||||
<CallInit />
|
||||
<CallPopout />
|
||||
<TAuthWrapper>
|
||||
<DesktopMediaProvider>
|
||||
<Outlet />
|
||||
</DesktopMediaProvider>
|
||||
</TAuthWrapper>
|
||||
</UserContext>
|
||||
</Session>
|
||||
</MTPProvider>
|
||||
</Crypto>
|
||||
</LegalWrapper>
|
||||
</LoginWrapper>
|
||||
|
|
@ -282,28 +264,19 @@ function RootShell() {
|
|||
|
||||
function AppShell() {
|
||||
return (
|
||||
<TTPProvider>
|
||||
<Session>
|
||||
<UserContext>
|
||||
<CallInit />
|
||||
<CallPopout />
|
||||
<TAuthWrapper>
|
||||
<AppLayout>
|
||||
<ChatContext>
|
||||
<NotificationsProvider>
|
||||
<Outlet />
|
||||
</NotificationsProvider>
|
||||
</ChatContext>
|
||||
</AppLayout>
|
||||
</TAuthWrapper>
|
||||
</UserContext>
|
||||
</Session>
|
||||
</TTPProvider>
|
||||
<AppLayout>
|
||||
<ChatContext>
|
||||
<NotificationsProvider>
|
||||
<Outlet />
|
||||
</NotificationsProvider>
|
||||
</ChatContext>
|
||||
</AppLayout>
|
||||
);
|
||||
}
|
||||
|
||||
function CallInit() {
|
||||
return useInitializeCall();
|
||||
useInitializeCall();
|
||||
return null;
|
||||
}
|
||||
|
||||
const rootRoute = createRootRoute({
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
useIsMobile,
|
||||
} from "@tensamin/ui";
|
||||
import z from "zod";
|
||||
import { useTTP } from "@tensamin/ttp";
|
||||
import { useMTP } from "@tensamin/mtp";
|
||||
import { useState } from "react";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { isTauri } from "@tauri-apps/api/core";
|
||||
|
|
@ -31,7 +31,7 @@ export default function Page() {
|
|||
|
||||
// Add Conversation Button Component
|
||||
function AddConversationButton() {
|
||||
const { send } = useTTP();
|
||||
const { send } = useMTP();
|
||||
const { contacts, insertContact } = useSession();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {
|
|||
import { useUser, type User } from "@tensamin/user/context";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import MDInput from "@tensamin/markdown/input";
|
||||
import { ttp } from "@tensamin/shared/data";
|
||||
import { useTTP } from "@tensamin/ttp";
|
||||
import { mtp } from "@tensamin/shared/data";
|
||||
import { useMTP } from "@tensamin/mtp";
|
||||
import { Check } from "lucide-react";
|
||||
|
||||
async function prepImage(
|
||||
|
|
@ -43,7 +43,7 @@ async function prepImage(
|
|||
export default function Page() {
|
||||
const { get } = useUser();
|
||||
const { load } = useStorage();
|
||||
const { send } = useTTP();
|
||||
const { send } = useMTP();
|
||||
const [currentUser, setCurrentUser] = useState<User | null>(null);
|
||||
const [draftUser, setDraftUser] = useState<Partial<User>>({});
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
|
|
@ -178,7 +178,7 @@ export default function Page() {
|
|||
: {}),
|
||||
};
|
||||
|
||||
const validation = ttp.change_user_data.request.safeParse(payload);
|
||||
const validation = mtp.change_user_data.request.safeParse(payload);
|
||||
|
||||
if (!validation.success) {
|
||||
setSaveSucceeded(false);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function QrCodeLogin() {
|
|||
setUserId(value);
|
||||
}
|
||||
});
|
||||
load("ttp_url")
|
||||
load("mtp_url")
|
||||
.then((value) => {
|
||||
if (value) {
|
||||
const url = new URL(value);
|
||||
|
|
|
|||
Loading…
Reference in a new issue