From 5fa79b90002bdf15719e473cf32eb4adfb9dc60f Mon Sep 17 00:00:00 2001
From: "yongen.loong"
Date: Tue, 23 Jul 2024 10:17:49 +0800
Subject: [PATCH] refactor: cleanup unused code
---
app/page.tsx | 2 +-
app/workspace-new/page.tsx | 13 --------
app/{workspace-open => workspaces}/page.tsx | 2 +-
components/menu/index.tsx | 33 --------------------
components/menu/mode-toggle.tsx | 18 -----------
components/menu/new.tsx | 20 ------------
components/menu/open.tsx | 20 ------------
components/modal.tsx | 30 ------------------
components/{menu => }/new-workspace-form.tsx | 0
components/top-menu.tsx | 2 +-
10 files changed, 3 insertions(+), 137 deletions(-)
delete mode 100644 app/workspace-new/page.tsx
rename app/{workspace-open => workspaces}/page.tsx (90%)
delete mode 100644 components/menu/index.tsx
delete mode 100644 components/menu/mode-toggle.tsx
delete mode 100644 components/menu/new.tsx
delete mode 100644 components/menu/open.tsx
delete mode 100644 components/modal.tsx
rename components/{menu => }/new-workspace-form.tsx (100%)
diff --git a/app/page.tsx b/app/page.tsx
index 4c0e3b2..c19f4c2 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -73,7 +73,7 @@ export default function Home() {
{links.map((link) => (
diff --git a/app/workspace-new/page.tsx b/app/workspace-new/page.tsx
deleted file mode 100644
index 0e4e753..0000000
--- a/app/workspace-new/page.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { WorkspaceForm } from "@/components/menu/new-workspace-form";
-import { getTemplateNames } from "@/data/template";
-
-export default async function Page() {
- const templateOptions = await getTemplateNames();
- return (
-
-
-
-
-
- );
-}
diff --git a/app/workspace-open/page.tsx b/app/workspaces/page.tsx
similarity index 90%
rename from app/workspace-open/page.tsx
rename to app/workspaces/page.tsx
index 385471e..b4fd6e2 100644
--- a/app/workspace-open/page.tsx
+++ b/app/workspaces/page.tsx
@@ -1,4 +1,4 @@
-import { WorkspaceForm } from "@/components/menu/new-workspace-form";
+import { WorkspaceForm } from "@/components/new-workspace-form";
import Existing from "@/components/workspace/existing";
import { getTemplateNames } from "@/data/template";
diff --git a/components/menu/index.tsx b/components/menu/index.tsx
deleted file mode 100644
index acdf1f0..0000000
--- a/components/menu/index.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import {
- Menubar,
- MenubarContent,
- MenubarMenu,
- MenubarTrigger,
-} from "@/components/ui/menubar";
-import { ModeToggle } from "@/components/menu/mode-toggle";
-import Modal from "@/components/modal";
-import { getTemplateNames } from "@/data/template";
-import NewMenu from "./new";
-import OpenMenu from "./open";
-
-export async function MenubarComponent() {
- return (
-
-
-
-
- Theme
-
-
-
-
-
-
- Chat} title="Chat">
- <>Put your component here.>
-
-
-
-
- );
-}
diff --git a/components/menu/mode-toggle.tsx b/components/menu/mode-toggle.tsx
deleted file mode 100644
index c2d4557..0000000
--- a/components/menu/mode-toggle.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-"use client";
-
-import * as React from "react";
-import { useTheme } from "next-themes";
-
-import { MenubarRadioGroup, MenubarRadioItem } from "@/components/ui/menubar";
-
-export function ModeToggle() {
- const { theme, setTheme } = useTheme();
-
- return (
-
- Light
- Dark
- System
-
- );
-}
diff --git a/components/menu/new.tsx b/components/menu/new.tsx
deleted file mode 100644
index 930ad8f..0000000
--- a/components/menu/new.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import {
- MenubarMenu,
- MenubarTrigger,
- MenubarContent,
- MenubarItem,
-} from "@/components/ui/menubar";
-import Link from "next/link";
-
-export default async function NewMenu() {
- return (
-
- New
-
-
- Workspace
-
-
-
- );
-}
diff --git a/components/menu/open.tsx b/components/menu/open.tsx
deleted file mode 100644
index b2ad41f..0000000
--- a/components/menu/open.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import {
- MenubarMenu,
- MenubarTrigger,
- MenubarContent,
- MenubarItem,
-} from "@/components/ui/menubar";
-import Link from "next/link";
-
-export default async function OpenMenu() {
- return (
-
- Open
-
-
- Workspace
-
-
-
- );
-}
diff --git a/components/modal.tsx b/components/modal.tsx
deleted file mode 100644
index 64f4ba4..0000000
--- a/components/modal.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from "@/components/ui/dialog";
-import { PropsWithChildren, ReactNode } from "react";
-
-export default function Modal({
- trigger,
- title,
- children,
-}: PropsWithChildren<{
- trigger: ReactNode;
- title: ReactNode;
-}>) {
- return (
-
- );
-}
diff --git a/components/menu/new-workspace-form.tsx b/components/new-workspace-form.tsx
similarity index 100%
rename from components/menu/new-workspace-form.tsx
rename to components/new-workspace-form.tsx
diff --git a/components/top-menu.tsx b/components/top-menu.tsx
index e2ac8f3..af8c467 100644
--- a/components/top-menu.tsx
+++ b/components/top-menu.tsx
@@ -17,7 +17,7 @@ export default function TopMenu() {
const links = [
{ href: "/", children: "Home" },
- { href: "/workspace-open", children: "Workspaces" },
+ { href: "/workspaces", children: "Workspaces" },
{ href: "https://github.com/AElfProject", children: "GitHub" },
];