diff --git a/app/[locale]/(protected)/app/chat/layout copy.tsx b/app/[locale]/(protected)/app/chat/layout copy.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/app/chat/layout copy.tsx +++ b/app/[locale]/(protected)/app/chat/layout copy.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/app/email/layout copy.tsx b/app/[locale]/(protected)/app/email/layout copy.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/app/email/layout copy.tsx +++ b/app/[locale]/(protected)/app/email/layout copy.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/app/kanban/kanban-app.tsx b/app/[locale]/(protected)/app/kanban/kanban-app.tsx index 18905431..218a3c98 100644 --- a/app/[locale]/(protected)/app/kanban/kanban-app.tsx +++ b/app/[locale]/(protected)/app/kanban/kanban-app.tsx @@ -14,7 +14,7 @@ import { import { SortableContext, arrayMove } from "@dnd-kit/sortable"; import ColumnContainer from "./column" import TaskCard from './task'; -import { createPortal } from "react-dom"; +// import { createPortal } from "react-dom"; import AddBoard from './add-board'; import CreateTask from "./create-task"; import { useTranslations } from 'next-intl'; @@ -147,7 +147,7 @@ const KanBanApp = ({ defaultCols, defaultTasks }: { defaultCols: Column[], defau - {createPortal( + {/* {createPortal( {activeColumn && ( } , document.body - )} + )} */} { diff --git a/app/[locale]/(protected)/app/layout.tsx b/app/[locale]/(protected)/app/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/app/layout.tsx +++ b/app/[locale]/(protected)/app/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/blocks/layout.tsx b/app/[locale]/(protected)/blocks/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/blocks/layout.tsx +++ b/app/[locale]/(protected)/blocks/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/changelog/layout.tsx b/app/[locale]/(protected)/changelog/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/changelog/layout.tsx +++ b/app/[locale]/(protected)/changelog/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/charts/appex-charts/layout.tsx b/app/[locale]/(protected)/charts/appex-charts/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/charts/appex-charts/layout.tsx +++ b/app/[locale]/(protected)/charts/appex-charts/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/charts/chart-js/layout.tsx b/app/[locale]/(protected)/charts/chart-js/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/charts/chart-js/layout.tsx +++ b/app/[locale]/(protected)/charts/chart-js/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/charts/layout.tsx b/app/[locale]/(protected)/charts/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/charts/layout.tsx +++ b/app/[locale]/(protected)/charts/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/charts/rechart/layout.tsx b/app/[locale]/(protected)/charts/rechart/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/charts/rechart/layout.tsx +++ b/app/[locale]/(protected)/charts/rechart/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/accordion/layout.tsx b/app/[locale]/(protected)/components/accordion/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/accordion/layout.tsx +++ b/app/[locale]/(protected)/components/accordion/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/alert-dialog/layout.tsx b/app/[locale]/(protected)/components/alert-dialog/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/alert-dialog/layout.tsx +++ b/app/[locale]/(protected)/components/alert-dialog/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/alert/layout.tsx b/app/[locale]/(protected)/components/alert/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/alert/layout.tsx +++ b/app/[locale]/(protected)/components/alert/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/avatar/layout.tsx b/app/[locale]/(protected)/components/avatar/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/avatar/layout.tsx +++ b/app/[locale]/(protected)/components/avatar/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/badge/layout.tsx b/app/[locale]/(protected)/components/badge/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/badge/layout.tsx +++ b/app/[locale]/(protected)/components/badge/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/breadcrumb/layout.tsx b/app/[locale]/(protected)/components/breadcrumb/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/breadcrumb/layout.tsx +++ b/app/[locale]/(protected)/components/breadcrumb/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/button/layout.tsx b/app/[locale]/(protected)/components/button/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/button/layout.tsx +++ b/app/[locale]/(protected)/components/button/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/calendar/layout.tsx b/app/[locale]/(protected)/components/calendar/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/calendar/layout.tsx +++ b/app/[locale]/(protected)/components/calendar/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/card/layout.tsx b/app/[locale]/(protected)/components/card/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/card/layout.tsx +++ b/app/[locale]/(protected)/components/card/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/carousel/layout.tsx b/app/[locale]/(protected)/components/carousel/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/carousel/layout.tsx +++ b/app/[locale]/(protected)/components/carousel/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/collapsible/layout.tsx b/app/[locale]/(protected)/components/collapsible/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/collapsible/layout.tsx +++ b/app/[locale]/(protected)/components/collapsible/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/colors/layout.tsx b/app/[locale]/(protected)/components/colors/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/colors/layout.tsx +++ b/app/[locale]/(protected)/components/colors/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/context-menu/layout.tsx b/app/[locale]/(protected)/components/context-menu/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/context-menu/layout.tsx +++ b/app/[locale]/(protected)/components/context-menu/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/dialog/layout.tsx b/app/[locale]/(protected)/components/dialog/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/dialog/layout.tsx +++ b/app/[locale]/(protected)/components/dialog/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/drawer/layout.tsx b/app/[locale]/(protected)/components/drawer/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/drawer/layout.tsx +++ b/app/[locale]/(protected)/components/drawer/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/dropdown/layout.tsx b/app/[locale]/(protected)/components/dropdown/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/dropdown/layout.tsx +++ b/app/[locale]/(protected)/components/dropdown/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/hover-card/layout.tsx b/app/[locale]/(protected)/components/hover-card/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/hover-card/layout.tsx +++ b/app/[locale]/(protected)/components/hover-card/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/menu-bar/layout.tsx b/app/[locale]/(protected)/components/menu-bar/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/menu-bar/layout.tsx +++ b/app/[locale]/(protected)/components/menu-bar/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/navigation-menu/layout.tsx b/app/[locale]/(protected)/components/navigation-menu/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/navigation-menu/layout.tsx +++ b/app/[locale]/(protected)/components/navigation-menu/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/pagination/layout.tsx b/app/[locale]/(protected)/components/pagination/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/pagination/layout.tsx +++ b/app/[locale]/(protected)/components/pagination/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/popover/layout.tsx b/app/[locale]/(protected)/components/popover/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/popover/layout.tsx +++ b/app/[locale]/(protected)/components/popover/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/progress/layout.tsx b/app/[locale]/(protected)/components/progress/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/progress/layout.tsx +++ b/app/[locale]/(protected)/components/progress/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/resizable/layout.tsx b/app/[locale]/(protected)/components/resizable/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/resizable/layout.tsx +++ b/app/[locale]/(protected)/components/resizable/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/scroll-area/layout.tsx b/app/[locale]/(protected)/components/scroll-area/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/scroll-area/layout.tsx +++ b/app/[locale]/(protected)/components/scroll-area/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/separator/layout.tsx b/app/[locale]/(protected)/components/separator/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/separator/layout.tsx +++ b/app/[locale]/(protected)/components/separator/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/sheet/layout.tsx b/app/[locale]/(protected)/components/sheet/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/sheet/layout.tsx +++ b/app/[locale]/(protected)/components/sheet/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/skeleton/layout.tsx b/app/[locale]/(protected)/components/skeleton/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/skeleton/layout.tsx +++ b/app/[locale]/(protected)/components/skeleton/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/sonner/layout.tsx b/app/[locale]/(protected)/components/sonner/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/sonner/layout.tsx +++ b/app/[locale]/(protected)/components/sonner/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/tabs/layout.tsx b/app/[locale]/(protected)/components/tabs/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/tabs/layout.tsx +++ b/app/[locale]/(protected)/components/tabs/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/toast/layout.tsx b/app/[locale]/(protected)/components/toast/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/toast/layout.tsx +++ b/app/[locale]/(protected)/components/toast/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/toggle/layout.tsx b/app/[locale]/(protected)/components/toggle/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/toggle/layout.tsx +++ b/app/[locale]/(protected)/components/toggle/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/tooltip/layout.tsx b/app/[locale]/(protected)/components/tooltip/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/tooltip/layout.tsx +++ b/app/[locale]/(protected)/components/tooltip/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/components/typography/layout.tsx b/app/[locale]/(protected)/components/typography/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/components/typography/layout.tsx +++ b/app/[locale]/(protected)/components/typography/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/audio/layout.tsx b/app/[locale]/(protected)/contributor/content/audio/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/audio/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/audio/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/image/components/columns.tsx b/app/[locale]/(protected)/contributor/content/image/components/columns.tsx index 4984ce42..12dd6e04 100644 --- a/app/[locale]/(protected)/contributor/content/image/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/content/image/components/columns.tsx @@ -12,6 +12,7 @@ import { import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { format } from "date-fns"; +import { Link } from "@/components/navigation"; const columns: ColumnDef[] = [ { @@ -139,12 +140,12 @@ const columns: ColumnDef[] = [ - + View - + Delete diff --git a/app/[locale]/(protected)/contributor/content/image/detail/[id]/page.tsx b/app/[locale]/(protected)/contributor/content/image/detail/[id]/page.tsx new file mode 100644 index 00000000..c4c3a5ac --- /dev/null +++ b/app/[locale]/(protected)/contributor/content/image/detail/[id]/page.tsx @@ -0,0 +1,15 @@ +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import FormImageDetail from "@/components/form/content/image-detail-form"; + +const ImageDetailPage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default ImageDetailPage; diff --git a/app/[locale]/(protected)/contributor/content/image/layout.tsx b/app/[locale]/(protected)/contributor/content/image/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/image/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/image/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/nulis-ai/layout.tsx b/app/[locale]/(protected)/contributor/content/nulis-ai/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/nulis-ai/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/nulis-ai/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/spit/layout.tsx b/app/[locale]/(protected)/contributor/content/spit/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/spit/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/teks/layout.tsx b/app/[locale]/(protected)/contributor/content/teks/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/teks/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/teks/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/content/video/layout.tsx b/app/[locale]/(protected)/contributor/content/video/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/contributor/content/video/layout.tsx +++ b/app/[locale]/(protected)/contributor/content/video/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/contributor/task/components/columns.tsx b/app/[locale]/(protected)/contributor/task/components/columns.tsx index 3d7be186..b1c9e66c 100644 --- a/app/[locale]/(protected)/contributor/task/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/task/components/columns.tsx @@ -118,10 +118,12 @@ const columns: ColumnDef[] = [ View
- - - Edit - + + + + Edit + + Delete diff --git a/app/[locale]/(protected)/contributor/task/update/[id]/page.tsx b/app/[locale]/(protected)/contributor/task/update/[id]/page.tsx new file mode 100644 index 00000000..f5a9a0d4 --- /dev/null +++ b/app/[locale]/(protected)/contributor/task/update/[id]/page.tsx @@ -0,0 +1,18 @@ +import { Card, CardContent } from "@/components/ui/card"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import FormTask from "@/components/form/task/task-form"; +import FormTaskDetail from "@/components/form/task/task-detail-form"; +import FormTaskEdit from "@/components/form/task/task-edit-form"; + +const TaskDetailPage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default TaskDetailPage; diff --git a/app/[locale]/(protected)/dashboard/layout.tsx b/app/[locale]/(protected)/dashboard/layout.tsx index 8d0beab5..2db12ef5 100644 --- a/app/[locale]/(protected)/dashboard/layout.tsx +++ b/app/[locale]/(protected)/dashboard/layout.tsx @@ -1,14 +1,16 @@ import PageTitle from "@/components/page-title"; import { Metadata } from "next"; +import { Suspense } from "react"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { return <> - - {children}; + + {children} + }; export default Layout; diff --git a/app/[locale]/(protected)/dashboard/page.tsx b/app/[locale]/(protected)/dashboard/page.tsx index b44c2581..079e6488 100644 --- a/app/[locale]/(protected)/dashboard/page.tsx +++ b/app/[locale]/(protected)/dashboard/page.tsx @@ -1,3 +1,5 @@ +'use client' + import { StatisticsBlock } from "@/components/blocks/statistics-block"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import DashboardDropdown from "@/components/dashboard-dropdown"; @@ -11,162 +13,165 @@ import BlogTable from "../contributor/blog/components/blog-table"; import ContentTable from "./routine-task/components/content-table"; import RecentActivity from "./routine-task/components/recent-activity"; import { Link } from "@/components/navigation"; +import { Suspense } from "react"; const DashboardPage = () => { const t = useTranslations("AnalyticsDashboard"); return ( -
-
- - - - - Tugas Rutin - - - Penugasan - - - Jadwal - - - Indeks - - - - -
-
- - -
- - - -
-
-
-
-
-
-
- - - - {"Total Produksi Konten"} - - - - - - - -
-
- - - {"Table"} - - - - - - -
-
-
- -
-
- - -
-
- Table Penugasan + +
+
+ + + + + Tugas Rutin + + + Penugasan + + + Jadwal + + + Indeks + + + + +
+
+ + +
+ + +
-
- - - -
-
+ - - - - +
-
- - -
-
- - - - - -
-
-
- -
-
- - -
-
- Table Indeks -
-
- - - -
-
+
+
+ + + + {"Total Produksi Konten"} + + + + + + - - - - +
+
+ + + {"Table"} + + + + + + +
-
- - + + +
+
+ + +
+
+ Table Penugasan +
+
+ + + +
+
+
+ + + +
+
+
+
+ +
+
+ + + + + +
+
+
+ +
+
+ + +
+
+ Table Indeks +
+
+ + + +
+
+
+ + + +
+
+
+
+ +
-
+ ); }; diff --git a/app/[locale]/(protected)/ecommerce/backend/layout.tsx b/app/[locale]/(protected)/ecommerce/backend/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/ecommerce/backend/layout.tsx +++ b/app/[locale]/(protected)/ecommerce/backend/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/ecommerce/layout.tsx b/app/[locale]/(protected)/ecommerce/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/ecommerce/layout.tsx +++ b/app/[locale]/(protected)/ecommerce/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/checkbox/layout.tsx b/app/[locale]/(protected)/forms/checkbox/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/checkbox/layout.tsx +++ b/app/[locale]/(protected)/forms/checkbox/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/combobox/layout.tsx b/app/[locale]/(protected)/forms/combobox/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/combobox/layout.tsx +++ b/app/[locale]/(protected)/forms/combobox/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/command/layout.tsx b/app/[locale]/(protected)/forms/command/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/command/layout.tsx +++ b/app/[locale]/(protected)/forms/command/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/form-validation/layout.tsx b/app/[locale]/(protected)/forms/form-validation/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/form-validation/layout.tsx +++ b/app/[locale]/(protected)/forms/form-validation/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input-file/layout.tsx b/app/[locale]/(protected)/forms/input-file/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input-file/layout.tsx +++ b/app/[locale]/(protected)/forms/input-file/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input-group/layout.tsx b/app/[locale]/(protected)/forms/input-group/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input-group/layout.tsx +++ b/app/[locale]/(protected)/forms/input-group/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input-layout/layout.tsx b/app/[locale]/(protected)/forms/input-layout/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input-layout/layout.tsx +++ b/app/[locale]/(protected)/forms/input-layout/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input-mask/layout.tsx b/app/[locale]/(protected)/forms/input-mask/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input-mask/layout.tsx +++ b/app/[locale]/(protected)/forms/input-mask/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input-otp/layout.tsx b/app/[locale]/(protected)/forms/input-otp/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input-otp/layout.tsx +++ b/app/[locale]/(protected)/forms/input-otp/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/input/layout.tsx b/app/[locale]/(protected)/forms/input/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/input/layout.tsx +++ b/app/[locale]/(protected)/forms/input/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/layout.tsx b/app/[locale]/(protected)/forms/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/layout.tsx +++ b/app/[locale]/(protected)/forms/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/radio/layout.tsx b/app/[locale]/(protected)/forms/radio/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/radio/layout.tsx +++ b/app/[locale]/(protected)/forms/radio/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/select/layout.tsx b/app/[locale]/(protected)/forms/select/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/select/layout.tsx +++ b/app/[locale]/(protected)/forms/select/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/slider/layout.tsx b/app/[locale]/(protected)/forms/slider/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/slider/layout.tsx +++ b/app/[locale]/(protected)/forms/slider/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/switch/layout.tsx b/app/[locale]/(protected)/forms/switch/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/switch/layout.tsx +++ b/app/[locale]/(protected)/forms/switch/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/forms/textarea/layout.tsx b/app/[locale]/(protected)/forms/textarea/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/forms/textarea/layout.tsx +++ b/app/[locale]/(protected)/forms/textarea/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/icons/layout.tsx b/app/[locale]/(protected)/icons/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/icons/layout.tsx +++ b/app/[locale]/(protected)/icons/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/layout.tsx b/app/[locale]/(protected)/layout.tsx index 32ba9850..2f7a1241 100644 --- a/app/[locale]/(protected)/layout.tsx +++ b/app/[locale]/(protected)/layout.tsx @@ -4,22 +4,22 @@ import DashCodeSidebar from "@/components/partials/sidebar"; import DashCodeFooter from "@/components/partials/footer"; import ThemeCustomize from "@/components/partials/customizer"; import DashCodeHeader from "@/components/partials/header"; -import { auth } from "@/lib/auth"; -import { redirect } from "@/components/navigation"; -const layout = async ({ children }: { children: React.ReactNode }) => { - const session = await auth(); +import MountedProvider from "@/providers/mounted.provider"; - if (!session) { - redirect("/"); - } +const layout = async ({ children }: { children: React.ReactNode }) => { + return ( - - - - - {children} - - + + + + + + {children} + + + ); }; diff --git a/app/[locale]/(protected)/maps/layout.tsx b/app/[locale]/(protected)/maps/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/maps/layout.tsx +++ b/app/[locale]/(protected)/maps/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/maps/maps-vector/layer-links.tsx b/app/[locale]/(protected)/maps/maps-vector/layer-links.tsx index f9800d30..f722b278 100644 --- a/app/[locale]/(protected)/maps/maps-vector/layer-links.tsx +++ b/app/[locale]/(protected)/maps/maps-vector/layer-links.tsx @@ -8,7 +8,7 @@ const LayerLinks = ({ height = 350 }: { height?: number }) => { const onClick = (event: React.MouseEvent) => { const name = event.currentTarget.getAttribute("name"); if (name) { - window.open(`https://www.google.com/search?q=${name}%20nz`); + // window.open(`https://www.google.com/search?q=${name}%20nz`); } }; diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/document/detail/[id]/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/document/detail/[id]/page.tsx index afa89b2b..79479fab 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/document/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/document/detail/[id]/page.tsx @@ -34,6 +34,7 @@ import "swiper/css/navigation"; import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules"; import { Avatar, AvatarImage } from "@/components/ui/avatar"; import JoditEditor from "jodit-react"; +import { Badge } from "@/components/ui/badge"; const detailSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -286,12 +287,19 @@ export default function DetailDocument() {
-
+
-

- {detail?.tags} -

+
+ {detail?.tags?.split(",").map((tag, index) => ( + + {tag.trim()} + + ))} +
diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx index 05ad3fff..0fcd0ff1 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx @@ -33,6 +33,7 @@ import "swiper/css"; import "swiper/css/navigation"; import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules"; import { Avatar, AvatarImage } from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; const detailSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -285,12 +286,19 @@ export default function DetailImage() {
-
+
-

- {detail?.tags} -

+
+ {detail?.tags?.split(",").map((tag, index) => ( + + {tag.trim()} + + ))} +
diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/video/detail/[id]/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/video/detail/[id]/page.tsx index ce86d7b7..39cf0ac5 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/video/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/video/detail/[id]/page.tsx @@ -33,6 +33,7 @@ import "swiper/css"; import "swiper/css/navigation"; import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules"; import { Avatar, AvatarImage } from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; const detailSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -292,12 +293,19 @@ export default function DetailImage() {
-
+
-

- {detail?.tags} -

+
+ {detail?.tags?.split(",").map((tag, index) => ( + + {tag.trim()} + + ))} +
diff --git a/app/[locale]/(protected)/table/react-table/layout.tsx b/app/[locale]/(protected)/table/react-table/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/table/react-table/layout.tsx +++ b/app/[locale]/(protected)/table/react-table/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/blank-page/layout.tsx b/app/[locale]/(protected)/utility/blank-page/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/blank-page/layout.tsx +++ b/app/[locale]/(protected)/utility/blank-page/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/blog/layout.tsx b/app/[locale]/(protected)/utility/blog/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/blog/layout.tsx +++ b/app/[locale]/(protected)/utility/blog/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/faq/layout.tsx b/app/[locale]/(protected)/utility/faq/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/faq/layout.tsx +++ b/app/[locale]/(protected)/utility/faq/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/invoice/add/layout.tsx b/app/[locale]/(protected)/utility/invoice/add/layout.tsx index ea4b107c..bff0fb8a 100644 --- a/app/[locale]/(protected)/utility/invoice/add/layout.tsx +++ b/app/[locale]/(protected)/utility/invoice/add/layout.tsx @@ -1,5 +1,5 @@ export const metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; diff --git a/app/[locale]/(protected)/utility/invoice/edit/layout.tsx b/app/[locale]/(protected)/utility/invoice/edit/layout.tsx index ea4b107c..bff0fb8a 100644 --- a/app/[locale]/(protected)/utility/invoice/edit/layout.tsx +++ b/app/[locale]/(protected)/utility/invoice/edit/layout.tsx @@ -1,5 +1,5 @@ export const metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; diff --git a/app/[locale]/(protected)/utility/invoice/layout.tsx b/app/[locale]/(protected)/utility/invoice/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/invoice/layout.tsx +++ b/app/[locale]/(protected)/utility/invoice/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/pricing/layout.tsx b/app/[locale]/(protected)/utility/pricing/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/pricing/layout.tsx +++ b/app/[locale]/(protected)/utility/pricing/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(protected)/utility/profile/layout.tsx b/app/[locale]/(protected)/utility/profile/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/(protected)/utility/profile/layout.tsx +++ b/app/[locale]/(protected)/utility/profile/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(public)/error.tsx b/app/[locale]/(public)/error.tsx new file mode 100644 index 00000000..d2e5230b --- /dev/null +++ b/app/[locale]/(public)/error.tsx @@ -0,0 +1,24 @@ +"use client"; // Error components must be Client Components + +import { useEffect } from "react"; +import { Button } from "@/components/ui/button"; +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { Info } from "lucide-react"; + +export default function Error({ error, reset }: { + error: Error & { digest?: string } + reset: () => void +}) { + return ( +
+ + + Something went wrong! + + +
+ ); +} + diff --git a/app/[locale]/(public)/layout.tsx b/app/[locale]/(public)/layout.tsx new file mode 100644 index 00000000..7832197d --- /dev/null +++ b/app/[locale]/(public)/layout.tsx @@ -0,0 +1,20 @@ +import LayoutProvider from "@/providers/layout.provider"; +import LayoutContentProvider from "@/providers/content.provider"; +import DashCodeSidebar from "@/components/partials/sidebar"; +import DashCodeFooter from "@/components/partials/footer"; +import ThemeCustomize from "@/components/partials/customizer"; +import DashCodeHeader from "@/components/partials/header"; +import MountedProvider from "@/providers/mounted.provider"; + +const layout = async ({ children }: { children: React.ReactNode }) => { + + return ( + + {children} + + ); +}; + +export default layout; diff --git a/app/[locale]/auth/404/layout.tsx b/app/[locale]/auth/404/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/404/layout.tsx +++ b/app/[locale]/auth/404/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/coming-soon/layout.tsx b/app/[locale]/auth/coming-soon/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/coming-soon/layout.tsx +++ b/app/[locale]/auth/coming-soon/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/forgot-password/layout.tsx b/app/[locale]/auth/forgot-password/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/forgot-password/layout.tsx +++ b/app/[locale]/auth/forgot-password/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/forgot-password2/layout.tsx b/app/[locale]/auth/forgot-password2/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/forgot-password2/layout.tsx +++ b/app/[locale]/auth/forgot-password2/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/forgot-password3/layout.tsx b/app/[locale]/auth/forgot-password3/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/forgot-password3/layout.tsx +++ b/app/[locale]/auth/forgot-password3/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/lock-screen/layout.tsx b/app/[locale]/auth/lock-screen/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/lock-screen/layout.tsx +++ b/app/[locale]/auth/lock-screen/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/lock-screen2/layout.tsx b/app/[locale]/auth/lock-screen2/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/lock-screen2/layout.tsx +++ b/app/[locale]/auth/lock-screen2/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/lock-screen3/layout.tsx b/app/[locale]/auth/lock-screen3/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/lock-screen3/layout.tsx +++ b/app/[locale]/auth/lock-screen3/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/login/layout.tsx b/app/[locale]/auth/login/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/login/layout.tsx +++ b/app/[locale]/auth/login/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/login2/layout.tsx b/app/[locale]/auth/login2/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/login2/layout.tsx +++ b/app/[locale]/auth/login2/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/login3/layout.tsx b/app/[locale]/auth/login3/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/login3/layout.tsx +++ b/app/[locale]/auth/login3/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/register/layout.tsx b/app/[locale]/auth/register/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/register/layout.tsx +++ b/app/[locale]/auth/register/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/register2/layout.tsx b/app/[locale]/auth/register2/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/register2/layout.tsx +++ b/app/[locale]/auth/register2/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/register3/layout.tsx b/app/[locale]/auth/register3/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/register3/layout.tsx +++ b/app/[locale]/auth/register3/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/under-construction/layout.tsx b/app/[locale]/auth/under-construction/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/under-construction/layout.tsx +++ b/app/[locale]/auth/under-construction/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/auth/under-maintenance/layout.tsx b/app/[locale]/auth/under-maintenance/layout.tsx index 9804c128..5666cfeb 100644 --- a/app/[locale]/auth/under-maintenance/layout.tsx +++ b/app/[locale]/auth/under-maintenance/layout.tsx @@ -1,7 +1,7 @@ import { Metadata } from "next"; export const metadata: Metadata = { - title: "Dashcode Next Js", + title: "Media Hub | POLRI", description: "Dashcode is a popular dashboard template.", }; const Layout = ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index ea2073b5..47c0c6ec 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -34,11 +34,9 @@ export default async function RootLayout({ - - - {children} - - + + {children} + diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts deleted file mode 100644 index 73228a09..00000000 --- a/app/api/auth/[...nextauth]/route.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { handlers } from "@/lib/auth"; -export const { GET, POST } = handlers; diff --git a/components/form/blog/blog--detail-form.tsx b/components/form/blog/blog--detail-form.tsx index 6ed692d2..e875e29d 100644 --- a/components/form/blog/blog--detail-form.tsx +++ b/components/form/blog/blog--detail-form.tsx @@ -30,12 +30,13 @@ import { listEnableCategory, } from "@/service/content/content"; import { getBlog, postBlog } from "@/service/blog/blog"; +import { Badge } from "@/components/ui/badge"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), slug: z.string().min(1, { message: "Judul diperlukan" }), meta: z.string().min(1, { message: "Judul diperlukan" }), - description: z + narration: z .string() .min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter." }), categoryName: z.string().min(1, { message: "Kategori diperlukan" }), @@ -49,11 +50,12 @@ type Category = { type Detail = { id: string; title: string; - description: string; + narration: string; slug: string; metadata: string; categoryName: string; thumbnailLink: string; + tags: string; }; const initialCategories: Category[] = [ @@ -115,17 +117,6 @@ export default function FormBlogDetail() { resolver: zodResolver(taskSchema), }); - // const handleKeyDown = (e: any) => { - // const newTag = e.target.value.trim(); // Ambil nilai input - // if (e.key === "Enter" && newTag) { - // e.preventDefault(); // Hentikan submit form - // if (!tags.includes(newTag)) { - // setTags((prevTags) => [...prevTags, newTag]); // Tambah tag baru - // setValue("tags", ""); // Kosongkan input - // } - // } - // }; - const handleRemoveTag = (index: any) => { setTags((prevTags) => prevTags.filter((_, i) => i !== index)); }; @@ -162,7 +153,7 @@ export default function FormBlogDetail() { const requestData = { ...data, title: data.title, - description: data.description, + description: data.narration, categoryId: selectedTarget, slug: data.slug, metadata: data.meta, @@ -244,19 +235,19 @@ export default function FormBlogDetail() { ( )} /> - {errors.description?.message && ( + {errors.narration?.message && (

- {errors.description.message} + {errors.narration.message}

)}
@@ -336,7 +327,7 @@ export default function FormBlogDetail() { />
-
+
- - {/* ( - - )} - /> */} -
- {tags.length === 0 && "Please add at least one tag."} -
-
- {tags.map((tag, index) => ( -
- {tag} - -
- ))} + {tag.trim()} + + ))} +
diff --git a/components/form/blog/blog-form.tsx b/components/form/blog/blog-form.tsx index a35c7a7f..534aad02 100644 --- a/components/form/blog/blog-form.tsx +++ b/components/form/blog/blog-form.tsx @@ -29,16 +29,16 @@ import { getTagsBySubCategoryId, listEnableCategory, } from "@/service/content/content"; -import { postBlog } from "@/service/blog/blog"; +import { postBlog, uploadThumbnailBlog } from "@/service/blog/blog"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), slug: z.string().min(1, { message: "Judul diperlukan" }), meta: z.string().min(1, { message: "Judul diperlukan" }), - description: z + narration: z .string() .min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter." }), - // tags: z.string().min(1, { message: "Judul diperlukan" }), + tags: z.string().min(1, { message: "Judul diperlukan" }), }); type Category = { @@ -81,6 +81,8 @@ export default function FormBlog() { const [selectedCategory, setSelectedCategory] = useState(); const [tags, setTags] = useState([]); const [isDraft, setIsDraft] = useState(false); + const [thumbnail, setThumbnail] = useState(null); + const [preview, setPreview] = useState(null); const [unitSelection, setUnitSelection] = useState({ allUnit: false, @@ -115,14 +117,6 @@ export default function FormBlog() { setTags((prevTags) => prevTags.filter((_, i) => i !== index)); }; - const handleImageChange = (event: ChangeEvent) => { - if (event.target.files) { - const files = Array.from(event.target.files); - setSelectedFiles((prevImages: any) => [...prevImages, ...files]); - console.log("DATAFILE::", selectedFiles); - } - }; - const handleRemoveImage = (index: number) => { setSelectedFiles((prevImages) => prevImages.filter((_, i) => i !== index)); }; @@ -166,11 +160,11 @@ export default function FormBlog() { const requestData = { ...data, title: data.title, - description: data.description, + narration: data.narration, categoryId: selectedTarget, slug: data.slug, metadata: data.meta, - // tags: data.tags, + tags: data.tags, isDraft, }; @@ -178,15 +172,25 @@ export default function FormBlog() { console.log("Form Data Submitted:", requestData); console.log("response", response); - MySwal.fire({ - title: "Sukses", - text: "Data berhasil disimpan.", - icon: "success", - confirmButtonColor: "#3085d6", - confirmButtonText: "OK", - }).then(() => { - router.push("/en/contributor/blog"); - }); + if (response.error) { + MySwal.fire("Error", response.message, "error"); + return; + } + + const blogId = response.data.data.id; + if (blogId && thumbnail) { + const formMedia = new FormData(); + formMedia.append("file", thumbnail); + + const responseThumbnail = await uploadThumbnailBlog(blogId, formMedia); + + if (responseThumbnail.error) { + MySwal.fire("Error", responseThumbnail.message, "error"); + return; + } + } + + MySwal.fire("Sukses", "Data berhasil disimpan.", "success"); }; const onSubmit = (data: TaskSchema) => { @@ -195,9 +199,8 @@ export default function FormBlog() { text: "Apakah Anda yakin ingin menyimpan data ini?", icon: "warning", showCancelButton: true, - cancelButtonColor: "#d33", - confirmButtonColor: "#3085d6", confirmButtonText: "Simpan", + cancelButtonText: "Batal", }).then((result) => { if (result.isConfirmed) { save(data); @@ -205,6 +208,17 @@ export default function FormBlog() { }); }; + const handleImageChange = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (file) { + setThumbnail(file); + console.log("Selected Thumbnail:", file); + } + if (file) { + setPreview(URL.createObjectURL(file)); + } + }; + const handlePublish = () => { setIsDraft(false); }; @@ -245,7 +259,7 @@ export default function FormBlog() { ( )} /> - {errors.description?.message && ( + {errors.narration?.message && (

