@@ -101,7 +101,7 @@ const LookupsView = () => {
101101 < Typography
102102 variant = "h1"
103103 color = "primary"
104- sx = { ( theme ) => ( { marginTop : theme . spacing ( 3 ) } ) }
104+ sx = { ( theme ) => ( { paddingTop : theme . spacing ( 3 ) } ) }
105105 >
106106 Data dictionary
107107 </ Typography >
@@ -127,58 +127,118 @@ const LookupsView = () => {
127127 </ Paper >
128128
129129 { SETTINGS . map ( ( recordType ) => (
130- < Paper sx = { { paddingLeft : 3 } } key = { recordType . key } >
130+ < Paper sx = { { px : 3 , pb : 3 } } key = { recordType . key } >
131131 < Grid2
132132 container
133133 spacing = { 3 }
134134 sx = { { marginTop : 3 } }
135135 ref = { refs [ recordType . key ] }
136136 >
137137 < Grid2 size = { 12 } >
138- < Grid2
139- container
140- direction = "row"
141- spacing = { 1 }
142- sx = { ( theme ) => ( {
143- marginTop : theme . spacing ( 3 ) ,
144- alignItems : "center" ,
145- } ) }
146- >
147- < Grid2 >
148- < Typography variant = "h2" > { recordType . label } </ Typography >
149- </ Grid2 >
150- < Grid2 >
151- < Tooltip title = "Return to top of page" >
152- < IconButton
153- component = { Link }
154- to = { "#" }
155- onClick = { ( e ) => {
156- e . preventDefault ( ) ;
157- scrollToTable ( "_scroll_to_top" , refs ) ;
158- history . replace ( "" ) ;
159- } }
160- size = "large"
138+ { TAG_TABLE_KEYS . includes ( recordType . key ) ? (
139+ < Can
140+ perform = "lookups:edit"
141+ yes = {
142+ recordType . key === "moped_component_tags" ? (
143+ < ComponentTagsTable
144+ canEdit = { true }
145+ handleSnackbar = { handleSnackbar }
146+ onScrollToTop = { ( ) => {
147+ scrollToTable ( "_scroll_to_top" , refs ) ;
148+ history . replace ( "" ) ;
149+ } }
150+ />
151+ ) : (
152+ < ProjectTagsTable
153+ canEdit = { true }
154+ handleSnackbar = { handleSnackbar }
155+ onScrollToTop = { ( ) => {
156+ scrollToTable ( "_scroll_to_top" , refs ) ;
157+ history . replace ( "" ) ;
158+ } }
159+ />
160+ )
161+ }
162+ no = {
163+ recordType . key === "moped_component_tags" ? (
164+ < ComponentTagsTable
165+ canEdit = { false }
166+ handleSnackbar = { handleSnackbar }
167+ onScrollToTop = { ( ) => {
168+ scrollToTable ( "_scroll_to_top" , refs ) ;
169+ history . replace ( "" ) ;
170+ } }
171+ />
172+ ) : (
173+ < ProjectTagsTable
174+ canEdit = { false }
175+ handleSnackbar = { handleSnackbar }
176+ onScrollToTop = { ( ) => {
177+ scrollToTable ( "_scroll_to_top" , refs ) ;
178+ history . replace ( "" ) ;
179+ } }
180+ />
181+ )
182+ }
183+ />
184+ ) : (
185+ < Grid2
186+ container
187+ direction = "row"
188+ spacing = { 1 }
189+ sx = { ( theme ) => ( {
190+ paddingTop : theme . spacing ( 3 ) ,
191+ alignItems : "center" ,
192+ justifyContent : "space-between" ,
193+ } ) }
194+ >
195+ < Grid2 >
196+ < Grid2
197+ container
198+ direction = "row"
199+ spacing = { 1 }
200+ sx = { { alignItems : "center" } }
161201 >
162- < ArrowUpwardIcon fontSize = "small" />
163- </ IconButton >
164- </ Tooltip >
165- </ Grid2 >
166- < Grid2 >
167- < CopyTextButton
168- copyButtonText = "Copy link"
169- textToCopy = { `${
170- window . location . origin
171- } ${ pathname } ${ createRecordKeyHash ( recordType . key ) } `}
172- />
173- </ Grid2 >
174- < Grid2 size = { 12 } >
175- < RecordTable
176- rows = { data ?. [ recordType . key ] }
177- columns = { recordType . columns }
178- loading = { loading }
179- />
202+ < Grid2 >
203+ < Typography variant = "h2" >
204+ { recordType . label }
205+ </ Typography >
206+ </ Grid2 >
207+ < Grid2 >
208+ < Tooltip title = "Return to top of page" >
209+ < IconButton
210+ component = { Link }
211+ to = { "#" }
212+ onClick = { ( e ) => {
213+ e . preventDefault ( ) ;
214+ scrollToTable ( "_scroll_to_top" , refs ) ;
215+ history . replace ( "" ) ;
216+ } }
217+ size = "large"
218+ >
219+ < ArrowUpwardIcon fontSize = "small" />
220+ </ IconButton >
221+ </ Tooltip >
222+ </ Grid2 >
223+ </ Grid2 >
224+ </ Grid2 >
225+ < Grid2 >
226+ < CopyTextButton
227+ copyButtonText = "Copy link"
228+ textToCopy = { `${
229+ window . location . origin
230+ } ${ pathname } ${ createRecordKeyHash ( recordType . key ) } `}
231+ />
232+ </ Grid2 >
233+ < Grid2 size = { 12 } >
234+ < RecordTable
235+ rows = { data ?. [ recordType . key ] }
236+ columns = { recordType . columns }
237+ loading = { loading }
238+ />
239+ </ Grid2 >
180240 </ Grid2 >
181- </ Grid2 >
241+ ) }
182242 </ Grid2 >
183243 </ Grid2 >
184244 </ Paper >
0 commit comments