Skip to content

Commit d472210

Browse files
committed
fix: fix records list not visible when resource action is open in drawer
1 parent c5718ff commit d472210

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

src/frontend/components/routes/resource-action.tsx

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const ResourceAction: React.FC<Props> = (props) => {
2626
const { resources } = props
2727
const { resourceId, actionName } = params
2828
const [tag, setTag] = useState('')
29+
const [filterVisible, setFilterVisible] = useState(false)
2930

3031
const resource = resources.find((r) => r.id === resourceId)
3132
if (!resource) {
@@ -37,13 +38,43 @@ const ResourceAction: React.FC<Props> = (props) => {
3738
return <NoActionError resourceId={resourceId!} actionName={actionName!} />
3839
}
3940

41+
const listActionName = 'list'
42+
const listAction = resource.resourceActions.find((r) => r.name === listActionName)
43+
4044
const contentTag = getResourceElementCss(resource.id, action.name)
4145

4246
if (action.showInDrawer) {
47+
if (!listAction) {
48+
return (
49+
<DrawerPortal width={action.containerWidth}>
50+
<BaseActionComponent action={action} resource={resource} />
51+
</DrawerPortal>
52+
)
53+
}
54+
55+
const toggleFilter = listAction.showFilter
56+
? (): void => setFilterVisible(!filterVisible)
57+
: undefined
58+
4359
return (
44-
<DrawerPortal width={action.containerWidth}>
45-
<BaseActionComponent action={action} resource={resource} />
46-
</DrawerPortal>
60+
<>
61+
<DrawerPortal width={action.containerWidth}>
62+
<BaseActionComponent
63+
action={action}
64+
resource={resource}
65+
setTag={setTag}
66+
/>
67+
</DrawerPortal>
68+
<Wrapper width={listAction.containerWidth}>
69+
<ActionHeader
70+
resource={resource}
71+
action={listAction}
72+
tag={tag}
73+
toggleFilter={toggleFilter}
74+
/>
75+
<BaseActionComponent action={listAction} resource={resource} setTag={setTag} />
76+
</Wrapper>
77+
</>
4778
)
4879
}
4980

src/frontend/hooks/use-navigation-resources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function useNavigationResources(
5353
memo[key] = enrichResource(resource, resource.navigation?.icon)
5454
} else if (memo[key] && memo[key].elements && resource.navigation?.name) {
5555
memo[key].label = translateLabel(resource.navigation?.name)
56-
memo[key].elements.push(enrichResource(resource))
56+
memo[key].elements?.push?.(enrichResource(resource))
5757
} else {
5858
memo[key] = {
5959
elements: [enrichResource(resource)],

0 commit comments

Comments
 (0)