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.
Files changed (56) hide show
  1. package/dist/auth/reset-password.svelte +27 -15
  2. package/dist/auth/reset-password.svelte.d.ts +7 -17
  3. package/dist/auth/sign-in.svelte +51 -23
  4. package/dist/auth/sign-in.svelte.d.ts +11 -1
  5. package/dist/auth/sign-up.svelte +62 -23
  6. package/dist/auth/sign-up.svelte.d.ts +13 -0
  7. package/dist/components/app/nav/app-sidebar.svelte +35 -0
  8. package/dist/components/app/nav/app-sidebar.svelte.d.ts +8 -0
  9. package/dist/components/app/nav/breadcrumb.svelte +42 -0
  10. package/dist/components/app/nav/breadcrumb.svelte.d.ts +19 -0
  11. package/dist/components/auth/google-sign-in.svelte +55 -53
  12. package/dist/components/auth/reset-password-form.svelte +49 -47
  13. package/dist/components/auth/reset-password-form.svelte.d.ts +3 -17
  14. package/dist/components/auth/sign-in-form.svelte +21 -5
  15. package/dist/components/auth/sign-in-form.svelte.d.ts +7 -17
  16. package/dist/components/auth/sign-up-form.svelte +127 -110
  17. package/dist/components/auth/sign-up-form.svelte.d.ts +10 -17
  18. package/dist/components/auth/user-button/profile-section/avatar-user.svelte +107 -0
  19. package/dist/components/auth/user-button/profile-section/avatar-user.svelte.d.ts +2 -0
  20. package/dist/components/auth/user-button/profile-section/connect-user.svelte +45 -0
  21. package/dist/components/auth/user-button/profile-section/connect-user.svelte.d.ts +18 -0
  22. package/dist/components/auth/user-button/profile-section/email-user.svelte +81 -0
  23. package/dist/components/auth/user-button/profile-section/email-user.svelte.d.ts +2 -0
  24. package/dist/components/auth/user-button/profile-section/phone-user.svelte +122 -0
  25. package/dist/components/auth/user-button/profile-section/phone-user.svelte.d.ts +2 -0
  26. package/dist/components/auth/user-button/profile-section/profile-section.svelte +17 -0
  27. package/dist/components/auth/user-button/profile-section/profile-section.svelte.d.ts +18 -0
  28. package/dist/components/auth/user-button/settings-dialog.svelte +80 -87
  29. package/dist/components/auth/user-button/type-account.svelte +35 -0
  30. package/dist/components/auth/user-button/type-account.svelte.d.ts +4 -0
  31. package/dist/components/auth/user-button/user-button.svelte +122 -112
  32. package/dist/components/nav/nav-main.svelte +70 -0
  33. package/dist/components/nav/nav-main.svelte.d.ts +18 -0
  34. package/dist/components/ui/badge/badge.svelte +49 -0
  35. package/dist/components/ui/badge/badge.svelte.d.ts +59 -0
  36. package/dist/components/ui/badge/index.d.ts +2 -0
  37. package/dist/components/ui/badge/index.js +2 -0
  38. package/dist/components/ui/collapsible/index.d.ts +5 -0
  39. package/dist/components/ui/collapsible/index.js +7 -0
  40. package/dist/config.d.ts +2 -0
  41. package/dist/config.js +28 -0
  42. package/dist/firebase/auth/auth-guard.svelte.d.ts +0 -30
  43. package/dist/firebase/auth/auth-guard.svelte.js +119 -103
  44. package/dist/firebase/auth/auth-manager.svelte.d.ts +73 -0
  45. package/dist/firebase/auth/auth-manager.svelte.js +257 -0
  46. package/dist/firebase/auth/auth.js +2 -2
  47. package/dist/firebase/auth/user.svelte.d.ts +0 -53
  48. package/dist/firebase/auth/user.svelte.js +177 -134
  49. package/dist/firebase/firestore/document-mutations.svelte.d.ts +1 -1
  50. package/dist/firebase/firestore/document-mutations.svelte.js +18 -13
  51. package/dist/firebase/storage/upload-task.svelte.d.ts +1 -0
  52. package/dist/firebase/storage/upload-task.svelte.js +4 -2
  53. package/dist/index.d.ts +1 -3
  54. package/dist/index.js +3 -3
  55. package/dist/types/nav.d.ts +4 -0
  56. 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,2 @@
1
+ declare const PhoneUser: import("svelte").Component<Record<string, never>, {}, "">;
2
+ export default PhoneUser;
@@ -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
- 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";
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
- import Lock from "lucide-svelte/icons/lock";
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
- import { firekitUser } from "../../../firebase/auth/user.svelte.js";
10
- import { User2 } from "lucide-svelte";
11
+ const data = {
12
+ nav: [
13
+ { name: "Profile", icon: User2 },
14
+ { name: "Security", icon: Lock },
15
+ ],
16
+ };
11
17
 
