UI tweaks / fixes (#11479)

* Update coloring of logs button

* Fix paging after submitting

* Fix sorting

* Add icon
This commit is contained in:
Nicolas Mowen 2024-05-22 07:14:48 -06:00 committed by GitHub
parent 592b645231
commit c49be0a47f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -227,9 +227,9 @@ def events():
elif sort == "score_desc": elif sort == "score_desc":
order_by = Event.data["score"].desc() order_by = Event.data["score"].desc()
elif sort == "date_asc": elif sort == "date_asc":
Event.start_time.asc() order_by = Event.start_time.asc()
elif sort == "date_desc": elif sort == "date_desc":
Event.start_time.desc() order_by = Event.start_time.desc()
else: else:
order_by = Event.start_time.desc() order_by = Event.start_time.desc()

View File

@ -13,6 +13,7 @@ import { toast } from "sonner";
import { isDesktop } from "react-device-detect"; import { isDesktop } from "react-device-detect";
import ActivityIndicator from "@/components/indicators/activity-indicator"; import ActivityIndicator from "@/components/indicators/activity-indicator";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { MdVerticalAlignBottom } from "react-icons/md";
const logTypes = ["frigate", "go2rtc", "nginx"] as const; const logTypes = ["frigate", "go2rtc", "nginx"] as const;
type LogType = (typeof logTypes)[number]; type LogType = (typeof logTypes)[number];
@ -381,7 +382,7 @@ function Logs() {
{initialScroll && !endVisible && ( {initialScroll && !endVisible && (
<Button <Button
className="absolute bottom-8 left-[50%] z-20 -translate-x-[50%] rounded-md bg-secondary-foreground p-2 text-primary" className="absolute bottom-8 left-[50%] z-20 flex -translate-x-[50%] items-center gap-1 rounded-md p-2"
onClick={() => onClick={() =>
contentRef.current?.scrollTo({ contentRef.current?.scrollTo({
top: contentRef.current?.scrollHeight, top: contentRef.current?.scrollHeight,
@ -389,6 +390,7 @@ function Logs() {
}) })
} }
> >
<MdVerticalAlignBottom />
Jump to Bottom Jump to Bottom
</Button> </Button>
)} )}

View File

@ -211,6 +211,7 @@ export default function SubmitPlus() {
...data.slice(0, pageIndex), ...data.slice(0, pageIndex),
[ [
...data[pageIndex].slice(0, index), ...data[pageIndex].slice(0, index),
{ ...data[pageIndex][index], plus_id: "new_upload" },
...data[pageIndex].slice(index + 1), ...data[pageIndex].slice(index + 1),
], ],
...data.slice(pageIndex + 1), ...data.slice(pageIndex + 1),
@ -275,17 +276,14 @@ export default function SubmitPlus() {
</DialogContent> </DialogContent>
</Dialog> </Dialog>
{events?.map((event, eIdx) => { {events?.map((event) => {
if (event.data.type != "object") { if (event.data.type != "object" || event.plus_id) {
return; return;
} }
const lastRow = eIdx == events.length - 1;
return ( return (
<div <div
key={event.id} key={event.id}
ref={lastRow ? lastEventRef : null}
className="relative flex aspect-video w-full cursor-pointer items-center justify-center rounded-lg bg-black md:rounded-2xl" className="relative flex aspect-video w-full cursor-pointer items-center justify-center rounded-lg bg-black md:rounded-2xl"
onClick={() => setUpload(event)} onClick={() => setUpload(event)}
> >
@ -324,7 +322,7 @@ export default function SubmitPlus() {
</div> </div>
); );
})} })}
{!isValidating && !isDone && <div ref={lastEventRef} />}
{isValidating && <ActivityIndicator />} {isValidating && <ActivityIndicator />}
</div> </div>
</div> </div>