diff --git a/src/App.tsx b/src/App.tsx index 9399d08..e89588c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,6 +4,7 @@ import HomePage from './components/pages/HomePage'; import DocsPage from './components/pages/DocsPage'; import OwnerPage from './components/pages/OwnerPage'; import UserPage from './components/pages/UserPage'; +import CardDisplayPage from './components/pages/CardDisplayPage'; function App() { useEffect(() => { @@ -14,7 +15,7 @@ function App() { }, []); return ( -
+
} /> } /> @@ -28,6 +29,7 @@ function App() { } /> } /> } /> + } /> } />
diff --git a/src/components/card/FullScreenCard.tsx b/src/components/card/FullScreenCard.tsx new file mode 100644 index 0000000..3bfe867 --- /dev/null +++ b/src/components/card/FullScreenCard.tsx @@ -0,0 +1,34 @@ +import { Card } from '../../types'; +import '../../styles/card-effects.css'; + +interface FullScreenCardProps { + card: Card; +} + +export default function FullScreenCard({ card }: FullScreenCardProps) { + const isSpecialStatus = ['yui', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seven'].includes(card.status); + + return ( +
+
+
+
+
+ {`Card +
+ {isSpecialStatus && ( + <> +
+
+ + )} +
+
+
+
+ ); +} \ No newline at end of file diff --git a/src/components/pages/CardDisplayPage.tsx b/src/components/pages/CardDisplayPage.tsx new file mode 100644 index 0000000..f1aab2f --- /dev/null +++ b/src/components/pages/CardDisplayPage.tsx @@ -0,0 +1,40 @@ +import { useParams } from 'react-router-dom'; +import { useQuery } from '@tanstack/react-query'; +import FullScreenCard from '../card/FullScreenCard'; +import { fetchCardById } from '../../utils/api'; + +export default function CardDisplayPage() { + const { id } = useParams<{ id: string }>(); + const cardId = parseInt(id || '0'); + + const { data: card, isLoading } = useQuery({ + queryKey: ['card', cardId], + queryFn: () => fetchCardById(cardId), + enabled: cardId > 0, + }); + + if (isLoading) { + return ( +
+ +
+ ); + } + + if (!card) { + return null; + } + + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/src/index.css b/src/index.css index 256bff8..868c3f4 100644 --- a/src/index.css +++ b/src/index.css @@ -18,6 +18,11 @@ line-break: strict; } + /* Transparent background for card display pages */ + body:has([data-page="card-display"]) { + background-color: transparent !important; + } + a { @apply text-primary no-underline hover:text-secondary; } diff --git a/src/styles/card-effects.css b/src/styles/card-effects.css index 20335b5..f79966a 100644 --- a/src/styles/card-effects.css +++ b/src/styles/card-effects.css @@ -10,6 +10,16 @@ overflow: hidden; } +.card-wrapper-fullscreen { + display: grid; + place-items: center; + position: relative; + aspect-ratio: 5/7; + width: 100%; + margin: 0 auto; + overflow: hidden; +} + .card-reflection { display: block; position: relative; diff --git a/src/utils/api.ts b/src/utils/api.ts index eecf6a2..269e29a 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import type { User, Card, CardOwner, Fanart, Seven } from '../types'; const getApiUrl = () => { - if (window.location.host === "localhost:8080" || window.location.host === "192.168.11.12:8080") { + if (window.location.host === "localhost:8080") { return "/api/"; } return "https://api.syui.ai/";