Skip to content

Commit 09b1df8

Browse files
committed
don't define components in render
1 parent c6f5d96 commit 09b1df8

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

app/pages/system/AuditLog.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,25 @@ import { Badge } from '~/ui/lib/Badge'
2222
import { Button } from '~/ui/lib/Button'
2323
import { PageHeader, PageTitle } from '~/ui/lib/PageHeader'
2424
import { Spinner } from '~/ui/lib/Spinner'
25+
import { classed } from '~/util/classed'
2526
import { toSyslogDateString, toSyslogTimeString } from '~/util/date'
2627
import { docLinks } from '~/util/links'
2728

2829
export const handle = { crumb: 'Audit Log' }
2930

31+
// todo
32+
// might want to still render the items in case of error
33+
const ErrorState = () => {
34+
return <div>Error State</div>
35+
}
36+
37+
// todo
38+
const LoadingState = () => {
39+
return <div>Loading State</div>
40+
}
41+
42+
const HeaderCell = classed.div`text-mono-sm text-tertiary`
43+
3044
// for virtualizer
3145
const estimateSize = () => 36
3246

@@ -87,7 +101,7 @@ export default function SiloAuditLogsPage() {
87101
overscan: 20,
88102
})
89103

90-
const LogTable = () => (
104+
const logTable = (
91105
<>
92106
<div
93107
className="relative w-full"
@@ -115,7 +129,6 @@ export default function SiloAuditLogsPage() {
115129
style={{
116130
gridTemplateColumns: '7rem 4.25rem 180px 120px 120px 120px 300px 300px',
117131
}}
118-
onClick={() => {}}
119132
>
120133
<div className="overflow-hidden whitespace-nowrap text-mono-sm">
121134
<span className="text-tertiary">
@@ -172,17 +185,6 @@ export default function SiloAuditLogsPage() {
172185
</>
173186
)
174187

175-
// todo
176-
// might want to still render the items in case of error
177-
const ErrorState = () => {
178-
return <div>Error State</div>
179-
}
180-
181-
// todo
182-
const LoadingState = () => {
183-
return <div>Loading State</div>
184-
}
185-
186188
return (
187189
<>
188190
<PageHeader>
@@ -206,18 +208,18 @@ export default function SiloAuditLogsPage() {
206208
gridTemplateColumns: '7rem 4.25rem 180px 120px 120px 120px 300px 300px',
207209
}}
208210
>
209-
{['Time', 'Status', 'Operation', 'Actor', 'Access Method', 'Silo', 'Duration'].map(
210-
(header) => (
211-
<div key={header} className="text-mono-sm text-tertiary">
212-
{header}
213-
</div>
214-
)
215-
)}
211+
<HeaderCell>Time</HeaderCell>
212+
<HeaderCell>Status</HeaderCell>
213+
<HeaderCell>Operation</HeaderCell>
214+
<HeaderCell>Actor</HeaderCell>
215+
<HeaderCell>Access Method</HeaderCell>
216+
<HeaderCell>Silo</HeaderCell>
217+
<HeaderCell>Duration</HeaderCell>
216218
</div>
217219

218220
<div className="!mx-0 flex h-full !w-full flex-col">
219221
<div className="w-full flex-1" ref={parentRef}>
220-
{error ? <ErrorState /> : !isLoading ? <LogTable /> : <LoadingState />}
222+
{error ? <ErrorState /> : !isLoading ? logTable : <LoadingState />}
221223
</div>
222224
</div>
223225
</>

0 commit comments

Comments
 (0)