Fix: Avatar

Deskripsi:
- Avatar job
- Avatar collaboration
- Avatar event
## No Issuue
This commit is contained in:
2024-10-01 16:31:12 +08:00
parent ca5c30499a
commit 284787243b
110 changed files with 1122 additions and 2064 deletions

View File

@@ -0,0 +1,13 @@
import { Job_UiNotUserView } from "@/app_modules/job/_ui";
import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
const jobId = params.id;
const dataJob = await job_getOneById(jobId);
return (
<>
<Job_UiNotUserView data={dataJob} />
</>
);
}

View File

@@ -0,0 +1,10 @@
import { UIGlobal_ImagePreview, UIGlobal_NotUserImagePreview } from "@/app_modules/_global/ui";
export default async function Page({ params }: { params: { id: string } }) {
const fileId = params.id;
return (
<>
<UIGlobal_NotUserImagePreview fileId={fileId} />
</>
);
}

View File

@@ -0,0 +1,7 @@
import { headers } from "next/headers";
export async function GET(
req: Request) {
const origin = new URL(req.url).origin;
return new Response(JSON.stringify({ success: true, origin }));
}

View File

@@ -1,110 +0,0 @@
"use client";
import {
ComponentGlobal_AvatarAndUsername,
ComponentGlobal_LoaderAvatar,
} from "@/app_modules/_global/component";
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
import {
UIGlobal_LayoutHeaderTamplate,
UIGlobal_LayoutTamplate,
} from "@/app_modules/_global/ui";
import {
ActionIcon,
Avatar,
Box,
Center,
Group,
Image,
Paper,
Text,
} from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { IconDots } from "@tabler/icons-react";
import { useState } from "react";
export default function Page() {
return (
<>
<UIGlobal_LayoutTamplate
header={<UIGlobal_LayoutHeaderTamplate title="Contoh" />}
>
<Paper p={"sm"}>
<ComponentGlobal_AvatarAndUsername
profile={{ id: "1" as any, name: "wibu" as any }}
component={
<Group position="right">
<Text lineClamp={1}>{Intl.DateTimeFormat("id-ID", {dateStyle: "full"}).format(new Date())}</Text>
</Group>
}
/>
</Paper>
</UIGlobal_LayoutTamplate>
</>
);
return (
<>
<Box p={"lg"} bg={"gray"} h={"100vh"}>
<Center h={"100%"}>
<ActionIcon bg={"blue"}>
<Avatar
size={100}
radius={"100%"}
src={
// "https://wibu-storage.wibudev.com/api/files/cm1efheqx005vkp7jo7lqarnf"
"/aset/global/avatar.png"
}
/>
</ActionIcon>
</Center>
</Box>
</>
);
return (
<>
<LoadImage
url={
"https://wibu-storage.wibudev.com/api/files/cm192febp004jkp7j2x1fgekw"
}
/>
</>
);
}
function LoadImage({ url }: { url: string }) {
const [ada, setAda] = useState<boolean | null>(null);
useShallowEffect(() => {
load();
}, []);
async function load() {
try {
const res = await fetch(url);
if (res.ok) {
return setAda(true);
}
setAda(false);
} catch (error) {
console.log("");
}
}
if (ada === null)
return (
<Box w={100}>
<Image w={"100%"} src={"/aset/global/loading.gif"} alt="" />
</Box>
);
if (!ada)
return (
<Image
src={
"https://cdn.idntimes.com/content-images/community/2021/06/2318629899-0991efc170-o-cropped-56965fbaa68adf470a17cc45ea5d328d-321a5127ded916230393dbb7bf7d130e_600x400.jpg"
}
alt=""
/>
);
return <Image src={url} alt="" />;
}

View File

@@ -1,9 +1,12 @@
import { Login } from "@/app_modules/auth";
import versionUpdate from "../../../../../package.json";
export default async function Page() {
const version = versionUpdate.version;
return (
<>
<Login />
<Login version={version} />
</>
);
}

