Fixed login, added clear storage button

This commit is contained in:
Alois 2026-04-07 15:57:51 +02:00
commit 462fc19591
6 changed files with 270 additions and 11 deletions

View file

@ -1,13 +1,19 @@
import { cn } from "../lib/utils";
import Controls from "@tensamin/tauri/controls";
export default function CreateScreen({
children,
className,
}: {
children: React.ReactNode;
className?: string;
}) {
return (
<div
className="bg-background w-screen h-screen flex flex-col justify-center items-center"
className={cn(
"bg-background w-screen h-screen flex flex-col justify-center items-center",
className,
)}
data-tauri-drag-region
>
<>
@ -17,3 +23,59 @@ export default function CreateScreen({
</div>
);
}
import { Button } from "../cmp/button";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "../cmp/alert-dialog";
import { useIsMobile } from "../lib/utils";
export function StorageDestoryer() {
const isMobile = useIsMobile();
return (
<div className={cn("fixed p-5 bottom-0", isMobile ? "w-full" : "right-0")}>
<AlertDialog>
<AlertDialogTrigger
render={
<Button variant="destructive" className={isMobile ? "w-full" : ""}>
Clear storage
</Button>
}
/>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
Are you sure you want to clear storage?
</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. It will clear all your settings and
credentials.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogAction
onClick={async () => {
localStorage.clear();
for (const db of await indexedDB.databases()) {
indexedDB.deleteDatabase(db.name!);
}
location.reload();
}}
>
Continue
</AlertDialogAction>
<AlertDialogCancel>Cancel</AlertDialogCancel>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
}