-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwizard.html
More file actions
248 lines (217 loc) · 8.93 KB
/
wizard.html
File metadata and controls
248 lines (217 loc) · 8.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="CrewKit — local-first team leadership platform for collaborative assessment">
<meta name="theme-color" content="#274133">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Setup — CrewKit</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="apple-touch-icon" href="favicon.ico">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css">
<style>
.wizard-shell {
max-width: 560px;
margin: 48px auto;
}
.wizard-nav {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 32px;
}
/* Uniform spacing between all form groups */
.card .form-group {
margin-bottom: 20px;
}
.card .form-group:last-of-type {
margin-bottom: 0;
}
/* Input with inline counter */
.input-counter-wrap {
position: relative;
}
.input-counter-wrap .form-input {
padding-right: 52px;
width: 100%;
}
.input-counter {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
font-size: .75rem;
color: var(--color-text-muted);
pointer-events: none;
white-space: nowrap;
}
.input-counter--over {
color: var(--color-error, #ef4444);
}
</style>
</head>
<body data-page="wizard">
<header class="app-header" id="app-header"></header>
<main class="app-main">
<div class="wizard-shell">
<div class="page-header">
<a href="index.html" class="page-header__back">← Back</a>
<h1 class="page-header__title" id="wizard-title">Create your setup.json</h1>
<p class="page-header__sub">You can change everything later.</p>
</div>
<div class="card">
<div class="card__title">Details</div>
<div class="form-group">
<label class="form-label" for="company-name">Company name <span>*</span></label>
<div class="input-counter-wrap">
<input class="form-input" id="company-name" type="text" maxlength="12"
placeholder="e.g. YourCompany" autocomplete="off">
<span class="input-counter" id="company-name-count">0 / 12</span>
</div>
<div class="form-error" id="company-name-err" style="display:none;margin-top:4px"></div>
</div>
<div class="form-group">
<label class="form-label" for="user-name">Your name <span>*</span></label>
<input class="form-input" id="user-name" type="text" maxlength="80"
placeholder="e.g. Max Mustermann" autocomplete="off">
<div class="form-error" id="user-name-err" style="display:none;margin-top:4px"></div>
</div>
<div class="form-group">
<label class="form-label" for="theme-select">Theme</label>
<select class="form-select" id="theme-select">
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="system">System</option>
</select>
</div>
<div class="wizard-nav">
<button class="btn btn--primary" id="wizard-submit" onclick="Wizard.finish()">Create setup.json →</button>
</div>
</div>
</div>
</main>
<footer class="app-footer" id="app-footer"></footer>
<div id="toast-container"></div>
<script src="validator.js"></script>
<script src="app.js"></script>
<script>
const ALL_MODULES = [
{ id: 'hard-skills-matrix', label: 'Hard Skills Matrix' },
{ id: 'seniority-matrix', label: 'Seniority Matrix' },
{ id: 'candidate-profile', label: 'Candidate Profile' },
{ id: 'portfolio-review-template', label: 'Portfolio & CV Review' },
{ id: 'interview-questionnaire', label: 'Interview Questionnaire' },
{ id: 'test-task-template', label: 'Test Task Review' },
{ id: 'soft-skills-matrix', label: 'Soft Skills Matrix' },
{ id: 'employee-profile', label: 'Employee Profiles' },
];
const Wizard = {
_validate() {
let ok = true;
const company = document.getElementById('company-name').value.trim();
const companyErr = document.getElementById('company-name-err');
const companyIn = document.getElementById('company-name');
if (!company) {
companyErr.textContent = 'Company name is required.';
companyErr.style.display = '';
companyIn.classList.add('form-input--error');
ok = false;
} else if (company.length > 12) {
companyErr.textContent = 'Maximum 12 characters.';
companyErr.style.display = '';
companyIn.classList.add('form-input--error');
ok = false;
} else {
companyErr.style.display = 'none';
companyIn.classList.remove('form-input--error');
}
const user = document.getElementById('user-name').value.trim();
const userErr = document.getElementById('user-name-err');
const userIn = document.getElementById('user-name');
if (!user) {
userErr.textContent = 'Your name is required.';
userErr.style.display = '';
userIn.classList.add('form-input--error');
ok = false;
} else {
userErr.style.display = 'none';
userIn.classList.remove('form-input--error');
}
return ok;
},
async finish() {
if (!this._validate()) return;
const now = new Date().toISOString();
const company = document.getElementById('company-name').value.trim();
const user = document.getElementById('user-name').value.trim();
const theme = document.getElementById('theme-select').value;
const setup = {
meta: {
version: Validator.CURRENT_VERSION,
createdAt: now,
updatedAt: now,
},
company: { name: company, theme },
user: { name: user },
artifacts: [],
crewMembers: [],
initiatives: {
columns: { 'todo': 'To-do' },
columnOrder: ['todo'],
'todo': []
}
};
const finalSetup = Wizard._editMode && App.setup
? { ...App.setup, company: { ...App.setup.company, name: company, theme }, user: { ...App.setup.user, name: user } }
: setup;
App.saveToStorage(finalSetup);
App.markClean();
App._applyTheme(theme);
// Auto-download with custom filename
const slug = s => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
const filename = `${slug(company)}_${slug(user)}_crewkit-setup.json`;
await App.downloadJSON(finalSetup, filename);
Toast.show('✅ Changes saved.', 'success', 3000);
setTimeout(() => { window.location.href = Wizard._editMode ? 'index.html' : 'index.html?new=1'; }, 800);
},
};
Pages.wizard = {
init() {
const isEdit = new URLSearchParams(location.search).get('edit') === '1';
// In edit mode: pre-fill form and update UI labels
if (isEdit && App.setup) {
document.getElementById('wizard-title').textContent = 'Edit your setup.json';
document.getElementById('wizard-submit').textContent = 'Save changes →';
Wizard._editMode = true;
const company = App.setup.company?.name || '';
const user = App.setup.user?.name || '';
const theme = App.setup.company?.theme || 'light';
document.getElementById('company-name').value = company;
document.getElementById('user-name').value = user;
document.getElementById('theme-select').value = theme;
// Update counter
const count = document.getElementById('company-name-count');
if (count) count.textContent = `${company.length} / 12`;
}
// Char counter
const input = document.getElementById('company-name');
const count = document.getElementById('company-name-count');
if (input && count) {
input.addEventListener('input', () => {
const len = input.value.length;
count.textContent = `${len} / 12`;
count.classList.toggle('input-counter--over', len > 12);
});
}
// Live theme preview
document.getElementById('theme-select')?.addEventListener('change', e => {
App._applyTheme(e.target.value);
});
},
};
</script>
</body>
</html>