mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 13:17:45 +00:00
feat: remove countdown
also discord, unsure what to do about it
This commit is contained in:
parent
e500cefcc2
commit
df6e31ba89
2 changed files with 1 additions and 81 deletions
|
|
@ -1,12 +1,10 @@
|
|||
import { Metadata } from "next";
|
||||
import { redirect } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { Icon } from "@iconify/react";
|
||||
|
||||
import { auth } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
import Countdown from "@/components/countdown";
|
||||
import MiiList from "@/components/mii/list";
|
||||
import Skeleton from "@/components/mii/list/skeleton";
|
||||
|
||||
|
|
@ -39,7 +37,7 @@ export async function generateMetadata({ searchParams }: Props): Promise<Metadat
|
|||
|
||||
export default async function Page({ searchParams }: Props) {
|
||||
const session = await auth();
|
||||
const { page, tags } = await searchParams;
|
||||
const { tags } = await searchParams;
|
||||
|
||||
if (session?.user) {
|
||||
const activePunishment = await prisma.punishment.findFirst({
|
||||
|
|
@ -55,21 +53,6 @@ export default async function Page({ searchParams }: Props) {
|
|||
<>
|
||||
<h1 className="sr-only">{tags ? `Miis tagged with '${tags}' - TomodachiShare` : "TomodachiShare - index mii list"}</h1>
|
||||
|
||||
{(!page || page === "1") && (
|
||||
<div className="flex items-center justify-center gap-2 mb-2 max-sm:flex-col">
|
||||
<a
|
||||
href="https://discord.gg/48cXBFKvWQ"
|
||||
className="bg-amber-50 border-2 border-amber-500 rounded-2xl shadow-lg px-4 py-2.5 flex justify-center items-center gap-4 w-fit"
|
||||
>
|
||||
<Icon icon="ic:baseline-discord" fontSize={48} className="text-indigo-400" />
|
||||
<div>
|
||||
<p className="text-xl font-bold">Join the Discord</p>
|
||||
<p className="text-sm">Code: 48cXBFKvWQ</p>
|
||||
</div>
|
||||
</a>
|
||||
<Countdown />
|
||||
</div>
|
||||
)}
|
||||
<Suspense fallback={<Skeleton />}>
|
||||
<MiiList searchParams={await searchParams} />
|
||||
</Suspense>
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Countdown() {
|
||||
const [days, setDays] = useState(31);
|
||||
const [hours, setHours] = useState(59);
|
||||
const [minutes, setMinutes] = useState(59);
|
||||
const [seconds, setSeconds] = useState(59);
|
||||
|
||||
const targetDate = new Date("2026-04-16T12:00:00Z").getTime();
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
const now = new Date().getTime();
|
||||
const distance = targetDate - now;
|
||||
|
||||
if (distance < 0) {
|
||||
clearInterval(interval);
|
||||
setDays(0);
|
||||
setHours(0);
|
||||
setMinutes(0);
|
||||
setSeconds(0);
|
||||
return;
|
||||
}
|
||||
|
||||
setDays(Math.floor(distance / (1000 * 60 * 60 * 24)));
|
||||
setHours(Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)));
|
||||
setMinutes(Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)));
|
||||
setSeconds(Math.floor((distance % (1000 * 60)) / 1000));
|
||||
}, 100);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="bg-amber-50 border-2 border-amber-500 rounded-2xl shadow-lg px-4 py-2.5 flex justify-center items-center gap-8 w-fit max-sm:max-w-72 max-sm:w-full max-sm:flex-col max-sm:gap-2">
|
||||
<div className="flex flex-col max-sm:items-center">
|
||||
<h1 className="text-xl font-bold">Living the Dream</h1>
|
||||
<h2 className="text-right text-sm max-sm:text-center">releases in:</h2>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4">
|
||||
<div className="flex flex-col text-center">
|
||||
<span className="text-2xl font-semibold">{days}</span>
|
||||
<span className="text-xs">days</span>
|
||||
</div>
|
||||
<div className="flex flex-col text-center">
|
||||
<span className="text-2xl font-semibold">{hours}</span>
|
||||
<span className="text-xs">hours</span>
|
||||
</div>
|
||||
<div className="flex flex-col text-center">
|
||||
<span className="text-2xl font-semibold">{minutes}</span>
|
||||
<span className="text-xs">minutes</span>
|
||||
</div>
|
||||
<div className="flex flex-col text-center">
|
||||
<span className="text-2xl font-semibold">{seconds}</span>
|
||||
<span className="text-xs">seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue