mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 12:04:02 +00:00
feat: add quick payment action and improve copy button UX
Mini App Home Screen: - Add 'Record Payment' button to utilities and rent period cards - Pre-fill payment amount with member's share (rentShare/utilityShare) - Modal dialog with amount input and currency display - Toast notifications for copy and payment success/failure feedback Copy Button Improvements: - Increase spacing between icon and text (4px → 8px) - Add hover background and padding for better touch target - Green background highlight when copied (in addition to icon color change) - Toast notification appears when copying any value Backend: - Add /api/miniapp/payments/add endpoint for quick payments - Payment notifications sent to 'reminders' topic in Telegram - Include member name, payment type, amount, and period in notification Files: - New: apps/miniapp/src/components/ui/toast.tsx - Modified: apps/miniapp/src/routes/home.tsx, apps/miniapp/src/index.css, apps/miniapp/src/theme.css, apps/miniapp/src/i18n.ts, apps/bot/src/miniapp-billing.ts, apps/bot/src/server.ts Quality Gates: ✅ format, lint, typecheck, build, test Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -122,6 +122,12 @@ export interface BotWebhookServerOptions {
|
||||
handler: (request: Request) => Promise<Response>
|
||||
}
|
||||
| undefined
|
||||
miniAppSubmitUtilityBill?:
|
||||
| {
|
||||
path?: string
|
||||
handler: (request: Request) => Promise<Response>
|
||||
}
|
||||
| undefined
|
||||
miniAppUpdateUtilityBill?:
|
||||
| {
|
||||
path?: string
|
||||
@@ -158,6 +164,12 @@ export interface BotWebhookServerOptions {
|
||||
handler: (request: Request) => Promise<Response>
|
||||
}
|
||||
| undefined
|
||||
miniAppSubmitPayment?:
|
||||
| {
|
||||
path?: string
|
||||
handler: (request: Request) => Promise<Response>
|
||||
}
|
||||
| undefined
|
||||
miniAppUpdatePayment?:
|
||||
| {
|
||||
path?: string
|
||||
@@ -241,6 +253,8 @@ export function createBotWebhookServer(options: BotWebhookServerOptions): {
|
||||
const miniAppRentUpdatePath = options.miniAppRentUpdate?.path ?? '/api/miniapp/admin/rent/update'
|
||||
const miniAppAddUtilityBillPath =
|
||||
options.miniAppAddUtilityBill?.path ?? '/api/miniapp/admin/utility-bills/add'
|
||||
const miniAppSubmitUtilityBillPath =
|
||||
options.miniAppSubmitUtilityBill?.path ?? '/api/miniapp/utility-bills/add'
|
||||
const miniAppUpdateUtilityBillPath =
|
||||
options.miniAppUpdateUtilityBill?.path ?? '/api/miniapp/admin/utility-bills/update'
|
||||
const miniAppDeleteUtilityBillPath =
|
||||
@@ -252,6 +266,7 @@ export function createBotWebhookServer(options: BotWebhookServerOptions): {
|
||||
const miniAppDeletePurchasePath =
|
||||
options.miniAppDeletePurchase?.path ?? '/api/miniapp/admin/purchases/delete'
|
||||
const miniAppAddPaymentPath = options.miniAppAddPayment?.path ?? '/api/miniapp/admin/payments/add'
|
||||
const miniAppSubmitPaymentPath = options.miniAppSubmitPayment?.path ?? '/api/miniapp/payments/add'
|
||||
const miniAppUpdatePaymentPath =
|
||||
options.miniAppUpdatePayment?.path ?? '/api/miniapp/admin/payments/update'
|
||||
const miniAppDeletePaymentPath =
|
||||
@@ -362,6 +377,10 @@ export function createBotWebhookServer(options: BotWebhookServerOptions): {
|
||||
return await options.miniAppAddUtilityBill.handler(request)
|
||||
}
|
||||
|
||||
if (options.miniAppSubmitUtilityBill && url.pathname === miniAppSubmitUtilityBillPath) {
|
||||
return await options.miniAppSubmitUtilityBill.handler(request)
|
||||
}
|
||||
|
||||
if (options.miniAppUpdateUtilityBill && url.pathname === miniAppUpdateUtilityBillPath) {
|
||||
return await options.miniAppUpdateUtilityBill.handler(request)
|
||||
}
|
||||
@@ -386,6 +405,10 @@ export function createBotWebhookServer(options: BotWebhookServerOptions): {
|
||||
return await options.miniAppAddPayment.handler(request)
|
||||
}
|
||||
|
||||
if (options.miniAppSubmitPayment && url.pathname === miniAppSubmitPaymentPath) {
|
||||
return await options.miniAppSubmitPayment.handler(request)
|
||||
}
|
||||
|
||||
if (options.miniAppUpdatePayment && url.pathname === miniAppUpdatePaymentPath) {
|
||||
return await options.miniAppUpdatePayment.handler(request)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user