@edgedev/create-edge-app 1.1.10 → 1.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/create-edge-app",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Create Edge Starter App",
5
5
  "bin": {
6
6
  "create-edge-app": "./bin/cli.js"
package/pages/app.vue CHANGED
@@ -8,11 +8,70 @@ const currentOrganization = computed(() => {
8
8
  return edgeGlobal.edgeState.currentOrganization
9
9
  })
10
10
 
11
+ const menuBuilder = () => {
12
+ const orgDocPath = `organizations/${currentOrganization.value}`
13
+ const orgRole = edgeFirebase?.user?.roles.find(role =>
14
+ role.collectionPath === orgDocPath.replaceAll('/', '-'),
15
+ )
16
+ const isOrgUserAdmin = orgRole && orgRole.role === 'admin'
17
+
18
+ edgeGlobal.edgeState.menuItems = [
19
+ {
20
+ title: 'Dashboard',
21
+ to: '/app/dashboard/things',
22
+ icon: 'LayoutDashboard',
23
+ },
24
+ {
25
+ title: 'Sub Things',
26
+ to: '/app/dashboard/subthings',
27
+ icon: 'Package',
28
+ },
29
+ {
30
+ title: 'Settings',
31
+ to: '/app/account/my-profile',
32
+ icon: 'Settings',
33
+ submenu: [
34
+ {
35
+ title: 'Profile',
36
+ to: '/app/account/my-profile',
37
+ icon: 'User',
38
+ },
39
+ {
40
+ title: 'Account',
41
+ to: '/app/account/my-account',
42
+ icon: 'CircleUser',
43
+ },
44
+ {
45
+ title: 'Orgs',
46
+ to: '/app/account/my-organizations',
47
+ icon: 'Group',
48
+ },
49
+ {
50
+ title: 'Org',
51
+ to: '/app/account/organization-settings',
52
+ icon: 'Settings',
53
+ override: isOrgUserAdmin,
54
+ },
55
+ {
56
+ title: 'Users',
57
+ to: '/app/account/organization-members',
58
+ icon: 'Users',
59
+ override: isOrgUserAdmin,
60
+ },
61
+ ],
62
+ },
63
+ ]
64
+ }
65
+
11
66
  watch(currentOrganization, async () => {
12
67
  if (currentOrganization.value) {
13
68
  // RUN STUFF HERE WHEN ORGANIZATION CHANGES LIKE SNAPSHOTS
14
69
  await projectSetOrg(currentOrganization.value, edgeFirebase, edgeGlobal)
15
70
 
71
+ const orgDocPath = `organizations/${currentOrganization.value}`
72
+ edgeGlobal.edgeState.isAdminCollections = [`organizations-${orgDocPath}`]
73
+ menuBuilder()
74
+
16
75
  // KEEP THIS CODE:
17
76
  const auth = useState('auth')
18
77
  auth.value = edgeFirebase.user
@@ -147,7 +206,7 @@ edgeGlobal.edgeState.userRoles = [
147
206
  },
148
207
  ]
149
208
 
150
- const menuItems = [
209
+ edgeGlobal.edgeState.menuItems = [
151
210
  {
152
211
  title: 'Dashboard',
153
212
  to: '/app/dashboard/things',
@@ -177,9 +236,10 @@ const menuItems = [
177
236
  <div class="h-full">
178
237
  <edge-side-bar
179
238
  v-if="edgeFirebase.user.loggedIn"
180
- :menu-items="menuItems"
239
+ :menu-items="edgeGlobal.edgeState.menuItems"
181
240
  :collapsible="sideBarProviderProps.collapsible"
182
241
  class="border-solid border-r"
242
+ :show-settings-section="false"
183
243
  >
184
244
  <template #header>
185
245
  <SidebarMenu>
@@ -233,6 +293,7 @@ const menuItems = [
233
293
  >
234
294
  <MenuSquare />
235
295
  </edge-shad-button>
296
+ <div id="page-header" />
236
297
  </template>
237
298
  </edge-menu>
238
299
  <NuxtPage class="flex-1 flex flex-col overflow-y-auto p-3 pt-0" />
@@ -1,73 +0,0 @@
1
- <script setup>
2
- const edgeFirebase = inject('edgeFirebase')
3
- const isAdmin = computed(() => {
4
- const orgRole = edgeFirebase?.user?.roles.find(role =>
5
- role.collectionPath === edgeGlobal.edgeState.organizationDocPath.replaceAll('/', '-'),
6
- )
7
- return orgRole && orgRole.role === 'admin'
8
- })
9
-
10
- const adminMenuItems = [
11
- {
12
- title: 'Organization',
13
- to: '/app/account/organization-settings',
14
- icon: 'Settings',
15
- },
16
- {
17
- title: 'Members',
18
- to: '/app/account/organization-members',
19
- icon: 'Users',
20
- },
21
- ]
22
-
23
- const menuItems = [
24
- {
25
- title: 'Profile',
26
- to: '/app/account/my-profile',
27
- icon: 'User',
28
- },
29
- {
30
- title: 'Account',
31
- to: '/app/account/my-account',
32
- icon: 'CircleUser',
33
- },
34
- {
35
- title: 'Organizations',
36
- to: '/app/account/my-organizations',
37
- icon: 'Group',
38
- },
39
- ]
40
- </script>
41
-
42
- <template>
43
- <div
44
- v-if="edgeGlobal.edgeState.organizationDocPath"
45
- >
46
- <div class="h-full p-0">
47
- <SidebarProvider class="min-h-full">
48
- <div class="h-full md:w-[180px]">
49
- <edge-side-bar
50
- :menu-items="menuItems"
51
- :settings-menu-items="isAdmin ? adminMenuItems : []"
52
- collapsible="submenu"
53
- class="bg-background text-foreground border-none w-[180px] absolute shadow-none"
54
- :show-settings-section="false"
55
- title="My Settings"
56
- settings-title="Organization Settings"
57
- group-label-classes="text-foreground/70"
58
- >
59
- <template #header>
60
- <h1 class="text-xl">
61
- Settings
62
- </h1>
63
- </template>
64
- </edge-side-bar>
65
- </div>
66
- <NuxtPage class="flex-1 flex flex-col overflow-y-auto p-3" />
67
- </SidebarProvider>
68
- </div>
69
- </div>
70
- </template>
71
-
72
- <style lang="scss">
73
- </style>