svelte-firekit 0.0.10 → 0.0.12
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/auth/reset-password.svelte +27 -15
- package/dist/auth/reset-password.svelte.d.ts +7 -17
- package/dist/auth/sign-in.svelte +51 -23
- package/dist/auth/sign-in.svelte.d.ts +11 -1
- package/dist/auth/sign-up.svelte +62 -23
- package/dist/auth/sign-up.svelte.d.ts +13 -0
- package/dist/components/app/nav/app-sidebar.svelte +35 -0
- package/dist/components/app/nav/app-sidebar.svelte.d.ts +8 -0
- package/dist/components/app/nav/breadcrumb.svelte +42 -0
- package/dist/components/app/nav/breadcrumb.svelte.d.ts +19 -0
- package/dist/components/auth/google-sign-in.svelte +55 -53
- package/dist/components/auth/reset-password-form.svelte +49 -47
- package/dist/components/auth/reset-password-form.svelte.d.ts +3 -17
- package/dist/components/auth/sign-in-form.svelte +21 -5
- package/dist/components/auth/sign-in-form.svelte.d.ts +7 -17
- package/dist/components/auth/sign-up-form.svelte +127 -110
- package/dist/components/auth/sign-up-form.svelte.d.ts +10 -17
- package/dist/components/auth/user-button/profile-section/avatar-user.svelte +107 -0
- package/dist/components/auth/user-button/profile-section/avatar-user.svelte.d.ts +2 -0
- package/dist/components/auth/user-button/profile-section/connect-user.svelte +45 -0
- package/dist/components/auth/user-button/profile-section/connect-user.svelte.d.ts +18 -0
- package/dist/components/auth/user-button/profile-section/email-user.svelte +81 -0
- package/dist/components/auth/user-button/profile-section/email-user.svelte.d.ts +2 -0
- package/dist/components/auth/user-button/profile-section/phone-user.svelte +122 -0
- package/dist/components/auth/user-button/profile-section/phone-user.svelte.d.ts +2 -0
- package/dist/components/auth/user-button/profile-section/profile-section.svelte +17 -0
- package/dist/components/auth/user-button/profile-section/profile-section.svelte.d.ts +18 -0
- package/dist/components/auth/user-button/settings-dialog.svelte +80 -87
- package/dist/components/auth/user-button/type-account.svelte +35 -0
- package/dist/components/auth/user-button/type-account.svelte.d.ts +4 -0
- package/dist/components/auth/user-button/user-button.svelte +122 -112
- package/dist/components/nav/nav-main.svelte +70 -0
- package/dist/components/nav/nav-main.svelte.d.ts +18 -0
- package/dist/components/ui/badge/badge.svelte +49 -0
- package/dist/components/ui/badge/badge.svelte.d.ts +59 -0
- package/dist/components/ui/badge/index.d.ts +2 -0
- package/dist/components/ui/badge/index.js +2 -0
- package/dist/components/ui/collapsible/index.d.ts +5 -0
- package/dist/components/ui/collapsible/index.js +7 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +28 -0
- package/dist/firebase/auth/auth-guard.svelte.d.ts +0 -30
- package/dist/firebase/auth/auth-guard.svelte.js +119 -103
- package/dist/firebase/auth/auth-manager.svelte.d.ts +73 -0
- package/dist/firebase/auth/auth-manager.svelte.js +257 -0
- package/dist/firebase/auth/auth.js +2 -2
- package/dist/firebase/auth/user.svelte.d.ts +0 -53
- package/dist/firebase/auth/user.svelte.js +177 -134
- package/dist/firebase/firestore/document-mutations.svelte.d.ts +1 -1
- package/dist/firebase/firestore/document-mutations.svelte.js +18 -13
- package/dist/firebase/storage/upload-task.svelte.d.ts +1 -0
- package/dist/firebase/storage/upload-task.svelte.js +4 -2
- package/dist/index.d.ts +1 -3
- package/dist/index.js +3 -3
- package/dist/types/nav.d.ts +4 -0
- package/package.json +4 -2
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from "../../../ui/button/button.svelte";
|
|
3
|
+
import { firekitAuthManager } from "../../../../firebase/auth/auth-manager.svelte.js";
|
|
4
|
+
|
|
5
|
+
import Input from "../../../ui/input/input.svelte";
|
|
6
|
+
import { toast } from "svelte-sonner";
|
|
7
|
+
import intlTelInput from "intl-tel-input";
|
|
8
|
+
import { onMount } from "svelte";
|
|
9
|
+
|
|
10
|
+
let phoneNumber = ""; // Inicializa como una cadena vacía
|
|
11
|
+
let haserror = false;
|
|
12
|
+
let it: any = null;
|
|
13
|
+
let _phone: any = { valid: false, value: "", error: "" };
|
|
14
|
+
|
|
15
|
+
onMount(() => {
|
|
16
|
+
const input: HTMLInputElement | null =
|
|
17
|
+
document.querySelector("#phonenumberuser");
|
|
18
|
+
if (input) {
|
|
19
|
+
it = intlTelInput(input, {
|
|
20
|
+
utilsScript:
|
|
21
|
+
"https://cdn.jsdelivr.net/npm/intl-tel-input@24.7.0/build/js/utils.js",
|
|
22
|
+
separateDialCode: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Si ya existe un número de teléfono, configúralo visualmente en el input
|
|
26
|
+
if (firekitAuthManager.data?.phoneNumber) {
|
|
27
|
+
it.setNumber(firekitAuthManager.data.phoneNumber);
|
|
28
|
+
phoneNumber = firekitAuthManager.data.phoneNumber;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (firekitAuthManager.data?.phoneNumber) {
|
|
35
|
+
_phone.value = firekitAuthManager.data.phoneNumber;
|
|
36
|
+
phoneNumber = firekitAuthManager.data.phoneNumber;
|
|
37
|
+
|
|
38
|
+
// Si intlTelInput está inicializado, actualiza el input con el valor
|
|
39
|
+
if (it) {
|
|
40
|
+
it.setNumber(firekitAuthManager.data.phoneNumber);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
async function handleChangePhoneNumber() {
|
|
46
|
+
if (it) {
|
|
47
|
+
_phone.value = it.getNumber();
|
|
48
|
+
_phone.error = it.getValidationError();
|
|
49
|
+
_phone.valid = it.isValidNumber();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!_phone.valid) {
|
|
53
|
+
toast.error("Phone number invalid.");
|
|
54
|
+
haserror = true;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (_phone.value === firekitAuthManager.data?.phoneNumber) {
|
|
59
|
+
toast.error("The phone number is the same as your current phone number.");
|
|
60
|
+
haserror = true;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
await firekitAuthManager.updateUserData({ phoneNumber: _phone.value });
|
|
65
|
+
await firekitAuthManager.updateProfileInfo({});
|
|
66
|
+
toast.success("Phone number updated successfully.");
|
|
67
|
+
haserror = false;
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<section class="space-y-5 border-t-slate-200 border-t-[2px] pt-4">
|
|
72
|
+
<div class="grid sm:grid-cols-12 gap-y-1.5 sm:gap-y-0 sm:gap-x-5">
|
|
73
|
+
<div class="sm:col-span-4 xl:col-span-3">
|
|
74
|
+
<p
|
|
75
|
+
class="sm:mt-2.5 inline-block text-sm {haserror
|
|
76
|
+
? 'text-red-500'
|
|
77
|
+
: 'text-foreground-500'}"
|
|
78
|
+
>
|
|
79
|
+
Phone number
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div class="sm:col-span-8 xl:col-span-9">
|
|
84
|
+
<div class="flex flex-wrap j items-center gap-3 sm:gap-5">
|
|
85
|
+
<div class="flex gap-2 items-center w-full">
|
|
86
|
+
<div class="flex flex-col gap-2 text-sm leading-tight">
|
|
87
|
+
<div id="contentphone" class=" space-y-1 my-2">
|
|
88
|
+
<!-- <Label class={haserror ? "text-red-500" : ""}>Phone number:</Label
|
|
89
|
+
> -->
|
|
90
|
+
<!-- oninput={changePhone} -->
|
|
91
|
+
<Input
|
|
92
|
+
id={"phonenumberuser"}
|
|
93
|
+
bind:value={phoneNumber}
|
|
94
|
+
name="phone"
|
|
95
|
+
type="tel"
|
|
96
|
+
class="input input-bordered w-full rounded bg-transparent px-3 text-md border-[#DBDEE2]"
|
|
97
|
+
onbeforeinput={(e:any) => {
|
|
98
|
+
if (
|
|
99
|
+
!/^\d*$/.test(e.data) &&
|
|
100
|
+
e.inputType !== "deleteContentBackward" &&
|
|
101
|
+
e.inputType !== "deleteContentForward"
|
|
102
|
+
) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
placeholder="Phone number"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<Button
|
|
110
|
+
onclick={handleChangePhoneNumber}
|
|
111
|
+
variant="default"
|
|
112
|
+
class="bg-blue-500 hover:bg-blue-600 text-white block ml-auto"
|
|
113
|
+
>
|
|
114
|
+
Save
|
|
115
|
+
</Button>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<div></div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</section>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { firekitAuthManager } from "../../../../firebase/auth/auth-manager.svelte.js";
|
|
3
|
+
|
|
4
|
+
import AvatarUser from "./avatar-user.svelte";
|
|
5
|
+
import ConnectUser from "./connect-user.svelte";
|
|
6
|
+
import EmailUser from "./email-user.svelte";
|
|
7
|
+
import PhoneUser from "./phone-user.svelte";
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<h2 class=" pb-3 text-lg font-semibold">Profile Details</h2>
|
|
11
|
+
|
|
12
|
+
<AvatarUser></AvatarUser>
|
|
13
|
+
{#if firekitAuthManager.user?.providerData[0]?.providerId !== "google.com"}
|
|
14
|
+
<EmailUser></EmailUser>
|
|
15
|
+
{/if}
|
|
16
|
+
<PhoneUser></PhoneUser>
|
|
17
|
+
<ConnectUser></ConnectUser>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ProfileSection: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ProfileSection = InstanceType<typeof ProfileSection>;
|
|
18
|
+
export default ProfileSection;
|
|
@@ -1,95 +1,88 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import * as Breadcrumb from "../../ui/breadcrumb/index.js";
|
|
3
|
+
import { Button } from "../../ui/button/index.js";
|
|
4
|
+
import * as Dialog from "../../ui/dialog/index.js";
|
|
5
|
+
import * as Sidebar from "../../ui/sidebar/index.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import Lock from "lucide-svelte/icons/lock";
|
|
8
|
+
import { User2 } from "lucide-svelte";
|
|
9
|
+
import ProfileSection from "./profile-section/profile-section.svelte";
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const data = {
|
|
12
|
+
nav: [
|
|
13
|
+
{ name: "Profile", icon: User2 },
|
|
14
|
+
{ name: "Security", icon: Lock },
|
|
15
|
+
],
|
|
16
|
+
};
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{ name: "Profile", icon: User2 },
|
|
15
|
-
{ name: "Security", icon: Lock },
|
|
16
|
-
],
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let open = $state(false);
|
|
18
|
+
let open = $state(false);
|
|
19
|
+
let section = $state("Profile");
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<Dialog.Root bind:open>
|
|
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
|
-
class="bg-muted/50 aspect-video max-w-3xl rounded-xl"
|
|
89
|
-
></div>
|
|
90
|
-
{/each}
|
|
91
|
-
</div>
|
|
92
|
-
</main>
|
|
93
|
-
</Sidebar.Provider>
|
|
94
|
-
</Dialog.Content>
|
|
23
|
+
<Dialog.Trigger>
|
|
24
|
+
{#snippet child({ props })}
|
|
25
|
+
<Button size="sm" {...props}>Profile</Button>
|
|
26
|
+
{/snippet}
|
|
27
|
+
</Dialog.Trigger>
|
|
28
|
+
<Dialog.Content
|
|
29
|
+
class="overflow-hidden p-0 md:max-h-[500px] md:max-w-[700px] lg:max-w-[800px]"
|
|
30
|
+
>
|
|
31
|
+
<Dialog.Title class="sr-only">Settings</Dialog.Title>
|
|
32
|
+
<Dialog.Description class="sr-only"
|
|
33
|
+
>Customize your settings here.</Dialog.Description
|
|
34
|
+
>
|
|
35
|
+
<Sidebar.Provider class="items-start">
|
|
36
|
+
<Sidebar.Root collapsible="none" class="hidden md:flex">
|
|
37
|
+
<Sidebar.Content>
|
|
38
|
+
<Sidebar.Group>
|
|
39
|
+
<Sidebar.GroupContent>
|
|
40
|
+
<Sidebar.Menu>
|
|
41
|
+
{#each data.nav as item (item.name)}
|
|
42
|
+
<Sidebar.MenuItem>
|
|
43
|
+
<Sidebar.MenuButton
|
|
44
|
+
isActive={item.name === section}
|
|
45
|
+
onclick={() => (section = item.name)}
|
|
46
|
+
>
|
|
47
|
+
{#snippet child({ props })}
|
|
48
|
+
<a href="##" {...props}>
|
|
49
|
+
<item.icon />
|
|
50
|
+
<span>{item.name}</span>
|
|
51
|
+
</a>
|
|
52
|
+
{/snippet}
|
|
53
|
+
</Sidebar.MenuButton>
|
|
54
|
+
</Sidebar.MenuItem>
|
|
55
|
+
{/each}
|
|
56
|
+
</Sidebar.Menu>
|
|
57
|
+
</Sidebar.GroupContent>
|
|
58
|
+
</Sidebar.Group>
|
|
59
|
+
</Sidebar.Content>
|
|
60
|
+
</Sidebar.Root>
|
|
61
|
+
<main class="flex h-[480px] flex-1 flex-col overflow-hidden">
|
|
62
|
+
<header
|
|
63
|
+
class="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12"
|
|
64
|
+
>
|
|
65
|
+
<div class="flex items-center gap-2 px-4">
|
|
66
|
+
<Breadcrumb.Root>
|
|
67
|
+
<Breadcrumb.List>
|
|
68
|
+
<Breadcrumb.Item class="hidden md:block">
|
|
69
|
+
<Breadcrumb.Link href="#">Settings</Breadcrumb.Link>
|
|
70
|
+
</Breadcrumb.Item>
|
|
71
|
+
<Breadcrumb.Separator class="hidden md:block" />
|
|
72
|
+
<Breadcrumb.Item>
|
|
73
|
+
<Breadcrumb.Page>{section}</Breadcrumb.Page>
|
|
74
|
+
</Breadcrumb.Item>
|
|
75
|
+
</Breadcrumb.List>
|
|
76
|
+
</Breadcrumb.Root>
|
|
77
|
+
</div>
|
|
78
|
+
</header>
|
|
79
|
+
<div class="flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0">
|
|
80
|
+
{#if section === "Profile"}
|
|
81
|
+
<ProfileSection></ProfileSection>
|
|
82
|
+
{/if}
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
</main>
|
|
86
|
+
</Sidebar.Provider>
|
|
87
|
+
</Dialog.Content>
|
|
95
88
|
</Dialog.Root>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
const { account }: { account: string } = $props();
|
|
3
|
+
import { Mail } from "lucide-svelte";
|
|
4
|
+
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
{#if account === "google.com"}
|
|
8
|
+
<svg
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
x="0px"
|
|
11
|
+
y="0px"
|
|
12
|
+
width="18"
|
|
13
|
+
height="18"
|
|
14
|
+
viewBox="0 0 48 48"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
fill="#4caf50"
|
|
18
|
+
d="M45,16.2l-5,2.75l-5,4.75L35,40h7c1.657,0,3-1.343,3-3V16.2z"
|
|
19
|
+
></path><path
|
|
20
|
+
fill="#1e88e5"
|
|
21
|
+
d="M3,16.2l3.614,1.71L13,23.7V40H6c-1.657,0-3-1.343-3-3V16.2z"
|
|
22
|
+
></path><polygon
|
|
23
|
+
fill="#e53935"
|
|
24
|
+
points="35,11.2 24,19.45 13,11.2 12,17 13,23.7 24,31.95 35,23.7 36,17"
|
|
25
|
+
></polygon><path
|
|
26
|
+
fill="#c62828"
|
|
27
|
+
d="M3,12.298V16.2l10,7.5V11.2L9.876,8.859C9.132,8.301,8.228,8,7.298,8h0C4.924,8,3,9.924,3,12.298z"
|
|
28
|
+
></path><path
|
|
29
|
+
fill="#fbc02d"
|
|
30
|
+
d="M45,12.298V16.2l-10,7.5V11.2l3.124-2.341C38.868,8.301,39.772,8,40.702,8h0 C43.076,8,45,9.924,45,12.298z"
|
|
31
|
+
></path>
|
|
32
|
+
</svg>
|
|
33
|
+
{:else}
|
|
34
|
+
<Mail class="size-4" />
|
|
35
|
+
{/if}
|
|
@@ -1,121 +1,131 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let isOpen = $state(false);
|
|
2
|
+
import SettingsDialog from "./settings-dialog.svelte";
|
|
3
|
+
import * as DropdownMenu from "../../ui/dropdown-menu/index.js";
|
|
4
|
+
import * as Avatar from "../../ui/avatar/index.js";
|
|
5
|
+
import { getInitials } from "../../../utils.js";
|
|
6
|
+
import type { NavItem } from "../../../types/nav.js";
|
|
7
|
+
import * as AlertDialog from "../../ui/alert-dialog/index.js";
|
|
8
|
+
import Button from "../../ui/button/button.svelte";
|
|
9
|
+
import { firekitAuth } from "../../../firebase/auth/auth.js";
|
|
10
|
+
import { LogOut } from "lucide-svelte";
|
|
11
|
+
import { firekitAuthManager } from "../../../firebase/auth/auth-manager.svelte.js";
|
|
12
|
+
import { Skeleton } from "../../ui/skeleton/index.js";
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
let isOpen = $state(false);
|
|
15
|
+
|
|
16
|
+
let { nav }: { nav?: NavItem[] } = $props();
|
|
17
|
+
async function handleLogout() {
|
|
18
|
+
await firekitAuth.logOut();
|
|
19
|
+
}
|
|
18
20
|
</script>
|
|
19
21
|
|
|
20
|
-
{#if
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
{#if !firekitAuthManager.initialized}
|
|
23
|
+
<div class="flex gap-2 items-center mx-4">
|
|
24
|
+
<Skeleton class="size-12 rounded-full" />
|
|
25
|
+
<div class="space-y-2">
|
|
26
|
+
<Skeleton class="h-3 w-[100px]" />
|
|
27
|
+
<Skeleton class="h-3 w-[150px]" />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
{:else if firekitAuthManager.data}
|
|
31
|
+
<DropdownMenu.Root>
|
|
32
|
+
<DropdownMenu.Trigger>
|
|
33
|
+
<Avatar.Root>
|
|
34
|
+
<Avatar.Image src={firekitAuthManager.data?.photoURL} alt="Avatar" />
|
|
35
|
+
<Avatar.Fallback>
|
|
36
|
+
{getInitials(firekitAuthManager.data?.displayName)}
|
|
37
|
+
</Avatar.Fallback>
|
|
38
|
+
</Avatar.Root>
|
|
39
|
+
</DropdownMenu.Trigger>
|
|
40
|
+
<DropdownMenu.Content>
|
|
41
|
+
<DropdownMenu.Group>
|
|
42
|
+
<DropdownMenu.GroupHeading>
|
|
43
|
+
<div class="flex items-center gap-3">
|
|
23
44
|
<Avatar.Root>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
<Avatar.Image
|
|
46
|
+
src={firekitAuthManager.data?.photoURL}
|
|
47
|
+
alt="Avatar"
|
|
48
|
+
/>
|
|
49
|
+
<Avatar.Fallback>
|
|
50
|
+
{getInitials(firekitAuthManager.data?.displayName)}
|
|
51
|
+
</Avatar.Fallback>
|
|
28
52
|
</Avatar.Root>
|
|
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
|
-
<DropdownMenu.Item onclick={() => (isOpen = true)}>
|
|
57
|
-
{#snippet child({ props })}
|
|
58
|
-
<SettingsDialog child({ props }) />
|
|
59
|
-
{/snippet}
|
|
60
|
-
</DropdownMenu.Item>
|
|
61
|
-
{#if nav}
|
|
62
|
-
{#each nav as { href, label }}
|
|
63
|
-
<DropdownMenu.Item>
|
|
64
|
-
<a {href}>
|
|
65
|
-
{label}
|
|
66
|
-
</a>
|
|
67
|
-
</DropdownMenu.Item>
|
|
68
|
-
{/each}
|
|
69
|
-
{/if}
|
|
53
|
+
<div class="grow">
|
|
54
|
+
<span
|
|
55
|
+
class="block font-medium text-sm text-gray-800 dark:text-neutral-200"
|
|
56
|
+
>
|
|
57
|
+
{firekitAuthManager.data?.displayName}
|
|
58
|
+
</span>
|
|
59
|
+
<p class="text-xs text-foreground-500">
|
|
60
|
+
{firekitAuthManager.data?.email}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</DropdownMenu.GroupHeading>
|
|
65
|
+
<DropdownMenu.Separator />
|
|
66
|
+
<DropdownMenu.Item onclick={() => (isOpen = true)}>
|
|
67
|
+
{#snippet child({ props })}
|
|
68
|
+
<SettingsDialog child({ props }) />
|
|
69
|
+
{/snippet}
|
|
70
|
+
</DropdownMenu.Item>
|
|
71
|
+
{#if nav}
|
|
72
|
+
{#each nav as { href, label }}
|
|
73
|
+
<DropdownMenu.Item>
|
|
74
|
+
<a {href}>
|
|
75
|
+
{label}
|
|
76
|
+
</a>
|
|
77
|
+
</DropdownMenu.Item>
|
|
78
|
+
{/each}
|
|
79
|
+
{/if}
|
|
70
80
|
|
|
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
|
-
|
|
81
|
+
<DropdownMenu.Separator />
|
|
82
|
+
<DropdownMenu.Item onclick={handleLogout}>
|
|
83
|
+
<LogOut /> Logout
|
|
84
|
+
</DropdownMenu.Item>
|
|
85
|
+
</DropdownMenu.Group>
|
|
86
|
+
</DropdownMenu.Content>
|
|
87
|
+
</DropdownMenu.Root>
|
|
88
|
+
<AlertDialog.Root bind:open={isOpen}>
|
|
89
|
+
<AlertDialog.Content>
|
|
90
|
+
<AlertDialog.Header>
|
|
91
|
+
<AlertDialog.Title>
|
|
92
|
+
<div class="flex justify-between items-center">
|
|
93
|
+
<div class="flex items-center gap-3">
|
|
94
|
+
<Avatar.Root>
|
|
95
|
+
<Avatar.Image
|
|
96
|
+
src={firekitAuthManager.data?.photoURL}
|
|
97
|
+
alt="Avatar"
|
|
98
|
+
/>
|
|
99
|
+
<Avatar.Fallback>
|
|
100
|
+
{getInitials(firekitAuthManager.data?.displayName)}
|
|
101
|
+
</Avatar.Fallback>
|
|
102
|
+
</Avatar.Root>
|
|
103
|
+
<div class="grow">
|
|
104
|
+
<span
|
|
105
|
+
class="block font-medium text-sm text-gray-800 dark:text-neutral-200"
|
|
106
|
+
>
|
|
107
|
+
{firekitAuthManager.data?.displayName}
|
|
108
|
+
</span>
|
|
109
|
+
<p class="text-xs text-foreground-500">
|
|
110
|
+
{firekitAuthManager.data?.email}
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<Button onclick={handleLogout} variant="link">
|
|
115
|
+
<LogOut />Logout
|
|
116
|
+
</Button>
|
|
117
|
+
</div>
|
|
118
|
+
</AlertDialog.Title>
|
|
119
|
+
<AlertDialog.Description>
|
|
120
|
+
Manage your name, password and account settings.
|
|
121
|
+
</AlertDialog.Description>
|
|
122
|
+
</AlertDialog.Header>
|
|
123
|
+
<AlertDialog.Footer>
|
|
124
|
+
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
|
|
125
|
+
<AlertDialog.Action>Continue</AlertDialog.Action>
|
|
126
|
+
</AlertDialog.Footer>
|
|
127
|
+
</AlertDialog.Content>
|
|
128
|
+
</AlertDialog.Root>
|
|
119
129
|
{:else}
|
|
120
|
-
|
|
130
|
+
<Button href="/login">Login</Button>
|
|
121
131
|
{/if}
|