wip: migrate to desktop2

This commit is contained in:
2024-02-12 20:04:45 +07:00
parent 1950cb59a2
commit ed52105c02
18 changed files with 172 additions and 177 deletions

View File

@@ -1,3 +1,4 @@
import { LoaderIcon } from "@lume/icons";
import {
Outlet,
ScrollRestoration,
@@ -11,4 +12,14 @@ export const Route = createRootRoute({
<Outlet />
</>
),
pendingComponent: Pending,
wrapInSuspense: true,
});
function Pending() {
return (
<div className="flex flex-col items-center justify-center w-screen h-screen">
<LoaderIcon className="size-5 animate-spin" />
</div>
);
}

View File

@@ -0,0 +1,20 @@
import { Navigation } from "@lume/ui";
import { Outlet, createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/app")({
component: App,
});
function App() {
return (
<div className="flex flex-col w-screen h-screen bg-gradient-to-tl from-gray-1 to-gray-2 dark:from-graydark-1 dark:to-graydark-2">
<div data-tauri-drag-region className="h-9 shrink-0" />
<div className="flex w-full h-full min-h-0">
<Navigation />
<div className="flex-1 h-full pb-2 pl-1 pr-2">
<Outlet />
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,13 @@
import { createLazyFileRoute } from "@tanstack/react-router";
export const Route = createLazyFileRoute("/app/space")({
component: Space,
});
function Space() {
return (
<div className="h-full w-full rounded-xl overflow-hidden bg-white shadow-[rgba(50,_50,_105,_0.15)_0px_2px_5px_0px,_rgba(0,_0,_0,_0.05)_0px_1px_1px_0px] dark:bg-black dark:shadow-none dark:ring-1 dark:ring-white/5">
<p>Hello</p>
</div>
);
}

View File

@@ -2,7 +2,6 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
import { invoke } from "@tauri-apps/api/core";
export const Route = createFileRoute("/")({
component: Index,
beforeLoad: async ({ location }) => {
const signer = await invoke("verify_signer");
if (!signer) {
@@ -13,13 +12,8 @@ export const Route = createFileRoute("/")({
},
});
}
throw redirect({
to: "/app/space",
});
},
});
function Index() {
return (
<div className="p-2">
<h3>Welcome Home!</h3>
</div>
);
}