@@ -43,38 +43,38 @@ export default function AuditLogDetailsPage() {
4343 // Fetches specific audit
4444 const { auditLog } = useAuditLogDetailsQuery ( )
4545
46- const changed_fields =
47- auditLog . rowData &&
48- Object . entries ( auditLog . rowData ) . map ( ( [ field , change ] , index ) => {
49- return (
50- < Accordion . Item key = { field } value = { field } >
51- < Accordion . Control >
52- < strong > { field === "new" ? "Data lagt til" : field } </ strong >
53- </ Accordion . Control >
54- < Accordion . Panel >
55- < div style = { { whiteSpace : "pre-wrap" } } >
56- { change . old ? (
57- < StringDiff // This component shows the string-difference
58- oldValue = { change . old ?? "" }
59- newValue = { change . new ?? "" }
60- method = { DiffMethod . Lines }
61- styles = { diffStyles }
62- key = { isDark ? "dark" : "light" }
63- />
64- ) : (
65- // Prints all values if there is no existing "old" value
66- Object . entries ( change ) . map ( ( [ key , value ] ) => (
67- < div key = { key } >
68- < strong > { key } :</ strong > { String ( value ) }
69- </ div >
70- ) )
71- ) }
72- </ div >
73- </ Accordion . Panel >
74- </ Accordion . Item >
75- )
76- } )
7746 if ( ! auditLog . rowData ) return null
47+
48+ const changed_fields = Object . entries ( auditLog . rowData ) . map ( ( [ field , change ] , index ) => {
49+ return (
50+ < Accordion . Item key = { field } value = { field } >
51+ < Accordion . Control >
52+ < strong > { field === "new" ? "Data lagt til" : field } </ strong >
53+ </ Accordion . Control >
54+ < Accordion . Panel >
55+ < div style = { { whiteSpace : "pre-wrap" } } >
56+ { change . old ? (
57+ < StringDiff // This component shows the string-difference
58+ oldValue = { change . old ?? "" }
59+ newValue = { change . new ?? "" }
60+ method = { DiffMethod . Lines }
61+ styles = { diffStyles }
62+ key = { isDark ? "dark" : "light" }
63+ />
64+ ) : (
65+ // Prints all values if there is no existing "old" value
66+ Object . entries ( change ) . map ( ( [ key , value ] ) => (
67+ < div key = { key } >
68+ < strong > { key } :</ strong > { String ( value ) }
69+ </ div >
70+ ) )
71+ ) }
72+ </ div >
73+ </ Accordion . Panel >
74+ </ Accordion . Item >
75+ )
76+ } )
77+
7878 return (
7979 < Stack >
8080 < Title order = { 2 } > Hendelse</ Title >
0 commit comments