Skip to content

Commit

Permalink
Merge pull request #114 from mokletdev/master
Browse files Browse the repository at this point in the history
rebase
  • Loading branch information
teguhbayu authored Sep 9, 2024
2 parents 8e97724 + 1fd5a9d commit 3fc425b
Show file tree
Hide file tree
Showing 26 changed files with 171 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
echo 'GOOGLE_REDIRECT_URI=${{secrets.GOOGLE_REDIRECT_URI}}' >> /home/mokletdev/actions-runner/_work/antareja/antareja/.env.local
- name: Install Modules
run: npm ci
- name: Generate prisma
run: npm run prisma:generate
- name: Push prisma schema
run: npm run prisma:deploy
- name: Build site
run: npm run build --if-present
- name: change dir
Expand Down
8 changes: 7 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
experimental:{
serverActions:{
bodySizeLimit:'5mb'
}
}
};

export default nextConfig;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"prettier": "prettier --write .",
"prisma": "dotenv -e .env.local prisma migrate dev",
"prisma:generate": "dotenv -e .env.local prisma generate",
"prisma:deploy": "dotenv -e .env.local prisma migrate deploy",
"prisma:push": "dotenv -e .env.local prisma db push",
"prisma:studio": "dotenv -e .env.local prisma studio"
},
Expand Down
1 change: 1 addition & 0 deletions public/image/juri5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function updateUserForm(data: FormData, id: string) {
const email = data.get("email") as string;
const password = (data.get("password") as string) || undefined;
const role = data.get("role") as Role;
const verified = data.get("verified") === "true";

try {
if (password) {
Expand All @@ -55,6 +56,7 @@ export async function updateUserForm(data: FormData, id: string) {
nama: name,
email: email,
role: role,
verified : verified,
}
);
revalidatePath("/", "layout");
Expand Down
6 changes: 4 additions & 2 deletions src/actions/pembayaran.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
"use server";

import { updatePembayaran } from "@/queries/pembayaran.query";
import { updateTim } from "@/queries/tim.query";
import { revalidatePath } from "next/cache";

export default async function konfirmasiPembayaran(
data: FormData,
idTim: string
) {
const status = Boolean(data.get("confirm") as string);
const status = data.get("confirm") === "true";
const statusPembayaran = data.get("isDP") === "true";

console.log(status);
try {
await updateTim({ id: idTim }, { confirmed: status });
await updatePembayaran({ tim_id: idTim }, { isDP: statusPembayaran });
revalidatePath("/", "layout");
return { success: true, message: "Berhasil mengupdate status pembayaran!" };
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/registrationForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function submitFormRegistrasi(
const tipe_pembayaran = data.get("tipe-pembayaran") as string;
const no_pelatih = data.get("no-pelatih") as string;

const timCount = (await findTims({ jenjang: jenjang })).length;
const timCount = (await findTims({ jenjang: jenjang, confirmed: true })).length;

if (timCount >= 30)
return { success: false, message: `Kuota jenjang ${jenjang} telah penuh!` };
Expand Down
35 changes: 35 additions & 0 deletions src/app/(admin)/admin/pembayaran/[id]/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export default function PembayaranForm({
{ label: "Belum Terkonfirmasi", value: false },
];

const optionsPembayaran = [
{ label: "Lunas", value: "false" },
{ label: "DP 50%", value: "true" },
];

async function Update(dataForm: FormData) {
const toastId = toast.loading("Loading...");
const result = await konfirmasiPembayaran(dataForm, data?.id!);
Expand Down Expand Up @@ -94,6 +99,36 @@ export default function PembayaranForm({
}}
/>
</div>

<div className="flex flex-col gap-2">
<label htmlFor={"isDP"} className="text-[16px]">
Status Pembayaran
</label>
<Select
name="isDP"
unstyled
defaultValue={{
label: data?.pembayaran?.isDP ? "DP 50%" : "Lunas",
value: data?.pembayaran?.isDP ? "true" : "false",
}}
options={optionsPembayaran}
id="isDP"
placeholder="Lunas/DP"
classNames={{
control: () =>
"rounded-[14px] border focus:bg-[#F1F6F9] border-neutral-400 px-[18px] active:border-black hover:border-black py-[14px] text-black placeholder-neutral-500 bg-white focus:outline-none transition-all duration-500 placeholder:text-[#C8C8C8]",
menu: () =>
"bg-white rounded-lg px-[18px] py-[14px] border border-neutral-400",
multiValue: () =>
"bg-primary-400 px-4 py-2 text-white rounded-2xl",
valueContainer: () => "flex gap-2",
menuList: () => "text-base flex flex-col gap-1",
option: () =>
"hover:bg-neutral-300 hover:cursor-pointer transition-all duration-500 rounded-lg p-2",
input: () => "focus:bg-[#F1F6F9]",
}}
/>
</div>
</div>
<div className="w-full justify-end flex my-6">
<SubmitButton />
Expand Down
34 changes: 34 additions & 0 deletions src/app/(admin)/admin/user/[id]/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export default function UserForm({
{ label: "ADMIN", value: "ADMIN" },
];

const optionsVerified = [
{ label: "true", value: "true" },
{ label: "false", value: "false" },
];

async function Create(data: FormData) {
const toastId = toast.loading("Loading...");
const result = await createUserForm(data);
Expand Down Expand Up @@ -102,6 +107,35 @@ export default function UserForm({
}}
/>
</div>
<div className="flex flex-col gap-2">
<label htmlFor={"verified"} className="text-[16px]">
Verified
</label>
<Select
name="verified"
unstyled
defaultValue={{
label: data?.verified.toString(),
value: data?.verified.toString(),
}}
options={optionsVerified}
id="verified"
placeholder="Verified"
classNames={{
control: () =>
"rounded-[14px] border focus:bg-[#F1F6F9] border-neutral-400 px-[18px] active:border-black hover:border-black py-[14px] text-black placeholder-neutral-500 bg-white focus:outline-none transition-all duration-500 placeholder:text-[#C8C8C8]",
menu: () =>
"bg-white rounded-lg px-[18px] py-[14px] border border-neutral-400",
multiValue: () =>
"bg-primary-400 px-4 py-2 text-white rounded-2xl",
valueContainer: () => "flex gap-2",
menuList: () => "text-base flex flex-col gap-1",
option: () =>
"hover:bg-neutral-300 hover:cursor-pointer transition-all duration-500 rounded-lg p-2",
input: () => "focus:bg-[#F1F6F9]",
}}
/>
</div>
</div>
<div className="w-full flex justify-end mt-3">
<SubmitButton text="Create" />
Expand Down
8 changes: 6 additions & 2 deletions src/app/(main)/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ export default async function Hero() {
BARISAN <span className="italic">JAWARA</span>
</H1>
<SecondaryLinkButton
href={session ? "/dashboard" : "/auth/register"}
href={
session?.user?.role == "ADMIN"
? (session ? "/admin" : "/auth/register")
: (session ? "/dashboard" : "/auth/register")
}
target="_blank"
className="group inline-flex py-[12px] px-[20px] justify-center items-center"
>
Expand All @@ -99,7 +103,7 @@ export default async function Hero() {
Antareja 2024
</P>
<LargeP className="font-semibold">
Selamat datang di website official lomba keterampilan baris berbaris
Selamat datang di website official lomba peraturan keterampilan baris berbaris
dari paskibra SMK Telkom Malang
</LargeP>
</div>
Expand Down
14 changes: 12 additions & 2 deletions src/app/(main)/components/Juri.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const juris = [
name: "Sersan Mayor Suroto",
title: "Juri",
},
{
image: "/image/juri5.svg",
name: "Bogie Nasution",
title: "Juri",
},
];

interface JuriCardProps {
Expand Down Expand Up @@ -63,10 +68,10 @@ export default function Juri() {
<div className="w-full flex flex-col gap-[40px] text-end">
<div className="mb-24 w-full flex flex-col items-end">
<H3 className="text-[#272727] font-bold">
Juri LKBB <span className="text-primary-500">Antareja 2024</span>
Juri LPKBB <span className="text-primary-500">Antareja 2024</span>
</H3>
<P className="text-wrap text-neutral-200 max-w-[300px] lg:max-w-none">
Yuk kenalan dulu dengan tim juri LKBB Antareja tahun 2024
Yuk kenalan dulu dengan tim juri LPKBB Antareja tahun 2024
</P>
</div>
<div className="relative flex justify-center items-center gap-28 lg:gap-4 flex-col lg:flex-row">
Expand All @@ -91,6 +96,11 @@ export default function Juri() {
name={juris[3].name}
title={juris[3].title}
/>
<JuriCard
image={juris[4].image}
name={juris[4].name}
title={juris[4].title}
/>
</div>
</div>
</SectionWrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(main)/components/Kategori.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Kategori() {
</div>
</div>
<SmallP className="text-white">
*Pendaftaran 20 Mei 2024 - 7 September 2024*
*Pendaftaran 20 Mei 2024 - 5 Oktober 2024*
</SmallP>
</div>
</figure>
Expand All @@ -50,7 +50,7 @@ export default function Kategori() {
</div>
</div>
<SmallP className="text-white">
*Pendaftaran 20 Mei 2024 - 7 September 2024*
*Pendaftaran 20 Mei 2024 - 5 Oktober 2024*
</SmallP>
</div>
</figure>
Expand Down
4 changes: 2 additions & 2 deletions src/app/(main)/components/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Timeline() {
<div className="w-full flex gap-[38px] justify-center items-center">
<TimelineItem
title="Pendaftaran Peserta"
dateString="20 Mei 2024 - 7 September 2024"
dateString="20 Mei 2024 - 5 Oktober 2024"
description="pendaftaran melalui website antareja.smktelkom-mlg.sch.id"
/>
<TimelineLine />
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function Timeline() {
<div className="xl:flex items-center justify-between hidden">
<TimelineItem
title="Pendaftaran Peserta"
dateString="20 Mei - 7 September 2024"
dateString="20 Mei - 5 Oktober 2024"
description="pendaftaran melalui website antareja.smktelkom-mlg.sch.id"
/>
<TimelineLine />
Expand Down
4 changes: 2 additions & 2 deletions src/app/(main)/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Video() {
</P>
</div>
<PrimaryLinkButton
href="https://drive.google.com/file/d/1KqoEFRavgL_KlhoKUBbgX-GpRBpEdQ6B/view?usp=drive_link"
href="https://drive.google.com/file/d/1JdewtpA0-Tcye436lVckEu5lY940Yy13/view?usp=sharing"
className="inline-flex gap-2 items-center mb-[40px]"
>
Unduh buku panduan <FaDownload />
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function Video() {
</P>
</div>
<PrimaryLinkButton
href="https://drive.google.com/file/d/1KqoEFRavgL_KlhoKUBbgX-GpRBpEdQ6B/view?usp=drive_link"
href="https://drive.google.com/file/d/1JdewtpA0-Tcye436lVckEu5lY940Yy13/view?usp=sharing"
className="inline-flex gap-2 items-center mb-[40px]"
>
Unduh buku panduan <FaDownload />
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/components/parts/Countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { H2, H5 } from "@/app/components/global/Text";
import { useCountdown } from "@/app/hooks/useCountdown";

const endDate = new Date("09/07/2024");
const endDate = new Date("10/05/2024");

function TimeFigure({
time,
Expand Down
1 change: 1 addition & 0 deletions src/app/(main)/dashboard/anggota/[posisi]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default async function EditAnggota({
timId: "",
} as unknown as Anggota);

console.log(anggota)
return (
<div className="my-16">
<EditAnggotaForm anggota={anggota} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/dashboard/components/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default async function Heading() {
<div className="flex items-center justify-between w-full mb-3">
<H2 className="mb-2">Selamat Datang, {session?.user?.nama}👋</H2>
<PrimaryLinkButton
href="https://drive.google.com/file/d/1KqoEFRavgL_KlhoKUBbgX-GpRBpEdQ6B/view?usp=drive_link"
href="https://drive.google.com/file/d/1JdewtpA0-Tcye436lVckEu5lY940Yy13/view?usp=sharing"
className="inline-flex gap-2 items-center"
>
Unduh buku panduan <FaDownload />
Expand Down
19 changes: 12 additions & 7 deletions src/app/(main)/dashboard/components/ProfileTim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SectionWrapper from "@/app/components/global/Wrapper";
import { TimWithRelations } from "@/types/entityRelations";
import { ReactNode, useState } from "react";
import { AnggotaCard } from "./parts/AnggotaCard";
import cn from "@/lib/clsx";

const rowsMapNormal = [
["b1s1", "b1s2", "b1s3"],
Expand All @@ -24,9 +25,9 @@ const sizeMap = {
NORMAL: 15,
};

function AnggotaCardsWrapper({ children }: Readonly<{ children: ReactNode }>) {
function AnggotaCardsWrapper({ children,className }: Readonly<{ children: ReactNode,className?:string }>) {
return (
<div className="flex items-center justify-center gap-16">{children}</div>
<div className={cn("flex items-center justify-center gap-16 ", className)}>{children}</div>
);
}

Expand Down Expand Up @@ -61,7 +62,7 @@ function TimLayout({ tim }: Readonly<{ tim: TimWithRelations }>) {

<div className="pb-20">
{tim.jenjang === "SMP" && (
<AnggotaCardsWrapper>
<AnggotaCardsWrapper className="flex flex-wrap gap-10">
<AnggotaCard
href={`/dashboard/anggota/cerdas_cermat1`}
image={
Expand All @@ -81,7 +82,7 @@ function TimLayout({ tim }: Readonly<{ tim: TimWithRelations }>) {
</AnggotaCardsWrapper>
)}
</div>
<AnggotaCardsWrapper>
<AnggotaCardsWrapper className="flex flex-wrap gap-10">
<AnggotaCard
href={`/dashboard/anggota/danton`}
image={danton?.foto ?? "/placeholder-profile-picture.jpg"}
Expand All @@ -105,7 +106,7 @@ function TimLayout({ tim }: Readonly<{ tim: TimWithRelations }>) {
</AnggotaCardsWrapper>
{tim.tipe_tim === "NORMAL"
? rowsMapNormal.map((row, i) => (
<AnggotaCardsWrapper key={i}>
<AnggotaCardsWrapper key={i} className="flex flex-wrap gap-10">
{row.map((pos, i) => {
const anggotaInPos = anggotas.find(
(value) => value.posisi === pos.toUpperCase()
Expand All @@ -126,7 +127,7 @@ function TimLayout({ tim }: Readonly<{ tim: TimWithRelations }>) {
</AnggotaCardsWrapper>
))
: rowsMapSmall.map((row, i) => (
<AnggotaCardsWrapper key={i}>
<AnggotaCardsWrapper key={i} className="flex flex-wrap gap-10">
{row.map((pos, i) => {
const anggotaInPos = anggotas.find(
(value) => value.posisi === pos.toUpperCase()
Expand Down Expand Up @@ -188,7 +189,11 @@ export default function ProfileTim({
{tim.confirmed ? "Sudah" : "Belum"}
</P>
</div>
<TimLayout tim={tim} />
{tim.confirmed ? <TimLayout tim={tim} /> : (
<SectionWrapper className="!pt-[100px] flex items-center justify-center">
<H3 className="text-center">Silahkan untuk menunggu konfirmasi pembayaran dari admin</H3>
</SectionWrapper>
)}
</div>
</SectionWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/dashboard/components/parts/AnggotaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function AnggotaCard({
return (
<Link
href={href}
className="relative flex w-1/6 items-center justify-center hover:scale-105 transition-all duration-300"
className="relative flex w-full sm:w-[40%] xl:w-1/6 items-center justify-center hover:scale-105 transition-all duration-300"
>
<Image
src={image}
Expand Down
Loading

0 comments on commit 3fc425b

Please sign in to comment.