-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update shared-components subproject commit and remove unused f…
…iles
- Loading branch information
Showing
10 changed files
with
70 additions
and
719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<React.Fragment> | ||
<DashBoard> | ||
<DashboardChart /> | ||
</DashBoard> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default function Page({ | ||
searchParams, | ||
}: { | ||
searchParams?: { | ||
query?: string; | ||
page?: string; | ||
}; | ||
}) { | ||
const query = searchParams?.query || ''; | ||
const currentPage = Number(searchParams?.page) || 1; | ||
const [adsAll, setAds] = useState<Advertisement[]>([]); | ||
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 ( | ||
<div className="w-full"> | ||
<header className="flex items-center justify-between px-6 py-8 bg-gray-900 text-white"> | ||
<div className="flex items-center space-x-4"> | ||
<h2 className="text-lg font-medium">Manage Ads</h2> | ||
</div> | ||
</header> | ||
<div className='w-full max-w-[80%] justify-center items-center m-auto'> | ||
<div className="mt-4 flex items-center justify-center gap-2 md:mt-8"> | ||
<Search placeholder="Search ad..." /> | ||
<CreateAd /> | ||
</div> | ||
<AdsTable query={query} currentPage={currentPage} /> | ||
<div className="mt-5 flex w-full justify-center"> | ||
<Pagination totalPages={totalPages} /> | ||
</div> | ||
</div> | ||
<br /><hr /> | ||
<div className='w-full max-w-[80%] justify-center items-center m-auto pb-40'> | ||
<div className="mt-4 items-center justify-center gap-2 md:mt-8"> | ||
<div className='row'><p className='ml-3 font-bold'>AD Campaign Gantt Chart</p></div> | ||
<div className="row"> | ||
<GanttChart adsAll={adsAll}/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<html lang="en"> | ||
<body> | ||
<SessionProvider> | ||
<NextUIProvider> | ||
<NextThemesProvider attribute="class" defaultTheme='light'> | ||
<NotificationProvider> | ||
<div className="flex"> | ||
<aside className="w-1/5 bg-[#ff7f00] text-white p-4"> | ||
<Sidebar /> | ||
</aside> | ||
<main className="w-full"> | ||
<div className="container mx-auto px-4 mb-8"> | ||
<Navbar /> | ||
{children} | ||
</div> | ||
</main> | ||
</div> | ||
<Analytics /> | ||
<SpeedInsights />{/* Vercel Speed Insights */} | ||
</NotificationProvider> | ||
</NextThemesProvider> | ||
</NextUIProvider> | ||
</SessionProvider> | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.