feat:pattern relation viz, assignment page

This commit is contained in:
Rama Priyanto 2024-12-13 18:39:38 +07:00
parent 32e71348f5
commit e2e1d96609
9 changed files with 88 additions and 9 deletions

View File

@ -16,12 +16,17 @@ import { CalendarEvent, CalendarCategory } from "./data";
import { EventContentArg } from "@fullcalendar/core"; import { EventContentArg } from "@fullcalendar/core";
import EventModal from "./event-modal"; import EventModal from "./event-modal";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { getAgendaSettingsList } from "@/service/agenda-setting/agenda-setting";
import dayjs from "dayjs";
const wait = () => new Promise((resolve) => setTimeout(resolve, 1000)); const wait = () => new Promise((resolve) => setTimeout(resolve, 1000));
interface CalendarViewProps { interface CalendarViewProps {
events: CalendarEvent[]; events: CalendarEvent[];
categories: CalendarCategory[]; categories: CalendarCategory[];
} }
const INITIAL_YEAR = dayjs().format("YYYY");
const INITIAL_MONTH = dayjs().format("M");
const CalendarView = ({ events, categories }: CalendarViewProps) => { const CalendarView = ({ events, categories }: CalendarViewProps) => {
const [selectedCategory, setSelectedCategory] = useState<string[] | null>( const [selectedCategory, setSelectedCategory] = useState<string[] | null>(
null null
@ -44,6 +49,18 @@ const CalendarView = ({ events, categories }: CalendarViewProps) => {
{ title: "Create New theme", id: "104", tag: "etc" }, { title: "Create New theme", id: "104", tag: "etc" },
]); ]);
useEffect(() => {
getCalendarEvents();
});
const getCalendarEvents = async () => {
const res = await getAgendaSettingsList(INITIAL_YEAR, INITIAL_MONTH, "");
console.log("ress", res);
if (res.error) {
return false;
}
};
useEffect(() => { useEffect(() => {
setSelectedCategory(categories?.map((c) => c.value)); setSelectedCategory(categories?.map((c) => c.value));
}, [events, categories]); }, [events, categories]);
@ -151,14 +168,14 @@ const CalendarView = ({ events, categories }: CalendarViewProps) => {
/> />
</div> </div>
<div id="external-events" className=" space-y-1.5 mt-6 px-4"> {/* <div id="external-events" className=" space-y-1.5 mt-6 px-4">
<p className="text-sm font-medium text-default-700 mb-3"> <p className="text-sm font-medium text-default-700 mb-3">
{t("shortDesc")} {t("shortDesc")}
</p> </p>
{dragEvents.map((event) => ( {dragEvents.map((event) => (
<ExternalDraggingevent key={event.id} event={event} /> <ExternalDraggingevent key={event.id} event={event} />
))} ))}
</div> </div> */}
<div className="py-4 text-default-800 font-semibold text-xs uppercase mt-4 mb-2 px-4"> <div className="py-4 text-default-800 font-semibold text-xs uppercase mt-4 mb-2 px-4">
{t("filter")} {t("filter")}
</div> </div>

View File

@ -1,17 +1,31 @@
import { getAgendaSettingsList } from "@/service/agenda-setting/agenda-setting";
import { faker } from "@faker-js/faker"; import { faker } from "@faker-js/faker";
import dayjs from "dayjs";
const date = new Date(); const date = new Date();
const prevDay = new Date().getDate() - 1; const prevDay = new Date().getDate() - 1;
const nextDay = new Date(new Date().getTime() + 24 * 60 * 60 * 1000); const nextDay = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
const INITIAL_YEAR = dayjs().format("YYYY");
const INITIAL_MONTH = dayjs().format("M");
// prettier-ignore // prettier-ignore
const nextMonth = date.getMonth() === 11 ? new Date(date.getFullYear() + 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() + 1, 1) const nextMonth = date.getMonth() === 11 ? new Date(date.getFullYear() + 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() + 1, 1)
// prettier-ignore // prettier-ignore
const prevMonth = date.getMonth() === 11 ? new Date(date.getFullYear() - 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() - 1, 1) const prevMonth = date.getMonth() === 11 ? new Date(date.getFullYear() - 1, 0, 1) : new Date(date.getFullYear(), date.getMonth() - 1, 1)
export const getCalendarEvents = async () => {
const res = await getAgendaSettingsList(INITIAL_YEAR, INITIAL_MONTH, "");
if (res.error) {
return false;
}
console.log("ress", res.data.data);
return res?.data?.data;
};
export const calendarEvents = [ export const calendarEvents = [
{ {
id: faker.string.uuid(), id: faker.string.uuid(),
title: "All Day Event", title: "aaaAll Day Event",
start: date, start: date,
end: nextDay, end: nextDay,
allDay: false, allDay: false,

View File

@ -1,9 +1,7 @@
import { getEvents, getCategories } from "./utils"; import { getEvents, getCategories } from "./utils";
import { Category } from "./data" import { Category } from "./data";
import CalendarView from "./calender-view"; import CalendarView from "./calender-view";
const CalenderPage = async () => { const CalenderPage = async () => {
const events = await getEvents(); const events = await getEvents();
const categories = await getCategories(); const categories = await getCategories();

View File

@ -8,4 +8,4 @@ export const getEvents = async () => {
// get categories // get categories
export const getCategories = async () => { export const getCategories = async () => {
return categories; return categories;
} };

View File

@ -0,0 +1,9 @@
export const metadata = {
title: "Task Plan Mediahub",
};
const Layout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
};
export default Layout;

View File

@ -0,0 +1,16 @@
"use client";
import SiteBreadcrumb from "@/components/site-breadcrumb";
import { Button } from "@/components/ui/button";
import { useState } from "react";
export default function TaskPlanMediahub() {
const [singleView, setSingleView] = useState(true);
return (
<div>
<SiteBreadcrumb />
<div className="flex justify-between">
<Button></Button>
</div>
</div>
);
}

View File

@ -0,0 +1,9 @@
export const metadata = {
title: "Task Plan Social Media Mediahub",
};
const Layout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
};
export default Layout;

View File

@ -0,0 +1,10 @@
import SiteBreadcrumb from "@/components/site-breadcrumb";
export default function MedsosMediahub() {
return (
<div>
<SiteBreadcrumb />
medsos mediahub
</div>
);
}

View File

@ -0,0 +1,6 @@
import { httpGetInterceptor } from "../http-config/http-interceptor-service";
export async function getAgendaSettingsList(year = "", month = "", type = "") {
const url = `agenda-settings/list?year=${year}&month=${month}&type=${type}`;
return httpGetInterceptor({ url });
}