Skip to content

Commit

Permalink
Rebase (#140)
Browse files Browse the repository at this point in the history
* fix: broken links and query in admin (#135)

* feat: Make admin team profile responsive
  • Loading branch information
teguhbayu authored Sep 20, 2024
1 parent fe01333 commit 25efb9f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 36 deletions.
20 changes: 15 additions & 5 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental:{
serverActions:{
bodySizeLimit:'5mb'
}
}
experimental: {
serverActions: {
bodySizeLimit: "5mb",
},
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "res.cloudinary.com",
port: "",
pathname: "/**",
},
],
},
};

export default nextConfig;
12 changes: 11 additions & 1 deletion src/app/(admin)/admin/tim/[id]/[posisi]/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PrimaryButton } from "@/app/components/global/Button";
import { H2, H3, P } from "@/app/components/global/Text";
import cn from "@/lib/clsx";
import { Anggota, Kelas } from "@prisma/client";
import Image from "next/image";
import { useRouter } from "next/navigation";

const kelas: { label: Kelas; value: Kelas }[] = [
Expand All @@ -21,9 +22,18 @@ export default function DisplayAnggota({
const router = useRouter();

return (
<form className="mx-[100px] my-[24px]">
<form className="mx-[20px] md:mx-[100px] my-[24px]">
<H2 className="mb-4">Informasi Anggota</H2>
<div className="w-full bg-white rounded-lg p-5 flex flex-col gap-8">
<div className="w-full flex justify-center items-center">
<Image
alt={`${anggota.nama}'s photo`}
src={anggota.foto}
width={600}
height={800}
className="rounded-xl object-cover w-[40vw] md:w-[15vw] aspect-[2/3]"
/>
</div>
<div className="flex flex-col gap-1">
<H3>Nama</H3>
<P>{anggota.nama}</P>
Expand Down
21 changes: 15 additions & 6 deletions src/app/(admin)/admin/tim/[id]/components/ProfileTim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ const sizeMap = {
NORMAL: 15,
};

function AnggotaCardsWrapper({ children }: Readonly<{ children: ReactNode }>) {
function AnggotaCardsWrapper({ children }: Readonly<{ children?: ReactNode }>) {
return (
<div className="flex items-center justify-center gap-20">{children}</div>
<div className="flex items-center justify-center gap-5 sm:gap-20 flex-wrap">
{children}
</div>
);
}

Expand Down Expand Up @@ -76,13 +78,20 @@ function TimLayout({ tim }: Readonly<{ tim: TimWithRelations }>) {
(Data belum lengkap)
</P>
)}
<div className="py-5 right-0 rounded-lg flex flex-col gap-12">
<div className="py-5 right-0 rounded-lg flex flex-col gap-5 sm:gap-12 mb-10">
{tim.jenjang === "SMA" ? (
<AnggotaCardsWrapper>
<AnggotaCard
href={`/admin/tim/${tim_id}/mascot`}
image={tim.foto_mascot ?? "/placeholder-profile-picture.jpg"}
name={tim.foto_mascot ? "Mascot " + tim.nama_tim : "Belum Diisi"}
image={
tim.foto_mascot && tim.foto_mascot !== ""
? tim.foto_mascot
: "/placeholder-profile-picture.jpg"
}
name={
tim.foto_mascot && tim.foto_mascot !== ""
? "Mascot " + tim.nama_tim
: "Belum Diisi"
}
posisi={"MASCOT"}
/>
</AnggotaCardsWrapper>
Expand Down
68 changes: 46 additions & 22 deletions src/app/(admin)/admin/tim/[id]/components/parts/AnggotaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface AnggotaCardProps {
image: string;
name: string;
posisi: string;
href: string;
href?: string;
}

export function AnggotaCard({
Expand All @@ -17,27 +17,51 @@ export function AnggotaCard({
href,
}: Readonly<AnggotaCardProps>) {
return (
<Link
href={href}
className="relative flex w-1/6 items-center justify-center hover:scale-105 transition-all duration-300"
>
<Image
src={image}
alt={`${name}'s Photo`}
width={150}
height={200}
className="w-full h-[320px] object-cover rounded-3xl"
unoptimized
/>
<div className="absolute rounded-3xl p-5 bg-white drop-shadow-md flex items-center gap-6 -bottom-4 w-[110%]">
<div className="p-[14px] rounded-2xl bg-primary-500 drop-shadow-glow">
<Person />
<>
{href ? (
<Link
href={href}
className="relative flex w-[65vw] sm:w-1/6 items-center justify-center hover:scale-105 transition-all duration-300 aspect-[2/3]"
>
<Image
src={image}
alt={`${name}'s Photo`}
width={150}
height={200}
className="w-full h-[320px] object-cover rounded-3xl"
unoptimized
/>
<div className="absolute rounded-3xl p-5 bg-white drop-shadow-md flex items-center gap-6 -bottom-4 w-[110%]">
<div className="p-[14px] rounded-2xl bg-primary-500 drop-shadow-glow">
<Person />
</div>
<div className="block text-start">
<P className="font-bold text-black mb-1 line-clamp-1">{name}</P>
<P>{posisi.toUpperCase()}</P>
</div>
</div>
</Link>
) : (
<div className="relative flex w-[65vw] sm:w-1/6 items-center justify-center transition-all duration-300 aspect-[23]">
<Image
src={image}
alt={`${name}'s Photo`}
width={150}
height={200}
className="w-full h-[320px] object-cover rounded-3xl"
unoptimized
/>
<div className="absolute rounded-3xl p-5 bg-white drop-shadow-md flex items-center gap-6 -bottom-4 w-[110%]">
<div className="p-[14px] rounded-2xl bg-primary-500 drop-shadow-glow">
<Person />
</div>
<div className="block text-start">
<P className="font-bold text-black mb-1 line-clamp-1">{name}</P>
<P>{posisi.toUpperCase()}</P>
</div>
</div>
</div>
<div className="block text-start">
<P className="font-bold text-black mb-1 line-clamp-1">{name}</P>
<P>{posisi.toUpperCase()}</P>
</div>
</div>
</Link>
)}
</>
);
}
2 changes: 1 addition & 1 deletion src/app/(admin)/admin/tim/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default async function TimEdit({ params }: { params: { id: string } }) {
tipe_tim: "NORMAL",
foto_mascot: "",
link_berkas: "",
link_video: ""
link_video: "",
};

const trygetTim = await findTim({ id: params.id });
Expand Down
5 changes: 4 additions & 1 deletion src/app/hooks/useCountdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export function useCountdown(targetDate: Date) {

useEffect(() => {
const interval = setInterval(() => {
setCountDown(countDownDate - new Date().getTime());
const counter = countDownDate - new Date().getTime();
if (counter > 0) {
setCountDown(counter);
} else return setCountDown(0);
}, 1000);

return () => clearInterval(interval);
Expand Down

0 comments on commit 25efb9f

Please sign in to comment.