@plutocms/supabase 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.2](https://github.com/plutocms/supabase/compare/v0.2.1...v0.2.2) (2026-09-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **deps:** require pluto 0.3.2 ([6a6382a](https://github.com/plutocms/supabase/commit/6a6382aed8103a58f8b586df82e8e36e6e7c1f02))
9
+
10
+ ## [0.2.1](https://github.com/plutocms/supabase/compare/v0.2.0...v0.2.1) (2026-09-09)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **admin:** register navbar and isolate layer styles ([#37](https://github.com/plutocms/supabase/issues/37)) ([38853b9](https://github.com/plutocms/supabase/commit/38853b93d2664b583cc2b1c993c937cc8e895354))
16
+
3
17
  ## [0.2.0](https://github.com/plutocms/supabase/compare/v0.1.2...v0.2.0) (2026-09-09)
4
18
 
5
19
 
package/FEATURES.md ADDED
@@ -0,0 +1,7 @@
1
+ # Features
2
+
3
+ This file lists every implemented feature of this project. Each entry links to a skill file
4
+ with full detail, so this file stays short.
5
+
6
+ See the workspace-level `CLAUDE.md` (one directory up) for the delegation, writing, and git
7
+ policies shared by every project here.
@@ -1,5 +1,6 @@
1
- @import '@nuxt/ui' source(none);
2
- @import 'tailwindcss' source(none);
1
+ @import '@nuxt/ui';
2
+ @import 'tailwindcss';
3
3
 
4
+ @source '../..';
4
5
  @source '../../../node_modules/.c12/*/app/**';
5
6
  @source '@plutocms/pluto/app/**/*';
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { DropdownMenuItem } from '@nuxt/ui'
2
+ import { UDropdownMenu } from '#components'
3
3
  import { domainFromUrl } from '#imports'
4
4
 
5
5
  const host = useRequestURL().host
@@ -13,6 +13,24 @@ function openSidebar() {
13
13
 
14
14
  const { isLoggedIn, user, logout } = await useAuth()
15
15
 
16
+ const displayName = computed(() => {
17
+ return (
18
+ user.value?.display_name ||
19
+ user.value?.full_name ||
20
+ user.value?.name ||
21
+ user.value?.username ||
22
+ 'User'
23
+ )
24
+ })
25
+
26
+ const shortDisplayName = computed(() => displayName.value.split(' ')[0])
27
+
28
+ const userMenuLabel = computed(() => {
29
+ return user.value?.username
30
+ ? `${displayName.value} (${user.value.username})`
31
+ : displayName.value
32
+ })
33
+
16
34
  const has_settings_modified = useState<boolean>('has_settings_modified')
17
35
 
18
36
  const { data: settingsData, status } = await useFetch('/api/settings', {
@@ -27,10 +45,14 @@ const maybeDevUrl = computed(() => {
27
45
  return settingsData.value?.settings.website_url || ''
28
46
  })
29
47
 
30
- const items = ref<DropdownMenuItem[][]>([
48
+ type DropdownItems = NonNullable<
49
+ Parameters<typeof UDropdownMenu>[0]['items']
50
+ >
51
+
52
+ const items = computed<DropdownItems>(() => [
31
53
  [
32
54
  {
33
- label: `${user.value?.display_name} (${user.value?.username})` || 'User',
55
+ label: userMenuLabel.value,
34
56
  avatar: {
35
57
  icon: 'lucide:user',
36
58
  class: 'bg-green-600',
@@ -170,7 +192,7 @@ defineShortcuts(extractShortcuts(items.value))
170
192
  root: 'rounded-xl',
171
193
  icon: 'text-white text-lg',
172
194
  }"
173
- :alt="user?.value?.display_name || 'User Avatar'"
195
+ :alt="displayName"
174
196
  size="sm"
175
197
  icon="lucide:user"
176
198
  class="bg-green-600"
@@ -179,7 +201,7 @@ defineShortcuts(extractShortcuts(items.value))
179
201
  <span
180
202
  class="light:text-zinc-800 hidden text-sm font-bold dark:text-white lg:inline"
181
203
  >
182
- {{ user?.display_name.split(' ')[0] || 'User' }}
204
+ {{ shortDisplayName }}
183
205
  </span>
184
206
  </div>
185
207
  </button>
@@ -0,0 +1,14 @@
1
+ <script setup lang="ts">
2
+ const route = useRoute()
3
+ const session = useSupabaseSession()
4
+
5
+ const shouldShowNavbar = computed(() => {
6
+ return route.path === '/admin'
7
+ || route.path.startsWith('/admin/')
8
+ || Boolean(session.value)
9
+ })
10
+ </script>
11
+
12
+ <template>
13
+ <NavbarAdmin v-if="shouldShowNavbar" />
14
+ </template>
@@ -7,15 +7,46 @@ interface PlutoSupabaseAuthOptions {
7
7
  route?: RouteLocationNormalizedGeneric
8
8
  }
9
9
 
10
+ interface PlutoUserMetadata {
11
+ display_name?: string
12
+ full_name?: string
13
+ name?: string
14
+ username?: string
15
+ is_admin?: boolean
16
+ [key: string]: unknown
17
+ }
18
+
10
19
  export async function useAuth(authOptions?: PlutoSupabaseAuthOptions) {
11
20
  const toast = useToast()
12
21
 
13
22
  const supabase = useSupabaseClient()
14
23
  const supabaseSession = useSupabaseSession()
15
24
 
16
- const supabaseUser = await supabase.auth.getUser()
25
+ const supabaseUser = useSupabaseUser()
26
+ const userMetadata = useState<PlutoUserMetadata | null>(
27
+ 'pluto-auth-user-metadata',
28
+ () => null
29
+ )
30
+
31
+ const { data: authenticatedUser } = await supabase.auth.getUser()
32
+
33
+ if (authenticatedUser.user?.user_metadata) {
34
+ userMetadata.value = authenticatedUser.user.user_metadata
35
+ }
36
+
37
+ watch(
38
+ supabaseUser,
39
+ (currentUser) => {
40
+ if (currentUser?.user_metadata) {
41
+ userMetadata.value = currentUser.user_metadata
42
+ }
43
+ },
44
+ { immediate: true }
45
+ )
17
46
 
18
- const user = computed(() => supabaseUser.data.user?.user_metadata ?? null)
47
+ const user = computed(
48
+ () => supabaseUser.value?.user_metadata ?? userMetadata.value
49
+ )
19
50
  const isLoggedIn = computed<boolean>(() => !!supabaseSession.value)
20
51
  const isSubmitting = ref<boolean>(false)
21
52
 
@@ -94,6 +125,7 @@ export async function useAuth(authOptions?: PlutoSupabaseAuthOptions) {
94
125
 
95
126
  async function logout(options?: LogoutOptions) {
96
127
  await supabase.auth.signOut()
128
+ userMetadata.value = null
97
129
 
98
130
  if (options?.showToast) {
99
131
  console.warn(`User logged out`)
@@ -0,0 +1,7 @@
1
+ import NavbarAdminProvider from '../components/navbar/NavbarAdminProvider.vue'
2
+
3
+ export default defineNuxtPlugin(() => {
4
+ const { registerNavbar } = useNavbarAdmin()
5
+
6
+ registerNavbar(NavbarAdminProvider)
7
+ })
package/nuxt.config.ts CHANGED
@@ -12,6 +12,8 @@ export default defineNuxtConfig({
12
12
  name: 'supabase',
13
13
  },
14
14
 
15
+ css: ['#layers/supabase/app/assets/css/tailwind.css'],
16
+
15
17
  runtimeConfig: {
16
18
  supabaseUrl: process.env.SUPABASE_URL,
17
19
  supabaseKey: process.env.SUPABASE_KEY,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plutocms/supabase",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "trustedDependencies": [
6
6
  "@parcel/watcher",
7
7
  "@plutocms/pluto",
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@nuxt/ui": "^4.9.0",
40
40
  "@nuxtjs/supabase": "^2.0.9",
41
- "@plutocms/pluto": "^0.3.0",
42
- "@plutocms/utils": "^0.2.0",
41
+ "@plutocms/pluto": "^0.3.2",
42
+ "@plutocms/utils": "^0.2.1",
43
43
  "postgres": "^3.4.9",
44
44
  "supabase": "^2.109.1",
45
45
  "yup": "1.7.1"