From 27ba439e0c355b2363ecc2f278c676a0252ef509 Mon Sep 17 00:00:00 2001 From: Cullen Lee Date: Tue, 25 Jun 2024 19:30:14 -0700 Subject: [PATCH] chore: Update shared-components subproject commit and remove unused files --- app/{ => (root)}/dashboard/page.tsx | 5 +- app/(root)/layout.tsx | 41 --- app/(root)/page.tsx | 124 ++------- app/dashboard/layout.tsx | 17 -- app/{(root) => }/globals.css | 0 app/layout.tsx | 49 ++++ components/ui/dashboard/charts.tsx | 24 +- components/ui/dashboard/icons.tsx | 375 ---------------------------- components/ui/dashboard/index.tsx | 152 +---------- packages/shared-components | 2 +- 10 files changed, 70 insertions(+), 719 deletions(-) rename app/{ => (root)}/dashboard/page.tsx (83%) delete mode 100644 app/(root)/layout.tsx delete mode 100644 app/dashboard/layout.tsx rename app/{(root) => }/globals.css (100%) create mode 100644 app/layout.tsx delete mode 100644 components/ui/dashboard/icons.tsx diff --git a/app/dashboard/page.tsx b/app/(root)/dashboard/page.tsx similarity index 83% rename from app/dashboard/page.tsx rename to app/(root)/dashboard/page.tsx index f570fa8..38c8ad7 100644 --- a/app/dashboard/page.tsx +++ b/app/(root)/dashboard/page.tsx @@ -4,7 +4,7 @@ import React from "react"; import DashBoard from "@/components/ui/dashboard/index"; import DashboardChart from "@/components/ui/dashboard/charts"; -const Page: React.FC = () => { +export default function Page() { return ( @@ -14,6 +14,3 @@ const Page: React.FC = () => { ); }; - - -export default Page \ No newline at end of file diff --git a/app/(root)/layout.tsx b/app/(root)/layout.tsx deleted file mode 100644 index 33e462d..0000000 --- a/app/(root)/layout.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import './globals.css'; - -import { Analytics } from '@vercel/analytics/react'; -import { SessionProvider } from 'next-auth/react'; -import { SpeedInsights } from "@vercel/speed-insights/next" -import { NextUIProvider } from '@nextui-org/react'; -import { ThemeProvider as NextThemesProvider } from "next-themes"; -import Frame from '@mitech/shared-components/component/frame-with-sidebar-and-navbar'; -import { NotificationProvider } from '@/components/ui/NotificationContext'; -export const metadata = { - title: 'Welcome to Mitech Recruitment', - description: - 'A user admin dashboard configured with Next.js, Postgres, NextAuth, Tailwind CSS, TypeScript, ESLint, and Prettier.' -}; - -export default async function RootLayout({ - children -}: { - children: React.ReactNode; -}) { - - return ( - - - - - -
- - {children} - -
- - {/* Vercel Speed Insights */} -
-
-
- - - ); -} \ No newline at end of file diff --git a/app/(root)/page.tsx b/app/(root)/page.tsx index 8dce3ed..38c8ad7 100644 --- a/app/(root)/page.tsx +++ b/app/(root)/page.tsx @@ -1,110 +1,16 @@ -"use client" -import Pagination from '@/components/ui/pagination'; -import Search from '@mitech/shared-components/ui/search'; -import AdsTable from '@/components/ui/ads-table'; -import { CreateAd } from '@/components/ui/button'; -import { Suspense, useEffect, useState } from 'react'; -import { Metadata } from 'next'; -import { GetFilteredAdsPages } from '@/lib/data'; -import GanttChart from '@/components/ui/gantt-chart/gantt-chart'; -import { fetchAds } from '@/lib/api'; -import { Advertisement } from '@/lib/definitions'; -import 'react-toastify/dist/ReactToastify.css'; -import Cookies from 'js-cookie'; -import { toast } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.css'; +"use client"; + +import React from "react"; +import DashBoard from "@/components/ui/dashboard/index"; +import DashboardChart from "@/components/ui/dashboard/charts"; + +export default function Page() { + return ( + + + + + + ); +}; -export default function Page({ - searchParams, -}: { - searchParams?: { - query?: string; - page?: string; - }; -}) { - const query = searchParams?.query || ''; - const currentPage = Number(searchParams?.page) || 1; - const [adsAll, setAds] = useState([]); - useEffect(() => { - fetchAds().then(data => setAds(data.result.filter((ad:any) => ad.status !== 'deleted'))); - }, []); - useEffect(() => { - const message = Cookies.get('notification_stop_ad'); - function showToast() { - toast.success(message); - } - if (message) { - setTimeout(showToast, 1000); - Cookies.remove('notification_stop_ad'); - } - }, []); - useEffect(() => { - const message = Cookies.get('notification_post_ad'); - function showToast() { - toast.success(message); - } - if (message) { - setTimeout(showToast, 1000); - Cookies.remove('notification_post_ad'); - } - }, []); - useEffect(() => { - const message = Cookies.get('notification_delete_ad'); - function showToast() { - toast.success(message); - } - if (message) { - setTimeout(showToast, 1000); - Cookies.remove('notification_delete_ad'); - } - }, []); - useEffect(() => { - const message = Cookies.get('notification_create_ad'); - function showToast() { - toast.success(message); - } - if (message) { - setTimeout(showToast, 1000); - Cookies.remove('notification_create_ad'); - } - }, []); - useEffect(() => { - const message = Cookies.get('notification_update_ad'); - function showToast() { - toast.success(message); - } - if (message) { - setTimeout(showToast, 1000); - Cookies.remove('notification_update_ad'); - } - }, []); - const totalPages = GetFilteredAdsPages(adsAll,query); -return ( -
-
-
-

Manage Ads

-
-
-
-
- - -
- -
- -
-
-

-
-
-

AD Campaign Gantt Chart

-
- -
-
-
-
-); -} diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx deleted file mode 100644 index 25567fe..0000000 --- a/app/dashboard/layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import '../(root)/globals.css'; -export const metadata = { - title: 'Next.js', - description: 'Generated by Next.js', -} - -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { - return ( - - {children} - - ) -} diff --git a/app/(root)/globals.css b/app/globals.css similarity index 100% rename from app/(root)/globals.css rename to app/globals.css diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..99f3e2b --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,49 @@ +import './globals.css'; +import { Analytics } from '@vercel/analytics/react'; +import { SessionProvider } from 'next-auth/react'; +import { SpeedInsights } from "@vercel/speed-insights/next" +import { NextUIProvider } from '@nextui-org/react'; +import { ThemeProvider as NextThemesProvider } from "next-themes"; +import { NotificationProvider } from '@/components/ui/NotificationContext'; +import Navbar from '@mitech/shared-components/ui/navbars/navbar-2'; +import Sidebar from '@mitech/shared-components/ui/sidebars/sidebar-2'; + +export const metadata = { + title: 'Next.js', + description: 'Generated by Next.js', +} + + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + + + + +
+ +
+
+ + {children} +
+
+
+ + {/* Vercel Speed Insights */} +
+
+
+
+ + + ) +} diff --git a/components/ui/dashboard/charts.tsx b/components/ui/dashboard/charts.tsx index dc4ee1c..82ce1f8 100644 --- a/components/ui/dashboard/charts.tsx +++ b/components/ui/dashboard/charts.tsx @@ -1,8 +1,5 @@ "use client" -import Link from "next/link"; import { useState } from "react"; -import { CircleAlertIcon, SearchIcon, BellIcon, Question } from "./icons"; -import { Avatar } from '@nextui-org/react'; import BarListChart from "./barList"; import BarChartComponent from "./barChart"; import LineCharts from "./lineChart"; @@ -40,26 +37,7 @@ const DashboardChart = () => { }; return ( -
-
-
- -
- There are 30 days left in your trial. - - Upgrade Account - -
-
-
- - - - - XD - -
-
+

Dashboard

diff --git a/components/ui/dashboard/icons.tsx b/components/ui/dashboard/icons.tsx deleted file mode 100644 index 528c0c4..0000000 --- a/components/ui/dashboard/icons.tsx +++ /dev/null @@ -1,375 +0,0 @@ -"use client" -import { JSX, SVGProps } from "react" -export function BarChartIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - ) -} -export function ChevronDownIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - ) -} -export function ChevronUpIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - ); -} - - -export function BellIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - ) -} - - -export function CircleAlertIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - ) -} - - -export function ClockIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - -export function CreditCardIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - -export function DollarSignIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - -export function FileIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - -export function FileTextIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - - - ) -} - - -export function FolderIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - ) -} - - -export function LayoutDashboardIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - - ) -} - - -export function LayoutGridIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - - ) -} - - - - -export function LogOutIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - ) -} - - -export function SearchIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - - - -export function UserIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - ) -} - - -export function UsersIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - - - - ) -} -export function Question(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - ) -} \ No newline at end of file diff --git a/components/ui/dashboard/index.tsx b/components/ui/dashboard/index.tsx index 50557a1..8c9ceb9 100644 --- a/components/ui/dashboard/index.tsx +++ b/components/ui/dashboard/index.tsx @@ -1,155 +1,9 @@ "use client" -import Link from "next/link" -import { usePathname } from 'next/navigation' -import { - LayoutDashboardIcon, - UsersIcon, - FileIcon, - CreditCardIcon, - DollarSignIcon, - FolderIcon, - UserIcon, - ChevronDownIcon, - ChevronUpIcon, -} from './icons'; -import { useState } from "react"; export default function DashBoard(props: any) { - return ( -
- -
- {props.children} -
-
+ return (<> + {props.children} + ) } -interface NavLinkProps { - href: string; - icon: any; - label: string; - isActive?: boolean; - submenu?: SubNavLinkData[]; -} - -const NavLink: React.FC = ({ href, icon: Icon, label, submenu }) => { - const pathname = usePathname(); - const isActive = pathname === href; - const [isOpen, setIsOpen] = useState(false); - - const toggleSubMenu = () => { - setIsOpen(!isOpen); - }; - - return ( -
-
-
- - {label} - {submenu && isOpen && } - {submenu && !isOpen && } -
-
- {isOpen && submenu && ( -
    - {submenu.map((submenuItem, index) => ( -
  • - - {submenuItem.label} - -
  • - ))} -
- )} -
- ); -}; -interface SubNavLinkData { - href: string; - label: string; -} - -interface NavLinkData { - href: string; - icon?: React.ComponentType<{ className?: string }>; - label: string; - isActive?: boolean; - submenu?: SubNavLinkData[]; -} - - -const navLinks: NavLinkData[] = [ - { href: '/dashboard', icon: LayoutDashboardIcon, label: 'Dashboard' }, - { - href: '#', - icon: UsersIcon, - label: 'Channels', - submenu: [ - { href: '#', label: 'Public' }, - { href: '#', label: 'Private' }, - ], - }, - { href: '#', icon: FileIcon, label: 'Campagins',submenu: [ - { href: '#', label: 'Campaigns' }, - { href: '#', label: 'Ad Gap' }, - { href: '#', label: 'Ads' } - ], }, - { href: '#', icon: FileIcon, label: 'Analytics' }, - { - href: '#', - icon: CreditCardIcon, - label: 'Reports', - submenu: [ - { href: '#', label: 'Export' }, - { href: '#', label: 'Import' }, - { href: '#', label: 'Schedule Automation' } - ], - }, - { href: '#', icon: DollarSignIcon, label: 'Insights' }, - { href: '#', icon: FolderIcon, label: 'E-commerce' }, -]; - -const Nav: React.FC = () => { - return ( - - ); -}; \ No newline at end of file diff --git a/packages/shared-components b/packages/shared-components index 1a60d97..33367b4 160000 --- a/packages/shared-components +++ b/packages/shared-components @@ -1 +1 @@ -Subproject commit 1a60d97e396adf8b2b3ee07d193db5191aeb911e +Subproject commit 33367b4be3faa85de40caa940a191f8f2ac78a77