@happydesigns/ui 0.15.0 → 0.15.1
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/app/app.config.ts
CHANGED
|
@@ -128,7 +128,7 @@ declare module '@nuxt/schema' {
|
|
|
128
128
|
copyrightYear?: number
|
|
129
129
|
/** The name of the copyright holder */
|
|
130
130
|
copyrightHolder?: string
|
|
131
|
-
/**
|
|
131
|
+
/** Optional homepage URL of the copyright holder; omit it to render plain text */
|
|
132
132
|
copyrightHomepage?: string
|
|
133
133
|
}
|
|
134
134
|
/** Social button definitions (e.g. Instagram, Facebook, GitHub) */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const props = defineProps<{
|
|
3
3
|
copyrightYear?: number
|
|
4
4
|
copyrightHolder?: string
|
|
5
|
+
/** Optional URL for the copyright holder. When omitted, the holder is rendered as plain text. */
|
|
5
6
|
copyrightHomepage?: string
|
|
6
7
|
}>()
|
|
7
8
|
|
|
@@ -26,9 +27,10 @@ const copyrightHomepage = props.copyrightHomepage ?? copyright?.copyrightHomepag
|
|
|
26
27
|
<template v-else>
|
|
27
28
|
<p class="text-muted text-sm">
|
|
28
29
|
Copyright © {{ copyrightYear }}
|
|
29
|
-
<ULink
|
|
30
|
+
<ULink v-if="copyrightHomepage" :to="copyrightHomepage">
|
|
30
31
|
{{ copyrightHolder }}
|
|
31
32
|
</ULink>
|
|
33
|
+
<span v-else>{{ copyrightHolder }}</span>
|
|
32
34
|
</p>
|
|
33
35
|
</template>
|
|
34
36
|
</div>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { StudioUser } from 'nuxt-studio/app'
|
|
3
|
+
|
|
4
|
+
withDefaults(defineProps<{
|
|
5
|
+
/** Accessible label for the icon-only button. */
|
|
6
|
+
ariaLabel?: string
|
|
7
|
+
/** Icon rendered by the underlying UButton. */
|
|
8
|
+
icon?: string
|
|
9
|
+
/** Optional visible button label. */
|
|
10
|
+
label?: string
|
|
11
|
+
}>(), {
|
|
12
|
+
ariaLabel: 'Open Nuxt Studio',
|
|
13
|
+
icon: 'i-lucide-log-in',
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
interface StudioSession {
|
|
17
|
+
user?: StudioUser | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const runtimeConfig = useRuntimeConfig()
|
|
21
|
+
const sessionCheckCookie = useCookie<string | null>('studio-session-check')
|
|
22
|
+
const sessionUser = ref<StudioUser | null | undefined>()
|
|
23
|
+
|
|
24
|
+
const studio = computed(() => runtimeConfig.public.studio)
|
|
25
|
+
const studioRoute = computed(() => studio.value.route || '/_studio')
|
|
26
|
+
|
|
27
|
+
onMounted(async () => {
|
|
28
|
+
if (studio.value.dev) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (String(sessionCheckCookie.value) !== 'true') {
|
|
33
|
+
sessionUser.value = null
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const session = await $fetch('/__nuxt_studio/auth/session') as StudioSession
|
|
39
|
+
sessionUser.value = session.user ?? null
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
sessionUser.value = null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!sessionUser.value?.email) {
|
|
46
|
+
sessionCheckCookie.value = null
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const isLoggedIn = computed(() => {
|
|
51
|
+
if (studio.value.dev) {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (String(sessionCheckCookie.value) !== 'true') {
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (sessionUser.value === undefined) {
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return Boolean(sessionUser.value?.email)
|
|
64
|
+
})
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<UButton
|
|
69
|
+
v-if="!isLoggedIn"
|
|
70
|
+
:to="studioRoute"
|
|
71
|
+
external
|
|
72
|
+
:aria-label="ariaLabel"
|
|
73
|
+
:icon="icon"
|
|
74
|
+
:label="label"
|
|
75
|
+
color="neutral"
|
|
76
|
+
variant="outline"
|
|
77
|
+
size="sm"
|
|
78
|
+
class="fixed bottom-2 left-2 z-50 print:hidden"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|