rubgram public side

Co-authored-by: Gunshin <[email protected]>
This commit is contained in:
Dreamgineer
2025-11-27 12:12:21 -05:00
co-authored by Gunshin
Unverified
parent 45f6d06cc9
commit 8a96ea8573
44 changed files with 2140 additions and 412 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { getArtifactConfig } from "@/lib/api";
import { db } from "@/lib/db";
import { characters, submissions } from "@/lib/db/schema";
import { CopyButton, EnkaBrowser } from "./client";
@@ -27,6 +28,7 @@ export default async function AdminSubmissionView({
.from(characters)
.where(eq(characters.name, sub?.char || ""))
.limit(1);
const { enka } = await getArtifactConfig();
return (
<div className="p-2 h-full">
<div className="flex flex-col h-full w-full gap-2">
@@ -48,7 +50,7 @@ export default async function AdminSubmissionView({
<Avatar char={char} />
</div>
<div className="border rounded-md h-full overflow-hidden">
<EnkaBrowser uid={sub?.uid || ""} />
{enka && <EnkaBrowser uid={sub?.uid || ""} />}
</div>
</div>
</div>
+19 -5
View File
@@ -4,7 +4,7 @@ import { useProgress } from "@bprogress/next";
import { Lock, Unlock } from "lucide-react";
import Link from "next/link";
import { useParams, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
@@ -138,7 +138,7 @@ export function LimitManager({
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Set limit</DialogTitle>
<DialogTitle>ตั้ง Limit</DialogTitle>
</DialogHeader>
<form
id="limit-form"
@@ -156,11 +156,11 @@ export function LimitManager({
</form>
<DialogFooter>
<DialogClose asChild>
<Button variant="outline">Cancel</Button>
<Button variant="outline">ยกเลิก</Button>
</DialogClose>
<DialogClose asChild>
<Button type="submit" form="limit-form">
Save changes
บันทึกการเปลี่ยนแปลง
</Button>
</DialogClose>
</DialogFooter>
@@ -206,10 +206,24 @@ export function SubmissionList({
export function Watcher() {
const router = useRouter();
const count = useRef<number | undefined>(undefined);
useEffect(() => {
const es = new EventSource(`/api/artifact/ev`);
es.addEventListener("update", () => router.refresh());
return () => es.close();
const interval = setInterval(() => {
fetch("/api/artifact/count")
.then((r) => r.json())
.then((r) => {
if (typeof count.current === "undefined") count.current = r;
if (count.current !== r) router.refresh();
count.current = r;
})
.catch((e) => console.error("Fetching artifact count failed", e));
}, 60000);
return () => {
es.close();
clearInterval(interval);
};
}, [router]);
return <div></div>;
+6 -6
View File
@@ -69,17 +69,17 @@ export default async function AdminLayout({
<AlertDialogContent className="z-101">
<AlertDialogHeader>
<AlertDialogTitle>
Are you absolutely sure?
คุณมั่นใจที่จะล้างข้อมูลทั้งหมดใช่ไหม?
</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete
your account and remove your data from our servers.
การกระทำนี้ไม่สามารถย้อนกลับได้
เราจะลบบัญชีของท่านออกจากระบบ
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogCancel>ยกเลิก</AlertDialogCancel>
<AlertDialogAction onClick={wipe}>
Continue
ดำเนินการต่อ
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -89,7 +89,7 @@ export default async function AdminLayout({
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Submissions</SidebarGroupLabel>
<SidebarGroupLabel>เสือกไอดีชาวบ้าน</SidebarGroupLabel>
<SidebarMenu>
<SubmissionList subs={subs} />
</SidebarMenu>
+3 -1
View File
@@ -159,7 +159,9 @@ function Placeholder({ className, ...props }: React.ComponentProps<"div">) {
export function Disclaimer() {
const [agreed, setAgreed] = useState(false);
if (agreed) return;
const [updated] = comms.var("updated");
if (agreed || updated) return;
return (
<Blocker>
<RulesDialog onOpenChange={(set) => !set && setAgreed(true)}>
+1 -1
View File
@@ -11,7 +11,7 @@ export function ArtifactFormWrapper(props: React.ComponentProps<"form">) {
.then((q) => {
if (typeof q === "string") return toast.error(q);
try {
// biome-ignore lint/suspicious/noTsIgnore: typescript issue
// biome-ignore lint/suspicious/noTsIgnore: error appears on build but not visible to biome
// @ts-ignore
cookieStore.set("sid", q.id);
} catch {}