@edgedev/create-edge-app 1.0.60 → 1.0.62
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/app.vue +3 -189
- package/layouts/public.vue +14 -0
- package/package.json +1 -1
- package/pages/app/account/[page].vue +8 -11
- package/pages/app/dashboard/[[collection]]/[[docId]].vue +2 -2
- package/pages/app.vue +191 -0
package/app.vue
CHANGED
|
@@ -1,196 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
// TODO : ADD CODE FOR NOTIFICATIONS AND DEEP LINKING
|
|
3
|
-
// import { useTheme } from 'vuetify'
|
|
4
|
-
// const vueTheme = useTheme()
|
|
5
|
-
// const changeTheme = (theme) => {
|
|
6
|
-
// vueTheme.global.name.value = theme
|
|
7
|
-
// }
|
|
8
|
-
const edgeFirebase = inject('edgeFirebase')
|
|
9
|
-
// const edgeGlobal = inject('edgeGlobal')
|
|
10
|
-
|
|
11
|
-
const currentOrganization = computed(() => {
|
|
12
|
-
return edgeGlobal.edgeState.currentOrganization
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
watch(currentOrganization, async () => {
|
|
16
|
-
if (currentOrganization.value) {
|
|
17
|
-
// RUN STUFF HERE WHEN ORGANIZATION CHANGES LIKE SNAPSHOTS
|
|
18
|
-
await projectSetOrg(currentOrganization.value, edgeFirebase, edgeGlobal)
|
|
19
|
-
|
|
20
|
-
// KEEP THIS CODE:
|
|
21
|
-
const auth = useState('auth')
|
|
22
|
-
auth.value = edgeFirebase.user
|
|
23
|
-
|
|
24
|
-
const preLoginRoute = useState('preLoginRoute')
|
|
25
|
-
const router = useRouter()
|
|
26
|
-
|
|
27
|
-
let cleanedRoute = ''
|
|
28
|
-
if (preLoginRoute.value) {
|
|
29
|
-
cleanedRoute = preLoginRoute.value.endsWith('/') ? preLoginRoute.value.slice(0, -1) : preLoginRoute.value
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (cleanedRoute === ''
|
|
33
|
-
|| cleanedRoute === '/app'
|
|
34
|
-
|| cleanedRoute === '/app/login'
|
|
35
|
-
|| cleanedRoute === '/app/signup') {
|
|
36
|
-
router.push('/app/dashboard')
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
router.push(preLoginRoute.value)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.log(auth.value)
|
|
43
|
-
}
|
|
44
|
-
if (!currentOrganization.value) {
|
|
45
|
-
const auth = useState('auth')
|
|
46
|
-
auth.value = ''
|
|
47
|
-
const router = useRouter()
|
|
48
|
-
router.push('/app/login')
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const currentOrg = computed(() => edgeFirebase.data[`organizations/${edgeGlobal.edgeState.currentOrganization}`])
|
|
53
|
-
|
|
54
|
-
watch (currentOrg, async () => {
|
|
55
|
-
if (currentOrg.value) {
|
|
56
|
-
edgeGlobal.edgeState = subscribedStatus(currentOrg.value)
|
|
57
|
-
}
|
|
58
|
-
}, { immediate: true }, { deep: true })
|
|
59
|
-
|
|
60
|
-
const orgName = computed(() => {
|
|
61
|
-
const org = edgeGlobal.edgeState.organizations.find(org => org.docId === edgeGlobal.edgeState.currentOrganization)
|
|
62
|
-
return org?.name
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const user = computed(() => {
|
|
66
|
-
return edgeFirebase.user
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
watch (user, async () => {
|
|
70
|
-
if (user.value) {
|
|
71
|
-
const auth = useState('auth')
|
|
72
|
-
auth.value = user.value
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
const colorMode = useColorMode()
|
|
76
|
-
onMounted(() => {
|
|
77
|
-
colorMode.preference = 'system'
|
|
78
|
-
// if (edgeGlobal.isDarkMode()) {
|
|
79
|
-
// changeTheme('dark')
|
|
80
|
-
// }
|
|
81
|
-
// else {
|
|
82
|
-
// changeTheme('light')
|
|
83
|
-
// }
|
|
84
|
-
})
|
|
85
|
-
edgeFirebase.runFunction('edgeFirebase-initFirestore', {})
|
|
86
|
-
edgeGlobal.edgeState.userRoles = [
|
|
87
|
-
{
|
|
88
|
-
name: 'Admin',
|
|
89
|
-
roles: [
|
|
90
|
-
{
|
|
91
|
-
collectionPath: 'organizationDocPath',
|
|
92
|
-
role: 'admin',
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'User',
|
|
98
|
-
roles: [
|
|
99
|
-
{
|
|
100
|
-
collectionPath: 'organizationDocPath',
|
|
101
|
-
role: 'user',
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
},
|
|
105
|
-
]
|
|
106
|
-
|
|
107
|
-
const menuItems = [
|
|
108
|
-
{
|
|
109
|
-
title: 'Dashboard',
|
|
110
|
-
to: '/app/dashboard/things',
|
|
111
|
-
icon: 'LayoutDashboard',
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
title: 'Sub Things',
|
|
115
|
-
to: '/app/dashboard/subthings',
|
|
116
|
-
icon: 'Package',
|
|
117
|
-
},
|
|
118
|
-
]
|
|
119
2
|
</script>
|
|
120
3
|
|
|
121
4
|
<template>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<template #start>
|
|
126
|
-
<Package class="h-6 w-6 mr-2" />
|
|
127
|
-
<h1 class="text-xl font-bold">
|
|
128
|
-
{{ orgName }}
|
|
129
|
-
</h1>
|
|
130
|
-
</template>
|
|
131
|
-
</edge-menu> -->
|
|
132
|
-
<div class="flex h-full">
|
|
133
|
-
<SidebarProvider>
|
|
134
|
-
<div class="h-full">
|
|
135
|
-
<edge-side-menu
|
|
136
|
-
v-if="edgeFirebase.user.loggedIn"
|
|
137
|
-
:menu-items="menuItems"
|
|
138
|
-
>
|
|
139
|
-
<template #header>
|
|
140
|
-
<SidebarMenu>
|
|
141
|
-
<SidebarMenuItem>
|
|
142
|
-
<SidebarMenuButton style="padding-left: 4px !important;">
|
|
143
|
-
<Package class="!h-6 !w-6" /> <span class="text-xl">{{ orgName }}</span>
|
|
144
|
-
</SidebarMenuButton>
|
|
145
|
-
</SidebarMenuItem>
|
|
146
|
-
</SidebarMenu>
|
|
147
|
-
</template>
|
|
148
|
-
<template #footer="slotProps">
|
|
149
|
-
<Card v-if="slotProps.sideBarState === 'expanded'">
|
|
150
|
-
<CardHeader class="p-2 pt-0 md:p-4">
|
|
151
|
-
<CardTitle>Upgrade to Pro</CardTitle>
|
|
152
|
-
<CardDescription>
|
|
153
|
-
Unlock all features and get unlimited access to our support
|
|
154
|
-
team.
|
|
155
|
-
</CardDescription>
|
|
156
|
-
</CardHeader>
|
|
157
|
-
<CardContent class="p-2 pt-0 md:p-4 md:pt-0">
|
|
158
|
-
<Button size="sm" class="w-full">
|
|
159
|
-
Upgrade
|
|
160
|
-
</Button>
|
|
161
|
-
</CardContent>
|
|
162
|
-
</Card>
|
|
163
|
-
</template>
|
|
164
|
-
</edge-side-menu>
|
|
165
|
-
</div>
|
|
166
|
-
<div class="grow h-full">
|
|
167
|
-
<div class="flex justify-between p-1">
|
|
168
|
-
<div>
|
|
169
|
-
<!-- possible breadcrumbs -->
|
|
170
|
-
</div>
|
|
171
|
-
<div>
|
|
172
|
-
<edge-user-menu v-if="edgeFirebase.user.loggedIn" :title="orgName" button-class="w-8 h-8" icon-class="w-6 h-6" />
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
<NuxtPage keepalive />
|
|
176
|
-
</div>
|
|
177
|
-
</SidebarProvider>
|
|
178
|
-
</div>
|
|
179
|
-
<!-- <edge-menu
|
|
180
|
-
v-if="edgeFirebase.user.loggedIn"
|
|
181
|
-
type="footer"
|
|
182
|
-
button-class="text-slate-500"
|
|
183
|
-
nav-class="justify-end mr-8"
|
|
184
|
-
class="bg-slate-800"
|
|
185
|
-
:menu-items="menuItems"
|
|
186
|
-
>
|
|
187
|
-
<template #start>
|
|
188
|
-
<div class="text-xs text-muted-foreground">
|
|
189
|
-
Copyright {{ new Date().getFullYear() }}
|
|
190
|
-
</div>
|
|
191
|
-
</template>
|
|
192
|
-
</edge-menu> -->
|
|
193
|
-
</div>
|
|
5
|
+
<NuxtLayout>
|
|
6
|
+
<NuxtPage />
|
|
7
|
+
</NuxtLayout>
|
|
194
8
|
</template>
|
|
195
9
|
|
|
196
10
|
<style lang="scss">
|
package/package.json
CHANGED
|
@@ -56,17 +56,14 @@ const page = computed(() => {
|
|
|
56
56
|
<template>
|
|
57
57
|
<div
|
|
58
58
|
v-if="edgeFirebase?.user?.loggedIn"
|
|
59
|
-
class="p-3 w-full h-[calc(100vh-118px)] overflow-y-auto"
|
|
60
59
|
>
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</Card>
|
|
70
|
-
</div>
|
|
60
|
+
<Card class="w-full flex-1 bg-muted/50 max-w-7xl 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>
|
|
71
68
|
</div>
|
|
72
69
|
</template>
|
|
@@ -73,9 +73,8 @@ onMounted(() => {
|
|
|
73
73
|
<template>
|
|
74
74
|
<div
|
|
75
75
|
v-if="edgeFirebase?.user?.loggedIn"
|
|
76
|
-
class="p-3 w-full h-[calc(100vh-118px)] overflow-y-auto"
|
|
77
76
|
>
|
|
78
|
-
<edge-dashboard v-if="docId === ''
|
|
77
|
+
<edge-dashboard v-if="docId === ''" :filter="state.filter" :collection="collection" class="flex-1">
|
|
79
78
|
<template #header-start>
|
|
80
79
|
<LayoutDashboard class="mr-2" />
|
|
81
80
|
<span class="capitalize">{{ collection }}</span>
|
|
@@ -126,6 +125,7 @@ onMounted(() => {
|
|
|
126
125
|
:doc-id="docId"
|
|
127
126
|
:schema="schemas[collection]"
|
|
128
127
|
:new-doc-schema="state.newDocs[collection]"
|
|
128
|
+
class="w-full max-w-7xl mx-auto flex-1"
|
|
129
129
|
>
|
|
130
130
|
<template #header-start="slotProps">
|
|
131
131
|
<FilePenLine class="mr-2" />
|
package/pages/app.vue
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const edgeFirebase = inject('edgeFirebase')
|
|
3
|
+
// const edgeGlobal = inject('edgeGlobal')
|
|
4
|
+
|
|
5
|
+
const currentOrganization = computed(() => {
|
|
6
|
+
return edgeGlobal.edgeState.currentOrganization
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
watch(currentOrganization, async () => {
|
|
10
|
+
if (currentOrganization.value) {
|
|
11
|
+
// RUN STUFF HERE WHEN ORGANIZATION CHANGES LIKE SNAPSHOTS
|
|
12
|
+
await projectSetOrg(currentOrganization.value, edgeFirebase, edgeGlobal)
|
|
13
|
+
|
|
14
|
+
// KEEP THIS CODE:
|
|
15
|
+
const auth = useState('auth')
|
|
16
|
+
auth.value = edgeFirebase.user
|
|
17
|
+
|
|
18
|
+
const preLoginRoute = useState('preLoginRoute')
|
|
19
|
+
const router = useRouter()
|
|
20
|
+
|
|
21
|
+
let cleanedRoute = ''
|
|
22
|
+
if (preLoginRoute.value) {
|
|
23
|
+
cleanedRoute = preLoginRoute.value.endsWith('/') ? preLoginRoute.value.slice(0, -1) : preLoginRoute.value
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (cleanedRoute === ''
|
|
27
|
+
|| cleanedRoute === '/app'
|
|
28
|
+
|| cleanedRoute === '/app/login'
|
|
29
|
+
|| cleanedRoute === '/app/signup') {
|
|
30
|
+
router.push('/app/dashboard')
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
router.push(preLoginRoute.value)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(auth.value)
|
|
37
|
+
}
|
|
38
|
+
if (!currentOrganization.value) {
|
|
39
|
+
const auth = useState('auth')
|
|
40
|
+
auth.value = ''
|
|
41
|
+
const router = useRouter()
|
|
42
|
+
router.push('/app/login')
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const currentOrg = computed(() => edgeFirebase.data[`organizations/${edgeGlobal.edgeState.currentOrganization}`])
|
|
47
|
+
|
|
48
|
+
watch (currentOrg, async () => {
|
|
49
|
+
if (currentOrg.value) {
|
|
50
|
+
edgeGlobal.edgeState = subscribedStatus(currentOrg.value)
|
|
51
|
+
}
|
|
52
|
+
}, { immediate: true }, { deep: true })
|
|
53
|
+
|
|
54
|
+
const orgName = computed(() => {
|
|
55
|
+
const org = edgeGlobal.edgeState.organizations.find(org => org.docId === edgeGlobal.edgeState.currentOrganization)
|
|
56
|
+
return org?.name
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const user = computed(() => {
|
|
60
|
+
return edgeFirebase.user
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
watch (user, async () => {
|
|
64
|
+
if (user.value) {
|
|
65
|
+
const auth = useState('auth')
|
|
66
|
+
auth.value = user.value
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
const colorMode = useColorMode()
|
|
70
|
+
onMounted(() => {
|
|
71
|
+
colorMode.preference = 'system'
|
|
72
|
+
// if (edgeGlobal.isDarkMode()) {
|
|
73
|
+
// changeTheme('dark')
|
|
74
|
+
// }
|
|
75
|
+
// else {
|
|
76
|
+
// changeTheme('light')
|
|
77
|
+
// }
|
|
78
|
+
})
|
|
79
|
+
edgeFirebase.runFunction('edgeFirebase-initFirestore', {})
|
|
80
|
+
edgeGlobal.edgeState.userRoles = [
|
|
81
|
+
{
|
|
82
|
+
name: 'Admin',
|
|
83
|
+
roles: [
|
|
84
|
+
{
|
|
85
|
+
collectionPath: 'organizationDocPath',
|
|
86
|
+
role: 'admin',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'User',
|
|
92
|
+
roles: [
|
|
93
|
+
{
|
|
94
|
+
collectionPath: 'organizationDocPath',
|
|
95
|
+
role: 'user',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
const menuItems = [
|
|
102
|
+
{
|
|
103
|
+
title: 'Dashboard',
|
|
104
|
+
to: '/app/dashboard/things',
|
|
105
|
+
icon: 'LayoutDashboard',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Sub Things',
|
|
109
|
+
to: '/app/dashboard/subthings',
|
|
110
|
+
icon: 'Package',
|
|
111
|
+
},
|
|
112
|
+
]
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<Toaster />
|
|
117
|
+
<div class="flex flex-col h-screen">
|
|
118
|
+
<div class="flex h-full w-full">
|
|
119
|
+
<SidebarProvider>
|
|
120
|
+
<div class="h-full">
|
|
121
|
+
<edge-side-menu
|
|
122
|
+
v-if="edgeFirebase.user.loggedIn"
|
|
123
|
+
:menu-items="menuItems"
|
|
124
|
+
>
|
|
125
|
+
<template #header>
|
|
126
|
+
<SidebarMenu>
|
|
127
|
+
<SidebarMenuItem>
|
|
128
|
+
<SidebarMenuButton style="padding-left: 4px !important;">
|
|
129
|
+
<Package class="!h-6 !w-6" /> <span class="text-xl">{{ orgName }}</span>
|
|
130
|
+
</SidebarMenuButton>
|
|
131
|
+
</SidebarMenuItem>
|
|
132
|
+
</SidebarMenu>
|
|
133
|
+
</template>
|
|
134
|
+
<template #footer="slotProps">
|
|
135
|
+
<Card v-if="slotProps.sideBarState === 'expanded'">
|
|
136
|
+
<CardHeader class="p-2 pt-0 md:p-4">
|
|
137
|
+
<CardTitle>Upgrade to Pro</CardTitle>
|
|
138
|
+
<CardDescription>
|
|
139
|
+
Unlock all features and get unlimited access to our support
|
|
140
|
+
team.
|
|
141
|
+
</CardDescription>
|
|
142
|
+
</CardHeader>
|
|
143
|
+
<CardContent class="p-2 pt-0 md:p-4 md:pt-0">
|
|
144
|
+
<Button size="sm" class="w-full">
|
|
145
|
+
Upgrade
|
|
146
|
+
</Button>
|
|
147
|
+
</CardContent>
|
|
148
|
+
</Card>
|
|
149
|
+
</template>
|
|
150
|
+
</edge-side-menu>
|
|
151
|
+
</div>
|
|
152
|
+
<div class="grow h-full flex flex-col h-screen">
|
|
153
|
+
<edge-menu
|
|
154
|
+
v-if="edgeFirebase.user.loggedIn"
|
|
155
|
+
type="nav"
|
|
156
|
+
nav-class="justify-left mr-8"
|
|
157
|
+
:menu-items="menuItems"
|
|
158
|
+
>
|
|
159
|
+
<template #start>
|
|
160
|
+
<SidebarTrigger class="-ml-2 mr-2 h-4 w-4" />
|
|
161
|
+
<Package class="h-6 w-6 mr-2" />
|
|
162
|
+
<h1 class="text-xl font-bold">
|
|
163
|
+
{{ orgName }}
|
|
164
|
+
</h1>
|
|
165
|
+
</template>
|
|
166
|
+
</edge-menu>
|
|
167
|
+
<NuxtPage class="flex-1 flex flex-col overflow-y-auto p-3" keepalive />
|
|
168
|
+
<edge-menu
|
|
169
|
+
v-if="edgeFirebase.user.loggedIn"
|
|
170
|
+
type="footer"
|
|
171
|
+
nav-class="justify-end mr-8"
|
|
172
|
+
:menu-items="menuItems"
|
|
173
|
+
>
|
|
174
|
+
<template #start>
|
|
175
|
+
<div class="text-xs text-muted-foreground">
|
|
176
|
+
Copyright {{ new Date().getFullYear() }}
|
|
177
|
+
</div>
|
|
178
|
+
</template>
|
|
179
|
+
</edge-menu>
|
|
180
|
+
</div>
|
|
181
|
+
</SidebarProvider>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</template>
|
|
185
|
+
|
|
186
|
+
<style lang="scss">
|
|
187
|
+
.firebase-emulator-warning { display: none; }
|
|
188
|
+
html, body {
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
}
|
|
191
|
+
</style>
|