forked from prehistoric-systems/chatpad
remove unused route
This commit is contained in:
parent
5756fb44ca
commit
14991d9ab5
2 changed files with 0 additions and 54 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue