From 611d5ddcf6d57b914db046f3199da67c6272c0f1 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 11:17:32 +0800 Subject: [PATCH 01/13] style : update navbar project --- .../project/components/ui/navbar_project.tsx | 245 ++++++------------ 1 file changed, 76 insertions(+), 169 deletions(-) diff --git a/src/module/project/components/ui/navbar_project.tsx b/src/module/project/components/ui/navbar_project.tsx index 23c167a..2204008 100644 --- a/src/module/project/components/ui/navbar_project.tsx +++ b/src/module/project/components/ui/navbar_project.tsx @@ -1,191 +1,98 @@ "use client" import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global'; -import { ActionIcon, Avatar, Badge, Box, Card, Center, Divider, Flex, Grid, Group, Text, TextInput, Title } from '@mantine/core'; -import React, { useState } from 'react'; +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 DrawerProject from './drawer_project'; import { useRouter } from 'next/navigation'; - -const dataProject = [ - { - id: 1, - title: 'Project 1', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROJECT SELESAI', - color: '#387529' - }, - { - id: 2, - title: 'Project 2', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROJECT SELESAI', - color: '#387529' - }, - { - id: 3, - title: 'Project 3', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROJECT SELESAI', - color: '#387529' - }, - { - id: 4, - title: 'Project 4', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROSES', - color: '#C5771A' - }, - { - id: 5, - title: 'Project5', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROSES', - color: '#C5771A' - }, - { - id: 6, - title: 'Project 6', - description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', - status: 'PROSES', - color: '#C5771A' - }, -] +import { TbClockPause } from 'react-icons/tb'; +import { IoIosCheckmarkCircleOutline } from 'react-icons/io'; +import { IoCloseCircleOutline } from 'react-icons/io5'; +import ProjectProcess from '../project_process'; +import ProjectDone from '../project_done'; +import ProjectCencel from '../project_cencel'; export default function NavbarProject() { - const [isList, setIsList] = useState(false) const [openDrawer, setOpenDrawer] = useState(false) - const router = useRouter() - const handleList = () => { - setIsList(!isList) - } + 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"> } /> + - - - } - placeholder="Pencarian" - /> - - - - {isList ? ( - - ) : ( - - )} - - - - - - Total Proyek - - 35 - - - - - - Proyek Selesai - - 35 - - - - - - Proyek Proses - - 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 - - - - - - ); - })} - - )} -
-
+ + + {tabsData.map((tab) => ( + + {isMobile ? tab.mobileLabel : tab.label} + + ))} + + + + + + + + + + + + + + +
+ setOpenDrawer(false)}> From 8d0872a0a3074a6938bfcf9324bfaeb86e069fff Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 11:18:25 +0800 Subject: [PATCH 02/13] style : add Project cancel --- .../project/components/project_cencel.tsx | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 src/module/project/components/project_cencel.tsx diff --git a/src/module/project/components/project_cencel.tsx b/src/module/project/components/project_cencel.tsx new file mode 100644 index 0000000..1eb92ed --- /dev/null +++ b/src/module/project/components/project_cencel.tsx @@ -0,0 +1,157 @@ +"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 BATAL', + }, + { + id: 2, + title: 'Project 2', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT BATAL', + }, + { + id: 3, + title: 'Project 3', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT BATAL', + }, + { + id: 4, + title: 'Project 4', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT BATAL', + }, + { + id: 5, + title: 'Project 5', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT BATAL', + }, + { + id: 6, + title: 'Project 6', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT BATAL', + }, +] +export default function ProjectCencel() { + 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 + + + + + + ); + })} + + )} +
+
+ ); +} From c2918522e5609025215c5dc820e8e260e4111e73 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 11:19:13 +0800 Subject: [PATCH 03/13] style : add project done --- .../project/components/project_done.tsx | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 src/module/project/components/project_done.tsx diff --git a/src/module/project/components/project_done.tsx b/src/module/project/components/project_done.tsx new file mode 100644 index 0000000..70075be --- /dev/null +++ b/src/module/project/components/project_done.tsx @@ -0,0 +1,157 @@ +"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 SELESAI', + }, + { + id: 2, + title: 'Project 2', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT SELESAI', + }, + { + id: 3, + title: 'Project 3', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT SELESAI', + }, + { + id: 4, + title: 'Project 4', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT SELESAI', + }, + { + id: 5, + title: 'Project 5', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT SELESAI', + }, + { + id: 6, + title: 'Project 6', + description: 'Tempat berkumpul semua anggota / staff perbekal darmasaba', + status: 'PROJECT SELESAI', + }, +] +export default function ProjectDone() { + 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 + + + + + + ); + })} + + )} +
+
+ ); +} From 29426c120cb46f8c63fea4b179e4274a72176f8d Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 11:19:50 +0800 Subject: [PATCH 04/13] style : add Project process --- .../project/components/project_process.tsx | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 src/module/project/components/project_process.tsx diff --git a/src/module/project/components/project_process.tsx b/src/module/project/components/project_process.tsx new file mode 100644 index 0000000..4a80c63 --- /dev/null +++ b/src/module/project/components/project_process.tsx @@ -0,0 +1,158 @@ +"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 ProjectProcess() { + 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 + + + + + + ); + })} + + )} +
+
+ ); +} + From 4625e7e4d49ea0dac6951e70aa98391b4ad6968b Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 12:30:24 +0800 Subject: [PATCH 05/13] style : uodate tabs division task --- .../_division_fitur/task/component/tabs_division_task.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/division_new/_division_fitur/task/component/tabs_division_task.tsx b/src/module/division_new/_division_fitur/task/component/tabs_division_task.tsx index e3c7687..30d18cb 100644 --- a/src/module/division_new/_division_fitur/task/component/tabs_division_task.tsx +++ b/src/module/division_new/_division_fitur/task/component/tabs_division_task.tsx @@ -12,7 +12,7 @@ export default function TabsDivisionTask() { return ( - Date: Mon, 22 Jul 2024 12:31:31 +0800 Subject: [PATCH 06/13] style : update navbar project --- src/module/project/components/ui/navbar_project.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/project/components/ui/navbar_project.tsx b/src/module/project/components/ui/navbar_project.tsx index 2204008..32b0e53 100644 --- a/src/module/project/components/ui/navbar_project.tsx +++ b/src/module/project/components/ui/navbar_project.tsx @@ -66,7 +66,7 @@ export default function NavbarProject() { - + {tabsData.map((tab) => ( Date: Mon, 22 Jul 2024 16:41:25 +0800 Subject: [PATCH 07/13] api : add api auth --- src/app/api/auth/login/route.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/app/api/auth/login/route.ts diff --git a/src/app/api/auth/login/route.ts b/src/app/api/auth/login/route.ts new file mode 100644 index 0000000..2432ae7 --- /dev/null +++ b/src/app/api/auth/login/route.ts @@ -0,0 +1,25 @@ +import prisma from "@/module/_global/bin/prisma"; +import { Login } from "@/types/auth/login"; +import { NextRequest } from "next/server"; + +export async function POST(req: NextRequest) { + const { email }: Login = await req.json(); + const user = await prisma.user.findUnique({ + where: { email, isActive: true }, + select: { id: true, phone: true }, + }); + + if (!user) { + return Response.json({ + success: false, + message: "Email atau Password salah", + }); + } + + return Response.json({ + success: true, + message: "Login Berhasil", + phone: user.phone, + id: user.id, + }); +} From 8c392e9b71cc3fb2109a05ae5c2653f540c4f096 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 16:42:08 +0800 Subject: [PATCH 08/13] feat : add bin prisma --- src/module/_global/bin/prisma.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/module/_global/bin/prisma.ts diff --git a/src/module/_global/bin/prisma.ts b/src/module/_global/bin/prisma.ts new file mode 100644 index 0000000..b9e55ff --- /dev/null +++ b/src/module/_global/bin/prisma.ts @@ -0,0 +1,17 @@ +import { PrismaClient } from '@prisma/client' + +const prismaClientSingleton = () => { + return new PrismaClient() +} + +type PrismaClientSingleton = ReturnType + +const globalForPrisma = globalThis as unknown as { + prisma: PrismaClientSingleton | undefined +} + +const prisma = globalForPrisma.prisma ?? prismaClientSingleton() + +export default prisma + +if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma \ No newline at end of file From 9df0554deee0a3ba978800248e5370e6f6270820 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 16:42:31 +0800 Subject: [PATCH 09/13] feat : add types data --- src/types/.gitkeep | 0 src/types/auth/login.ts | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 src/types/.gitkeep create mode 100644 src/types/auth/login.ts diff --git a/src/types/.gitkeep b/src/types/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/types/auth/login.ts b/src/types/auth/login.ts new file mode 100644 index 0000000..17ca1cb --- /dev/null +++ b/src/types/auth/login.ts @@ -0,0 +1,5 @@ +export interface Login { + id: string + email: string + phone: string +} \ No newline at end of file From baede1e228c5d023a4097724fcd34373bc4a71f8 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 16:42:53 +0800 Subject: [PATCH 10/13] test api --- api.http | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 api.http diff --git a/api.http b/api.http new file mode 100644 index 0000000..a3ab361 --- /dev/null +++ b/api.http @@ -0,0 +1,8 @@ +### +POST http://localhost:3000/api/auth/login/ HTTP/1.1 +Content-Type: application/json +{ + "id": "devLukman", + "phone": "6287701790942", + "email": "lukman@bip.com" +} \ No newline at end of file From 7cb18918583fa0f1b0b110deda51e4a8c8053cf8 Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 17:53:47 +0800 Subject: [PATCH 11/13] style : update drawer list discussion --- .../discussion/component/drawer_list_discussion.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/division_new/_division_fitur/discussion/component/drawer_list_discussion.tsx b/src/module/division_new/_division_fitur/discussion/component/drawer_list_discussion.tsx index 87c6d5f..767fae0 100644 --- a/src/module/division_new/_division_fitur/discussion/component/drawer_list_discussion.tsx +++ b/src/module/division_new/_division_fitur/discussion/component/drawer_list_discussion.tsx @@ -7,7 +7,7 @@ export default function DrawerListDiscussion() { window.location.href = "/discussion/create"} justify={'center'} align={'center'} direction={'column'} > From ed1354a840d491979bad2a7bba3e9df8b1466f2c Mon Sep 17 00:00:00 2001 From: lukman Date: Mon, 22 Jul 2024 17:54:17 +0800 Subject: [PATCH 12/13] style : update form create discussion --- .../component/form_create_discussion.tsx | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/module/division_new/_division_fitur/discussion/component/form_create_discussion.tsx b/src/module/division_new/_division_fitur/discussion/component/form_create_discussion.tsx index 8451623..d1354f2 100644 --- a/src/module/division_new/_division_fitur/discussion/component/form_create_discussion.tsx +++ b/src/module/division_new/_division_fitur/discussion/component/form_create_discussion.tsx @@ -18,27 +18,21 @@ export default function FormCreateDiscussion() { return ( - - -
- -
-
- - -