@edgedev/create-edge-app 1.1.10 → 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
|
@@ -55,15 +55,92 @@ const page = computed(() => {
|
|
|
55
55
|
|
|
56
56
|
<template>
|
|
57
57
|
<div
|
|
58
|
-
v-if="
|
|
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
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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>
|
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
|
-
|
|
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" />
|
package/pages/app/account.vue
DELETED
|
@@ -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>
|