@@ -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
0 commit comments