- {errors.description.message} + {errors.narration.message}

)}
@@ -311,22 +325,20 @@ export default function FormBlog() {
- +
- { - // const file = e.target.files[0]; - // if (file) { - // console.log("Selected File:", file); - // // Tambahkan logika jika diperlukan, misalnya upload file ke server - // } - // }} - className="" - /> +
+ {preview && ( +
+ Thumbnail Preview +
+ )}
diff --git a/components/form/content/image-detail-form.tsx b/components/form/content/image-detail-form.tsx new file mode 100644 index 00000000..204fcedb --- /dev/null +++ b/components/form/content/image-detail-form.tsx @@ -0,0 +1,427 @@ +"use client"; +import React, { ChangeEvent, useEffect, useRef, useState } from "react"; +import { useForm, Controller } from "react-hook-form"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { Card } from "@/components/ui/card"; +import { zodResolver } from "@hookform/resolvers/zod"; +import * as z from "zod"; +import Swal from "sweetalert2"; +import withReactContent from "sweetalert2-react-content"; +import { useParams, useRouter } from "next/navigation"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Checkbox } from "@/components/ui/checkbox"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import JoditEditor from "jodit-react"; +import { register } from "module"; +import { Switch } from "@/components/ui/switch"; +import Cookies from "js-cookie"; +import { createTask } from "@/config/api"; +import { + createMedia, + getTagsBySubCategoryId, + listEnableCategory, +} from "@/service/content/content"; +import { detailMedia } from "@/service/curated-content/curated-content"; +import { Badge } from "@/components/ui/badge"; +import { MailIcon } from "lucide-react"; + +const imageSchema = z.object({ + title: z.string().min(1, { message: "Judul diperlukan" }), + description: z + .string() + .min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter." }), + creatorName: z.string().min(1, { message: "Creator diperlukan" }), + // tags: z.string().min(1, { message: "Judul diperlukan" }), +}); + +type Category = { + id: string; + name: string; +}; + +type Detail = { + id: string; + title: string; + description: string; + slug: string; + category: { + id: number; + name: string; + }; + categoryName: string; + thumbnailLink: string; + tags: string; +}; + +export default function FormImageDetail() { + const MySwal = withReactContent(Swal); + const router = useRouter(); + + const { id } = useParams() as { id: string }; + console.log(id); + const editor = useRef(null); + type ImageSchema = z.infer; + + const [selectedFiles, setSelectedFiles] = useState([]); + const taskId = Cookies.get("taskId"); + const scheduleId = Cookies.get("scheduleId"); + const scheduleType = Cookies.get("scheduleType"); + + const [categories, setCategories] = useState([]); + const [selectedCategory, setSelectedCategory] = useState(); + const [tags, setTags] = useState([]); + const [detail, setDetail] = useState(); + const [refresh, setRefresh] = useState(false); + const [selectedPublishers, setSelectedPublishers] = useState([]); + + const [selectedTarget, setSelectedTarget] = useState(""); + const [unitSelection, setUnitSelection] = useState({ + allUnit: false, + mabes: false, + polda: false, + polres: false, + }); + + let fileTypeId = "1"; + + const { + control, + handleSubmit, + setValue, + formState: { errors }, + } = useForm({ + resolver: zodResolver(imageSchema), + }); + + // const handleKeyDown = (e: any) => { + // const newTag = e.target.value.trim(); // Ambil nilai input + // if (e.key === "Enter" && newTag) { + // e.preventDefault(); // Hentikan submit form + // if (!tags.includes(newTag)) { + // setTags((prevTags) => [...prevTags, newTag]); // Tambah tag baru + // setValue("tags", ""); // Kosongkan input + // } + // } + // }; + + const handleRemoveTag = (index: any) => { + setTags((prevTags) => prevTags.filter((_, i) => i !== index)); + }; + + const handleImageChange = (event: ChangeEvent) => { + if (event.target.files) { + const files = Array.from(event.target.files); + setSelectedFiles((prevImages: any) => [...prevImages, ...files]); + console.log("DATAFILE::", selectedFiles); + } + }; + + const handleRemoveImage = (index: number) => { + setSelectedFiles((prevImages) => prevImages.filter((_, i) => i !== index)); + }; + + const handleCheckboxChange = (id: number) => { + setSelectedPublishers((prev) => + prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id] + ); + }; + + useEffect(() => { + async function initState() { + getCategories(); + } + + initState(); + }, []); + + const getCategories = async () => { + try { + const category = await listEnableCategory(fileTypeId); + const resCategory: Category[] = category.data.data.content; + + setCategories(resCategory); + console.log("data category", resCategory); + + if (scheduleId && scheduleType === "3") { + const findCategory = resCategory.find((o) => + o.name.toLowerCase().includes("pers rilis") + ); + + if (findCategory) { + // setValue("categoryId", findCategory.id); + setSelectedCategory(findCategory.id); // Set the selected category + const response = await getTagsBySubCategoryId(findCategory.id); + setTags(response?.data.data); + } + } + } catch (error) { + console.error("Failed to fetch categories:", error); + } + }; + + useEffect(() => { + async function initState() { + if (id) { + const response = await detailMedia(id); + const details = response.data?.data; + + setDetail(details); + + if (details.publishedForObject) { + const publisherIds = details.publishedForObject.map( + (obj: any) => obj.id + ); + setSelectedPublishers(publisherIds); + } + + const matchingCategory = categories.find( + (category) => category.id === details.categoryId + ); + + if (matchingCategory) { + setSelectedTarget(matchingCategory.name); + } + + setSelectedTarget(details.categoryId); // Untuk dropdown + } + } + initState(); + }, [refresh, setValue]); + + const save = async (data: ImageSchema) => { + const requestData = { + ...data, + title: data.title, + description: data.description, + htmlDescription: data.description, + fileTypeId, + categoryId: selectedTarget, + subCategoryId: selectedTarget, + uploadedBy: "2b7c8d83-d298-4b19-9f74-b07924506b58", + statusId: "1", + publishedFor: "6", + creatorName: data.creatorName, + tags: "siap", + isYoutube: false, + isInternationalMedia: false, + }; + + const response = await createMedia(requestData); + console.log("Form Data Submitted:", requestData); + + MySwal.fire({ + title: "Sukses", + text: "Data berhasil disimpan.", + icon: "success", + confirmButtonColor: "#3085d6", + confirmButtonText: "OK", + }).then(() => { + router.push("/en/contributor/content/image"); + }); + }; + + const onSubmit = (data: ImageSchema) => { + MySwal.fire({ + title: "Simpan Data", + text: "Apakah Anda yakin ingin menyimpan data ini?", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#d33", + confirmButtonColor: "#3085d6", + confirmButtonText: "Simpan", + }).then((result) => { + if (result.isConfirmed) { + save(data); + } + }); + }; + + return ( +
+ {detail !== undefined ? ( +
+ +
+

Form Konten Foto

+
+ {/* Input Title */} +
+ + ( + + )} + /> + {errors.title?.message && ( +

+ {errors.title.message} +

+ )} +
+
+
+ + +
+
+ +
+ + ( + + )} + /> + {errors.description?.message && ( +

+ {errors.description.message} +

+ )} +
+
+
+
+
+ +
+
+ + ( + + )} + /> + {errors.creatorName?.message && ( +

+ {errors.creatorName.message} +

+ )} +
+
+
+ + + Thumbnail Gambar Utama + +
+
+
+ +
+ {detail?.tags?.split(",").map((tag, index) => ( + + {tag.trim()} + + ))} +
+
+
+
+
+ +
+ handleCheckboxChange(5)} + /> + +
+
+ handleCheckboxChange(6)} + /> + +
+
+ handleCheckboxChange(7)} + /> + +
+
+ handleCheckboxChange(8)} + /> + +
+
+
+
+ +

