diff --git a/next.config.js b/next.config.js index 983d7350..5c728631 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,10 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + reactStrictMode: false, experimental: { serverActions: true - } + }, + } module.exports = nextConfig diff --git a/package.json b/package.json index 15651cf3..a6e33e51 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-simple-toasts": "^5.10.0", + "react-toastify": "^9.1.3", + "socket.io-client": "^4.7.2", "tailwindcss": "3.3.3", "typescript": "5.1.6", "uuid": "^9.0.1", diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 46f70188..fed69d0d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -73,7 +73,7 @@ model Katalog { namaBisnis String alamatKantor String tlpn String - deskripssi String + deskripsi String active Boolean @default(true) createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt diff --git a/public/img/2ba722df-abd3-4b3a-b087-fc9f61b077ae.png b/public/img/2ba722df-abd3-4b3a-b087-fc9f61b077ae.png new file mode 100644 index 00000000..6e04e0ec Binary files /dev/null and b/public/img/2ba722df-abd3-4b3a-b087-fc9f61b077ae.png differ diff --git a/src/app/api/portofolio/create/route.ts b/src/app/api/portofolio/create/route.ts deleted file mode 100644 index 2a89f55e..00000000 --- a/src/app/api/portofolio/create/route.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { myConsole } from "@/app/fun/my_console"; -import prisma from "@/app/lib/prisma"; -import { NextResponse } from "next/server"; - -export async function POST(req: Request) { - if (req.method === "POST") { - const body = await req.json(); - // myConsole(body); - - const data = await prisma.katalog.create({ - data: { - profileId: body.profileId, - namaBisnis: body.namaBisnis, - alamatKantor: body.alamatKantor, - tlpn: body.tlpn, - deskripssi: body.deskripssi, - masterBidangBisnisId: body.masterBidangBisnisId, - }, - }); - - return NextResponse.json({ status: 201, success: true }); - } - return NextResponse.json({ success: false }); -} diff --git a/src/app/api/profile/create/route.ts b/src/app/api/profile/create/route.ts deleted file mode 100644 index 012231e5..00000000 --- a/src/app/api/profile/create/route.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { myConsole } from "@/app/fun/my_console"; -import prisma from "@/app/lib/prisma"; -import { NextResponse } from "next/server"; - -export async function POST(req: Request) { - if (req.method === "POST") { - const body = await req.json(); - // myConsole(body); - - const data = await prisma.profile.create({ - data: { - userId: body.userId, - name: body.name, - email: body.email, - alamat: body.alamat, - jenisKelamin: body.jenisKelamin, - }, - }); - - if (data) return NextResponse.json({ status: 201 }); - - return NextResponse.json({ success: true }); - } - return NextResponse.json({ success: false }); -} diff --git a/src/app/api/profile/edit/route.ts b/src/app/api/profile/edit/route.ts deleted file mode 100644 index d41cd1d4..00000000 --- a/src/app/api/profile/edit/route.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { myConsole } from "@/app/fun/my_console"; -import prisma from "@/app/lib/prisma"; -import { NextResponse } from "next/server"; - -export async function POST(req: Request) { - if (req.method === "POST") { - const body = await req.json(); - // myConsole(body); - - const data = await prisma.profile.update({ - where: { - id: body.id - }, - data: { - name: body.name, - email: body.email, - alamat: body.alamat, - jenisKelamin: body.jenisKelamin - } - }) - - if(data) { - return NextResponse.json({status: 200}) - } else { - return new Response("Error",{ status :401 }); - } - - - - return NextResponse.json({ success: true }); - } - return NextResponse.json({ success: false }); -} diff --git a/src/app/dev/home/page.tsx b/src/app/dev/home/page.tsx index 98c88a72..499c6b37 100644 --- a/src/app/dev/home/page.tsx +++ b/src/app/dev/home/page.tsx @@ -6,6 +6,7 @@ import { redirect } from "next/navigation"; import yaml from "yaml"; import fs from "fs"; +import { funGetUserProfile } from "@/app_modules/fun/get_user_profile"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); export default async function Page() { @@ -18,9 +19,13 @@ export default async function Page() { }) ); + const dataProfile = await funGetUserProfile(usr.id) + + return ( <> - + {/* {JSON.stringify(usr)} */} + ); } diff --git a/src/app/dev/katalog/[id]/layout.tsx b/src/app/dev/katalog/[id]/layout.tsx new file mode 100644 index 00000000..62c2dc48 --- /dev/null +++ b/src/app/dev/katalog/[id]/layout.tsx @@ -0,0 +1,10 @@ +import { KatalogLayout } from "@/app_modules/katalog/main"; + +export default async function Layout({ children, params }: { children: any, params: {id: string} }) { + // const a = atob(params.id.toString()) + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/katalog/view/page.tsx b/src/app/dev/katalog/[id]/page.tsx similarity index 100% rename from src/app/dev/katalog/view/page.tsx rename to src/app/dev/katalog/[id]/page.tsx diff --git a/src/app/dev/katalog/view/layout.tsx b/src/app/dev/katalog/view/layout.tsx deleted file mode 100644 index 903dc27c..00000000 --- a/src/app/dev/katalog/view/layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { KatalogLayout } from "@/app_modules/katalog/main"; - -export default async function Layout({ children }: { children: any }) { - return ( - <> - {children} - - ); -} diff --git a/src/app/dev/portofolio/create/[id]/layout.tsx b/src/app/dev/portofolio/create/[id]/layout.tsx new file mode 100644 index 00000000..be0a02bc --- /dev/null +++ b/src/app/dev/portofolio/create/[id]/layout.tsx @@ -0,0 +1,8 @@ +import { CreatePortofolio, CreatePortofolioLayout, PortofolioLayout } from "@/app_modules/katalog/portofolio"; +import React from "react"; + +export default async function Layout({children, params}: {children: React.ReactNode, params: {id: string}}) { + return<> + {children} + +} \ No newline at end of file diff --git a/src/app/dev/portofolio/create/page.tsx b/src/app/dev/portofolio/create/[id]/page.tsx similarity index 50% rename from src/app/dev/portofolio/create/page.tsx rename to src/app/dev/portofolio/create/[id]/page.tsx index 92d01ad6..2bdd09e8 100644 --- a/src/app/dev/portofolio/create/page.tsx +++ b/src/app/dev/portofolio/create/[id]/page.tsx @@ -1,16 +1,16 @@ import { myConsole } from "@/app/fun/my_console"; import { CreatePortofolio } from "@/app_modules/katalog/portofolio"; -import { getBidangBisnis } from "@/app_modules/katalog/portofolio/fun/get_list_bidang_bisnis"; -import { getProfile } from "@/app_modules/katalog/profile"; +import { getBidangBisnis } from "@/app_modules/katalog/portofolio/fun/get_bidang_bisnis"; -export default async function Page() { +export default async function Page({ params }: { params: { id: string } }) { const bidangBisnis = await getBidangBisnis(); - const id = await getProfile(); - const profileId = id?.id; return ( <> - + ); } diff --git a/src/app/dev/portofolio/create/layout.tsx b/src/app/dev/portofolio/create/layout.tsx deleted file mode 100644 index 42df5deb..00000000 --- a/src/app/dev/portofolio/create/layout.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { PortofolioLayout } from "@/app_modules/katalog/portofolio"; -import React from "react"; - -export default async function Layout({children}: {children: React.ReactNode}) { - return<> - {children} - -} \ No newline at end of file diff --git a/src/app/dev/portofolio/main/[id]/layout.tsx b/src/app/dev/portofolio/main/[id]/layout.tsx new file mode 100644 index 00000000..f46699c1 --- /dev/null +++ b/src/app/dev/portofolio/main/[id]/layout.tsx @@ -0,0 +1,13 @@ +import { PortofolioLayout } from "@/app_modules/katalog/portofolio"; +import { getOnePortofolio } from "@/app_modules/katalog/portofolio/fun/get_one_portofolio"; + +export default async function Layout({ children, params }: { children: any, params: {id: string} }) { + const getPorto = await getOnePortofolio(params.id) + + + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/portofolio/main/[id]/page.tsx b/src/app/dev/portofolio/main/[id]/page.tsx new file mode 100644 index 00000000..25e9a13e --- /dev/null +++ b/src/app/dev/portofolio/main/[id]/page.tsx @@ -0,0 +1,15 @@ +import { ViewPortofolio } from "@/app_modules/katalog/portofolio"; +import { getOnePortofolio } from "@/app_modules/katalog/portofolio/fun/get_one_portofolio"; + +export default async function Page({params}: {params: {id: string}}) { + + const getPorto = await getOnePortofolio(params.id) + // console.log(getPorto) + + return ( + <> + {/* {JSON.stringify(getPorto)} */} + + + ); +} diff --git a/src/app/dev/profile/create/layout.tsx b/src/app/dev/profile/create/[id]/layout.tsx similarity index 99% rename from src/app/dev/profile/create/layout.tsx rename to src/app/dev/profile/create/[id]/layout.tsx index 30c363ec..a4737a19 100644 --- a/src/app/dev/profile/create/layout.tsx +++ b/src/app/dev/profile/create/[id]/layout.tsx @@ -7,3 +7,4 @@ export default function Layout({ children }: { children: any }) { ); } + diff --git a/src/app/dev/profile/create/[id]/page.tsx b/src/app/dev/profile/create/[id]/page.tsx new file mode 100644 index 00000000..fb1c2751 --- /dev/null +++ b/src/app/dev/profile/create/[id]/page.tsx @@ -0,0 +1,9 @@ +import { CreateProfile } from "@/app_modules/katalog/profile"; + +export default async function Page({params}: {params: {id: string}}) { + // console.log(params.id) + + return <> + + +} \ No newline at end of file diff --git a/src/app/dev/profile/create/page.tsx b/src/app/dev/profile/create/page.tsx deleted file mode 100644 index 97c50e37..00000000 --- a/src/app/dev/profile/create/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { CreateProfile } from "@/app_modules/katalog/profile"; - -export default async function Page() { - return <> - - -} \ No newline at end of file diff --git a/src/app/dev/profile/edit/[id]/layout.tsx b/src/app/dev/profile/edit/[id]/layout.tsx new file mode 100644 index 00000000..34a5c84c --- /dev/null +++ b/src/app/dev/profile/edit/[id]/layout.tsx @@ -0,0 +1,12 @@ +import { funGetUserProfile } from "@/app_modules/fun/get_user_profile"; +import { EditProfileLayout } from "@/app_modules/katalog/profile"; + +export default async function Layout({ children, params }: { children: any, params: {id: string} }) { + const data = await funGetUserProfile(params.id) + const profileId = data?.Profile?.id + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/profile/edit/[id]/page.tsx b/src/app/dev/profile/edit/[id]/page.tsx new file mode 100644 index 00000000..dca06bfe --- /dev/null +++ b/src/app/dev/profile/edit/[id]/page.tsx @@ -0,0 +1,14 @@ +import { funGetUserProfile } from "@/app_modules/fun/get_user_profile"; +import { getProfile } from "@/app_modules/katalog/profile"; +import EditProfile from "@/app_modules/katalog/profile/edit/view"; + +export default async function Page({ params }: { params: { id: string } }) { + const data = await funGetUserProfile(params.id); + + return ( + <> + {/* {JSON.stringify(data)} */} + + + ); +} diff --git a/src/app/dev/profile/edit/layout.tsx b/src/app/dev/profile/edit/layout.tsx deleted file mode 100644 index 9b8d49f1..00000000 --- a/src/app/dev/profile/edit/layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EditProfileLayout } from "@/app_modules/katalog/profile"; - -export default function Layout({ children }: { children: any }) { - return ( - <> - {children} - - ); -} diff --git a/src/app/dev/profile/edit/page.tsx b/src/app/dev/profile/edit/page.tsx deleted file mode 100644 index a1684084..00000000 --- a/src/app/dev/profile/edit/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { getProfile } from "@/app_modules/katalog/profile"; -import EditProfile from "@/app_modules/katalog/profile/edit/view"; - -export default async function Page() { - const data = await getProfile(); - - return ( - <> - {/* {JSON.stringify(data)} */} - - - ); -} diff --git a/src/app/dev/profile/upload/[id]/layout.tsx b/src/app/dev/profile/upload/[id]/layout.tsx new file mode 100644 index 00000000..a204721f --- /dev/null +++ b/src/app/dev/profile/upload/[id]/layout.tsx @@ -0,0 +1,13 @@ +import { UploadFotoProfileLayout } from "@/app_modules/katalog/profile"; +import { AppShell } from "@mantine/core"; + +export default function Layout({ children, params }: { children: any, params: {id: string} }) { + + return ( + <> + + {children} + + + ); +} diff --git a/src/app/dev/profile/upload/page.tsx b/src/app/dev/profile/upload/[id]/page.tsx similarity index 79% rename from src/app/dev/profile/upload/page.tsx rename to src/app/dev/profile/upload/[id]/page.tsx index fd388ea7..9c98a056 100644 --- a/src/app/dev/profile/upload/page.tsx +++ b/src/app/dev/profile/upload/[id]/page.tsx @@ -6,23 +6,20 @@ import fs from "fs"; import { funGetUserProfile } from "@/app_modules/fun/get_user_profile"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); - export default async function Page() { - const c = cookies().get("ssn") + const c = cookies().get("ssn"); const usr = JSON.parse( await unsealData(c?.value as string, { password: config.server.password, }) ); - console.log(usr) - - const imageUrl = await funGetUserProfile(usr.id).then((res) => res?.Profile?.ImageProfile?.url) - + const imageUrl = await funGetUserProfile(usr.id).then( + (res) => res?.Profile?.ImageProfile?.url + ); return ( <> - ); diff --git a/src/app/dev/profile/upload/layout.tsx b/src/app/dev/profile/upload/layout.tsx deleted file mode 100644 index 371d9700..00000000 --- a/src/app/dev/profile/upload/layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { UploadFotoProfileLayout } from "@/app_modules/katalog/profile"; -import { AppShell } from "@mantine/core"; - -export default function Layout({ children }: { children: any }) { - return ( - <> - {children} - - ); -} diff --git a/src/app/emotion.tsx b/src/app/emotion.tsx index 07deb7bf..940464e2 100644 --- a/src/app/emotion.tsx +++ b/src/app/emotion.tsx @@ -1,31 +1,40 @@ -'use client'; +"use client"; +import AppNotif from "@/app_modules/notif"; // import './globals.css' -import { CacheProvider } from '@emotion/react'; -import { MantineProvider, useEmotionCache } from '@mantine/core'; -import { useServerInsertedHTML } from 'next/navigation'; +import { CacheProvider } from "@emotion/react"; +import { MantineProvider, useEmotionCache } from "@mantine/core"; +import { useServerInsertedHTML } from "next/navigation"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; -export default function RootStyleRegistry({ children }: { children: React.ReactNode }) { - const cache = useEmotionCache(); - cache.compat = true; +export default function RootStyleRegistry({ + children, +}: { + children: React.ReactNode; +}) { + const cache = useEmotionCache(); + cache.compat = true; - useServerInsertedHTML(() => ( -