diff --git a/src/components/site/SiteMobileBlocker.tsx b/src/components/site/SiteMobileBlocker.tsx
index ef47a16..acce806 100644
--- a/src/components/site/SiteMobileBlocker.tsx
+++ b/src/components/site/SiteMobileBlocker.tsx
@@ -1,37 +1,28 @@
-import { SITE_CONFIG } from "@/data/site/siteConfig";
+import { SITE_BACKGROUND_STYLE } from "@/data/site/siteConfig";
const MOBILE_TEXT =
"Ce site a été conçu pour être utilisé sur ordinateur. Veuillez réessayer sur votre ordinateur pour une expérience optimale.";
-/**
- * Mobile blocker screen
- */
export function SiteMobileBlocker(): React.JSX.Element {
return (
state.setStep);
const setPlayerName = useGameStore((state) => state.setPlayerName);
const [charIndex, setCharIndex] = useState(0);
- const dialogueStarted = useRef(false);
const inputRef = useRef(null);
- const forcedName = SITE_CONFIG.forcedName;
- const displayValue = forcedName.slice(0, charIndex);
- const isComplete = charIndex >= forcedName.length;
+ const presetPlayerName = SITE_CONFIG.presetPlayerName;
+ const displayValue = presetPlayerName.slice(0, charIndex);
+ const isComplete = charIndex >= presetPlayerName.length;
- // Play dialogue when screen appears (with subtitles)
useEffect(() => {
- if (dialogueStarted.current) return;
- dialogueStarted.current = true;
+ let cancelled = false;
void (async () => {
const manifest = await loadDialogueManifest();
- if (manifest) {
- await playDialogueById(manifest, "narrateur_intro_prenom");
- }
+ if (cancelled || !manifest) return;
+ await playDialogueById(manifest, SITE_DIALOGUE_IDS.naming);
})();
+
+ return () => {
+ cancelled = true;
+ stopCurrentDialogue();
+ };
}, []);
- // Focus input on mount
useEffect(() => {
inputRef.current?.focus();
}, []);
const handleNameChange = useCallback(
(event: React.ChangeEvent): void => {
- const nextLength = Math.min(event.target.value.length, forcedName.length);
+ const nextLength = Math.min(
+ event.target.value.length,
+ presetPlayerName.length,
+ );
setCharIndex(nextLength);
},
- [forcedName.length],
+ [presetPlayerName.length],
);
const handleConfirm = (): void => {
if (isComplete) {
- setPlayerName(forcedName);
+ setPlayerName(presetPlayerName);
setStep("transition");
}
};
@@ -75,6 +84,7 @@ export function SiteNamingScreen(): React.JSX.Element {
}}
>
+
+ Votre personnage s'appelle {presetPlayerName}. Tapez{" "}
+ {presetPlayerName.length} caractères pour révéler son nom.
+