* refactor: remove custom icon packs * fix: command not work on windows * fix: make open_window command async * feat: improve commands * feat: improve * refactor: column * feat: improve thread column * feat: improve * feat: add stories column * feat: improve * feat: add search column * feat: add reset password * feat: add subscription * refactor: settings * chore: improve commands * fix: crash on production * feat: use tauri store plugin for cache * feat: new icon * chore: update icon for windows * chore: improve some columns * chore: polish code
42 lines
975 B
TypeScript
42 lines
975 B
TypeScript
import { events } from "@/commands.gen";
|
|
import { appSettings } from "@/commons";
|
|
import { Spinner } from "@/components";
|
|
import type { QueryClient } from "@tanstack/react-query";
|
|
import { Outlet, createRootRouteWithContext } from "@tanstack/react-router";
|
|
import type { OsType } from "@tauri-apps/plugin-os";
|
|
import { useEffect } from "react";
|
|
|
|
interface RouterContext {
|
|
queryClient: QueryClient;
|
|
platform: OsType;
|
|
}
|
|
|
|
export const Route = createRootRouteWithContext<RouterContext>()({
|
|
component: Screen,
|
|
pendingComponent: Pending,
|
|
});
|
|
|
|
function Screen() {
|
|
useEffect(() => {
|
|
const unlisten = events.newSettings.listen((data) => {
|
|
appSettings.setState((state) => {
|
|
return { ...state, ...data.payload };
|
|
});
|
|
});
|
|
|
|
return () => {
|
|
unlisten.then((f) => f());
|
|
};
|
|
}, []);
|
|
|
|
return <Outlet />;
|
|
}
|
|
|
|
function Pending() {
|
|
return (
|
|
<div className="flex flex-col items-center justify-center w-screen h-screen">
|
|
<Spinner className="size-5" />
|
|
</div>
|
|
);
|
|
}
|