@@ -7,11 +7,7 @@ import {
77 ADMIN_ACCESS_PERMISSION_RE ,
88 ADMIN_ACCESS_PERMISSION_POSTFIX ,
99} from '#client/constants'
10- import {
11- Button ,
12- ComponentWrapper ,
13- WidgetWrapper ,
14- } from '#client/components/ui'
10+ import { WidgetWrapper } from '#client/components/ui'
1511import Permissions from '#shared/permissions'
1612import { PermissionsSet } from '#shared/utils'
1713import { cn } from '#client/utils'
@@ -60,6 +56,7 @@ const _AdminHome: React.FC<Props> = ({ children }) => {
6056 const permissions = useStore ( stores . permissions )
6157 const page = useStore ( stores . router )
6258 const officeId = useStore ( stores . officeId )
59+ const layoutView = useStore ( stores . layoutView )
6360
6461 const filteredModules = React . useMemo ( ( ) => {
6562 return modulesWithAdminComponents . filter ( ( m ) => {
@@ -76,30 +73,65 @@ const _AdminHome: React.FC<Props> = ({ children }) => {
7673 } )
7774 } , [ permissions , officeId ] )
7875
79- return filteredModules . length ? (
80- < div className = "grid grid-cols-[240px_minmax(0,auto)] gap-x-4" >
81- < div >
82- < WidgetWrapper className = "p-2 sticky top-2" >
76+ if ( ! filteredModules . length ) {
77+ return (
78+ < WidgetWrapper >
79+ Please select an office that you can work with.
80+ </ WidgetWrapper >
81+ )
82+ }
83+
84+ if ( layoutView === 'desktop' ) {
85+ return (
86+ < div className = "grid grid-cols-[240px_minmax(0,auto)] gap-x-4" >
87+ < div >
88+ < WidgetWrapper className = "p-2 sticky top-2 -mb-1" >
89+ { filteredModules . map ( ( x , i ) => {
90+ const isActive = ! ! ( page && x . routes . includes ( page . route ) )
91+ return (
92+ < ModuleLink
93+ key = { x . id }
94+ isActive = { isActive }
95+ module = { x }
96+ className = "mb-1"
97+ />
98+ )
99+ } ) }
100+ </ WidgetWrapper >
101+ </ div >
102+ < div >
103+ < div > { children } </ div >
104+ </ div >
105+ </ div >
106+ )
107+ }
108+
109+ return (
110+ < div >
111+ < WidgetWrapper className = "p-2 " >
112+ < div className = "flex flex-wrap -mb-1 -mr-1" >
83113 { filteredModules . map ( ( x , i ) => {
84114 const isActive = ! ! ( page && x . routes . includes ( page . route ) )
85- return < ModuleLink key = { x . id } isActive = { isActive } module = { x } />
115+ return (
116+ < ModuleLink
117+ key = { x . id }
118+ isActive = { isActive }
119+ module = { x }
120+ className = "mr-1 mb-1"
121+ />
122+ )
86123 } ) }
87- </ WidgetWrapper >
88- </ div >
89- < div >
90- < div > { children } </ div >
91- </ div >
124+ </ div >
125+ </ WidgetWrapper >
126+ < div > { children } </ div >
92127 </ div >
93- ) : (
94- < WidgetWrapper >
95- Please select an office that you can work with.
96- </ WidgetWrapper >
97128 )
98129}
99130
100131const ModuleLink : React . FC < {
101132 isActive : boolean
102133 module : ModuleWithAdminComponents
134+ className ?: string
103135} > = ( props ) => {
104136 const officeId = useStore ( stores . officeId )
105137 const counterApiUri = `/admin-api/${ props . module . id } /counter`
@@ -115,9 +147,10 @@ const ModuleLink: React.FC<{
115147 < a
116148 href = { `/admin/${ props . module . id } ` }
117149 className = { cn (
118- 'relative flex items-center px-4 py-4 rounded-tiny hover:bg-gray-50' ,
150+ 'relative flex items-center px-4 py-3 rounded-tiny hover:bg-gray-50' ,
119151 props . isActive &&
120- 'bg-purple-50 hover:bg-purple-50 bg-opacity-40 hover:bg-opacity-40 text-purple-500'
152+ 'bg-purple-50 hover:bg-purple-50 bg-opacity-40 hover:bg-opacity-40 text-purple-500' ,
153+ props . className
121154 ) }
122155 >
123156 < span className = "flex-1 text-ellipsis overflow-hidden mr-1 whitespace-nowrap" >
0 commit comments