feat
Desc: - Fitur config untuk error pada server di bagian .env PWD - Fitur home dan tampilan menu
This commit is contained in:
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
9
src/app/dev/home/layout.tsx
Normal file
9
src/app/dev/home/layout.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { HomeLayout } from "@/app_modules/home";
|
||||||
|
|
||||||
|
export default async function Layout({children}: {children: any}) {
|
||||||
|
return <>
|
||||||
|
<HomeLayout>{children}</HomeLayout>
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
|
}
|
||||||
@@ -64,7 +64,6 @@ export default function Login() {
|
|||||||
align={"center"}
|
align={"center"}
|
||||||
gap={"lg"}
|
gap={"lg"}
|
||||||
>
|
>
|
||||||
<>
|
|
||||||
<IconCircleLetterH size={150} />
|
<IconCircleLetterH size={150} />
|
||||||
<Title>Login</Title>
|
<Title>Login</Title>
|
||||||
|
|
||||||
@@ -80,7 +79,10 @@ export default function Login() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
mt={"xs"}
|
||||||
h={30}
|
h={30}
|
||||||
|
w={250}
|
||||||
|
|
||||||
radius={50}
|
radius={50}
|
||||||
compact
|
compact
|
||||||
bg={Warna.hijau_muda}
|
bg={Warna.hijau_muda}
|
||||||
@@ -91,7 +93,6 @@ export default function Login() {
|
|||||||
>
|
>
|
||||||
Login
|
Login
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export default function Register() {
|
|||||||
<Flex direction={"column"} gap={"xl"} align={"center"}>
|
<Flex direction={"column"} gap={"xl"} align={"center"}>
|
||||||
<Flex direction={"column"}>
|
<Flex direction={"column"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
w={250}
|
||||||
label="Username"
|
label="Username"
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
@@ -70,6 +71,8 @@ export default function Register() {
|
|||||||
<Text>Nomor : {nomor}</Text>
|
<Text>Nomor : {nomor}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Button
|
<Button
|
||||||
|
w={250}
|
||||||
|
mt={"md"}
|
||||||
radius={50}
|
radius={50}
|
||||||
bg={Warna.biru}
|
bg={Warna.biru}
|
||||||
color="cyan"
|
color="cyan"
|
||||||
|
|||||||
@@ -81,11 +81,15 @@ export default function Validasi() {
|
|||||||
<Text>to {nomor}</Text>
|
<Text>to {nomor}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<PinInput
|
<PinInput
|
||||||
|
spacing={"md"}
|
||||||
|
mt={"md"}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setInputOtp(val);
|
setInputOtp(val);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
w={100}
|
||||||
|
mt={"md"}
|
||||||
compact
|
compact
|
||||||
radius={50}
|
radius={50}
|
||||||
bg={Warna.hijau_tua}
|
bg={Warna.hijau_tua}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import fs from "fs";
|
|||||||
import yaml from "yaml";
|
import yaml from "yaml";
|
||||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns token(id and username)
|
||||||
|
*/
|
||||||
export async function getToken() {
|
export async function getToken() {
|
||||||
const c = cookies().get("ssn");
|
const c = cookies().get("ssn");
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import HomeView from "./view";
|
import HomeView from "./view";
|
||||||
|
import HomeLayout from "./layout";
|
||||||
export {HomeView}
|
export {HomeView, HomeLayout}
|
||||||
35
src/app_modules/home/layout.tsx
Normal file
35
src/app_modules/home/layout.tsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
"use client";
|
||||||
|
import { ActionIcon, AppShell, Flex, Group, Header, Text } from "@mantine/core";
|
||||||
|
import { HomeView } from ".";
|
||||||
|
import { IconUserSearch, IconAward, IconQrcode } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
export default function HomeLayout({ children }: { children: any }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={
|
||||||
|
<Header height={50} bg={"dark"}>
|
||||||
|
<Group position="apart" align="center" h={50} p={"sm"}>
|
||||||
|
<ActionIcon>
|
||||||
|
<IconUserSearch />
|
||||||
|
</ActionIcon>
|
||||||
|
<Text color="white" fw={"bold"}>
|
||||||
|
HIPMI
|
||||||
|
</Text>
|
||||||
|
<Flex justify={"flex-end"}>
|
||||||
|
<ActionIcon>
|
||||||
|
<IconAward />
|
||||||
|
</ActionIcon>
|
||||||
|
<ActionIcon>
|
||||||
|
<IconQrcode />
|
||||||
|
</ActionIcon>
|
||||||
|
</Flex>
|
||||||
|
</Group>
|
||||||
|
</Header>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,25 +1,72 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Text, Title } from "@mantine/core";
|
import { ActionIcon, Box, Flex, Image, Paper, SimpleGrid, Text, Title } from "@mantine/core";
|
||||||
import { Logout } from "../auth";
|
import { Logout } from "../auth";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ApiHipmi } from "@/app/lib/api";
|
import { ApiHipmi } from "@/app/lib/api";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { getToken } from "./fun/get-token";
|
import { getToken } from "./fun/get-token";
|
||||||
|
|
||||||
|
import {
|
||||||
|
IconAffiliate,
|
||||||
|
IconBriefcase,
|
||||||
|
IconHeartHandshake,
|
||||||
|
IconMap2,
|
||||||
|
IconMessages,
|
||||||
|
IconPackageImport,
|
||||||
|
IconPresentation,
|
||||||
|
IconShoppingBag,
|
||||||
|
IconUserCircle,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
import router from "next/router";
|
||||||
|
import toast from "react-simple-toasts";
|
||||||
|
|
||||||
|
const listHalaman = [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "Forums",
|
||||||
|
icon: <IconMessages size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "Project Collaboration",
|
||||||
|
icon: <IconAffiliate size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "Voting",
|
||||||
|
icon: <IconPackageImport size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "Event",
|
||||||
|
icon: <IconPresentation size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: "Crowd Funding",
|
||||||
|
icon: <IconHeartHandshake size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
name: "Marketplace",
|
||||||
|
icon: <IconShoppingBag size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: "Job Vacancy",
|
||||||
|
icon: <IconBriefcase size={50} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: "Business Maps",
|
||||||
|
icon: <IconMap2 size={50} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export default function HomeView() {
|
export default function HomeView() {
|
||||||
const [token, setToken] = useState<any | null>(null);
|
const [token, setToken] = useState<any | null>(null);
|
||||||
|
|
||||||
// useShallowEffect(() => {
|
|
||||||
// userToken();
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
// async function userToken() {
|
|
||||||
// await fetch(ApiHipmi.get_token)
|
|
||||||
// .then((res) => res.json())
|
|
||||||
// .then((val) => setToken(val));
|
|
||||||
// }
|
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
getUserId();
|
getUserId();
|
||||||
}, []);
|
}, []);
|
||||||
@@ -31,9 +78,51 @@ export default function HomeView() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(token, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(token, null, 2)}</pre> */}
|
||||||
<Title>Home</Title>
|
|
||||||
<Text>Welcome, {token?.username}</Text>
|
<Box>
|
||||||
<Logout />
|
<Flex align={"center"} gap={"sm"}>
|
||||||
|
<ActionIcon
|
||||||
|
size={30}
|
||||||
|
variant="transparent"
|
||||||
|
// onClick={() => {
|
||||||
|
// if (valToken?.data?.Profile === null) {
|
||||||
|
// return router.push("/dev/katalog/profile/create");
|
||||||
|
// } else {
|
||||||
|
// return router.push("/dev/katalog/view");
|
||||||
|
// }
|
||||||
|
// }}
|
||||||
|
>
|
||||||
|
<IconUserCircle size={50} color="black" />
|
||||||
|
</ActionIcon>
|
||||||
|
|
||||||
|
<Text>Welcome to, {token?.username}</Text>
|
||||||
|
</Flex>
|
||||||
|
<Paper bg={"dark"} radius={5} my={"xs"}>
|
||||||
|
<Image alt="logo" src={"/aset/logo.png"} />
|
||||||
|
</Paper>
|
||||||
|
<Box my={"sm"}>
|
||||||
|
<SimpleGrid cols={2}>
|
||||||
|
{listHalaman.map((e, i) => (
|
||||||
|
<Paper
|
||||||
|
key={e.id}
|
||||||
|
h={100}
|
||||||
|
withBorder
|
||||||
|
onClick={() => toast(e.name)}
|
||||||
|
>
|
||||||
|
<Flex
|
||||||
|
justify={"center"}
|
||||||
|
align={"center"}
|
||||||
|
direction={"column"}
|
||||||
|
h={100}
|
||||||
|
>
|
||||||
|
{e.icon}
|
||||||
|
{e.name}
|
||||||
|
</Flex>
|
||||||
|
</Paper>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user