@edgedev/create-edge-app 1.1.11 → 1.1.13

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.13",
4
4
  "description": "Create Edge Starter App",
5
5
  "bin": {
6
6
  "create-edge-app": "./bin/cli.js"
@@ -55,15 +55,31 @@ const page = computed(() => {
55
55
 
56
56
  <template>
57
57
  <div
58
- v-if="edgeFirebase?.user?.loggedIn"
58
+ v-if="edgeGlobal.edgeState.organizationDocPath"
59
59
  >
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>
60
+ <edge-organization-settings
61
+ v-if="page === 'organization-settings'"
62
+ :subscribe-options="subscribeOptions"
63
+ :form-schema="orgSchema"
64
+ :org-fields="orgFields"
65
+ />
66
+ <edge-my-account
67
+ v-if="page === 'my-account'"
68
+ />
69
+ <edge-my-profile
70
+ v-if="page === 'my-profile'"
71
+ :form-schema="metaSchema"
72
+ :meta-fields="metaFields"
73
+ />
74
+ <edge-organization-members
75
+ v-if="page === 'organization-members'"
76
+ />
77
+ <edge-my-organizations
78
+ v-if="page === 'my-organizations'"
79
+ :registration-code="config.public.registrationCode"
80
+ />
81
+ <edge-billing
82
+ v-if="page === 'subscription'"
83
+ />
68
84
  </div>
69
85
  </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>