# Voting prototype
- feat - Tampilan beranda - Tampilan status - Tampilan kontribusi - Tampilan riwayat ## No Issue
This commit is contained in:
57
src/app_modules/vote/main/beranda.tsx
Normal file
57
src/app_modules/vote/main/beranda.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
ActionIcon,
|
||||
Affix,
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { IconCirclePlus } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../component/card_view_publish";
|
||||
|
||||
export default function Vote_Beranda() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ bottom: rem(100), right: rem(30) }}>
|
||||
<ActionIcon
|
||||
size={"xl"}
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
bg={"blue"}
|
||||
onClick={() => {
|
||||
router.push(RouterVote.create);
|
||||
}}
|
||||
>
|
||||
<IconCirclePlus color="white" size={40} />
|
||||
</ActionIcon>
|
||||
</Affix>
|
||||
|
||||
<Stack>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish path={RouterVote.main_detail}/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
40
src/app_modules/vote/main/kontribusi.tsx
Normal file
40
src/app_modules/vote/main/kontribusi.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../component/card_view_publish";
|
||||
|
||||
export default function Vote_Kontribusi() {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_kontribusi}
|
||||
pilihanSaya={true}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
107
src/app_modules/vote/main/layout.tsx
Normal file
107
src/app_modules/vote/main/layout.tsx
Normal file
@@ -0,0 +1,107 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
ActionIcon,
|
||||
AppShell,
|
||||
Center,
|
||||
Footer,
|
||||
Grid,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import React, { useState } from "react";
|
||||
import ComponentVote_HeaderTamplate from "../component/header_tamplate";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
IconClick,
|
||||
IconHistory,
|
||||
IconHome,
|
||||
IconReservedLine,
|
||||
} from "@tabler/icons-react";
|
||||
import { gs_vote_hotMenu } from "../global_state";
|
||||
import { useAtom } from "jotai";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
|
||||
export default function LayoutVote_Main({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
|
||||
|
||||
const listFooter = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Beranda",
|
||||
path: RouterVote.beranda,
|
||||
icon: <IconHome />,
|
||||
},
|
||||
|
||||
{
|
||||
id: 2,
|
||||
name: "Status",
|
||||
path: RouterVote.status,
|
||||
icon: <IconReservedLine />,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Kontribusi",
|
||||
path: RouterVote.kontribusi,
|
||||
icon: <IconClick />,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Riwayat",
|
||||
path: RouterVote.riwayat,
|
||||
icon: <IconHistory />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppShell
|
||||
header={
|
||||
<ComponentVote_HeaderTamplate
|
||||
title="Voting"
|
||||
route={RouterHome.main_home}
|
||||
/>
|
||||
}
|
||||
footer={
|
||||
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
||||
<Grid>
|
||||
{listFooter.map((e, i) => (
|
||||
<Grid.Col
|
||||
key={e.id}
|
||||
span={"auto"}
|
||||
pt={"md"}
|
||||
onClick={() => {
|
||||
router.replace(e.path);
|
||||
setHotMenu(i);
|
||||
}}
|
||||
>
|
||||
<Center>
|
||||
<Stack align="center" spacing={0}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c={hotMenu === i ? "blue" : "white"}
|
||||
>
|
||||
{e.icon}
|
||||
</ActionIcon>
|
||||
<Text fz={10} c={hotMenu === i ? "blue" : "white"}>
|
||||
{e.name}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
</Footer>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</AppShell>
|
||||
</>
|
||||
);
|
||||
}
|
||||
59
src/app_modules/vote/main/riwayat/index.tsx
Normal file
59
src/app_modules/vote/main/riwayat/index.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import { Stack, Tabs } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import Vote_SemuaRiwayat from "./semua";
|
||||
import Vote_RiwayatSaya from "./saya";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_vote_riwayat } from "../../global_state";
|
||||
|
||||
export default function Vote_Riwayat() {
|
||||
const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_vote_riwayat)
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
path: <Vote_SemuaRiwayat />,
|
||||
value: "Semua",
|
||||
label: "Semua Riwayat",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Vote_RiwayatSaya />,
|
||||
value: "Saya",
|
||||
label: "Riwayat Saya",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
variant="pills"
|
||||
radius={"xl"}
|
||||
color="blue"
|
||||
defaultValue={"Semua"}
|
||||
value={tabsRiwayat}
|
||||
onTabChange={setTabsRiwayat}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{listTabs.map((e, i) => (
|
||||
<Tabs.Tab
|
||||
key={i}
|
||||
value={e.value}
|
||||
bg={tabsRiwayat === e.value ? "blue" : "gray.1"}
|
||||
fw={tabsRiwayat === e.value ? "bold" : "normal"}
|
||||
>
|
||||
{e.label}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Panel key={e.id} value={e.value}>
|
||||
{e.path}
|
||||
</Tabs.Panel>
|
||||
))}
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
}
|
||||
39
src/app_modules/vote/main/riwayat/saya.tsx
Normal file
39
src/app_modules/vote/main/riwayat/saya.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Stack,
|
||||
Card,
|
||||
Grid,
|
||||
Avatar,
|
||||
Divider,
|
||||
Title,
|
||||
Badge,
|
||||
Group,
|
||||
Radio,
|
||||
Center,
|
||||
Text,
|
||||
Box,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
|
||||
|
||||
export default function Vote_RiwayatSaya() {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_riwayat_saya}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
39
src/app_modules/vote/main/riwayat/semua.tsx
Normal file
39
src/app_modules/vote/main/riwayat/semua.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Stack,
|
||||
Card,
|
||||
Grid,
|
||||
Avatar,
|
||||
Divider,
|
||||
Title,
|
||||
Badge,
|
||||
Group,
|
||||
Radio,
|
||||
Center,
|
||||
Text,
|
||||
Box,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
|
||||
|
||||
export default function Vote_SemuaRiwayat() {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Box key={i}>
|
||||
<ComponentVote_CardViewPublish
|
||||
path={RouterVote.detail_semua_riwayat}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
12
src/app_modules/vote/main/status/draft.tsx
Normal file
12
src/app_modules/vote/main/status/draft.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client"
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
|
||||
export default function Vote_StatusDraft() {
|
||||
return (
|
||||
<>
|
||||
<ComponentVote_CardViewStatus path={RouterVote.detail_draft} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
70
src/app_modules/vote/main/status/index.tsx
Normal file
70
src/app_modules/vote/main/status/index.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
"use client";
|
||||
|
||||
import { Stack, Tabs } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { gs_vote_status } from "../../global_state";
|
||||
import Vote_StatusPublish from "./publish";
|
||||
import Vote_StatusReview from "./review";
|
||||
import Vote_StatusDraft from "./draft";
|
||||
import Vote_StatusReject from "./reject";
|
||||
|
||||
export default function Vote_Status() {
|
||||
const router = useRouter();
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
path: <Vote_StatusPublish />,
|
||||
value: "Publish",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Vote_StatusReview />,
|
||||
value: "Review",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
path: <Vote_StatusDraft />,
|
||||
value: "Draft",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
path: <Vote_StatusReject />,
|
||||
value: "Reject",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
color="blue"
|
||||
variant="pills"
|
||||
radius={"xl"}
|
||||
defaultValue={"Publish"}
|
||||
value={tabsStatus}
|
||||
onTabChange={setTabsStatus}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Tab
|
||||
key={e.id}
|
||||
value={e.value}
|
||||
bg={tabsStatus === e.value ? "blue" : "gray.1"}
|
||||
fw={tabsStatus === e.value ? "bold" : "normal"}
|
||||
>
|
||||
{e.value}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
{listTabs.map((e) => (
|
||||
<Tabs.Panel key={e.id} value={e.value}>
|
||||
{e.path}
|
||||
</Tabs.Panel>
|
||||
))}
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
}
|
||||
80
src/app_modules/vote/main/status/publish.tsx
Normal file
80
src/app_modules/vote/main/status/publish.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Skeleton,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Vote_StatusPublish() {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
shadow="lg"
|
||||
withBorder
|
||||
p={30}
|
||||
radius={"md"}
|
||||
onClick={() => {
|
||||
router.push(RouterVote.detail_publish);
|
||||
}}
|
||||
>
|
||||
{/* Isi deskripsi */}
|
||||
<Card.Section>
|
||||
<Stack>
|
||||
<Text fw={"bold"}>Voting Pemilihan Tempat Makan</Text>
|
||||
<Badge>
|
||||
<Group>
|
||||
<Text>
|
||||
{new Date().toLocaleDateString(["id-ID"], {
|
||||
dateStyle: "medium",
|
||||
})}
|
||||
</Text>
|
||||
<Text>-</Text>
|
||||
<Text>
|
||||
{new Date(
|
||||
moment(Date.now()).add(10, "days").calendar()
|
||||
).toLocaleDateString(["id-ID"], {
|
||||
dateStyle: "medium",
|
||||
})}
|
||||
</Text>
|
||||
</Group>
|
||||
</Badge>
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<Text fz={10}>Voting A</Text>
|
||||
<Avatar radius={100} variant="outline" color="blue">
|
||||
2
|
||||
</Avatar>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<Text fz={10}>Voting B</Text>
|
||||
<Avatar radius={100} variant="outline" color="red">
|
||||
3
|
||||
</Avatar>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
12
src/app_modules/vote/main/status/reject.tsx
Normal file
12
src/app_modules/vote/main/status/reject.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
|
||||
export default function Vote_StatusReject() {
|
||||
return (
|
||||
<>
|
||||
<ComponentVote_CardViewStatus path={RouterVote.detail_reject} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
12
src/app_modules/vote/main/status/review.tsx
Normal file
12
src/app_modules/vote/main/status/review.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import ComponentVote_CardViewStatus from "../../component/card_view_status";
|
||||
|
||||
export default function Vote_StatusReview() {
|
||||
return (
|
||||
<>
|
||||
<ComponentVote_CardViewStatus path={RouterVote.detail_review}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user