Skip to content

Commit cf20d36

Browse files
Changed FLA log selection screen (#822)
* Added no recent logs comment and disabled clear logs button when no logs exists * Implemented suggestions from Kush
1 parent ae67945 commit cf20d36

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

gcs/src/components/fla/SelectFlightLog.jsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function SelectFlightLog({ getLogSummary }) {
100100
return recentFgcsLogs.map((log, idx) => (
101101
<div
102102
key={idx}
103-
className="flex flex-col px-4 py-2 hover:cursor-pointer hover:bg-falcongrey-700 hover:rounded-sm w-80"
103+
className="flex flex-col px-4 py-2 hover:cursor-pointer hover:bg-falcongrey-600 hover:rounded-sm"
104104
onClick={() => handleFile(log)}
105105
>
106106
<p>{log.name} </p>
@@ -117,25 +117,49 @@ export default function SelectFlightLog({ getLogSummary }) {
117117
))
118118
}, [recentFgcsLogs, handleFile])
119119

120+
const logsExist = useMemo(() => {
121+
return (
122+
recentLogItems === null ||
123+
(recentFgcsLogs !== null && recentLogItems.length === 0)
124+
)
125+
}, [recentLogItems, recentFgcsLogs])
126+
120127
return (
121128
<div className="flex flex-col items-center justify-center h-full mx-auto">
122129
<div className="flex flex-row items-center justify-center gap-8">
123130
<div className="flex flex-col gap-4">
124131
<Button onClick={selectFile} loading={loadingFile}>
125132
Analyse a log
126133
</Button>
127-
<Button color="red" variant="filled" onClick={clearFgcsLogs}>
134+
<Button
135+
disabled={logsExist}
136+
color="red"
137+
variant="filled"
138+
onClick={clearFgcsLogs}
139+
>
128140
Clear Logs
129141
</Button>
130142
</div>
131-
<Divider size="sm" orientation="vertical" />
143+
<Divider size="xs" orientation="vertical" />
132144
<div className="relative">
133145
<LoadingOverlay visible={recentFgcsLogs === null || loadingFile} />
134146
<div className="flex flex-col items-center gap-2">
135147
<p className="font-bold">Recent FGCS telemetry logs</p>
136-
<ScrollArea h={250} offsetScrollbars>
137-
{recentLogItems}
138-
</ScrollArea>
148+
<ScrollArea.Autosize
149+
className="relative"
150+
type="always"
151+
scrollbars="y"
152+
mah={250}
153+
offsetScrollbars="present"
154+
>
155+
{logsExist ? (
156+
<p className="w-full my-4 text-center text-falcongrey-400 text-sm">
157+
No recent logs
158+
</p>
159+
) : (
160+
recentLogItems
161+
)}
162+
</ScrollArea.Autosize>
139163
</div>
140164
</div>
141165
</div>

0 commit comments

Comments
 (0)