From ee1344975eaccf2d7aaf370b2b1700a1f0b02b94 Mon Sep 17 00:00:00 2001
From: awtkns <32209255+awtkns@users.noreply.github.com>
Date: Wed, 1 Nov 2023 15:57:52 -0700
Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=A3=20Remove=20dead=20pages?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
next/package.json | 1 -
next/src/components/drawer/LeftSidebar.tsx | 7 +-
next/src/components/sidebar/links.tsx | 14 +---
next/src/pages/index.tsx | 2 +-
next/src/pages/org/[org].tsx | 74 ----------------------
next/src/ui/table.tsx | 31 ---------
6 files changed, 4 insertions(+), 125 deletions(-)
delete mode 100644 next/src/pages/org/[org].tsx
delete mode 100644 next/src/ui/table.tsx
diff --git a/next/package.json b/next/package.json
index 1056dd49a1..dc9cad5a9c 100644
--- a/next/package.json
+++ b/next/package.json
@@ -26,7 +26,6 @@
"@splinetool/react-spline": "^2.2.6",
"@tailwindcss/forms": "^0.5.3",
"@tanstack/react-query": "^4.29.14",
- "@tanstack/react-table": "^8.9.3",
"@trpc/client": "^10.21.1",
"@trpc/next": "^10.21.1",
"@trpc/react-query": "^10.21.1",
diff --git a/next/src/components/drawer/LeftSidebar.tsx b/next/src/components/drawer/LeftSidebar.tsx
index 568af4e290..0b68bfa3f9 100644
--- a/next/src/components/drawer/LeftSidebar.tsx
+++ b/next/src/components/drawer/LeftSidebar.tsx
@@ -86,17 +86,14 @@ const LeftSidebar = ({ show, setShow, onReload }: DisplayProps & { onReload?: ()
Pages
- {PAGE_LINKS.filter((link) =>
- typeof link.enabled === "boolean" ? link.enabled : link.enabled(session?.user)
- ).map((link, i) => (
+ {PAGE_LINKS.map((link, i) => (
{
- console.log(router.pathname, link.href, link.forceRefresh);
- if (router.pathname === link.href && link.forceRefresh) {
+ if (router.pathname === link.href) {
onReload?.();
return;
}
diff --git a/next/src/components/sidebar/links.tsx b/next/src/components/sidebar/links.tsx
index e242aa44cb..d95b897fd1 100644
--- a/next/src/components/sidebar/links.tsx
+++ b/next/src/components/sidebar/links.tsx
@@ -1,4 +1,3 @@
-import type { User } from "next-auth";
import type { IconType } from "react-icons";
import {
FaBusinessTime,
@@ -15,50 +14,43 @@ import { FaXTwitter } from "react-icons/fa6";
type LinkMetadata = {
name: string;
href: string;
- forceRefresh?: boolean;
icon: IconType;
badge?: {
text: string;
className?: string;
};
className?: string;
- enabled: boolean | ((user?: User) => boolean);
};
+
export const PAGE_LINKS: LinkMetadata[] = [
{
name: "Home",
href: "/",
icon: FaHome,
- enabled: true,
- forceRefresh: true,
},
{
name: "Help",
href: "https://docs.reworkd.ai/",
icon: FaQuestion,
className: "group-hover:text-red-500",
- enabled: true,
},
{
name: "Templates",
href: "/templates",
icon: FaFileCode,
className: "transition-transform group-hover:scale-110",
- enabled: true,
},
{
name: "Settings",
href: "/settings",
icon: FaCog,
className: "transition-transform group-hover:rotate-90",
- enabled: true,
},
{
name: "Organization",
href: "/organization",
icon: FaBusinessTime,
className: "transition-transform group-hover:scale-110",
- enabled: (user) => !!user && user.organizations.length > 0,
},
];
@@ -67,24 +59,20 @@ export const SOCIAL_LINKS: LinkMetadata[] = [
name: "Github",
href: "https://github.com/reworkd/AgentGPT",
icon: FaGithub,
- enabled: true,
},
{
name: "Twitter",
href: "https://twitter.com/ReworkdAI",
icon: FaXTwitter,
- enabled: true,
},
{
name: "Discord",
href: "https://discord.gg/gcmNyAAFfV",
icon: FaDiscord,
- enabled: true,
},
{
name: "LinkedIn",
href: "https://www.linkedin.com/company/reworkd/",
icon: FaLinkedin,
- enabled: true,
},
];
diff --git a/next/src/pages/index.tsx b/next/src/pages/index.tsx
index 27c4eba3a4..a40188a435 100644
--- a/next/src/pages/index.tsx
+++ b/next/src/pages/index.tsx
@@ -148,7 +148,7 @@ const Home: NextPage = () => {
{agent !== null ? (
();
-
-const columns = [
- columnHelper.accessor("id", {
- header: "OrgUser",
- }),
- columnHelper.accessor("role", {
- header: "Role",
- }),
- columnHelper.accessor("user.name", {
- header: "User",
- }),
-];
-
-export default function OrganizationPage() {
- const { query } = useRouter();
-
- const { data: session } = useSession();
- const slug = query.org as string;
-
- const { data } = useQuery(
- ["organization", slug],
- async () => {
- return await new OrganizationApi(session?.accessToken).get(slug);
- },
- {
- enabled: !!session?.user,
- }
- );
-
- const table = useReactTable({
- data: data?.users ?? [],
- columns,
- getCoreRowModel: getCoreRowModel(),
- });
-
- return (
-
-
-
- );
-}
-
-export const getServerSideProps: GetServerSideProps = async ({ locale = "en" }) => {
- const supportedLocales = languages.map((language) => language.code);
- const chosenLocale = supportedLocales.includes(locale) ? locale : "en";
-
- return {
- props: {
- ...(await serverSideTranslations(chosenLocale, nextI18NextConfig.ns)),
- },
- };
-};
diff --git a/next/src/ui/table.tsx b/next/src/ui/table.tsx
deleted file mode 100644
index 784094f3c2..0000000000
--- a/next/src/ui/table.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { flexRender, Table } from "@tanstack/react-table";
-import type { FC } from "react";
-
-const Table: FC<{ table: Table }> = ({ table }) => (
-
-
- {table.getHeaderGroups().map((headerGroup) => (
-
- {headerGroup.headers.map((header) => (
-
- {header.isPlaceholder
- ? null
- : flexRender(header.column.columnDef.header, header.getContext())}
- |
- ))}
-
- ))}
-
-
- {table.getRowModel().rows.map((row) => (
-
- {row.getVisibleCells().map((cell) => (
- {flexRender(cell.column.columnDef.cell, cell.getContext())} |
- ))}
-
- ))}
-
-
-);
-
-export default Table;