diff --git a/aimenet-web/src/pages/card-in-screen.tsx b/aimenet-web/src/pages/card-in-screen.tsx index 727f58b..147cd82 100644 --- a/aimenet-web/src/pages/card-in-screen.tsx +++ b/aimenet-web/src/pages/card-in-screen.tsx @@ -1,7 +1,7 @@ import {useEffect, useState} from "react"; import {useNavigate, useParams} from "react-router-dom"; import {useLiveQuery} from "dexie-react-hooks"; -import {CircleDot, CircleCheckBig, Home, Nfc, Plus, ServerOff, Wallet} from "lucide-react"; +import {CircleDot, CircleCheckBig, Home, Nfc, Wallet, WifiOff} from "lucide-react"; import {AimeCard, AimeServer, db} from "@/lib/database"; import {getServerInfo, serverCardIn} from "@/lib/aime-net"; @@ -27,6 +27,7 @@ import {AimeCardEntry} from "@/components/aime-card"; import {LoadingIndicator} from "@/components/loading-indicator"; import {CardCreationDialog} from "@/components/card-creation-form"; import {NoCardsNotification} from "@/components/no-cards-notification"; +import {IncognitoStorageWarning} from "@/components/incognito-warning.tsx"; /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -37,12 +38,13 @@ async function performCardInAction(card: AimeCard, server: AimeServer, setCardIn await serverCardIn(server.address, card.id); await db.cards.update(card.id, {lastUsed: Date.now()}); - setTimeout(() => setCardInStatus(false), 1000); toaster({ - title: "Card In Success", + title: "Success", description: "Card in request has been sent successfully.", duration: 5000 }); + + setTimeout(() => setCardInStatus(false), 1000); } catch { toaster({ variant: "destructive", @@ -63,12 +65,7 @@ function CardList(props: { cards: ReadonlyArray | null, cardSelected: return (<>

{props.cards?.length ? "Cards" : "Additional Cards"}

- - - - + @@ -90,16 +87,17 @@ function ServerCardInPage() { const cards = useLiveQuery(() => db.cards.toArray()); const [server, setServer] = useState(null); - const [connectionError, setConnectionError] = useState(false); const [cardInStatus, setCardInStatus] = useState(false); + const [connectionError, setConnectionError] = useState(false); const [selectedCard, setSelectedCard] = useState(null); + const [serverReloadCounter, setServerReloadCounter] = useState(0); // select newest card useEffect(() => { const sortedCards = cards?.sort(x => x.lastUsed); setSelectedCard(sortedCards ? sortedCards[sortedCards.length - 1] : null); }, [cards]); - + useEffect(() => { const loadServer = async () => { if (!serverId) { @@ -133,7 +131,7 @@ function ServerCardInPage() { }; loadServer().catch(console.error); - }, [serverId]); + }, [serverId, serverReloadCounter]); return ( <> @@ -146,14 +144,17 @@ function ServerCardInPage() { {!server && ()} - {(server && connectionError) && ( - - Connection Issue - - There was an issue connecting to {server.address}. - Please check the game is running and try again. - - )} + {(server && connectionError) + ? + + Connection Issue + + There was an issue connecting to {server.address}. + Please check the game is running and setServerReloadCounter(serverReloadCounter + 1)}>try again. + + + : } {server && (