View File

@@ -1,13 +0,0 @@
import { Colab_DetailNotifikasi } from "@/app_modules/colab";
import colab_getOneNotifikasiById from "@/app_modules/colab/fun/get/get_one_notifikasi_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let notifId = params.id;
const data = await colab_getOneNotifikasiById({ notifId: notifId });
return (
<>
<Colab_DetailNotifikasi data={data as any} />
</>
);
}

View File

@@ -1,15 +0,0 @@
import { LayoutColab_DetailStatusPublish } from "@/app_modules/colab";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutColab_DetailStatusPublish>{children}</LayoutColab_DetailStatusPublish>
</>
);
}

View File

@@ -1,9 +0,0 @@
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
export default async function Page() {
return (
<>
<ComponentGlobal_V2_LoadingPage />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Colab_DetailStatusPublish } from "@/app_modules/colab";
export default async function Page() {
return (
<>
<Colab_DetailStatusPublish />
</>
);
}

View File

@@ -1,16 +0,0 @@
import { LayoutColab_DetailStatusReject } from "@/app_modules/colab";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutColab_DetailStatusReject>
{children}
</LayoutColab_DetailStatusReject>
</>
);
}

View File

@@ -1,9 +0,0 @@
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
export default async function Page() {
return (
<>
<ComponentGlobal_V2_LoadingPage />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Colab_DetailStatusReject } from "@/app_modules/colab";
export default async function Page() {
return (
<>
<Colab_DetailStatusReject />
</>
);
}

View File

@@ -1,16 +0,0 @@
import { LayoutColab_DetailStatusReview } from "@/app_modules/colab";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutColab_DetailStatusReview>
{children}
</LayoutColab_DetailStatusReview>
</>
);
}

View File

