@stoker-platform/web-app 0.5.100 → 0.5.102
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/CHANGELOG.md +16 -1
- package/package.json +4 -4
- package/src/Collection.tsx +1 -1
- package/src/List.tsx +5 -4
- package/src/Record.tsx +2 -0
- package/src/Tenant.tsx +32 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.102
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add showMetrics option to relation lists
|
|
8
|
+
- @stoker-platform/node-client@0.5.58
|
|
9
|
+
- @stoker-platform/utils@0.5.49
|
|
10
|
+
- @stoker-platform/web-client@0.5.58
|
|
11
|
+
|
|
12
|
+
## 0.5.101
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix: hide Dashboard menu item when not needed
|
|
17
|
+
|
|
3
18
|
## 0.5.100
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
6
21
|
|
|
7
|
-
- feat
|
|
22
|
+
- feat: add search-all to titles context parameter
|
|
8
23
|
- @stoker-platform/node-client@0.5.57
|
|
9
24
|
- @stoker-platform/utils@0.5.48
|
|
10
25
|
- @stoker-platform/web-client@0.5.57
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.102",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"scripts": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@react-google-maps/api": "^2.20.8",
|
|
53
53
|
"@sentry/react": "^10.50.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.58",
|
|
55
|
+
"@stoker-platform/utils": "0.5.49",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.58",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/Collection.tsx
CHANGED
|
@@ -2440,7 +2440,7 @@ function Collection({
|
|
|
2440
2440
|
search={search}
|
|
2441
2441
|
defaultSort={defaultSort}
|
|
2442
2442
|
setOptimisticList={setOptimisticList}
|
|
2443
|
-
relationList={
|
|
2443
|
+
relationList={relationList}
|
|
2444
2444
|
relationCollection={relationCollection}
|
|
2445
2445
|
relationParent={relationParent}
|
|
2446
2446
|
formList={formList}
|
package/src/List.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CollectionSchema,
|
|
7
7
|
FormList,
|
|
8
8
|
Metric,
|
|
9
|
+
RelationList,
|
|
9
10
|
RowHighlight,
|
|
10
11
|
StokerCollection,
|
|
11
12
|
StokerPermissions,
|
|
@@ -121,7 +122,7 @@ interface ListProps {
|
|
|
121
122
|
}
|
|
122
123
|
| undefined
|
|
123
124
|
setOptimisticList: () => void
|
|
124
|
-
relationList?:
|
|
125
|
+
relationList?: RelationList
|
|
125
126
|
relationCollection?: CollectionSchema
|
|
126
127
|
relationParent?: StokerRecord
|
|
127
128
|
formList?: FormList
|
|
@@ -1329,13 +1330,13 @@ export function List({
|
|
|
1329
1330
|
<ScrollArea
|
|
1330
1331
|
className={cn(
|
|
1331
1332
|
!relationList && !formList && "min-h-screen xl:min-h-full xl:h-[calc(100vh-252px)]",
|
|
1332
|
-
relationList && hasBreadcrumbs && "xl:h-[calc(100vh-352px-73px)]",
|
|
1333
|
-
relationList && !hasBreadcrumbs && "xl:h-[calc(100vh-352px)]",
|
|
1333
|
+
!!relationList && hasBreadcrumbs && "xl:h-[calc(100vh-352px-73px)]",
|
|
1334
|
+
!!relationList && !hasBreadcrumbs && "xl:h-[calc(100vh-352px)]",
|
|
1334
1335
|
formList && "h-[264px] xl:h-[316px]",
|
|
1335
1336
|
)}
|
|
1336
1337
|
>
|
|
1337
1338
|
<CardContent>
|
|
1338
|
-
{metrics && hasMetrics && !relationList && (
|
|
1339
|
+
{metrics && hasMetrics && !formList && (!relationList || relationList.showMetrics) && (
|
|
1339
1340
|
<div className="hidden lg:flex flex-row gap-4 mb-4 mt-4 max-w-[calc(100vw-96px)]">
|
|
1340
1341
|
{metrics.map((metric: Metric | Chart, index: number) => {
|
|
1341
1342
|
const hideThirdMetric = index >= 2 && hasChart ? "hidden xl:grid" : undefined
|
package/src/Record.tsx
CHANGED
|
@@ -129,6 +129,7 @@ export const Record = ({ collection }: { collection: CollectionSchema }) => {
|
|
|
129
129
|
async (data) => {
|
|
130
130
|
if (!data) {
|
|
131
131
|
setRecord(undefined)
|
|
132
|
+
setIsRouteLoading("-", location.pathname)
|
|
132
133
|
return
|
|
133
134
|
}
|
|
134
135
|
if (!recordInitialised.current || liveUpdate || fieldLiveUpdate) {
|
|
@@ -160,6 +161,7 @@ export const Record = ({ collection }: { collection: CollectionSchema }) => {
|
|
|
160
161
|
})
|
|
161
162
|
if (!data) {
|
|
162
163
|
setRecord(undefined)
|
|
164
|
+
setIsRouteLoading("-", location.pathname)
|
|
163
165
|
return
|
|
164
166
|
}
|
|
165
167
|
deserializeTimestamps(data)
|
package/src/Tenant.tsx
CHANGED
|
@@ -12,7 +12,14 @@ import "./App.css"
|
|
|
12
12
|
import { createElement, Suspense, useMemo, useEffect, useState, useCallback, useRef } from "react"
|
|
13
13
|
import { Outlet, useNavigate, useLocation } from "react-router"
|
|
14
14
|
import { collectionAccess, tryFunction } from "@stoker-platform/utils"
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
Background,
|
|
17
|
+
CollectionSchema,
|
|
18
|
+
DashboardItem,
|
|
19
|
+
MenuGroup,
|
|
20
|
+
MetaIcon,
|
|
21
|
+
StokerCollection,
|
|
22
|
+
} from "@stoker-platform/types"
|
|
16
23
|
import { useMode } from "./providers/ModeProvider"
|
|
17
24
|
import {
|
|
18
25
|
DropdownMenu,
|
|
@@ -107,6 +114,16 @@ function Tenant() {
|
|
|
107
114
|
isGlobalCachePendingRef.current = isGlobalCachePending.size
|
|
108
115
|
}, [isGlobalCachePending.size])
|
|
109
116
|
|
|
117
|
+
const dashboard = tryFunction(globalConfig.admin?.dashboard)
|
|
118
|
+
const hasDashboard = dashboard?.some((item: DashboardItem) => {
|
|
119
|
+
const collectionPermissions = permissions?.collections?.[item.collection]
|
|
120
|
+
if (!collectionPermissions) return false
|
|
121
|
+
return (
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
123
|
+
(!item.roles || item.roles?.includes(permissions.Role!)) && collectionAccess("Read", collectionPermissions)
|
|
124
|
+
)
|
|
125
|
+
})
|
|
126
|
+
|
|
110
127
|
useEffect(() => {
|
|
111
128
|
const getConfig = async () => {
|
|
112
129
|
const appName = await getCachedConfigValue(globalConfig, ["global", "appName"])
|
|
@@ -166,6 +183,7 @@ function Tenant() {
|
|
|
166
183
|
])
|
|
167
184
|
if (hidden) continue
|
|
168
185
|
if (collection.parentCollection) continue
|
|
186
|
+
if (!hasCollectionAccess(collection)) continue
|
|
169
187
|
|
|
170
188
|
sidebarMenu.push({
|
|
171
189
|
title: collectionName,
|
|
@@ -174,7 +192,6 @@ function Tenant() {
|
|
|
174
192
|
})
|
|
175
193
|
|
|
176
194
|
if (!collectionsGrouped.includes(collectionName)) {
|
|
177
|
-
if (!hasCollectionAccess(collection)) continue
|
|
178
195
|
navbarMenu.push({
|
|
179
196
|
title: collectionName,
|
|
180
197
|
collections: [collectionName],
|
|
@@ -636,17 +653,19 @@ function Tenant() {
|
|
|
636
653
|
</SheetTrigger>
|
|
637
654
|
<SheetContent side="left" className="sm:max-w-xs overflow-y-auto">
|
|
638
655
|
<nav className="grid gap-6 text-lg font-medium pt-12">
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
656
|
+
{hasDashboard && (
|
|
657
|
+
<button
|
|
658
|
+
className={
|
|
659
|
+
window.location.pathname === "/"
|
|
660
|
+
? "flex items-center gap-4 px-2.5 text-foreground"
|
|
661
|
+
: "flex items-center gap-4 px-2.5 text-muted-foreground hover:text-foreground"
|
|
662
|
+
}
|
|
663
|
+
onClick={() => runViewTransition(() => navigate("/"))}
|
|
664
|
+
>
|
|
665
|
+
<ChartBar className="h-5 w-5" />
|
|
666
|
+
Dashboard
|
|
667
|
+
</button>
|
|
668
|
+
)}
|
|
650
669
|
{sidebarMenu.map((group) => {
|
|
651
670
|
if (group.collections.length === 1) {
|
|
652
671
|
const className = "flex items-center gap-4 px-2.5 text-primary"
|