12
- const data = {
13
- nav: [
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
- <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 ===
45
- "Messages & media"}
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="#"
70
- >Settings</Breadcrumb.Link
71
- >
72
- </Breadcrumb.Item>
73
- <Breadcrumb.Separator class="hidden md:block" />
74
- <Breadcrumb.Item>
75
- <Breadcrumb.Page
76
- >Messages & media</Breadcrumb.Page
77
- >
78
- </Breadcrumb.Item>
79
- </Breadcrumb.List>
80
- </Breadcrumb.Root>
81
- </div>
82
- </header>
83
- <div
84
- class="flex flex-1 flex-col gap-4 overflow-y-auto p-4 pt-0"
85
- >
86
- {#each Array.from({ length: 10 }) as _, i (i)}
87
- <div
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}
@@ -0,0 +1,4 @@
1
+ declare const TypeAccount: import("svelte").Component<{
2
+ account: string;
3
+ }, {}, "">;
4
+ export default TypeAccount;
@@ -1,121 +1,131 @@
1
1
  <script lang="ts">
2
- import * as DropdownMenu from "../../ui/dropdown-menu/index.js";
3
- import * as Avatar from "../../ui/avatar/index.js";
4
- import { getInitials } from "../../../utils.js";
5
- import type { NavItem } from "../../../types/nav.js";
6
- let { nav }: { nav?: NavItem[] } = $props();
7
- import * as AlertDialog from "../../ui/alert-dialog/index.js";
8
- import Button from "../../ui/button/button.svelte";
9
- import { firekitUser } from "../../../firebase/auth/user.svelte.js";
10
- import { firekitAuth } from "../../../firebase/auth/auth.js";
11
- import { LogOut } from "lucide-svelte";
12
- import SettingsDialog from "./settings-dialog.svelte";
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
- async function handleLogout() {
16
- await firekitAuth.logOut();
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 firekitUser.user}
21
- <DropdownMenu.Root>
22
- <DropdownMenu.Trigger>
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
- <Avatar.Image src={firekitUser.photoURL} alt="Avatar" />
25
- <Avatar.Fallback>
26
- {getInitials(firekitUser.displayName)}
27
- </Avatar.Fallback>
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
- </DropdownMenu.Trigger>
30
- <DropdownMenu.Content>
31
- <DropdownMenu.Group>
32
- <DropdownMenu.GroupHeading>
33
- <div class="flex items-center gap-3">
34
- <Avatar.Root>
35
- <Avatar.Image
36
- src={firekitUser.photoURL}
37
- alt="Avatar"
38
- />
39
- <Avatar.Fallback>
40
- {getInitials(firekitUser.displayName)}
41
- </Avatar.Fallback>
42
- </Avatar.Root>
43
- <div class="grow">
44
- <span
45
- class="block font-medium text-sm text-gray-800 dark:text-neutral-200"
46
- >
47
- {firekitUser.displayName}
48
- </span>
49
- <p class="text-xs text-foreground-500">
50
- {firekitUser.email}
51
- </p>
52
- </div>
53
- </div>
54
- </DropdownMenu.GroupHeading>
55
- <DropdownMenu.Separator />
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
- <DropdownMenu.Separator />
72
- <DropdownMenu.Item onclick={handleLogout}>
73
- <LogOut /> Logout
74
- </DropdownMenu.Item>
75
- </DropdownMenu.Group>
76
- </DropdownMenu.Content>
77
- </DropdownMenu.Root>
78
- <AlertDialog.Root bind:open={isOpen}>
79
- <AlertDialog.Content>
80
- <AlertDialog.Header>
81
- <AlertDialog.Title>
82
- <div class="flex justify-between items-center">
83
- <div class="flex items-center gap-3">
84
- <Avatar.Root>
85
- <Avatar.Image
86
- src={firekitUser.photoURL}
87
- alt="Avatar"
88
- />
89
- <Avatar.Fallback>
90
- {getInitials(firekitUser.displayName)}
91
- </Avatar.Fallback>
92
- </Avatar.Root>
93
- <div class="grow">
94
- <span
95
- class="block font-medium text-sm text-gray-800 dark:text-neutral-200"
96
- >
97
- {firekitUser.displayName}
98
- </span>
99
- <p class="text-xs text-foreground-500">
100
- {firekitUser.email}
101
- </p>
102
- </div>
103
- </div>
104
- <Button onclick={handleLogout} variant="link">
105
- <LogOut />Logout
106
- </Button>
107
- </div>
108
- </AlertDialog.Title>
109
- <AlertDialog.Description>
110
- Manage your name, password and account settings.
111
- </AlertDialog.Description>
112
- </AlertDialog.Header>
113
- <AlertDialog.Footer>
114
- <AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
115
- <AlertDialog.Action>Continue</AlertDialog.Action>
116
- </AlertDialog.Footer>
117
- </AlertDialog.Content>
118
- </AlertDialog.Root>
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
- <Button href="/login">Login</Button>
130
+ <Button href="/login">Login</Button>
121
131
  {/if}