feat(don): add payment method indicator in admin
Build and Push Image / build-backend (push) Successful in 2m32s
Build and Push Image / build-frontend (push) Successful in 3m40s
Build and Push Image / push (push) Successful in 1m10s

This commit is contained in:
2026-07-14 14:12:27 +07:00 Unverified
parent bceaf9e7f4
commit 745a9152d9
3 changed files with 16 additions and 1 deletions
+13 -1
View File
@@ -11,6 +11,7 @@ import {
ImageIcon,
MessageCircleWarning,
WalletIcon,
QrCodeIcon as PromptpayIcon,
} from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
@@ -32,6 +33,8 @@ import { getImage, reloadWidget, resendPopup, testPopup } from "./api";
import { formatDistanceToNow } from "date-fns";
import { lePalette } from "../../rubgram/admin/[id]/client";
import { th } from "date-fns/locale";
import TruemoneyIcon from "#/assets/tmn.webp";
import Image from "@/components/image";
// directly adapted for date instead of UUID
function colorFor(date: Date) {
@@ -135,7 +138,7 @@ const columns: ColumnDef<typeof donations.$inferSelect>[] = [
cell(row) {
return <ActionRow row={row.row.original} filler />;
},
meta: { className: "w-27 p-0" },
meta: { className: "w-36 p-0" },
},
];
@@ -148,6 +151,15 @@ function ActionRow({
}) {
return (
<div className="flex gap-1">
{row.method === "pp" ? (
<PromptpayIcon className="size-8 p-1 opacity-50" />
) : (
<Image
src={TruemoneyIcon}
alt="truemoney"
className="size-8 p-1 opacity-50 brightness-200 grayscale"
/>
)}
<SimpleTooltip text="แสดง Popup อีกครั้ง">
<ActionButton
variant="outline"
+1
View File
@@ -205,6 +205,7 @@ export default async function () {
amount,
message,
image: downscaled,
method: $.type,
uid: $.artifact === "true" ? $.uid : null,
// dont send on screen if less than 10
sent: $.amount < 10,
+2
View File
@@ -347,6 +347,7 @@ export const guides = pgTable("guides", {
//#region Donate
export const schDonate = pgSchema("donate");
export const paymentMethod = schDonate.enum("payment_method", ["tmn", "pp"]);
export const donations = schDonate.table("donations", {
id: text().primaryKey().$defaultFn(uuidv7),
@@ -359,6 +360,7 @@ export const donations = schDonate.table("donations", {
lastPing: timestamp("last_ping").default(new Date("01-01-2000")).notNull(),
sent: boolean().default(false).notNull(),
uid: text(),
method: paymentMethod().notNull().default("pp"),
});
//#endregion