@edgedev/create-edge-app 1.1.11 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/create-edge-app",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Create Edge Starter App",
5
5
  "bin": {
6
6
  "create-edge-app": "./bin/cli.js"
@@ -55,15 +55,92 @@ const page = computed(() => {
55
55
 
56
56
  <template>
57
57
  <div
58
- v-if="edgeFirebase?.user?.loggedIn"
58
+ v-if="edgeGlobal.edgeState.organizationDocPath"
59
+ class="w-full max-w-7xl mx-auto bg-white rounded-[9.96px] shadow-md px-6"
59
60
  >
60
- <Card class="w-full flex-1 bg-muted/50 m-auto">
61
- <edge-organization-settings v-if="page === 'organization-settings'" :subscribe-options="subscribeOptions" :form-schema="orgSchema" :org-fields="orgFields" />
62
- <edge-my-account v-if="page === 'my-account'" />
63
- <edge-my-profile v-if="page === 'my-profile'" :form-schema="metaSchema" :meta-fields="metaFields" />
64
- <edge-organization-members v-if="page === 'organization-members'" />
65
- <edge-my-organizations v-if="page === 'my-organizations'" :registration-code="config.public.registrationCode" />
66
- <edge-billing v-if="page === 'subscription'" />
67
- </Card>
61
+ <edge-organization-settings
62
+ v-if="page === 'organization-settings'"
63
+ :subscribe-options="subscribeOptions"
64
+ :form-schema="orgSchema"
65
+ :org-fields="orgFields"
66
+ class="bg-white"
67
+ >
68
+ <template #header>
69
+ <Teleport to="#page-header">
70
+ <edge-shad-breadcrumbs
71
+ :items="[
72
+ { text: 'Settings', to: '/app/dashboard/my-profile' },
73
+ { text: 'Organization', to: '' },
74
+ ]"
75
+ />
76
+ </Teleport>
77
+ </template>
78
+ </edge-organization-settings>
79
+ <edge-my-account
80
+ v-if="page === 'my-account'"
81
+ class="bg-white"
82
+ >
83
+ <template #header>
84
+ <Teleport to="#page-header">
85
+ <edge-shad-breadcrumbs
86
+ :items="[
87
+ { text: 'Settings', to: '/app/dashboard/my-profile' },
88
+ { text: 'My Account', to: '' },
89
+ ]"
90
+ />
91
+ </Teleport>
92
+ </template>
93
+ </edge-my-account>
94
+ <edge-my-profile
95
+ v-if="page === 'my-profile'"
96
+ :form-schema="metaSchema"
97
+ :meta-fields="metaFields"
98
+ class="bg-white"
99
+ >
100
+ <template #header>
101
+ <Teleport to="#page-header">
102
+ <edge-shad-breadcrumbs
103
+ :items="[
104
+ { text: 'Settings', to: '/app/dashboard/my-profile' },
105
+ { text: 'My Profile', to: '' },
106
+ ]"
107
+ />
108
+ </Teleport>
109
+ </template>
110
+ </edge-my-profile>
111
+ <edge-organization-members
112
+ v-if="page === 'organization-members'"
113
+ class="bg-white"
114
+ >
115
+ <template #header>
116
+ <Teleport to="#page-header">
117
+ <edge-shad-breadcrumbs
118
+ :items="[
119
+ { text: 'Settings', to: '/app/dashboard/my-profile' },
120
+ { text: 'Users', to: '' },
121
+ ]"
122
+ />
123
+ </Teleport>
124
+ </template>
125
+ </edge-organization-members>
126
+ <edge-my-organizations
127
+ v-if="page === 'my-organizations'"
128
+ :registration-code="config.public.registrationCode"
129
+ class="bg-white"
130
+ >
131
+ <template #header>
132
+ <Teleport to="#page-header">
133
+ <edge-shad-breadcrumbs
134
+ :items="[
135
+ { text: 'Settings', to: '/app/dashboard/my-profile' },
136
+ { text: 'My Organizations', to: '' },
137
+ ]"
138
+ />
139
+ </Teleport>
140
+ </template>
141
+ </edge-my-organizations>
142
+ <edge-billing
143
+ v-if="page === 'subscription'"
144
+ />
68
145
  </div>
69
146
  </template>
@@ -62,10 +62,40 @@ definePageMeta({
62
62
  middleware: 'auth',
63
63
  })
64
64
 
65
+ const isAdmin = computed(() => {
66
+ return edgeGlobal.isAdminGlobal(edgeFirebase).value
67
+ })
68
+
69
+ const toBool = v => v === true || v === 'true' || v === 1 || v === '1'
70
+
71
+ const allowMenuItem = (item) => {
72
+ const isDev = config.public.developmentMode
73
+ const adminOnly = toBool(item.adminOnly)
74
+ const devOnly = toBool(item.devOnly)
75
+ const override = toBool(item.override)
76
+ if (item.override !== undefined)
77
+ return override
78
+ if (adminOnly && !isAdmin.value)
79
+ return false
80
+ if (devOnly && !isDev)
81
+ return false
82
+ return true
83
+ }
84
+
65
85
  onMounted(() => {
66
86
  if (!route.params.collection) {
67
- // If making a static collection route, this onMounted should be removed
68
- router.push('/app/dashboard/things')
87
+ const menuItems = edgeGlobal.edgeState.menuItems
88
+ .filter(allowMenuItem)
89
+ .map(item => ({
90
+ ...item,
91
+ submenu: Array.isArray(item.submenu)
92
+ ? item.submenu.filter(allowMenuItem)
93
+ : item.submenu,
94
+ }))
95
+ const firstTop = (menuItems && menuItems.length) ? menuItems[0] : null
96
+ if (firstTop && typeof firstTop.to === 'string' && firstTop.to.length) {
97
+ router.replace(firstTop.to)
98
+ }
69
99
  }
70
100
  })
71
101
  </script>