From 07369e5db9dd2fbb3d408ab4317eddee51710676 Mon Sep 17 00:00:00 2001 From: lukman Date: Tue, 20 Aug 2024 17:36:09 +0800 Subject: [PATCH] style : update position project --- src/app/api/calender/indicator/route.ts | 28 +++ .../calender/ui/date_event_division.tsx | 47 ++--- src/module/project/lib/api_project.ts | 0 src/module/project/lib/type_project.ts | 0 src/module/project/ui/.gitkeep | 0 src/module/project/ui/list_project.tsx | 160 ++++++++++++++++++ src/module/project/ui/menu_drawer_project.tsx | 35 ++++ src/module/project/ui/tab_project.tsx | 99 +++++++++++ tsconfig.json | 2 +- 9 files changed, 349 insertions(+), 22 deletions(-) create mode 100644 src/app/api/calender/indicator/route.ts create mode 100644 src/module/project/lib/api_project.ts create mode 100644 src/module/project/lib/type_project.ts create mode 100644 src/module/project/ui/.gitkeep create mode 100644 src/module/project/ui/list_project.tsx create mode 100644 src/module/project/ui/menu_drawer_project.tsx create mode 100644 src/module/project/ui/tab_project.tsx diff --git a/src/app/api/calender/indicator/route.ts b/src/app/api/calender/indicator/route.ts new file mode 100644 index 0000000..5ca5850 --- /dev/null +++ b/src/app/api/calender/indicator/route.ts @@ -0,0 +1,28 @@ +import { funGetUserByCookies } from "@/module/auth"; +import { NextResponse } from "next/server"; + + +export async function GET(request: Request) { + try { + const user = await funGetUserByCookies() + if (user.id == undefined) { + return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 }); + } + + const { searchParams } = new URL(request.url); + + const id = searchParams.get("id"); + + return NextResponse.json({ success: true, data: null }, { status: 200 }); + } catch (error) { + return NextResponse.json({ success: false, message: "" }, { status: 401 }); + } +} + + + + + + + + diff --git a/src/module/calender/ui/date_event_division.tsx b/src/module/calender/ui/date_event_division.tsx index fb0cab5..ea708fb 100644 --- a/src/module/calender/ui/date_event_division.tsx +++ b/src/module/calender/ui/date_event_division.tsx @@ -26,7 +26,6 @@ export default function DateEventDivision() { function change(val: Date) { const a: any = moment(new Date(val)).format('YYYY-MM-DD') - console.log(val, a) setDate(a) getData(a) } @@ -58,27 +57,33 @@ export default function DateEventDivision() { /> - Hari Ini - {isData.map((event, index) => { - const bgColor = ['#D8D8F1', '#FED6C5'][index % 2] - const colorDivider = ['#535FCA', '#A7A7A7'][index % 2] - return ( - - router.push(`/division/${param.id}/calender/${event.id}`)} bg={bgColor} pl={15} p={10} style={{ - borderRadius: 10 - }} h={113}> - - - - {event.timeStart} - {event.timeEnd} - {event.title} - Dibuat oleh : {event.user_name} - - + + Event + + {isData.length > 0 ? ( + isData.map((event, index) => { + const bgColor = ['#D8D8F1', '#FED6C5'][index % 2] + const colorDivider = ['#535FCA', '#A7A7A7'][index % 2] + return ( + + router.push(`/division/${param.id}/calender/${event.id}`)} bg={bgColor} pl={15} p={10} style={{ + borderRadius: 10 + }} h={113}> + + + + {event.timeStart} - {event.timeEnd} + {event.title} + Dibuat oleh : {event.user_name} + + + - - ) - })} + ) + }) + ) : ( + Tidak ada event + )} ); diff --git a/src/module/project/lib/api_project.ts b/src/module/project/lib/api_project.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/module/project/lib/type_project.ts b/src/module/project/lib/type_project.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/module/project/ui/.gitkeep b/src/module/project/ui/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/module/project/ui/list_project.tsx b/src/module/project/ui/list_project.tsx new file mode 100644 index 0000000..4ab513a --- /dev/null +++ b/src/module/project/ui/list_project.tsx @@ -0,0 +1,160 @@ +"use client" +import { WARNA } from '@/module/_global'; +import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Text, TextInput, Title } from '@mantine/core'; +import { useRouter } from 'next/navigation'; +import React, { useState } from 'react'; +import { HiMagnifyingGlass, HiMiniPresentationChartBar, HiOutlineListBullet, HiSquares2X2 } from 'react-icons/hi2'; +import { MdAccountCircle } from 'react-icons/md'; +import { RiCircleFill } from 'react-icons/ri'; + +const dataProject = [ + { + id: 1, + title: 'Project 1', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, + { + id: 2, + title: 'Project 2', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, + { + id: 3, + title: 'Project 3', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, + { + id: 4, + title: 'Project 4', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, + { + id: 5, + title: 'Project 5', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, + { + id: 6, + title: 'Project 6', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT PROSES', + }, +] +export default function ListProject() { + const [isList, setIsList] = useState(false) + const router = useRouter() + + const handleList = () => { + setIsList(!isList) + } + return ( + + + + } + placeholder="Pencarian" + /> + + + + {isList ? ( + + ) : ( + + )} + + + + + + Total Proyek + + 35 + + + {isList ? ( + + {dataProject.map((v, i) => { + return ( + + router.push(`/project/${v.id}`)}> + +
+ + + +
+ {v.title} +
+ + + +
+ +
+ ); + })} +
+ ) : ( + + {dataProject.map((v, i) => { + return ( + + router.push(`/project/${v.id}`)}> + + + + {v.title} + + + + + {v.description} + + {v.status} + + + + + +5 + + + + + + ); + })} + + )} +
+
+ ); +} + + + diff --git a/src/module/project/ui/menu_drawer_project.tsx b/src/module/project/ui/menu_drawer_project.tsx new file mode 100644 index 0000000..c15b672 --- /dev/null +++ b/src/module/project/ui/menu_drawer_project.tsx @@ -0,0 +1,35 @@ +import { WARNA } from '@/module/_global'; +import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core'; +import React, { useState } from 'react'; +import { HiOutlineFilter } from 'react-icons/hi'; +import { IoAddCircle } from 'react-icons/io5'; + +export default function MenuDrawerProject() { + return ( + + + + window.location.href = "/project/create"} justify={'center'} align={'center'} direction={'column'} > + + + + + Tambah Proyek + + + window.location.href = "/project?cat=filter"} justify={'center'} align={'center'} direction={'column'} > + + + + + Filter + + + + + + ); +} + diff --git a/src/module/project/ui/tab_project.tsx b/src/module/project/ui/tab_project.tsx new file mode 100644 index 0000000..04f2f34 --- /dev/null +++ b/src/module/project/ui/tab_project.tsx @@ -0,0 +1,99 @@ +"use client" +import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global'; +import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, rem, Tabs, Text, TextInput, Title } from '@mantine/core'; +import React, { useEffect, useState } from 'react'; +import { HiMenu } from 'react-icons/hi'; +import { HiMagnifyingGlass, HiMiniPresentationChartBar, HiOutlineListBullet, HiSquares2X2 } from 'react-icons/hi2'; +import { MdAccountCircle } from 'react-icons/md'; +import { RiCircleFill } from "react-icons/ri"; +import { useRouter } from 'next/navigation'; +import { TbClockPause } from 'react-icons/tb'; +import { IoIosCheckmarkCircleOutline } from 'react-icons/io'; +import { IoCloseCircleOutline } from 'react-icons/io5'; +import ListProject from './list_project'; +import MenuDrawerProject from './menu_drawer_project'; + +export default function TabProject() { + const [openDrawer, setOpenDrawer] = useState(false) + + const iconStyle = { width: rem(20), height: rem(20) }; + + const tabsData = [ + { + value: 'segera', + label: 'Proyek Proses', + mobileLabel: 'Proses', + icon: , + }, + { + value: 'selesai', + label: 'Proyek Selesai', + mobileLabel: 'Selesai', + icon: , + }, + { + value: 'batal', + label: 'Proyek Batal', + mobileLabel: ' Batal', + icon: , + }, + ]; + const [isMobile, setIsMobile] = useState(false); + + useEffect(() => { + const handleResize = () => { + if (window.innerWidth < 495) { + setIsMobile(true); + } else { + setIsMobile(false); + } + }; + window.addEventListener('resize', handleResize); + handleResize(); + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); + + return ( + + setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings"> + + } /> + + + + + {tabsData.map((tab) => ( + + {isMobile ? tab.mobileLabel : tab.label} + + ))} + + + + + + + + + + + + + + + + + setOpenDrawer(false)}> + + + + ); +} diff --git a/tsconfig.json b/tsconfig.json index 41cf299..fd40f63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,6 @@ "@/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/.gitkeep"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/.gitkeep", "src/module/project/ui/.gitkeep"], "exclude": ["node_modules"] }