feat(donate): force refresh button
Build and Push Image / build-backend (push) Successful in 16s
Build and Push Image / build-frontend (push) Successful in 1m11s
Build and Push Image / push (push) Successful in 44s

This commit is contained in:
2026-06-08 12:46:27 +07:00 Unverified
parent bfef17758e
commit 9e124cd5b2
4 changed files with 32 additions and 7 deletions
+6
View File
@@ -18,6 +18,12 @@ export async function testPopup() {
});
}
export async function reloadWidget() {
if (!(await adminCheck())) throw new Error("Unauthorized");
sse.donate.pub("refresh", null);
}
export async function resendPopup(id: string) {
if (!(await adminCheck())) throw new Error("Unauthorized");
const [sub] = await db
+24 -7
View File
@@ -10,10 +10,16 @@ import {
import { donations } from "@/lib/db/schema";
import { cn } from "@/lib/utils";
import type { ColumnDef } from "@tanstack/react-table";
import { BitcoinIcon, BugPlay, Copy, MessageCircleWarning } from "lucide-react";
import {
BitcoinIcon,
BugPlay,
ChevronsLeftRightEllipsis,
Copy,
MessageCircleWarning,
} from "lucide-react";
import { useEllipsisVisible } from "react-hook-text-overflow";
import { ActionButton } from "../../../../components/action-button";
import { resendPopup, testPopup } from "./api";
import { reloadWidget, resendPopup, testPopup } from "./api";
import { useEffect } from "react";
import { sse } from "@/lib/db/sse-endpoints";
import { useRouter } from "next/navigation";
@@ -57,11 +63,22 @@ const columns: ColumnDef<typeof donations.$inferSelect>[] = [
accessorKey: "id",
header() {
return (
<SimpleTooltip text="Send test popup">
<ActionButton variant="outline" size="icon-sm" action={testPopup}>
<BugPlay />
</ActionButton>
</SimpleTooltip>
<div className="flex gap-1">
<SimpleTooltip text="Send test popup">
<ActionButton variant="outline" size="icon-sm" action={testPopup}>
<BugPlay />
</ActionButton>
</SimpleTooltip>
<SimpleTooltip text="Reload all widget">
<ActionButton
variant="outline"
size="icon-sm"
action={reloadWidget}
>
<ChevronsLeftRightEllipsis />
</ActionButton>
</SimpleTooltip>
</div>
);
},
cell(row) {
+1
View File
@@ -75,6 +75,7 @@ export default function () {
const { clean } = sse.donate.subMany({
heartbeat: (tag) => pendingHeartbeat[tag]?.(),
ping: enqueue,
refresh: () => location.reload(),
});
const interval = setInterval(async () => {
+1
View File
@@ -42,6 +42,7 @@ export const sse = sseEndpointMap({
// roundtrip SSE system check
heartbeat: z.number(),
update: z.null(),
refresh: z.null(),
},
// Passive Update Checker
active: {