Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0cfd6fd
feat: api gen
richardscull Jun 23, 2026
9aab2e1
feat: Add admin scores preview page
richardscull Jun 23, 2026
6174f15
feat: Add score processing page wit hscores
richardscull Jun 23, 2026
5183755
feat: Add scores processing events
richardscull Jun 23, 2026
73369d2
feat: Add user scores edit page tab
richardscull Jun 23, 2026
502e161
fix: status badge color for score
richardscull Jun 23, 2026
610bce6
feat: Add apply to all matching the filter for user action
richardscull Jun 23, 2026
f1302a1
feat: refresh processing stats on refresh
richardscull Jun 23, 2026
db6a2ef
fix: Show submission status select for scores filter select
richardscull Jun 23, 2026
e041274
feat: Add confirm dialog for applying processing action to score
richardscull Jun 23, 2026
f95098a
fix: build error
richardscull Jun 23, 2026
31827a2
feat: Simplify build query
richardscull Jun 24, 2026
c4c012e
feat: clean up and minor improvements
richardscull Jun 24, 2026
3e6e681
chore: improve key for score processing
richardscull Jun 24, 2026
4789f0a
Merge pull request #45 from SunriseCommunity/feat/score-processing-ad…
richardscull Jun 24, 2026
1c52afd
Merge branch 'main' into version/0.2.0
richardscull Sep 26, 2026
cb4d9ae
feat: Add api client generated files to eslint ignore
richardscull Sep 26, 2026
0d1eaf3
chore!: bump node packages and drop turbo as it's enabled by default …
richardscull Sep 26, 2026
f2f3d08
feat: use define config for openapi config
richardscull Sep 26, 2026
e935dd5
feat: remove fix for the prefetched false of links, as the prefetch w…
richardscull Sep 26, 2026
401acfd
feat: remove hey api client fetch
richardscull Sep 26, 2026
5281c81
fix: infinite useCallback memorisation on createQueryString
richardscull Sep 26, 2026
c01702f
fix: destroy video stream if user have canceled it early
richardscull Sep 26, 2026
7f535a7
fix: image warning on front page
richardscull Sep 26, 2026
6bc4201
fix: finally fix the error warning on the leaderboard page
richardscull Sep 26, 2026
7ad39c3
feat: Add NEXT_PUBLIC_ALLOW_LOCAL_IP to the next config
richardscull Sep 26, 2026
13a1953
Merge pull request #48 from SunriseCommunity/feat/bump-npm-packages
richardscull Sep 26, 2026
971fe44
Merge branch 'main' into version/0.2.0
richardscull Oct 4, 2026
c5aa9f0
feat: api gen
richardscull Oct 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ NEXT_PUBLIC_KOFI_LINK= # Optional: Your Ko-fi donation page URL.
NEXT_PUBLIC_BOOSTY_LINK= # Optional: Your Boosty.to page URL.
NEXT_PUBLIC_STATUS_PAGE_LINK= # Optional: Link to your status page.
NEXT_PUBLIC_PATCHER_PAGE_ENABLED= # Optional: Set to "true" to show the Sunrise Patcher page in the help section.
NEXT_PUBLIC_UNOPTIMIZED_IMAGES= # Optional: Set to "true" to disable Next.js image optimization.
NEXT_PUBLIC_UNOPTIMIZED_IMAGES= # Optional: Set to "true" to disable Next.js image optimization.
NEXT_PUBLIC_ALLOW_LOCAL_IP= # Optional: Set to "true" to allow the image optimizer to fetch loopback/private addresses. Only needed locally.
1 change: 1 addition & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ docker compose -f docker-compose.yml up -d # Creates the container with app and
> ```bash
> NODE_TLS_REJECT_UNAUTHORIZED=0
> NEXT_PUBLIC_UNOPTIMIZED_IMAGES=true
> NEXT_PUBLIC_ALLOW_LOCAL_IP=true
> ```
> to you `.env.local` file.

Expand Down
163 changes: 163 additions & 0 deletions app/(admin)/admin/processing/events/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
"use client";

import { Filter, ScrollText } from "lucide-react";
import Link from "next/link";
import { useMemo, useState } from "react";

import PrettyDate from "@/components/General/PrettyDate";
import PrettyHeader from "@/components/General/PrettyHeader";
import { SmallUserElement } from "@/components/SmallUserElement";
import Spinner from "@/components/Spinner";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { MultiSelect } from "@/components/ui/multi-select";
import { useScoreProcessingEvents } from "@/lib/hooks/api/score-processing/useScoreProcessingEvents";
import { ScoreProcessingEventType } from "@/lib/types/api";
import { isInstance } from "@/lib/utils/type.util";

