<script>
	import { goto } from '$app/navigation';
	import { auth } from '$lib/stores/auth.js';

	let userId = $state('');

	function enterApp() {
		if (userId.trim()) {
			auth.login(userId.trim());
			goto('/dashboard');
		}
	}
</script>

<h1>OwOrganizer</h1>

<p>Enter your user ID to open the app.</p>

<form onsubmit={(e) => { e.preventDefault(); enterApp(); }}>
	<label>
		User ID
		<input type="text" bind:value={userId} placeholder="e.g., alice" />
	</label>
	<button type="submit">Open App</button>
</form>