Kotak Saran (0)

+
+
+

Keterangan:

+ {/*

{detail?.status}

*/} +
+
+
+
+ ) : ( + "" + )} +
+ ); +} diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index ec996b60..4d94d1a6 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -30,7 +30,7 @@ import { listEnableCategory, } from "@/service/content/content"; -const taskSchema = z.object({ +const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), description: z .string() @@ -48,7 +48,7 @@ export default function FormImage() { const MySwal = withReactContent(Swal); const router = useRouter(); const editor = useRef(null); - type TaskSchema = z.infer; + type ImageSchema = z.infer; const [selectedFiles, setSelectedFiles] = useState([]); const taskId = Cookies.get("taskId"); @@ -74,8 +74,8 @@ export default function FormImage() { handleSubmit, setValue, formState: { errors }, - } = useForm({ - resolver: zodResolver(taskSchema), + } = useForm({ + resolver: zodResolver(imageSchema), }); // const handleKeyDown = (e: any) => { @@ -140,7 +140,7 @@ export default function FormImage() { } }; - const save = async (data: TaskSchema) => { + const save = async (data: ImageSchema) => { const requestData = { ...data, title: data.title, @@ -151,7 +151,7 @@ export default function FormImage() { subCategoryId: selectedTarget, uploadedBy: "2b7c8d83-d298-4b19-9f74-b07924506b58", statusId: "1", - publishedFor: 1, + publishedFor: "6", creatorName: data.creatorName, tags: "siap", isYoutube: false, @@ -168,11 +168,11 @@ export default function FormImage() { confirmButtonColor: "#3085d6", confirmButtonText: "OK", }).then(() => { - router.push("/contributor/content/image"); + router.push("/en/contributor/content/image"); }); }; - const onSubmit = (data: TaskSchema) => { + const onSubmit = (data: ImageSchema) => { MySwal.fire({ title: "Simpan Data", text: "Apakah Anda yakin ingin menyimpan data ini?", @@ -220,9 +220,9 @@ export default function FormImage() { @@ -228,7 +328,7 @@ export default function PublishMediahub() {

{errors.title.message}

)}
-
+
{Object.keys(taskOutput).map((key) => ( @@ -247,10 +347,12 @@ export default function PublishMediahub() { ))}
-
-
- -
+
+ +
+
+
+
{Object.keys(unitSelection).map((key) => (
+ + + + + + + Daftar Wilayah Polda dan Polres + +
+ {listDest.map((polda: any) => ( +
+ + {expandedPolda[polda.id] && ( +
+ + {polda?.subDestination?.map((polres: any) => ( + + ))} +
+ )} +
+ ))} +
+
+
-
+
setType(value)} // Mengubah nilai state ketika pilihan berubah + value={detail?.assignmentType?.id.toString()} + onValueChange={(value) => setType(value)} className="flex flex-wrap gap-3" >
@@ -291,12 +472,12 @@ export default function PublishMediahub() {
-
+
-
+
( )} /> - {errors.naration?.message && ( + {errors.description?.message && (

- {errors.naration.message} + {errors.description.message}

)}
diff --git a/components/form/planning/medsos-publish.tsx b/components/form/planning/medsos-publish.tsx index 5124f4a4..12381adb 100644 --- a/components/form/planning/medsos-publish.tsx +++ b/components/form/planning/medsos-publish.tsx @@ -20,16 +20,23 @@ import { import { Checkbox } from "@/components/ui/checkbox"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import JoditEditor from "jodit-react"; -import { createTask } from "@/service/task"; +import { createTask, getUserLevelForAssignments } from "@/service/task"; import { cn } from "@/lib/utils"; import { format } from "date-fns"; -import { CalendarIcon } from "lucide-react"; +import { CalendarIcon, ChevronDown, ChevronUp } from "lucide-react"; import { id } from "date-fns/locale"; -import { getPlanningById } from "@/service/planning/planning"; +import { getPlanningById, publishPlanning } from "@/service/planning/planning"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), - naration: z.string().min(2, { + description: z.string().min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter.", }), }); @@ -70,6 +77,10 @@ export default function PublishMedsos() { const [startDate, setStartDate] = useState(new Date()); const [detail, setDetail] = useState(); const [refresh] = useState(false); + const [listDest, setListDest] = useState([]); // Data Polda dan Polres + const [checkedLevels, setCheckedLevels] = useState(new Set()); + const [expandedPolda, setExpandedPolda] = useState([{}]); + const [isLoading, setIsLoading] = useState(false); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ @@ -94,6 +105,30 @@ export default function PublishMedsos() { setPlatformTypeVisible(selectedValue === 2); }; + useEffect(() => { + async function fetchPoldaPolres() { + setIsLoading(true); + try { + const response = await getUserLevelForAssignments(); + setListDest(response.data.data.list); + const initialExpandedState = response.data.data.list.reduce( + (acc: any, polda: any) => { + acc[polda.id] = false; + return acc; + }, + {} + ); + setExpandedPolda(initialExpandedState); + console.log("polres", initialExpandedState); + } catch (error) { + console.error("Error fetching Polda/Polres data:", error); + } finally { + setIsLoading(false); + } + } + fetchPoldaPolres(); + }, []); + useEffect(() => { async function initState() { if (id) { @@ -104,6 +139,13 @@ export default function PublishMedsos() { if (details?.date) { setStartDate(new Date(details.date)); // Konversi string tanggal ke objek Date } + + if (details?.assignedToLevel) { + const levels = new Set( + details.assignedToLevel.split(",").map(Number) + ); + setCheckedLevels(levels); + } } } initState(); @@ -136,6 +178,22 @@ export default function PublishMedsos() { } }, [detail?.fileTypeOutput]); + const handleCheckboxChange = (levelId: number) => { + setCheckedLevels((prev) => { + const updatedLevels = new Set(prev); + if (updatedLevels.has(levelId)) { + updatedLevels.delete(levelId); + } else { + updatedLevels.add(levelId); + } + return updatedLevels; + }); + }; + + const handlePoldaPolresChange = () => { + return Array.from(checkedLevels).join(","); // Mengonversi Set ke string + }; + const save = async (data: TaskSchema) => { const fileTypeMapping = { all: "1", @@ -145,31 +203,59 @@ export default function PublishMedsos() { text: "5", }; - const selectedOutputs = Object.keys(taskOutput) - .filter((key) => taskOutput[key as keyof typeof taskOutput]) // Ambil hanya yang `true` - .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) // Konversi ke nilai string + const unitMapping = { + allUnit: "0", + mabes: "1", + polda: "2", + polres: "3", + }; + const assignmentPurposeString = Object.keys(unitSelection) + .filter((key) => unitSelection[key as keyof typeof unitSelection]) + .map((key) => unitMapping[key as keyof typeof unitMapping]) .join(","); - const requestData = { + const selectedOutputs = Object.keys(taskOutput) + .filter((key) => taskOutput[key as keyof typeof taskOutput]) + .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) + .join(","); + + const requestData: { + id?: number; + title: string; + target: string; + assignedToLevel: any; + assignmentPurpose: any; + assignmentTypeId: string; + fileTypeOutput: string; + description: string; + platformType: string | null; + date: any; + assignmentMainTypeId: number; + planningTypeId: number; + } = { ...data, // assignmentType, // assignmentCategory, target: selectedTarget, - unitSelection, - assignedToRole: "3", - taskType: taskType, - broadcastType: broadcastType, - assignmentMainTypeId: mainType, - assignmentPurpose: "1", + assignedToLevel: handlePoldaPolresChange(), + assignmentPurpose: assignmentPurposeString, assignmentTypeId: type, fileTypeOutput: selectedOutputs, - id: null, - narration: data.naration, + description: data.description, platformType: "", title: data.title, + date: startDate, + planningTypeId: 2, + assignmentMainTypeId: 1, }; - const response = await createTask(requestData); + if (id) { + requestData.id = parseInt(id, 10); // Ensure id is a number + } + + console.log("Form Data Submitted:", requestData); + + const response = await publishPlanning(requestData); console.log("Form Data Submitted:", requestData); console.log("response", response); @@ -181,7 +267,7 @@ export default function PublishMedsos() { confirmButtonColor: "#3085d6", confirmButtonText: "OK", }).then(() => { - router.push("/en/contributor/task"); + router.push("/en/contributor/planning/medsos-mediahub"); }); }; @@ -201,6 +287,13 @@ export default function PublishMedsos() { }); }; + const toggleExpand = (poldaId: any) => { + setExpandedPolda((prev: any) => ({ + ...prev, + [poldaId]: !prev[poldaId], + })); + }; + return (
@@ -218,7 +311,7 @@ export default function PublishMedsos() { @@ -228,7 +321,7 @@ export default function PublishMedsos() {

{errors.title.message}

)}
-
+
{Object.keys(taskOutput).map((key) => ( @@ -247,10 +340,12 @@ export default function PublishMedsos() { ))}
-
-
- -
+
+ +
+
+
+
{Object.keys(unitSelection).map((key) => (
+ + + + + + + Daftar Wilayah Polda dan Polres + +
+ {listDest.map((polda: any) => ( +
+ + {expandedPolda[polda.id] && ( +
+ + {polda?.subDestination?.map((polres: any) => ( + + ))} +
+ )} +
+ ))} +
+
+
-
+
-
+
@@ -314,11 +488,11 @@ export default function PublishMedsos() {
-
+
( )} /> - {errors.naration?.message && ( + {errors.description?.message && (

- {errors.naration.message} + {errors.description.message}

)}
diff --git a/components/form/schedule/event-detail-form.tsx b/components/form/schedule/event-detail-form.tsx index 57d9c072..22bec2c8 100644 --- a/components/form/schedule/event-detail-form.tsx +++ b/components/form/schedule/event-detail-form.tsx @@ -128,7 +128,7 @@ export default function FormEventDetail() { )}
-
+

Aktifkan fitur live streaming

@@ -167,7 +167,7 @@ export default function FormEventDetail() {
)} -
+
@@ -229,7 +229,7 @@ export default function FormEventDetail() {
-
+
{/* Kirim setValue ke MapHome */}
-

DI SAMPAIKAN OLEH

+

+ DI SAMPAIKAN OLEH +

diff --git a/components/form/schedule/pers-release--detail-form.tsx b/components/form/schedule/pers-release--detail-form.tsx index ce13efe8..440bb27c 100644 --- a/components/form/schedule/pers-release--detail-form.tsx +++ b/components/form/schedule/pers-release--detail-form.tsx @@ -136,7 +136,7 @@ export default function FormDetailPressRillis() { )}
-
+

Aktifkan fitur live streaming

@@ -175,7 +175,7 @@ export default function FormDetailPressRillis() {
)} -
+
@@ -237,7 +237,7 @@ export default function FormDetailPressRillis() {
-
+
{/* Kirim setValue ke MapHome */}
-
+
-

DI SAMPAIKAN OLEH

+

+ DI SAMPAIKAN OLEH +

diff --git a/components/form/schedule/press-conference-detail-form.tsx b/components/form/schedule/press-conference-detail-form.tsx index b1e08ba5..a86d35ed 100644 --- a/components/form/schedule/press-conference-detail-form.tsx +++ b/components/form/schedule/press-conference-detail-form.tsx @@ -128,7 +128,7 @@ export default function FormDetailPressConference() { )}
-
+

Aktifkan fitur live streaming

@@ -167,7 +167,7 @@ export default function FormDetailPressConference() {
)} -
+
@@ -229,7 +229,7 @@ export default function FormDetailPressConference() {
-
+
{/* Kirim setValue ke MapHome */}
-

DI SAMPAIKAN OLEH

+

+ DI SAMPAIKAN OLEH +

diff --git a/components/form/task/task-detail-form.tsx b/components/form/task/task-detail-form.tsx index 58e644e0..f3279960 100644 --- a/components/form/task/task-detail-form.tsx +++ b/components/form/task/task-detail-form.tsx @@ -20,9 +20,22 @@ import { import { Checkbox } from "@/components/ui/checkbox"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import JoditEditor from "jodit-react"; -import { createTask, getTask } from "@/service/task"; +import { + createTask, + getTask, + getUserLevelForAssignments, +} from "@/service/task"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { ChevronDown, ChevronUp } from "lucide-react"; const taskSchema = z.object({ + uniqueCode: z.string().min(1, { message: "Judul diperlukan" }), title: z.string().min(1, { message: "Judul diperlukan" }), naration: z.string().min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter.", @@ -31,8 +44,10 @@ const taskSchema = z.object({ export type taskDetail = { id: number; + uniqueCode: string; title: string; fileTypeOutput: string; + assignedToRole: string; assignedToTopLevel: string; assignmentType: { id: number; @@ -74,6 +89,10 @@ export default function FormTaskDetail() { const [selectedTarget, setSelectedTarget] = useState("all"); const [detail, setDetail] = useState(); const [refresh] = useState(false); + const [listDest, setListDest] = useState([]); // Data Polda dan Polres + const [checkedLevels, setCheckedLevels] = useState(new Set()); + const [expandedPolda, setExpandedPolda] = useState([{}]); + const [isLoading, setIsLoading] = useState(false); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ @@ -98,6 +117,30 @@ export default function FormTaskDetail() { // setPlatformTypeVisible(selectedValue === 2); // }; + useEffect(() => { + async function fetchPoldaPolres() { + setIsLoading(true); + try { + const response = await getUserLevelForAssignments(); + setListDest(response.data.data.list); + const initialExpandedState = response.data.data.list.reduce( + (acc: any, polda: any) => { + acc[polda.id] = false; + return acc; + }, + {} + ); + setExpandedPolda(initialExpandedState); + console.log("polres", initialExpandedState); + } catch (error) { + console.error("Error fetching Polda/Polres data:", error); + } finally { + setIsLoading(false); + } + } + fetchPoldaPolres(); + }, []); + useEffect(() => { async function initState() { if (id) { @@ -105,6 +148,13 @@ export default function FormTaskDetail() { const details = response.data?.data; setDetail(details); + + if (details?.assignedToLevel) { + const levels = new Set( + details.assignedToLevel.split(",").map(Number) + ); + setCheckedLevels(levels); + } } } initState(); @@ -208,6 +258,25 @@ export default function FormTaskDetail() { }); }; + const handleCheckboxChange = (levelId: any) => { + setCheckedLevels((prev: any) => { + const updatedLevels = new Set(prev); + if (updatedLevels.has(levelId)) { + updatedLevels.delete(levelId); + } else { + updatedLevels.add(levelId); + } + return updatedLevels; + }); + }; + + const toggleExpand = (poldaId: any) => { + setExpandedPolda((prev: any) => ({ + ...prev, + [poldaId]: !prev[poldaId], + })); + }; + return (
@@ -215,8 +284,24 @@ export default function FormTaskDetail() { {detail !== undefined ? (
- {/* Input Title */}
+ + ( + + )} + /> +
+
-
+
- - Semua Pengguna - Kontributor - Approver + Semua Pengguna + Kontributor + Approver
-
+
{Object.keys(unitSelection).map((key) => (
))}
+
+ + + + + + + + Daftar Wilayah Polda dan Polres + + +
+ {listDest.map((polda: any) => ( +
+ + {expandedPolda[polda.id] && ( +
+ + {polda?.subDestination?.map((polres: any) => ( + + ))} +
+ )} +
+ ))} +
+
+
+
-
+
Medsos Mediahub
-
+
{/* RadioGroup Assignment Category */} -
+
-
+
{Object.keys(taskOutput).map((key) => ( @@ -337,7 +508,7 @@ export default function FormTaskDetail() { ))}
-
+
-
+
; + const { id } = useParams() as { id: string }; + console.log(id); + + // State for various form fields + const [taskOutput, setTaskOutput] = useState({ + all: false, + video: false, + audio: false, + image: false, + text: false, + }); + + // const [assignmentType, setAssignmentType] = useState("mediahub"); + // const [assignmentCategory, setAssignmentCategory] = useState("publication"); + const [mainType, setMainType] = useState("1"); + const [taskType, setTaskType] = useState("atensi-khusus"); + const [broadcastType, setBroadcastType] = useState(""); // untuk Tipe Penugasan + const [type, setType] = useState("1"); + const [selectedTarget, setSelectedTarget] = useState("3,4"); + const [detail, setDetail] = useState(); + const [refresh] = useState(false); + const [listDest, setListDest] = useState([]); // Data Polda dan Polres + const [checkedLevels, setCheckedLevels] = useState(new Set()); + const [expandedPolda, setExpandedPolda] = useState([{}]); + const [isLoading, setIsLoading] = useState(false); + + const [platformTypeVisible, setPlatformTypeVisible] = useState(false); + const [unitSelection, setUnitSelection] = useState({ + allUnit: false, + mabes: false, + polda: false, + polres: false, + }); + + const { + control, + handleSubmit, + formState: { errors }, + } = useForm({ + resolver: zodResolver(taskSchema), + }); + + // const handleRadioChange = (event: React.ChangeEvent) => { + // const selectedValue = Number(event.target.value); + // setMainType(selectedValue); + + // setPlatformTypeVisible(selectedValue === 2); + // }; + + useEffect(() => { + async function fetchPoldaPolres() { + setIsLoading(true); + try { + const response = await getUserLevelForAssignments(); + setListDest(response.data.data.list); + const initialExpandedState = response.data.data.list.reduce( + (acc: any, polda: any) => { + acc[polda.id] = false; + return acc; + }, + {} + ); + setExpandedPolda(initialExpandedState); + console.log("polres", initialExpandedState); + } catch (error) { + console.error("Error fetching Polda/Polres data:", error); + } finally { + setIsLoading(false); + } + } + fetchPoldaPolres(); + }, []); + + useEffect(() => { + async function initState() { + if (id) { + const response = await getTask(id); + const details = response.data?.data; + + setDetail(details); + + if (details?.assignedToLevel) { + const levels = new Set( + details.assignedToLevel.split(",").map(Number) + ); + setCheckedLevels(levels); + } + + // Add more state setting here based on other fields like broadcastType, taskOutput, etc. + } + } + initState(); + }, [id, refresh]); + + useEffect(() => { + if (detail?.broadcastType) { + setBroadcastType(detail.broadcastType); // Mengatur nilai broadcastType dari API + } + }, [detail?.broadcastType]); + + useEffect(() => { + if (detail?.fileTypeOutput) { + const outputSet = new Set(detail.fileTypeOutput.split(",").map(Number)); // Membagi string ke dalam array dan mengonversi ke nomor + setTaskOutput({ + all: outputSet.has(0), + video: outputSet.has(2), + audio: outputSet.has(4), + image: outputSet.has(1), + text: outputSet.has(3), + }); + } + }, [detail?.fileTypeOutput]); + + useEffect(() => { + if (detail?.assignedToTopLevel) { + const outputSet = new Set( + detail.assignedToTopLevel.split(",").map(Number) + ); + setUnitSelection({ + allUnit: outputSet.has(0), + mabes: outputSet.has(1), + polda: outputSet.has(2), + polres: outputSet.has(3), + }); + } + }, [detail?.fileTypeOutput]); + + const handleCheckboxChange = (levelId: number) => { + setCheckedLevels((prev) => { + const updatedLevels = new Set(prev); + if (updatedLevels.has(levelId)) { + updatedLevels.delete(levelId); + } else { + updatedLevels.add(levelId); + } + return updatedLevels; + }); + }; + + const handlePoldaPolresChange = () => { + return Array.from(checkedLevels).join(","); // Mengonversi Set ke string + }; + + const save = async (data: TaskSchema) => { + const fileTypeMapping = { + all: "1", + video: "2", + audio: "3", + image: "4", + text: "5", + }; + + const unitMapping = { + allUnit: "0", + mabes: "1", + polda: "2", + polres: "3", + }; + const assignmentPurposeString = Object.keys(unitSelection) + .filter((key) => unitSelection[key as keyof typeof unitSelection]) + .map((key) => unitMapping[key as keyof typeof unitMapping]) + .join(","); + + const selectedOutputs = Object.keys(taskOutput) + .filter((key) => taskOutput[key as keyof typeof taskOutput]) // Ambil hanya yang `true` + .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) // Konversi ke nilai string + .join(","); + + const requestData: { + id?: any; + title: string; + assignedToLevel: any; + assignmentPurpose: any; + assignmentTypeId: string; + fileTypeOutput: string; + narration: string; + platformType: string | null; + assignmentMainTypeId: any; + taskType: string; + assignedToRole: string; + broadcastType: string; + } = { + ...data, + // assignmentType, + // assignmentCategory, + id: detail?.id || null, + assignedToLevel: handlePoldaPolresChange(), + assignmentPurpose: assignmentPurposeString, + assignedToRole: selectedTarget, + taskType: taskType, + broadcastType: broadcastType, + assignmentMainTypeId: mainType, + assignmentTypeId: type, + fileTypeOutput: selectedOutputs, + narration: data.naration, + platformType: "", + title: data.title, + }; + + const response = await createTask(requestData); + + console.log("Form Data Submitted:", requestData); + console.log("response", response); + + MySwal.fire({ + title: "Sukses", + text: "Data berhasil disimpan.", + icon: "success", + confirmButtonColor: "#3085d6", + confirmButtonText: "OK", + }).then(() => { + router.push("/en/contributor/task"); + }); + }; + + const onSubmit = (data: TaskSchema) => { + MySwal.fire({ + title: "Simpan Data", + text: "Apakah Anda yakin ingin menyimpan data ini?", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#d33", + confirmButtonColor: "#3085d6", + confirmButtonText: "Simpan", + }).then((result) => { + if (result.isConfirmed) { + save(data); + } + }); + }; + + const toggleExpand = (poldaId: any) => { + setExpandedPolda((prev: any) => ({ + ...prev, + [poldaId]: !prev[poldaId], + })); + }; + + return ( + +
+

Form Penugasan

+ {detail !== undefined ? ( + +
+ {/*
+ + ( + + )} + /> +
*/} +
+ + ( + + )} + /> + {errors.title?.message && ( +

{errors.title.message}

+ )} +
+
+
+ + +
+
+ {Object.keys(unitSelection).map((key) => ( +
+ + setUnitSelection({ ...unitSelection, [key]: value }) + } + /> + +
+ ))} +
+
+ + + + + + + + Daftar Wilayah Polda dan Polres + + +
+ {listDest.map((polda: any) => ( +
+ + {expandedPolda[polda.id] && ( +
+ + {polda?.subDestination?.map((polres: any) => ( + + ))} +
+ )} +
+ ))} +
+
+
+
+
+
+ + setMainType(value)} + // value={String(mainType)} + // onValueChange={(value) => setMainType(Number(value))} + className="flex flex-wrap gap-3" + > + + + + + +
+
+ + setTaskType(String(value))} + className="flex flex-wrap gap-3" + > + + + + + +
+ {/* RadioGroup Assignment Category */} +
+ + setType(value)} // Mengubah nilai state ketika pilihan berubah + className="flex flex-wrap gap-3" + > +
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+ {Object.keys(taskOutput).map((key) => ( +
+ + setTaskOutput({ ...taskOutput, [key]: value }) + } + /> + +
+ ))} +
+
+
+ + setBroadcastType(value)} // Mengatur nilai saat radio berubah + className="flex flex-wrap gap-3" + > +
+ + +
+
+ + +
+
+ + +
+
+
+
+ + ( + + )} + /> + {errors.naration?.message && ( +

+ {errors.naration.message} +

+ )} +
+
+ + {/* Submit Button */} +
+ +
+ + ) : ( + "" + )} +
+
+ ); +} diff --git a/components/form/task/task-form.tsx b/components/form/task/task-form.tsx index f94037cd..8b74a6b8 100644 --- a/components/form/task/task-form.tsx +++ b/components/form/task/task-form.tsx @@ -20,7 +20,19 @@ import { import { Checkbox } from "@/components/ui/checkbox"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import JoditEditor from "jodit-react"; -import { createTask, getTask } from "@/service/task"; +import { + createTask, + getTask, + getUserLevelForAssignments, +} from "@/service/task"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { ChevronDown, ChevronUp } from "lucide-react"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -34,6 +46,7 @@ export type taskDetail = { title: string; fileTypeOutput: string; assignedToTopLevel: string; + assignedToLevel: string; assignmentType: { id: number; name: string; @@ -71,9 +84,13 @@ export default function FormTask() { const [taskType, setTaskType] = useState("atensi-khusus"); const [broadcastType, setBroadcastType] = useState(""); // untuk Tipe Penugasan const [type, setType] = useState("1"); - const [selectedTarget, setSelectedTarget] = useState("all"); + const [selectedTarget, setSelectedTarget] = useState("3,4"); const [detail, setDetail] = useState(); const [refresh] = useState(false); + const [listDest, setListDest] = useState([]); // Data Polda dan Polres + const [checkedLevels, setCheckedLevels] = useState(new Set()); + const [expandedPolda, setExpandedPolda] = useState([{}]); + const [isLoading, setIsLoading] = useState(false); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ @@ -96,7 +113,47 @@ export default function FormTask() { // setMainType(selectedValue); // setPlatformTypeVisible(selectedValue === 2); + + useEffect(() => { + async function fetchPoldaPolres() { + setIsLoading(true); + try { + const response = await getUserLevelForAssignments(); + setListDest(response.data.data.list); + const initialExpandedState = response.data.data.list.reduce( + (acc: any, polda: any) => { + acc[polda.id] = false; + return acc; + }, + {} + ); + setExpandedPolda(initialExpandedState); + console.log("polres", initialExpandedState); + } catch (error) { + console.error("Error fetching Polda/Polres data:", error); + } finally { + setIsLoading(false); + } + } + fetchPoldaPolres(); + }, []); + // }; + const handleCheckboxChange = (levelId: number) => { + setCheckedLevels((prev) => { + const updatedLevels = new Set(prev); + if (updatedLevels.has(levelId)) { + updatedLevels.delete(levelId); + } else { + updatedLevels.add(levelId); + } + return updatedLevels; + }); + }; + + const handlePoldaPolresChange = () => { + return Array.from(checkedLevels).join(","); // Mengonversi Set ke string + }; const save = async (data: TaskSchema) => { const fileTypeMapping = { @@ -107,25 +164,47 @@ export default function FormTask() { text: "5", }; + const unitMapping = { + allUnit: "0", + mabes: "1", + polda: "2", + polres: "3", + }; + const assignmentPurposeString = Object.keys(unitSelection) + .filter((key) => unitSelection[key as keyof typeof unitSelection]) + .map((key) => unitMapping[key as keyof typeof unitMapping]) + .join(","); + const selectedOutputs = Object.keys(taskOutput) .filter((key) => taskOutput[key as keyof typeof taskOutput]) // Ambil hanya yang `true` .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) // Konversi ke nilai string .join(","); - const requestData = { + const requestData: { + id?: number; + title: string; + assignedToLevel: any; + assignmentPurpose: any; + assignmentTypeId: string; + fileTypeOutput: string; + narration: string; + platformType: string | null; + assignmentMainTypeId: any; + taskType: string; + assignedToRole: string; + broadcastType: string; + } = { ...data, // assignmentType, // assignmentCategory, - target: selectedTarget, - unitSelection, - assignedToRole: "3", + assignedToLevel: handlePoldaPolresChange(), + assignmentPurpose: assignmentPurposeString, + assignedToRole: selectedTarget, taskType: taskType, broadcastType: broadcastType, assignmentMainTypeId: mainType, - assignmentPurpose: "1", assignmentTypeId: type, fileTypeOutput: selectedOutputs, - id: null, narration: data.naration, platformType: "", title: data.title, @@ -163,6 +242,13 @@ export default function FormTask() { }); }; + const toggleExpand = (poldaId: any) => { + setExpandedPolda((prev: any) => ({ + ...prev, + [poldaId]: !prev[poldaId], + })); + }; + return (
@@ -198,9 +284,9 @@ export default function FormTask() { - Semua Pengguna - Kontributor - Approver + Semua Pengguna + Kontributor + Approver
@@ -220,6 +306,82 @@ export default function FormTask() {
))}
+ + + + + + + Daftar Wilayah Polda dan Polres + +
+ {listDest.map((polda: any) => ( +
+ + {expandedPolda[polda.id] && ( +
+ + {polda?.subDestination?.map((polres: any) => ( + + ))} +
+ )} +
+ ))} +
+
+
diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx index 0f6cb699..bf182631 100644 --- a/components/landing-page/navbar.tsx +++ b/components/landing-page/navbar.tsx @@ -308,12 +308,11 @@ const Navbar = () => {
- -
- +
+ Masuk - + Daftar
diff --git a/components/partials/auth/login-form.tsx b/components/partials/auth/login-form.tsx index cb344fa9..09aba4f0 100644 --- a/components/partials/auth/login-form.tsx +++ b/components/partials/auth/login-form.tsx @@ -168,7 +168,7 @@ const LoginForm = () => { }); } } else { - window.location.href = "/"; + // window.location.href = "/"; Cookies.set("status", "login", { expires: 1, }); diff --git a/components/partials/footer/index.tsx b/components/partials/footer/index.tsx index c55c1e85..bcc08b59 100644 --- a/components/partials/footer/index.tsx +++ b/components/partials/footer/index.tsx @@ -5,16 +5,8 @@ import FooterContent from './footer-content' import { Link } from "@/components/navigation" import Image from 'next/image' import { Icon } from "@/components/ui/icon"; -import { auth } from '@/lib/auth' const DashCodeFooter = () => { - - const [session, setSession] = React.useState(); - - const initSession = async () => { - const ses = await auth(); - setSession(ses); - } return ( @@ -49,13 +41,11 @@ const DashCodeFooter = () => { >
{session?.user?.name?.charAt(0)
diff --git a/components/partials/header/profile-info.tsx b/components/partials/header/profile-info.tsx index 66e48c8f..b08c84bc 100644 --- a/components/partials/header/profile-info.tsx +++ b/components/partials/header/profile-info.tsx @@ -12,19 +12,11 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Icon } from "@/components/ui/icon"; -import { signOut, auth } from "@/lib/auth"; import Image from "next/image"; import { Link } from "@/i18n/routing"; import React from "react"; const ProfileInfo = () => { - - const [session, setSession] = React.useState(); - - const initSession = async () => { - const ses = await auth(); - setSession(ses); - } return (
@@ -32,15 +24,15 @@ const ProfileInfo = () => {
{session?.user?.name?.charAt(0)
- {session?.user?.name} + UserName
@@ -50,8 +42,8 @@ const ProfileInfo = () => { {session?.user?.name?.charAt(0) {
- {session?.user?.name} + Name
- {session?.user?.email} + Email
diff --git a/components/partials/sidebar/common/team-switcher.tsx b/components/partials/sidebar/common/team-switcher.tsx index b4b86e0c..52d11613 100644 --- a/components/partials/sidebar/common/team-switcher.tsx +++ b/components/partials/sidebar/common/team-switcher.tsx @@ -1,7 +1,6 @@ "use client" import * as React from "react" -import { useSession } from "next-auth/react"; import { ChevronsUpDown, Check, CirclePlus } from 'lucide-react'; import { cn } from "@/lib/utils" @@ -88,7 +87,7 @@ export default function TeamSwitcher({ className }: TeamSwitcherProps) { const [config] = useConfig(); const [hoverConfig] = useMenuHoverConfig(); const { hovered } = hoverConfig; - const { data: session } = useSession(); + const [data, setData] = React.useState(); const [open, setOpen] = React.useState(false) const [showNewTeamDialog, setShowNewTeamDialog] = React.useState(false) const [selectedTeam, setSelectedTeam] = React.useState( @@ -128,12 +127,12 @@ export default function TeamSwitcher({ className }: TeamSwitcherProps) { - {session?.user?.name?.charAt(0)} + Username :