furina.id/src/pages/home/page.tsx

93 lines
2.4 KiB
TypeScript
Raw Normal View History

2024-01-06 03:35:50 +07:00
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useEffect, useRef, useState } from "react";
import styles from "./style.module.css";
import { cn } from "@/utility/utils";
import LoadingPage from "../misc/loading-page";
2024-01-06 12:35:42 +07:00
import PageMetadata from "@/components/containers/PageMetadata";
2024-01-06 20:33:36 +07:00
import Modal from "@/components/ui/Modal";
import useModal from "@/hooks/useModal";
2024-01-10 16:25:32 +07:00
import Button from "@/components/ui/Button";
2024-01-06 03:35:50 +07:00
2024-01-05 23:28:25 +07:00
const HomePage = () => {
2024-01-06 03:35:50 +07:00
const appRef = useRef<any>();
const cleanRef = useRef<any>();
const targetRef = useRef<HTMLDivElement>(null);
const [isReady, setReady] = useState(false);
useEffect(() => {
if (!appRef.current) {
appRef.current = true;
const init = async () => {
const { default: game } = await import("./game");
const { app, clean } = await game();
targetRef.current?.appendChild(app.view as never);
appRef.current = app;
cleanRef.current = clean;
setReady(true);
};
init();
}
return () => {
if (cleanRef.current) {
cleanRef.current();
}
};
}, [setReady]);
return (
<div>
2024-01-06 12:35:42 +07:00
<PageMetadata
title="Pet the Furina"
description="Play pet the furina meme game"
keywords="pet furina, pet the furina, pet the meme, furina pat pat, pat furina"
/>
2024-01-06 03:35:50 +07:00
{!isReady ? <LoadingPage /> : null}
<div
ref={targetRef}
className={cn(
"flex flex-col items-center justify-center",
styles.canvasContainer
)}
/>
<Credits />
</div>
);
};
const Credits = () => {
2024-01-06 20:33:36 +07:00
const modal = useModal();
2024-01-06 03:35:50 +07:00
return (
<div className="container pt-4 pb-16 border-t">
2024-01-10 16:25:32 +07:00
<Button onClick={modal.onOpen}>Assets Credits</Button>
2024-01-06 03:35:50 +07:00
2024-01-06 20:33:36 +07:00
<Modal {...modal} title="Big Thanks to:" size="xl">
<pre className="font-sans overflow-x-auto">
2024-01-06 03:35:50 +07:00
{`
Furina Stickers:
Guido_ (https://risibank.fr/media/297778-genshin-archon-hydro-c6-r5-soutine)
Coll5 (https://risibank.fr/media/317061-furina-focalor-genshin)
2024-01-06 20:33:36 +07:00
Music:
Kururin Furina Cover by Ariyutta (https://facebook.com/arbi.yudatama)
pet the peepo by NitroiF (https://www.youtube.com/shorts/ll2Au3CdV2k)
2024-01-06 03:35:50 +07:00
Hand Sprite:
@soapmangraylace2752 (https://www.youtube.com/shorts/HEguW7Gmu2w)
Fijiwaterhelp (https://jailbreak.fandom.com/wiki/User_blog:Fijiwaterhelp/hand_petting)
`.trim()}
</pre>
2024-01-06 20:33:36 +07:00
</Modal>
2024-01-06 03:35:50 +07:00
</div>
);
2024-01-05 23:28:25 +07:00
};
export default HomePage;