@edgedev/create-edge-app 1.1.4 → 1.1.5
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 +1 -1
- package/tsconfig.json +1 -1
- package/layouts/app.vue +0 -224
package/package.json
CHANGED
package/tsconfig.json
CHANGED
package/layouts/app.vue
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
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
|
-
})
|
|
73
|
-
edgeFirebase.runFunction('edgeFirebase-initFirestore', {})
|
|
74
|
-
edgeGlobal.edgeState.userRoles = [
|
|
75
|
-
{
|
|
76
|
-
name: 'Admin',
|
|
77
|
-
roles: [
|
|
78
|
-
{
|
|
79
|
-
collectionPath: 'organizationDocPath',
|
|
80
|
-
role: 'admin',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'User',
|
|
86
|
-
roles: [
|
|
87
|
-
{
|
|
88
|
-
collectionPath: 'organizationDocPath',
|
|
89
|
-
role: 'user',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
const menuItems = [
|
|
96
|
-
{
|
|
97
|
-
title: 'Dashboard',
|
|
98
|
-
to: '/app/dashboard/things',
|
|
99
|
-
icon: 'LayoutDashboard',
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
title: 'Sub Things',
|
|
103
|
-
to: '/app/dashboard/subthings',
|
|
104
|
-
icon: 'Package',
|
|
105
|
-
},
|
|
106
|
-
]
|
|
107
|
-
|
|
108
|
-
const slots = useSlots()
|
|
109
|
-
const hasLeftPanel = computed(() => {
|
|
110
|
-
const leftPanelSlot = slots['left-panel']
|
|
111
|
-
if (!leftPanelSlot) {
|
|
112
|
-
return false
|
|
113
|
-
}
|
|
114
|
-
const slotContent = leftPanelSlot()
|
|
115
|
-
return slotContent.length > 0 && slotContent.some(node => node.children && node.children.length > 0)
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
const leftPanelDefaultSize = computed(() => {
|
|
119
|
-
if (hasLeftPanel.value) {
|
|
120
|
-
return 20
|
|
121
|
-
}
|
|
122
|
-
return 0
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const mainPanelDefaultSize = computed(() => {
|
|
126
|
-
if (hasLeftPanel.value) {
|
|
127
|
-
return 80
|
|
128
|
-
}
|
|
129
|
-
return 100
|
|
130
|
-
})
|
|
131
|
-
</script>
|
|
132
|
-
|
|
133
|
-
<template>
|
|
134
|
-
<Head>
|
|
135
|
-
<title>Edge App</title>
|
|
136
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
|
|
137
|
-
</Head>
|
|
138
|
-
<Toaster />
|
|
139
|
-
<div class="flex flex-col h-screen">
|
|
140
|
-
<div class="flex h-full w-full">
|
|
141
|
-
<edge-sidebar-provider
|
|
142
|
-
v-slot="sideBarProviderProps"
|
|
143
|
-
enable-nested-menu
|
|
144
|
-
collapsible="slack"
|
|
145
|
-
>
|
|
146
|
-
<div class="h-full">
|
|
147
|
-
<edge-side-bar
|
|
148
|
-
v-if="edgeFirebase.user.loggedIn"
|
|
149
|
-
:menu-items="menuItems"
|
|
150
|
-
:collapsible="sideBarProviderProps.collapsible"
|
|
151
|
-
class="border-solid border-r"
|
|
152
|
-
>
|
|
153
|
-
<template #header>
|
|
154
|
-
<SidebarMenu>
|
|
155
|
-
<SidebarMenuItem>
|
|
156
|
-
<SidebarMenuButton style="padding-left: 4px !important;">
|
|
157
|
-
<Package class="!h-6 !w-6" /> <span class="text-xl">{{ orgName }}</span>
|
|
158
|
-
</SidebarMenuButton>
|
|
159
|
-
</SidebarMenuItem>
|
|
160
|
-
</SidebarMenu>
|
|
161
|
-
</template>
|
|
162
|
-
<template #footer="slotProps">
|
|
163
|
-
<Card v-if="slotProps.sideBarState === 'expanded'">
|
|
164
|
-
<CardHeader class="p-2 pt-0 md:p-4">
|
|
165
|
-
<CardTitle>Upgrade to Pro</CardTitle>
|
|
166
|
-
<CardDescription>
|
|
167
|
-
Unlock all features and get unlimited access to our support
|
|
168
|
-
team.
|
|
169
|
-
</CardDescription>
|
|
170
|
-
</CardHeader>
|
|
171
|
-
<CardContent class="p-2 pt-0 md:p-4 md:pt-0">
|
|
172
|
-
<Button size="sm" class="w-full">
|
|
173
|
-
Upgrade
|
|
174
|
-
</Button>
|
|
175
|
-
</CardContent>
|
|
176
|
-
</Card>
|
|
177
|
-
</template>
|
|
178
|
-
<template #nested-menu>
|
|
179
|
-
<slot name="nested-menu" />
|
|
180
|
-
</template>
|
|
181
|
-
</edge-side-bar>
|
|
182
|
-
</div>
|
|
183
|
-
<ResizablePanelGroup
|
|
184
|
-
direction="horizontal"
|
|
185
|
-
class="h-full w-full"
|
|
186
|
-
>
|
|
187
|
-
<ResizablePanel class="bg-sidebar text-sidebar-foreground" :default-size="leftPanelDefaultSize">
|
|
188
|
-
<slot name="left-panel" />
|
|
189
|
-
</ResizablePanel>
|
|
190
|
-
<ResizableHandle v-if="hasLeftPanel" with-handle />
|
|
191
|
-
<ResizablePanel :default-size="mainPanelDefaultSize">
|
|
192
|
-
<div class="grow h-full flex flex-col h-screen">
|
|
193
|
-
<edge-menu
|
|
194
|
-
v-if="edgeFirebase.user.loggedIn"
|
|
195
|
-
type="nav"
|
|
196
|
-
nav-class="justify-left"
|
|
197
|
-
class="px-1 border-none"
|
|
198
|
-
>
|
|
199
|
-
<template #start>
|
|
200
|
-
<edge-shad-button
|
|
201
|
-
v-show="edgeGlobal.edgeState.sidebar.isMobile"
|
|
202
|
-
variant="icon"
|
|
203
|
-
class="p-1"
|
|
204
|
-
@click="edgeGlobal.edgeState.sidebar.toggleSidebar"
|
|
205
|
-
>
|
|
206
|
-
<MenuSquare />
|
|
207
|
-
</edge-shad-button>
|
|
208
|
-
</template>
|
|
209
|
-
</edge-menu>
|
|
210
|
-
<slot />
|
|
211
|
-
</div>
|
|
212
|
-
</ResizablePanel>
|
|
213
|
-
</ResizablePanelGroup>
|
|
214
|
-
</edge-sidebar-provider>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
</template>
|
|
218
|
-
|
|
219
|
-
<style lang="scss">
|
|
220
|
-
.firebase-emulator-warning { display: none; }
|
|
221
|
-
html, body {
|
|
222
|
-
overflow: hidden;
|
|
223
|
-
}
|
|
224
|
-
</style>
|