|
1 | | -<script setup> |
2 | | -const { loggedIn, session, clear } = useUserSession() |
| 1 | +<script setup lang="ts"> |
| 2 | +const { loggedIn, user, session, clear } = useUserSession() |
| 3 | +
|
| 4 | +const providers = computed(() => [ |
| 5 | + { |
| 6 | + label: session.value.user?.github?.login || 'GitHub', |
| 7 | + to: '/auth/github', |
| 8 | + disabled: Boolean(user.value?.github), |
| 9 | + icon: 'i-simple-icons-github', |
| 10 | + }, |
| 11 | + { |
| 12 | + label: session.value.user?.spotify?.display_name || 'Spotify', |
| 13 | + to: '/auth/spotify', |
| 14 | + disabled: Boolean(user.value?.spotify), |
| 15 | + icon: 'i-simple-icons-spotify', |
| 16 | + }, |
| 17 | + { |
| 18 | + label: session.value.user?.google?.email || 'Google', |
| 19 | + to: '/auth/google', |
| 20 | + disabled: Boolean(user.value?.google), |
| 21 | + icon: 'i-simple-icons-google', |
| 22 | + }, |
| 23 | + { |
| 24 | + label: session.value.user?.twitch?.login || 'Twitch', |
| 25 | + to: '/auth/twitch', |
| 26 | + disabled: Boolean(user.value?.twitch), |
| 27 | + icon: 'i-simple-icons-twitch', |
| 28 | + }, |
| 29 | + { |
| 30 | + label: user.value?.auth0?.email || 'Auth0', |
| 31 | + to: '/auth/auth0', |
| 32 | + disabled: Boolean(user.value?.auth0), |
| 33 | + icon: 'i-simple-icons-auth0', |
| 34 | + }, |
| 35 | + { |
| 36 | + label: user.value?.discord?.username || 'Discord', |
| 37 | + to: '/auth/discord', |
| 38 | + disabled: Boolean(user.value?.discord), |
| 39 | + icon: 'i-simple-icons-discord', |
| 40 | + }, |
| 41 | + { |
| 42 | + label: user.value?.battledotnet?.battletag || 'Battle.net', |
| 43 | + to: '/auth/battledotnet', |
| 44 | + disabled: Boolean(user.value?.battledotnet), |
| 45 | + icon: 'i-simple-icons-battledotnet', |
| 46 | + }, |
| 47 | +].map(p => ({ |
| 48 | + ...p, |
| 49 | + prefetch: false, |
| 50 | + external: true, |
| 51 | +}))) |
3 | 52 | </script> |
4 | 53 |
|
5 | 54 | <template> |
6 | 55 | <UHeader> |
7 | 56 | <template #right> |
8 | | - <UButton |
9 | | - v-if="!loggedIn || !session.user.github" |
10 | | - to="/auth/github" |
11 | | - icon="i-simple-icons-github" |
12 | | - external |
13 | | - color="gray" |
14 | | - size="xs" |
15 | | - > |
16 | | - Login with GitHub |
17 | | - </UButton> |
18 | | - <UButton |
19 | | - v-if="!loggedIn || !session.user.spotify" |
20 | | - to="/auth/spotify" |
21 | | - icon="i-simple-icons-spotify" |
22 | | - external |
23 | | - color="gray" |
24 | | - size="xs" |
25 | | - > |
26 | | - Login with Spotify |
27 | | - </UButton> |
28 | | - <UButton |
29 | | - v-if="!loggedIn || !session.user.google" |
30 | | - to="/auth/google" |
31 | | - icon="i-simple-icons-google" |
32 | | - external |
33 | | - color="gray" |
34 | | - size="xs" |
35 | | - > |
36 | | - Login with Google |
37 | | - </UButton> |
38 | | - <UButton |
39 | | - v-if="!loggedIn || !session.user.twitch" |
40 | | - to="/auth/twitch" |
41 | | - icon="i-simple-icons-twitch" |
42 | | - external |
43 | | - color="gray" |
44 | | - size="xs" |
45 | | - > |
46 | | - Login with Twitch |
47 | | - </UButton> |
48 | | - <UButton |
49 | | - v-if="!loggedIn || !session.user.auth0" |
50 | | - to="/auth/auth0" |
51 | | - icon="i-simple-icons-auth0" |
52 | | - external |
53 | | - color="gray" |
54 | | - size="xs" |
55 | | - > |
56 | | - Login with Auth0 |
57 | | - </UButton> |
58 | | - <UButton |
59 | | - v-if="!loggedIn || !session.user.discord" |
60 | | - to="/auth/discord" |
61 | | - icon="i-simple-icons-discord" |
62 | | - external |
63 | | - color="gray" |
64 | | - size="xs" |
65 | | - > |
66 | | - Login with Discord |
67 | | - </UButton> |
| 57 | + <UDropdown :items="[providers]"> |
| 58 | + <UButton |
| 59 | + icon="i-heroicons-chevron-down" |
| 60 | + trailing |
| 61 | + color="gray" |
| 62 | + size="xs" |
| 63 | + > |
| 64 | + Login with |
| 65 | + </UButton> |
| 66 | + </UDropdown> |
68 | 67 | <UButton |
69 | 68 | v-if="loggedIn" |
70 | 69 | color="gray" |
|
0 commit comments