@@ -1,9 +0,0 @@
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
export default async function Page() {
return (
<>
<ComponentGlobal_V2_LoadingPage />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Colab_DetailStatusReview } from "@/app_modules/colab";
export default async function Page() {
return (
<>
<Colab_DetailStatusReview />
</>
);
}

View File

@@ -1,13 +0,0 @@
import { Colab_NotifikasiView } from "@/app_modules/colab";
import colab_getListNotifikasiByUserId from "@/app_modules/colab/fun/get/get_list_notifikasi_by_user_id";
export default async function Page() {
const listNotifikasi = await colab_getListNotifikasiByUserId();
// console.log(listNotifikasi);
return (
<>
<Colab_NotifikasiView listNotifikasi={listNotifikasi as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
export default async function Page() {
return (
<>
<ComponentGlobal_V2_LoadingPage />
</>
);
}

View File

@@ -1,19 +0,0 @@
import { Colab_Status } from "@/app_modules/colab";
import colab_getListByStatusId from "@/app_modules/colab/fun/get/get_list_by_status_id";
export default async function Page() {
const listPublish = (await colab_getListByStatusId(1)).data;
const listReview = (await colab_getListByStatusId(2)).data;
const listReject = (await colab_getListByStatusId(3)).data;
return (
<>
<Colab_Status
listPublish={listPublish as any}
listReview={listReview as any}
listReject={listReject as any}
/>
</>
);
}

View File

@@ -1,7 +1,5 @@
"use server";
import { Job_MainDetail } from "@/app_modules/job";
import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
import app_config from "@/util/app_config";
export default async function Page({ params }: { params: { id: string } }) {
const idJob = params.id;
@@ -9,7 +7,7 @@ export default async function Page({ params }: { params: { id: string } }) {
return (
<>
<Job_MainDetail dataJob={dataJob as any} hostName={app_config.host} />
<Job_MainDetail dataJob={dataJob as any} />
</>
);
}

View File

@@ -4,11 +4,7 @@ import { job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let jobId = params.id;
const dataJob = await job_getOneById(jobId);
// const platform = os.platform();
// const hostName =
// platform === "darwin"
// ? "http://localhost:3000"
// : "https://test-hipmi.wibudev.com";
return (
<>
<Job_NonUserView data={dataJob as any} />

View File

@@ -1,5 +1,6 @@
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { LayoutVote_DetailKontribusi } from "@/app_modules/vote";
import { voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get/fun_get_one_by_id";
import React from "react";
export default async function Layout({
@@ -11,12 +12,14 @@ export default async function Layout({
}) {
const votingId = params.id;
const userLoginId = await funGetUserIdByToken();
const dataVoting = await voting_funGetOneVotingbyId(votingId);
return (
<>
<LayoutVote_DetailKontribusi
votingId={votingId}
userLoginId={userLoginId}
dataVoting={dataVoting}
>
{children}
</LayoutVote_DetailKontribusi>

View File

@@ -1,5 +1,6 @@
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { LayoutVote_MainDetail } from "@/app_modules/vote";
import { voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get/fun_get_one_by_id";
import React from "react";
export default async function Layout({
@@ -11,10 +12,15 @@ export default async function Layout({
}) {
const votingId = params.id;
const userLoginId = await funGetUserIdByToken();
const dataVoting = await voting_funGetOneVotingbyId(votingId);
return (
<>
<LayoutVote_MainDetail votingId={votingId} userLoginId={userLoginId}>
<LayoutVote_MainDetail
votingId={votingId}
userLoginId={userLoginId}
dataVoting={dataVoting}
>
{children}
</LayoutVote_MainDetail>
</>

View File

@@ -1,6 +1,6 @@
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { LayoutVote_DetailPublish } from "@/app_modules/vote";
import { Voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get";
import { voting_funGetOneVotingbyId } from "@/app_modules/vote/fun/get/fun_get_one_by_id";
import React from "react";
export default async function Layout({
@@ -13,11 +13,15 @@ export default async function Layout({
const votingId = params.id;
const userLoginId = await funGetUserIdByToken();
const dataVoting = await Voting_funGetOneVotingbyId(votingId);
const dataVoting = await voting_funGetOneVotingbyId(votingId);
return (
<>
<LayoutVote_DetailPublish votingId={votingId} userLoginId={userLoginId}>
<LayoutVote_DetailPublish
votingId={votingId}
userLoginId={userLoginId}
dataVoting={dataVoting}
>
{children}
</LayoutVote_DetailPublish>
</>

View File

@@ -2,11 +2,11 @@ import { Vote_Beranda } from "@/app_modules/vote";
import { vote_getAllListPublish } from "@/app_modules/vote/fun/get/get_all_list_publish";
export default async function Page() {
const dataVote = await vote_getAllListPublish({page: 1})
const dataVote = await vote_getAllListPublish({ page: 1 });
return (
<>
<Vote_Beranda dataVote={dataVote as any} />
</>
);
}
return (
<>
<Vote_Beranda dataVote={dataVote as any} />
</>
);
}

View File

@@ -1,13 +1,9 @@
"use client";
import { MainColor } from "@/app_modules/_global/color/color_pallet";
// import './globals.css'
import { CacheProvider } from "@emotion/react";
import {
Box,
Container,
MantineProvider,
rem,
useEmotionCache,
useEmotionCache
} from "@mantine/core";
import { Notifications } from "@mantine/notifications";
import { Provider } from "jotai";

View File

@@ -3,7 +3,9 @@ import DIRECTORY_ID from "./id-derectory";
import prisma from "./prisma";
import { pathAssetImage } from "./path_asset_image";
export { DIRECTORY_ID };
export { prisma };
export { APIs };
export { pathAssetImage as RouterAssetImage };

View File

@@ -1,3 +1,4 @@
export const routerImagePreview = {
"main": ({ id }: { id: string }) => `/dev/image-preview/${id}`,
main: ({ id }: { id: string }) => `/dev/image-preview/${id}`,
not_user_image: ({ id }: { id: string }) => `/preview-image/${id}`,
};

View File

@@ -24,4 +24,5 @@ export const RouterJob = {
// non user
non_user_view: "/dev/job/non_user_view/",
"job_vacancy_non_user": ({ id }: { id: string }) => `/job-vacancy/${id}`,
};

View File

@@ -1,4 +0,0 @@
'use server'
export default async function makuro_test() {
console.log("ini diserver")
}

View File

@@ -1,54 +0,0 @@
"use client";
import { Box, Button, Stack, TextInput } from "@mantine/core";
import makuro_test from "./makuro_test";
import { useState } from "react";
import _, { forIn } from "lodash";
export default function ViewMakuro() {
const [listnya, setListnya] = useState<any[]>([
{
name: "Voting",
value: "",
},
{ name: "Voting", value: "" },
]);
return (
<>
<Stack p={24}>
{listnya.map((e, k) => (
<Box key={k}>
<TextInput
onChange={(v) => {
const val = _.clone(listnya);
val[k].value = v.currentTarget.value;
setListnya([...val]);
}}
label={e.name}
/>
</Box>
))}
<Button
onClick={() => {
// const cek = listnya[listnya.length - 1]
// console.log(cek.id + 1);
if (listnya.length > 4) return console.log("ga bisa lebih");
setListnya([...listnya, { name: "Voting", value: "" }]);
}}
>
{" "}
Tambah
</Button>
<Button
onClick={() => {
console.log(JSON.stringify(listnya, null, 4));
}}
>
Hasilnya
</Button>
</Stack>
</>
);
}

View File

@@ -1,37 +0,0 @@
"use client";
import { Button, Group, Stack } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useWibuRealtime } from "wibu-realtime";
export function RealtimePage({ token }: { token: string }) {
const [data, setData] = useWibuRealtime({
project: "hipmi",
WIBU_REALTIME_TOKEN: token,
});
useShallowEffect(() => {
if (data) {
console.log(data);
}
}, [data]);
function onKirim() {
setData({
id: "123",
data: {
"topic":"test",
}
});
}
return (
<Stack p={"lg"}>
<Group>
<Stack>
{JSON.stringify(data)}
<Button onClick={onKirim}> Tekan Aja</Button>
</Stack>
</Group>
</Stack>
);
}

View File

@@ -1,9 +0,0 @@
import { v4 as uuidv4 } from "uuid";
export const createItems = (length = 100): string[] =>
Array.from({ length }).map(() => uuidv4());
export const loadMore = async (length = 100): Promise<string[]> => {
console.log("Loading more items...");
return new Promise((res) => setTimeout(() => res(createItems(length)), 100));
};

View File

@@ -1,3 +0,0 @@
import { atomWithStorage } from "jotai/utils";
export const gs_coba_chat = atomWithStorage<any[]>("gs_coba_chat", []);

View File

@@ -1,14 +0,0 @@
import { ServerEnv } from "../lib/server_env";
import { RealtimePage } from "./_ui/RealtimePage";
const env = process.env;
const WIBU_REALTIME_KEY = process.env.WIBU_REALTIME_KEY;
export default function App() {
return (
<div>
{/* <pre>{JSON.stringify(env, null, 2)}</pre>
<pre>{JSON.stringify(ServerEnv.value, null, 2)}</pre> */}
<RealtimePage token={WIBU_REALTIME_KEY as string} />
</div>
);
}

View File

@@ -1,5 +1,3 @@
import { SplashScreen } from "@/app_modules/auth";
import { redirect } from "next/navigation";
import PageSplash from "./dev/auth/splash/page";
export default async function Page() {

View File

@@ -0,0 +1,13 @@
"use client";
import { useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
export default function Page() {
const [origin, setOrigin] = useState("");
useShallowEffect(() => {
if (typeof window !== "undefined") {
setOrigin(window.location.origin);
}
}, []);
return <div>{origin}</div>;
}