Skip to content

Commit

Permalink
feat(style/view): start atlas port, add config viewer
Browse files Browse the repository at this point in the history
Co-authored-by: proudparrot2 <[email protected]>
  • Loading branch information
IncognitoTGT and proudparrot2 committed Dec 11, 2024
1 parent 38d1ea6 commit 7cdd1d8
Show file tree
Hide file tree
Showing 7 changed files with 379 additions and 309 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@marsidev/react-turnstile": "^0.7.2",
"@monaco-editor/react": "^4.6.0",
"@next/bundle-analyzer": "15.0.1",
"@novnc/novnc": "^1.5.0",
"@paralleldrive/cuid2": "^2.2.2",
Expand Down Expand Up @@ -44,6 +45,7 @@
"drizzle-zod": "^0.5.1",
"input-otp": "^1.2.4",
"lucide-react": "^0.358.0",
"monaco-editor": "^0.52.0",
"next": "15.0.3-canary.5",
"next-auth": "5.0.0-beta.24",
"next-themes": "^0.3.0",
Expand Down
40 changes: 40 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/app/(main)/admin/config/editor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use client";
import Editor from "@monaco-editor/react";
export default function ConfigEditor({ current }: { current: string }) {
return (
<Editor
defaultLanguage="json"
className="size-[90vh]"
defaultValue={current}
theme="vs-dark"
defaultPath="repo://.config/config.json"
/>
);
}
16 changes: 16 additions & 0 deletions src/app/(main)/admin/config/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { readFile } from "node:fs";
import ConfigEditor from "./editor";

export default async function Page() {
const configFile = await new Promise<Buffer>((res, rej) =>
readFile(`${process.cwd()}/.config/config.json`, (err, data) => {
if (err) rej(err);
res(data);
}),
);
return (
<div className="flex h-full flex-col">
<ConfigEditor current={configFile.toString()} />
</div>
);
}
1 change: 1 addition & 0 deletions src/app/(main)/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export default async function AdminLayout({ children }: { children: React.ReactN
</div>
);
}
export const dynamic = "force-dynamic";
Loading

0 comments on commit 7cdd1d8

Please sign in to comment.