const PAGE_SIZE = 25;

export default function Page() {
const [page, setPage] = useState(1);
const [showFilters, setShowFilters] = useState(false);
const [eventTypes, setEventTypes] = useState<ScoreProcessingEventType[]>([]);

const { data, error, isLoading } = useScoreProcessingEvents(
useMemo(() => ({ types: eventTypes, page, limit: PAGE_SIZE }), [eventTypes, page]),
{ refreshInterval: 0, revalidateOnFocus: false, keepPreviousData: true },
);

const events = data?.events ?? [];
const totalCount = data?.total_count ?? 0;
const totalPages = Math.max(1, Math.ceil(totalCount / PAGE_SIZE));

return (
<div className="flex w-full flex-col space-y-4">
<PrettyHeader text="Processing events" roundBottom icon={<ScrollText />} />

<div className="flex items-center justify-between gap-2">
<p className="text-sm text-muted-foreground">
{totalCount}
{" "}
event(s)
</p>
<Button type="button" variant="outline" className="relative" onClick={() => setShowFilters(!showFilters)}>
<Filter className="mr-2 size-4" />
Filters
{eventTypes.length > 0 && (
<div className="absolute -right-2 -top-2 flex size-5 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground">
{eventTypes.length}
</div>
)}
</Button>
</div>

<div
className="overflow-hidden transition-all duration-500 ease-in-out"
style={{ maxHeight: showFilters ? "300px" : "0" }}
>
<Card>
<CardContent className="space-y-2 p-4">
<label className="text-sm font-medium">Event type</label>
<MultiSelect
options={Object.values(ScoreProcessingEventType).map(option => ({
value: option,
label: option,
}))}
defaultValue={eventTypes}
placeholder="All event types"
onValueChange={(values) => {
setEventTypes(values.filter(isScoreProcessingEventType));
setPage(1);
}}
/>
</CardContent>
</Card>
</div>

<div className="space-y-2">
{error
? (
<Card className="p-8">
<CardContent className="flex flex-col items-center justify-center gap-2 p-0 text-center text-muted-foreground">
<ScrollText className="size-12 opacity-50" />
<p className="font-medium text-foreground">Could not load processing events.</p>
<p className="text-sm">{error.message ?? "Refresh the page and try again."}</p>
</CardContent>
</Card>
)
: isLoading && events.length === 0
? (
<Card className="p-8">
<CardContent className="flex items-center justify-center p-0">
<Spinner />
</CardContent>
</Card>
)
: events.length > 0
? (
events.map(event => (
<Card key={event.id}>
<CardContent className="flex flex-col gap-2 p-4 md:flex-row md:items-center md:justify-between">
<div className="min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-2">
<Badge variant="outline">{event.event_type}</Badge>
{event.executor
? (
<SmallUserElement avatarUrl={event.executor.avatar_url} username={event.executor.username} profileUrl={`/admin/users/${event.executor.user_id}/edit`} />
)
: <Badge className="bg-muted text-muted-foreground">Server</Badge>}
{event.score_id != null && (
<Link
href={`/admin/scores/${event.score_id}`}
className="text-sm text-muted-foreground hover:underline"
>
{`Score #${event.score_id}`}
</Link>
)}
{event.task_id != null && (
<span className="text-sm text-muted-foreground">
{`Task #${event.task_id}`}
</span>
)}
</div>
{event.json_data && (
<pre className="mt-2 overflow-x-auto whitespace-pre-wrap break-all rounded bg-muted/40 p-2 text-xs text-muted-foreground">
{event.json_data}
</pre>
)}
</div>
<PrettyDate className="text-sm text-muted-foreground" time={event.created_at} />
</CardContent>
</Card>
))
)
: (
<Card className="p-8">
<CardContent className="flex flex-col items-center justify-center p-0 text-muted-foreground">
<ScrollText className="mb-4 size-12 opacity-50" />
<p>No processing events found.</p>
</CardContent>
</Card>
)}
</div>

<div className="flex items-center justify-between">
<Button variant="outline" disabled={page <= 1} onClick={() => setPage(page - 1)}>
Previous
</Button>
<span className="text-sm text-muted-foreground">
{`Page ${page} of ${totalPages}`}
</span>
<Button variant="outline" disabled={page >= totalPages} onClick={() => setPage(page + 1)}>
Next
</Button>
</div>
</div>
);
}

function isScoreProcessingEventType(value: string): value is ScoreProcessingEventType {
return isInstance(value, ScoreProcessingEventType);
}
Loading
Loading