yadflow 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,101 +0,0 @@
1
- import { useState } from 'react';
2
- import { useAuthStore } from '../../store/useAuthStore';
3
-
4
- export function LoginPage() {
5
- const [username, setUsername] = useState('');
6
- const [password, setPassword] = useState('');
7
- const { login, error } = useAuthStore();
8
-
9
- const handleSubmit = (e: React.FormEvent) => {
10
- e.preventDefault();
11
- login(username, password);
12
- };
13
-
14
- return (
15
- <div
16
- className="h-screen w-screen flex items-center justify-center"
17
- style={{ background: 'var(--color-bg-primary)' }}
18
- >
19
- <div
20
- className="w-full max-w-md rounded-2xl p-10 shadow-2xl"
21
- style={{
22
- background: 'var(--color-bg-secondary)',
23
- border: '1px solid var(--color-border-default)',
24
- }}
25
- >
26
- {/* Logo */}
27
- <div className="flex justify-center mb-6">
28
- <img src="/logo.svg" alt="Logo" className="h-14" />
29
- </div>
30
-
31
- {/* Title */}
32
- <h1 className="text-center text-xl font-bold text-white mb-1">
33
- Booking Flow Documentation
34
- </h1>
35
- <p className="text-center text-sm mb-8" style={{ color: 'var(--color-text-muted)' }}>
36
- Sign in to access the documentation
37
- </p>
38
-
39
- <form onSubmit={handleSubmit} className="space-y-5">
40
- {/* Username */}
41
- <div>
42
- <label className="block text-sm font-semibold text-white mb-2">
43
- Username
44
- </label>
45
- <input
46
- type="text"
47
- value={username}
48
- onChange={(e) => setUsername(e.target.value)}
49
- placeholder="Enter your username"
50
- className="w-full px-4 py-3 rounded-lg text-sm text-white placeholder-slate-500 border outline-none transition-colors focus:border-[var(--color-primary)]"
51
- style={{
52
- background: 'var(--color-surface-highlight)',
53
- borderColor: 'var(--color-border-default)',
54
- }}
55
- autoFocus
56
- />
57
- </div>
58
-
59
- {/* Password */}
60
- <div>
61
- <label className="block text-sm font-semibold text-white mb-2">
62
- Password
63
- </label>
64
- <input
65
- type="password"
66
- value={password}
67
- onChange={(e) => setPassword(e.target.value)}
68
- placeholder="Enter your password"
69
- className="w-full px-4 py-3 rounded-lg text-sm text-white placeholder-slate-500 border outline-none transition-colors focus:border-[var(--color-primary)]"
70
- style={{
71
- background: 'var(--color-surface-highlight)',
72
- borderColor: 'var(--color-border-default)',
73
- }}
74
- />
75
- </div>
76
-
77
- {/* Error */}
78
- {error && (
79
- <p className="text-sm text-red-400 text-center">{error}</p>
80
- )}
81
-
82
- {/* Submit */}
83
- <button
84
- type="submit"
85
- className="w-full py-3 rounded-xl text-white font-semibold text-sm transition-all hover:opacity-90 cursor-pointer"
86
- style={{
87
- background: 'var(--color-primary)',
88
- boxShadow: '0 4px 20px rgba(97, 22, 218, 0.4)',
89
- }}
90
- >
91
- Sign In
92
- </button>
93
- </form>
94
-
95
- <p className="text-center text-xs mt-6" style={{ color: 'var(--color-text-muted)' }}>
96
- Booking flow documentation portal
97
- </p>
98
- </div>
99
- </div>
100
- );
101
- }
@@ -1,42 +0,0 @@
1
- import { create } from 'zustand';
2
-
3
- // Login gate — presentational ONLY, never a security control (real access control is the
4
- // repo / Pages ACL). `yad docs` sets DOCS_REQUIRE_LOGIN to `false` by default for public docs;
5
- // teams publishing to a private Pages site can flip it to `true` (login_gate: true) and set
6
- // credentials via the Vite env vars VITE_DOCS_USER / VITE_DOCS_PASS at build time.
7
- const DOCS_REQUIRE_LOGIN = false;
8
- const CREDENTIALS = {
9
- username: import.meta.env.VITE_DOCS_USER ?? 'docs',
10
- password: import.meta.env.VITE_DOCS_PASS ?? 'docs',
11
- };
12
-
13
- interface AuthStore {
14
- isAuthenticated: boolean;
15
- username: string | null;
16
- error: string | null;
17
- login: (username: string, password: string) => boolean;
18
- logout: () => void;
19
- }
20
-
21
- export const useAuthStore = create<AuthStore>((set) => ({
22
- isAuthenticated: !DOCS_REQUIRE_LOGIN || sessionStorage.getItem('auth') === 'true',
23
- username: sessionStorage.getItem('auth_user'),
24
- error: null,
25
-
26
- login: (username, password) => {
27
- if (username === CREDENTIALS.username && password === CREDENTIALS.password) {
28
- sessionStorage.setItem('auth', 'true');
29
- sessionStorage.setItem('auth_user', username);
30
- set({ isAuthenticated: true, username, error: null });
31
- return true;
32
- }
33
- set({ error: 'Invalid username or password' });
34
- return false;
35
- },
36
-
37
- logout: () => {
38
- sessionStorage.removeItem('auth');
39
- sessionStorage.removeItem('auth_user');
40
- set({ isAuthenticated: false, username: null, error: null });
41
- },
42
- }));