remove unused route

This commit is contained in:
Andrei Canta 2023-03-19 08:54:17 +02:00
parent 5756fb44ca
commit 14991d9ab5
2 changed files with 0 additions and 54 deletions

View file

@ -11,7 +11,6 @@ import {
Router,
} from "@tanstack/react-location";
import { ChatRoute } from "../routes/ChatRoute";
import { DataRoute } from "../routes/DataRoute";
import { IndexRoute } from "../routes/IndexRoute";
import { Layout } from "./Layout";
@ -38,7 +37,6 @@ export function App() {
routes={[
{ path: "/", element: <IndexRoute /> },
{ path: "/chats/:chatId", element: <ChatRoute /> },
{ path: "/data", element: <DataRoute /> },
]}
>
<ColorSchemeProvider

View file

@ -1,52 +0,0 @@
import { Button, Container, Group } from "@mantine/core";
import download from "downloadjs";
import { db } from "../db";
export function DataRoute() {
return (
<Container>
<Group>
<Button
onClick={async () => {
const blob = await db.export();
download(
blob,
`chatpad-export-${new Date().toLocaleString()}.json`,
"application/json"
);
}}
>
Export Data
</Button>
<input
id="file-upload-btn"
type="file"
onChange={async (e) => {
const file = e.currentTarget.files?.[0];
if (!file) return;
await db.import(file, {
acceptNameDiff: true,
overwriteValues: true,
acceptMissingTables: true,
clearTablesBeforeImport: true,
});
}}
accept="application/json"
hidden
/>
<Button component="label" htmlFor="file-upload-btn">
Import Data
</Button>
<Button
onClick={async () => {
await db.delete();
localStorage.clear();
window.location.assign("/");
}}
>
Delete Data
</Button>
</Group>
</Container>
);
}