Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit f32deb1

Browse files
committed
Schema, Light Mode, Cleaning
1 parent 0b09695 commit f32deb1

File tree

7 files changed

+34
-37
lines changed

7 files changed

+34
-37
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
31
# dependencies
42
/node_modules
53
/.pnp

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ SQLite Viewer GUI Program written in Rust using Tauri + NextJS
3535
1. **Clone the Repository**
3636

3737
```sh
38-
git clone https://github.com/TeaByte/mt-uploader.git
39-
cd mt-uploader
38+
git clone https://github.com/TeaByte/sqlite-viewer.git
39+
cd sqlite-viewer
4040
```
4141

4242
2. **Install Dependencies**

app/execute.tsx

+17-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use client";
22

3-
import { TableInfos } from "@/types";
3+
import { invoke } from "@tauri-apps/api/tauri";
4+
import React, { useState } from "react";
5+
46
import {
57
Table,
68
TableBody,
@@ -9,22 +11,8 @@ import {
911
TableHeader,
1012
TableRow,
1113
} from "@/components/ui/table";
12-
import {
13-
Accordion,
14-
AccordionContent,
15-
AccordionItem,
16-
AccordionTrigger,
17-
} from "@/components/ui/accordion";
18-
1914
import { Textarea } from "@/components/ui/textarea";
2015

21-
import { invoke } from "@tauri-apps/api/tauri";
22-
import React, { useState } from "react";
23-
24-
type x =
25-
| { result: { Ok: Array<{ [key: string]: string }> } }
26-
| { result: { Err: string } };
27-
2816
export default function ExecuteSQL({ table }: { table: string }) {
2917
const [sql, setSQL] = useState("");
3018
const [result, setResult] = useState<string | string[]>();
@@ -68,28 +56,28 @@ export default function ExecuteSQL({ table }: { table: string }) {
6856
{typeof result === "string" ? (
6957
<p>{result}</p>
7058
) : result instanceof Array ? (
71-
<table className="table-auto">
72-
<thead>
73-
<tr>
59+
<Table className="table-auto">
60+
<TableHeader>
61+
<TableRow>
7462
{Object.keys(result[0]).map((key) => (
75-
<th key={key} className="border px-4 py-2">
63+
<TableHead key={key} className="border px-4 py-2">
7664
{key}
77-
</th>
65+
</TableHead>
7866
))}
79-
</tr>
80-
</thead>
81-
<tbody>
67+
</TableRow>
68+
</TableHeader>
69+
<TableBody>
8270
{result.map((row, index) => (
83-
<tr key={index}>
71+
<TableRow key={index}>
8472
{Object.values(row).map((value, index) => (
85-
<td key={index} className="border px-4 py-2">
73+
<TableCell key={index} className="border px-4 py-2">
8674
{value}
87-
</td>
75+
</TableCell>
8876
))}
89-
</tr>
77+
</TableRow>
9078
))}
91-
</tbody>
92-
</table>
79+
</TableBody>
80+
</Table>
9381
) : null}
9482
</form>
9583
</div>

app/layout.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import type { Metadata } from "next";
33
import { Merriweather_Sans } from "next/font/google";
44

55
import ThemeProvider from "@/components/theme/provider";
6+
import Toggle from "@/components/theme/toggle";
67

78
const font = Merriweather_Sans({ subsets: ["latin"] });
89
export const metadata: Metadata = {
9-
title: "Rust SQLite Viewer",
10-
description: "Rust SQLite Viewer",
10+
title: "SQLite Viewer",
11+
description: "SQLite Viewer",
1112
};
1213

1314
export default function RootLayout({
@@ -25,6 +26,12 @@ export default function RootLayout({
2526
disableTransitionOnChange
2627
>
2728
{children}
29+
<footer className="p-4 fixed bottom-0 w-full bg-background">
30+
<div className="flex justify-between items-center">
31+
<Toggle />
32+
SQLite Viewer V0.3
33+
</div>
34+
</footer>
2835
</ThemeProvider>
2936
</body>
3037
</html>

app/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function Home() {
2929
};
3030

3131
return (
32-
<main className="flex flex-col min-h-screen">
32+
<main className="flex flex-col">
3333
{selectedDataBase ? (
3434
<Load path={selectedDataBase} />
3535
) : (

app/structure.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default function Structure({ tablesInfo }: { tablesInfo: TableInfos }) {
3535
<TableHead>NotNull</TableHead>
3636
<TableHead>Default Value</TableHead>
3737
<TableHead>Primary Key</TableHead>
38+
<TableHead>Schema</TableHead>
3839
</TableRow>
3940
</TableHeader>
4041
<TableBody>
@@ -53,6 +54,9 @@ export default function Structure({ tablesInfo }: { tablesInfo: TableInfos }) {
5354
{tableInfo.dflt_value ? tableInfo.dflt_value : "None"}
5455
</TableCell>
5556
<TableCell>{tableInfo.pk ? "Yes" : "No"}</TableCell>
57+
<TableCell>{`"${tableInfo.name}" ${tableInfo.type} ${
58+
tableInfo.notnull ? "NOT NULL" : ""
59+
}`}</TableCell>
5660
</TableRow>
5761
))}
5862
</TableBody>

src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
{
6565
"fullscreen": false,
6666
"height": 600,
67-
"maxHeight": 600,
67+
"minHeight": 600,
6868
"resizable": true,
6969
"title": "SQLite Viewer",
7070
"width": 800,

0 commit comments

Comments
 (0)