@svadmin/ui 0.38.7 → 0.39.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.
- package/dist/components/AdminApp.svelte +3 -2
- package/dist/components/ApiSettings.svelte +86 -1
- package/dist/components/ForgotPasswordPage.svelte +5 -8
- package/dist/components/LoginPage.svelte +5 -8
- package/dist/components/RegisterPage.svelte +5 -8
- package/dist/components/Sidebar.svelte +10 -4
- package/dist/components/SvadminLogo.svelte +16 -0
- package/dist/components/SvadminLogo.svelte.d.ts +7 -0
- package/dist/components/UpdatePasswordPage.svelte +5 -8
- package/dist/components/account/CompanyProfilePage.svelte +56 -1
- package/dist/components/account/ImportMembersPage.svelte +31 -0
- package/dist/components/account/SettingsEnterprisePage.svelte +172 -19
- package/dist/components/account/SettingsPlainPage.svelte +121 -17
- package/dist/components/account/SettingsSidebarPage.svelte +282 -70
- package/dist/components/account/TeamMembersPage.svelte +68 -2
- package/dist/components/account/UserProfilePage.svelte +206 -0
- package/dist/components/account/UserProfilePage.svelte.d.ts +4 -0
- package/dist/components/network/TeamCrewTablePage.svelte +17 -1
- package/dist/components/network/UserCardsNFTPage.svelte +5 -0
- package/dist/components/profile/ActivityTimeline.svelte +24 -2
- package/dist/components/profile/ActivityTimeline.svelte.d.ts +1 -0
- package/dist/components/profile/ProfileVariantSections.svelte +452 -0
- package/dist/components/profile/ProfileVariantSections.svelte.d.ts +8 -0
- package/dist/components/profile/ProjectsGrid.svelte +20 -6
- package/dist/components/profile/PublicProfilePage.svelte +42 -21
- package/dist/components/profile/PublicProfilePage.svelte.d.ts +1 -0
- package/dist/components/profile/TeamsShowcase.svelte +31 -12
- package/dist/components/profile/TeamsShowcase.svelte.d.ts +1 -0
- package/dist/components/ui/alert/alert.svelte.d.ts +14 -14
- package/dist/components/ui/avatar/avatar.svelte.d.ts +14 -14
- package/dist/components/ui/badge/badge.svelte.d.ts +20 -20
- package/dist/components/ui/button/button.svelte.d.ts +44 -44
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +13 -13
|
@@ -2,99 +2,311 @@
|
|
|
2
2
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
3
3
|
import * as Card from '../ui/card/index.js';
|
|
4
4
|
import { Button } from '../ui/button/index.js';
|
|
5
|
+
import { Badge } from '../ui/badge/index.js';
|
|
6
|
+
import { Input } from '../ui/input/index.js';
|
|
5
7
|
import { Label } from '../ui/label/index.js';
|
|
6
8
|
import { Switch } from '../ui/switch/index.js';
|
|
7
9
|
import { Separator } from '../ui/separator/index.js';
|
|
8
|
-
import { Loader2,
|
|
10
|
+
import { Loader2, Camera, Key, Copy, Check } from '@lucide/svelte';
|
|
9
11
|
|
|
10
12
|
const i18n = useTranslation();
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const navItems = [
|
|
15
|
+
{ id: 'basic', label: 'account.basicSettings' },
|
|
16
|
+
{ id: 'signin', label: 'account.socialSignIn' },
|
|
17
|
+
{ id: 'password', label: 'account.password' },
|
|
18
|
+
{ id: 'sso', label: 'account.singleSignOn' },
|
|
19
|
+
{ id: 'preferences', label: 'account.preferences' },
|
|
20
|
+
{ id: 'address', label: 'account.address' },
|
|
21
|
+
{ id: 'api', label: 'account.manageApi' },
|
|
22
|
+
{ id: 'delete', label: 'account.deleteAccount' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
let activeSection = $state('basic');
|
|
26
|
+
|
|
27
|
+
function scrollTo(id: string) {
|
|
28
|
+
activeSection = id;
|
|
29
|
+
if (typeof document !== 'undefined') {
|
|
30
|
+
document.getElementById(`settings-section-${id}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let displayName = $state('Alex Chen');
|
|
35
|
+
let company = $state('Nebula Labs');
|
|
36
|
+
let phone = $state('+86 138 **** 9527');
|
|
37
|
+
let email = $state('alex@example.com');
|
|
38
|
+
let availableToHire = $state(true);
|
|
39
|
+
let profileVisible = $state(true);
|
|
40
|
+
let socialGithub = $state(true);
|
|
41
|
+
let socialGoogle = $state(false);
|
|
42
|
+
let twoFactor = $state(true);
|
|
43
|
+
let language = $state('en');
|
|
44
|
+
let timezone = $state('Asia/Shanghai');
|
|
45
|
+
let currency = $state('CNY');
|
|
46
|
+
let apiKey = $state('sv_demo_pub_9f3e••••41ab');
|
|
47
|
+
let copied = $state(false);
|
|
17
48
|
let saving = $state(false);
|
|
18
49
|
|
|
19
50
|
async function handleSave() {
|
|
20
51
|
saving = true;
|
|
21
|
-
await new Promise(r => setTimeout(r, 800));
|
|
52
|
+
await new Promise((r) => setTimeout(r, 800));
|
|
22
53
|
saving = false;
|
|
23
54
|
}
|
|
55
|
+
|
|
56
|
+
async function copyApiKey() {
|
|
57
|
+
try {
|
|
58
|
+
await navigator.clipboard.writeText(apiKey);
|
|
59
|
+
copied = true;
|
|
60
|
+
setTimeout(() => (copied = false), 2000);
|
|
61
|
+
} catch {
|
|
62
|
+
copied = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
24
65
|
</script>
|
|
25
66
|
|
|
26
67
|
<div class="space-y-6" data-svadmin-content-page="account">
|
|
27
|
-
<div>
|
|
28
|
-
<
|
|
29
|
-
|
|
68
|
+
<div class="flex items-start justify-between gap-4">
|
|
69
|
+
<div>
|
|
70
|
+
<h2 class="text-xl font-semibold text-foreground">{i18n.t('account.settingsSidebar')}</h2>
|
|
71
|
+
<p class="mt-1 text-sm text-muted-foreground">{i18n.t('account.settingsSidebarDescription')}</p>
|
|
72
|
+
</div>
|
|
73
|
+
<Button onclick={handleSave} disabled={saving} size="sm">
|
|
74
|
+
{#if saving}<Loader2 class="h-4 w-4 animate-spin mr-2" />{/if}
|
|
75
|
+
{i18n.t('common.save')}
|
|
76
|
+
</Button>
|
|
30
77
|
</div>
|
|
31
78
|
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<Switch id="default-collapsed" bind:checked={defaultCollapsed} />
|
|
79
|
+
<div class="flex flex-col gap-6 lg:flex-row">
|
|
80
|
+
<!-- Anchor nav -->
|
|
81
|
+
<nav class="w-full shrink-0 lg:w-52">
|
|
82
|
+
<div class="flex gap-1 overflow-x-auto lg:sticky lg:top-6 lg:flex-col">
|
|
83
|
+
{#each navItems as item (item.id)}
|
|
84
|
+
<button
|
|
85
|
+
class="whitespace-nowrap rounded-lg px-3 py-2 text-left text-sm transition-colors
|
|
86
|
+
{activeSection === item.id ? 'bg-primary/10 font-medium text-primary' : 'text-muted-foreground hover:bg-accent hover:text-foreground'}"
|
|
87
|
+
onclick={() => scrollTo(item.id)}
|
|
88
|
+
>
|
|
89
|
+
{i18n.t(item.label)}
|
|
90
|
+
</button>
|
|
91
|
+
{/each}
|
|
46
92
|
</div>
|
|
93
|
+
</nav>
|
|
47
94
|
|
|
48
|
-
|
|
95
|
+
<div class="min-w-0 flex-1 space-y-6">
|
|
96
|
+
<!-- Basic Settings -->
|
|
97
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-basic">
|
|
98
|
+
<Card.CardHeader>
|
|
99
|
+
<Card.CardTitle class="text-base">{i18n.t('account.basicSettings')}</Card.CardTitle>
|
|
100
|
+
</Card.CardHeader>
|
|
101
|
+
<Card.CardContent class="space-y-4">
|
|
102
|
+
<div class="flex items-center gap-4">
|
|
103
|
+
<div class="relative">
|
|
104
|
+
<div class="flex h-16 w-16 items-center justify-center rounded-full bg-primary/10 text-primary text-xl font-bold">AC</div>
|
|
105
|
+
<button class="absolute -bottom-1 -right-1 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm">
|
|
106
|
+
<Camera class="h-3 w-3" />
|
|
107
|
+
</button>
|
|
108
|
+
</div>
|
|
109
|
+
<div>
|
|
110
|
+
<p class="text-sm font-medium text-foreground">{i18n.t('account.photo')}</p>
|
|
111
|
+
<p class="text-xs text-muted-foreground">150x150px JPEG, PNG Image</p>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<Separator />
|
|
115
|
+
<div class="grid gap-4 sm:grid-cols-2">
|
|
116
|
+
<div class="space-y-2">
|
|
117
|
+
<Label for="sb-name">{i18n.t('profile.name')}</Label>
|
|
118
|
+
<Input id="sb-name" bind:value={displayName} />
|
|
119
|
+
</div>
|
|
120
|
+
<div class="space-y-2">
|
|
121
|
+
<Label for="sb-company">{i18n.t('profile.company')}</Label>
|
|
122
|
+
<Input id="sb-company" bind:value={company} />
|
|
123
|
+
</div>
|
|
124
|
+
<div class="space-y-2">
|
|
125
|
+
<Label for="sb-phone">{i18n.t('account.phone')}</Label>
|
|
126
|
+
<Input id="sb-phone" bind:value={phone} />
|
|
127
|
+
</div>
|
|
128
|
+
<div class="space-y-2">
|
|
129
|
+
<Label for="sb-email">Email</Label>
|
|
130
|
+
<Input id="sb-email" bind:value={email} type="email" />
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
<Separator />
|
|
134
|
+
<div class="flex items-center justify-between gap-4">
|
|
135
|
+
<div class="space-y-1">
|
|
136
|
+
<Label for="sb-visibility">{i18n.t('account.visibility')}</Label>
|
|
137
|
+
<p class="text-xs text-muted-foreground">{i18n.t('account.publicProfileCard')}</p>
|
|
138
|
+
</div>
|
|
139
|
+
<Switch id="sb-visibility" bind:checked={profileVisible} />
|
|
140
|
+
</div>
|
|
141
|
+
<div class="flex items-center justify-between gap-4">
|
|
142
|
+
<div class="space-y-1">
|
|
143
|
+
<Label for="sb-availability">{i18n.t('account.availability')}</Label>
|
|
144
|
+
<p class="text-xs text-muted-foreground">{i18n.t('account.availableToHire')}</p>
|
|
145
|
+
</div>
|
|
146
|
+
<Switch id="sb-availability" bind:checked={availableToHire} />
|
|
147
|
+
</div>
|
|
148
|
+
</Card.CardContent>
|
|
149
|
+
</Card.Card>
|
|
49
150
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
</
|
|
55
|
-
<
|
|
56
|
-
|
|
151
|
+
<!-- Social Sign in + 2FA -->
|
|
152
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-signin">
|
|
153
|
+
<Card.CardHeader>
|
|
154
|
+
<Card.CardTitle class="text-base">{i18n.t('account.socialSignIn')}</Card.CardTitle>
|
|
155
|
+
</Card.CardHeader>
|
|
156
|
+
<Card.CardContent class="space-y-4">
|
|
157
|
+
<div class="flex items-center justify-between gap-4">
|
|
158
|
+
<div class="space-y-1">
|
|
159
|
+
<Label for="sb-github">Source Control</Label>
|
|
160
|
+
<p class="text-xs text-muted-foreground">alexchen</p>
|
|
161
|
+
</div>
|
|
162
|
+
<Switch id="sb-github" bind:checked={socialGithub} />
|
|
163
|
+
</div>
|
|
164
|
+
<div class="flex items-center justify-between gap-4">
|
|
165
|
+
<div class="space-y-1">
|
|
166
|
+
<Label for="sb-google">Identity Cloud</Label>
|
|
167
|
+
<p class="text-xs text-muted-foreground">alex@example.com</p>
|
|
168
|
+
</div>
|
|
169
|
+
<Switch id="sb-google" bind:checked={socialGoogle} />
|
|
170
|
+
</div>
|
|
171
|
+
<Separator />
|
|
172
|
+
<div class="flex items-center justify-between gap-4">
|
|
173
|
+
<div class="space-y-1">
|
|
174
|
+
<Label for="sb-2fa">{i18n.t('account.twoFactorAuth')}</Label>
|
|
175
|
+
<p class="text-xs text-muted-foreground">{i18n.t('security.twoFactorDescription')}</p>
|
|
176
|
+
</div>
|
|
177
|
+
<div class="flex items-center gap-2">
|
|
178
|
+
<Badge variant="secondary" class="text-[10px]">{twoFactor ? i18n.t('security.twoFactorActive') : i18n.t('security.twoFactorInactive')}</Badge>
|
|
179
|
+
<Switch id="sb-2fa" bind:checked={twoFactor} />
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
</Card.CardContent>
|
|
183
|
+
</Card.Card>
|
|
57
184
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
</
|
|
63
|
-
<
|
|
64
|
-
|
|
185
|
+
<!-- Password -->
|
|
186
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-password">
|
|
187
|
+
<Card.CardHeader>
|
|
188
|
+
<Card.CardTitle class="text-base">{i18n.t('account.password')}</Card.CardTitle>
|
|
189
|
+
</Card.CardHeader>
|
|
190
|
+
<Card.CardContent>
|
|
191
|
+
<div class="grid gap-4 sm:grid-cols-3">
|
|
192
|
+
<div class="space-y-2">
|
|
193
|
+
<Label for="sb-current-pw">{i18n.t('profile.currentPassword')}</Label>
|
|
194
|
+
<Input id="sb-current-pw" type="password" />
|
|
195
|
+
</div>
|
|
196
|
+
<div class="space-y-2">
|
|
197
|
+
<Label for="sb-new-pw">{i18n.t('profile.newPassword')}</Label>
|
|
198
|
+
<Input id="sb-new-pw" type="password" />
|
|
199
|
+
</div>
|
|
200
|
+
<div class="space-y-2">
|
|
201
|
+
<Label for="sb-confirm-pw">{i18n.t('auth.confirmPassword')}</Label>
|
|
202
|
+
<Input id="sb-confirm-pw" type="password" />
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</Card.CardContent>
|
|
206
|
+
</Card.Card>
|
|
65
207
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
</
|
|
71
|
-
<
|
|
72
|
-
|
|
208
|
+
<!-- SSO -->
|
|
209
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-sso">
|
|
210
|
+
<Card.CardHeader>
|
|
211
|
+
<Card.CardTitle class="text-base">{i18n.t('account.singleSignOn')}</Card.CardTitle>
|
|
212
|
+
</Card.CardHeader>
|
|
213
|
+
<Card.CardContent>
|
|
214
|
+
<div class="grid gap-4 sm:grid-cols-2">
|
|
215
|
+
<div class="space-y-2">
|
|
216
|
+
<Label for="sb-client-id">Client ID</Label>
|
|
217
|
+
<Input id="sb-client-id" placeholder="xxxxxxxx-xxxx-xxxx" />
|
|
218
|
+
</div>
|
|
219
|
+
<div class="space-y-2">
|
|
220
|
+
<Label for="sb-client-secret">Client Secret</Label>
|
|
221
|
+
<Input id="sb-client-secret" type="password" placeholder="••••••••" />
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</Card.CardContent>
|
|
225
|
+
</Card.Card>
|
|
73
226
|
|
|
74
|
-
|
|
227
|
+
<!-- Preferences -->
|
|
228
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-preferences">
|
|
229
|
+
<Card.CardHeader>
|
|
230
|
+
<Card.CardTitle class="text-base">{i18n.t('account.preferences')}</Card.CardTitle>
|
|
231
|
+
</Card.CardHeader>
|
|
232
|
+
<Card.CardContent>
|
|
233
|
+
<div class="grid gap-4 sm:grid-cols-3">
|
|
234
|
+
<div class="space-y-2">
|
|
235
|
+
<Label for="sb-language">{i18n.t('account.language')}</Label>
|
|
236
|
+
<select id="sb-language" bind:value={language} class="flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring">
|
|
237
|
+
<option value="en">English</option>
|
|
238
|
+
<option value="zh-CN">中文(简体)</option>
|
|
239
|
+
</select>
|
|
240
|
+
</div>
|
|
241
|
+
<div class="space-y-2">
|
|
242
|
+
<Label for="sb-timezone">{i18n.t('account.timezone')}</Label>
|
|
243
|
+
<select id="sb-timezone" bind:value={timezone} class="flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring">
|
|
244
|
+
<option value="Asia/Shanghai">Asia/Shanghai (GMT+8)</option>
|
|
245
|
+
<option value="America/Los_Angeles">America/Los_Angeles (GMT-7)</option>
|
|
246
|
+
<option value="Europe/Berlin">Europe/Berlin (GMT+2)</option>
|
|
247
|
+
</select>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="space-y-2">
|
|
250
|
+
<Label for="sb-currency">{i18n.t('account.currency')}</Label>
|
|
251
|
+
<select id="sb-currency" bind:value={currency} class="flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring">
|
|
252
|
+
<option value="CNY">CNY (¥)</option>
|
|
253
|
+
<option value="USD">USD ($)</option>
|
|
254
|
+
<option value="EUR">EUR (€)</option>
|
|
255
|
+
</select>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</Card.CardContent>
|
|
259
|
+
</Card.Card>
|
|
75
260
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
261
|
+
<!-- Address -->
|
|
262
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-address">
|
|
263
|
+
<Card.CardHeader>
|
|
264
|
+
<Card.CardTitle class="text-base">{i18n.t('account.address')}</Card.CardTitle>
|
|
265
|
+
</Card.CardHeader>
|
|
266
|
+
<Card.CardContent>
|
|
267
|
+
<div class="grid gap-4 sm:grid-cols-2">
|
|
268
|
+
<div class="space-y-2">
|
|
269
|
+
<Label for="sb-country">{i18n.t('account.country')}</Label>
|
|
270
|
+
<Input id="sb-country" value="China" />
|
|
271
|
+
</div>
|
|
272
|
+
<div class="space-y-2">
|
|
273
|
+
<Label for="sb-city">{i18n.t('account.city')}</Label>
|
|
274
|
+
<Input id="sb-city" value="Shanghai" />
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</Card.CardContent>
|
|
278
|
+
</Card.Card>
|
|
91
279
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
280
|
+
<!-- Manage API -->
|
|
281
|
+
<Card.Card class="border-border/60 scroll-mt-6" id="settings-section-api">
|
|
282
|
+
<Card.CardHeader>
|
|
283
|
+
<Card.CardTitle class="flex items-center gap-2 text-base">
|
|
284
|
+
<Key class="h-4 w-4 text-muted-foreground" />{i18n.t('account.manageApi')}
|
|
285
|
+
</Card.CardTitle>
|
|
286
|
+
</Card.CardHeader>
|
|
287
|
+
<Card.CardContent>
|
|
288
|
+
<div class="flex items-center gap-2">
|
|
289
|
+
<Input readonly value={apiKey} class="h-9 font-mono text-xs" />
|
|
290
|
+
<Button size="sm" variant="outline" onclick={copyApiKey}>
|
|
291
|
+
{#if copied}<Check class="h-4 w-4 text-green-500" />{:else}<Copy class="h-4 w-4" />{/if}
|
|
292
|
+
</Button>
|
|
293
|
+
<Button size="sm" variant="ghost">{i18n.t('api.regenerate')}</Button>
|
|
294
|
+
</div>
|
|
295
|
+
</Card.CardContent>
|
|
296
|
+
</Card.Card>
|
|
297
|
+
|
|
298
|
+
<!-- Delete Account -->
|
|
299
|
+
<Card.Card class="border-destructive/30 scroll-mt-6" id="settings-section-delete">
|
|
300
|
+
<Card.CardHeader>
|
|
301
|
+
<Card.CardTitle class="text-base text-destructive">{i18n.t('account.deleteAccount')}</Card.CardTitle>
|
|
302
|
+
<Card.CardDescription>{i18n.t('account.deleteAccountDescription')}</Card.CardDescription>
|
|
303
|
+
</Card.CardHeader>
|
|
304
|
+
<Card.CardContent>
|
|
305
|
+
<div class="flex justify-end">
|
|
306
|
+
<Button variant="destructive" size="sm">{i18n.t('account.deleteAccount')}</Button>
|
|
307
|
+
</div>
|
|
308
|
+
</Card.CardContent>
|
|
309
|
+
</Card.Card>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
100
312
|
</div>
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import * as Card from '../ui/card/index.js';
|
|
4
4
|
import { Button } from '../ui/button/index.js';
|
|
5
5
|
import { Input } from '../ui/input/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Label } from '../ui/label/index.js';
|
|
7
|
+
import { Search, UserPlus, MoreHorizontal, Link2, Copy, Send } from '@lucide/svelte';
|
|
7
8
|
|
|
8
9
|
const i18n = useTranslation();
|
|
9
10
|
|
|
@@ -19,6 +20,15 @@
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
let searchQuery = $state('');
|
|
23
|
+
let inviteEmail = $state('');
|
|
24
|
+
let inviteRole = $state('Viewer');
|
|
25
|
+
let linkCopied = $state(false);
|
|
26
|
+
|
|
27
|
+
function copyInviteLink() {
|
|
28
|
+
navigator.clipboard?.writeText('https://acme.com/invite/xK7fQ2').catch(() => {});
|
|
29
|
+
linkCopied = true;
|
|
30
|
+
setTimeout(() => linkCopied = false, 2000);
|
|
31
|
+
}
|
|
22
32
|
|
|
23
33
|
let members = $state<TeamMember[]>([
|
|
24
34
|
{ id: '1', name: 'Alex Chen', email: 'alex@acme.com', role: 'Admin', department: 'Engineering', status: 'active', lastActive: 'Just now' },
|
|
@@ -27,6 +37,14 @@
|
|
|
27
37
|
{ id: '4', name: 'Lisa Wang', email: 'lisa@acme.com', role: 'Editor', department: 'Engineering', status: 'active', lastActive: '1 hour ago' },
|
|
28
38
|
{ id: '5', name: 'Tom Brown', email: 'tom@acme.com', role: 'Viewer', department: 'Sales', status: 'inactive', lastActive: '2 weeks ago' },
|
|
29
39
|
{ id: '6', name: 'Emma Davis', email: 'emma@acme.com', role: 'Admin', department: 'Engineering', status: 'active', lastActive: '10 min ago' },
|
|
40
|
+
{ id: '7', name: 'James Wilson', email: 'james@acme.com', role: 'Editor', department: 'Infrastructure', status: 'active', lastActive: '30 min ago' },
|
|
41
|
+
{ id: '8', name: 'Yuki Tanaka', email: 'yuki@acme.com', role: 'Editor', department: 'Engineering', status: 'invited', lastActive: 'Pending' },
|
|
42
|
+
{ id: '9', name: 'Priya Nair', email: 'priya@acme.com', role: 'Viewer', department: 'Data', status: 'active', lastActive: '2 hours ago' },
|
|
43
|
+
{ id: '10', name: 'Carlos Mendez', email: 'carlos@acme.com', role: 'Editor', department: 'Engineering', status: 'active', lastActive: '1 day ago' },
|
|
44
|
+
{ id: '11', name: 'Hana Sato', email: 'hana@acme.com', role: 'Viewer', department: 'Design', status: 'active', lastActive: '3 hours ago' },
|
|
45
|
+
{ id: '12', name: 'Oscar Lund', email: 'oscar@acme.com', role: 'Viewer', department: 'Infrastructure', status: 'inactive', lastActive: '1 month ago' },
|
|
46
|
+
{ id: '13', name: 'Mia Torres', email: 'mia@acme.com', role: 'Editor', department: 'Marketing', status: 'invited', lastActive: 'Pending' },
|
|
47
|
+
{ id: '14', name: 'Chen Wei', email: 'chen@acme.com', role: 'Admin', department: 'Engineering', status: 'active', lastActive: '15 min ago' },
|
|
30
48
|
]);
|
|
31
49
|
|
|
32
50
|
const filtered = $derived(
|
|
@@ -59,7 +77,7 @@
|
|
|
59
77
|
<div class="space-y-6" data-svadmin-content-page="account">
|
|
60
78
|
<div class="flex items-start justify-between gap-4">
|
|
61
79
|
<div>
|
|
62
|
-
<h2 class="text-xl font-semibold text-foreground">{i18n.t('account.
|
|
80
|
+
<h2 class="text-xl font-semibold text-foreground">{i18n.t('account.teamMembersCount', { count: members.length })}</h2>
|
|
63
81
|
<p class="mt-1 text-sm text-muted-foreground">{i18n.t('account.teamMembersDescription')}</p>
|
|
64
82
|
</div>
|
|
65
83
|
<Button size="sm">
|
|
@@ -72,6 +90,54 @@
|
|
|
72
90
|
<Input placeholder={i18n.t('common.search')} bind:value={searchQuery} class="pl-9" />
|
|
73
91
|
</div>
|
|
74
92
|
|
|
93
|
+
<!-- Invite people -->
|
|
94
|
+
<div class="grid gap-4 lg:grid-cols-2">
|
|
95
|
+
<Card.Card class="border-border/60">
|
|
96
|
+
<Card.CardHeader class="pb-3">
|
|
97
|
+
<Card.CardTitle class="text-base">{i18n.t('account.invitePeople')}</Card.CardTitle>
|
|
98
|
+
<Card.CardDescription>{i18n.t('account.invitePeopleDescription')}</Card.CardDescription>
|
|
99
|
+
</Card.CardHeader>
|
|
100
|
+
<Card.CardContent class="space-y-3">
|
|
101
|
+
<div class="grid gap-3 sm:grid-cols-[1fr_140px]">
|
|
102
|
+
<div class="space-y-1.5">
|
|
103
|
+
<Label for="invite-email">Email</Label>
|
|
104
|
+
<Input id="invite-email" type="email" placeholder="name@example.com" bind:value={inviteEmail} />
|
|
105
|
+
</div>
|
|
106
|
+
<div class="space-y-1.5">
|
|
107
|
+
<Label for="invite-role">{i18n.t('account.role')}</Label>
|
|
108
|
+
<select id="invite-role" bind:value={inviteRole} class="flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring">
|
|
109
|
+
<option>Admin</option>
|
|
110
|
+
<option>Editor</option>
|
|
111
|
+
<option>Viewer</option>
|
|
112
|
+
</select>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="flex justify-end">
|
|
116
|
+
<Button size="sm" disabled={!inviteEmail}>
|
|
117
|
+
<Send class="h-3.5 w-3.5 mr-1" />{i18n.t('account.sendInvite')}
|
|
118
|
+
</Button>
|
|
119
|
+
</div>
|
|
120
|
+
</Card.CardContent>
|
|
121
|
+
</Card.Card>
|
|
122
|
+
|
|
123
|
+
<Card.Card class="border-border/60">
|
|
124
|
+
<Card.CardHeader class="pb-3">
|
|
125
|
+
<Card.CardTitle class="flex items-center gap-2 text-base">
|
|
126
|
+
<Link2 class="h-4 w-4 text-muted-foreground" />{i18n.t('account.inviteWithLink')}
|
|
127
|
+
</Card.CardTitle>
|
|
128
|
+
<Card.CardDescription>{i18n.t('account.inviteLinkHint')}</Card.CardDescription>
|
|
129
|
+
</Card.CardHeader>
|
|
130
|
+
<Card.CardContent class="space-y-3">
|
|
131
|
+
<div class="flex items-center gap-2">
|
|
132
|
+
<Input readonly value="https://acme.com/invite/xK7fQ2" class="flex-1 font-mono text-xs" />
|
|
133
|
+
<Button size="sm" variant="outline" onclick={copyInviteLink}>
|
|
134
|
+
<Copy class="h-3.5 w-3.5 mr-1" />{linkCopied ? '✓' : ''} {i18n.t('account.copyLink')}
|
|
135
|
+
</Button>
|
|
136
|
+
</div>
|
|
137
|
+
</Card.CardContent>
|
|
138
|
+
</Card.Card>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
75
141
|
<!-- Members grid -->
|
|
76
142
|
<div class="grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
|
|
77
143
|
{#each filtered as member (member.id)}
|