@edgedev/create-edge-app 1.0.61 → 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 CHANGED
@@ -1,192 +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
- <Toaster />
123
- <div class="flex flex-col h-screen">
124
- <div class="flex h-full w-full">
125
- <SidebarProvider>
126
- <div class="h-full">
127
- <edge-side-menu
128
- v-if="edgeFirebase.user.loggedIn"
129
- :menu-items="menuItems"
130
- >
131
- <template #header>
132
- <SidebarMenu>
133
- <SidebarMenuItem>
134
- <SidebarMenuButton style="padding-left: 4px !important;">
135
- <Package class="!h-6 !w-6" /> <span class="text-xl">{{ orgName }}</span>
136
- </SidebarMenuButton>
137
- </SidebarMenuItem>
138
- </SidebarMenu>
139
- </template>
140
- <template #footer="slotProps">
141
- <Card v-if="slotProps.sideBarState === 'expanded'">
142
- <CardHeader class="p-2 pt-0 md:p-4">
143
- <CardTitle>Upgrade to Pro</CardTitle>
144
- <CardDescription>
145
- Unlock all features and get unlimited access to our support
146
- team.
147
- </CardDescription>
148
- </CardHeader>
149
- <CardContent class="p-2 pt-0 md:p-4 md:pt-0">
150
- <Button size="sm" class="w-full">
151
- Upgrade
152
- </Button>
153
- </CardContent>
154
- </Card>
155
- </template>
156
- </edge-side-menu>
157
- </div>
158
- <div class="grow h-full flex flex-col h-screen">
159
- <edge-menu
160
- v-if="edgeFirebase.user.loggedIn"
161
- type="nav"
162
- nav-class="justify-left mr-8"
163
- :menu-items="menuItems"
164
- >
165
- <template #start>
166
- <SidebarTrigger class="-ml-2 mr-2 h-4 w-4" />
167
- <Package class="h-6 w-6 mr-2" />
168
- <h1 class="text-xl font-bold">
169
- {{ orgName }}
170
- </h1>
171
- </template>
172
- </edge-menu>
173
- <NuxtPage class="flex-1 flex flex-col overflow-y-auto p-3" keepalive />
174
- <edge-menu
175
- v-if="edgeFirebase.user.loggedIn"
176
- type="footer"
177
- nav-class="justify-end mr-8"
178
- :menu-items="menuItems"
179
- >
180
- <template #start>
181
- <div class="text-xs text-muted-foreground">
182
- Copyright {{ new Date().getFullYear() }}
183
- </div>
184
- </template>
185
- </edge-menu>
186
- </div>
187
- </SidebarProvider>
188
- </div>
189
- </div>
5
+ <NuxtLayout>
6
+ <NuxtPage />
7
+ </NuxtLayout>
190
8
  </template>
191
9
 
192
10
  <style lang="scss">
@@ -0,0 +1,14 @@
1
+ <script setup>
2
+ </script>
3
+
4
+ <template>
5
+ <div class="flex min-h-screen w-full flex-col">
6
+ <main class="flex flex-1 flex-col gap-4 px-4 pb-4 md:gap-8 md:px-8 md:pb-8">
7
+ <slot />
8
+ </main>
9
+ </div>
10
+ </template>
11
+
12
+ <style>
13
+
14
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/create-edge-app",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "Create Edge Starter App",
5
5
  "bin": {
6
6
  "create-edge-app": "./bin/cli.js"
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>