From 698abcec229300e38984ed2c7a456abb437864ae Mon Sep 17 00:00:00 2001 From: "Mr.Dat" Date: Tue, 24 Mar 2026 17:29:58 +0700 Subject: [PATCH] feat: refactor billing components and add payment history - Remove BillingWalletRow.vue component. - Update PlayerConfigsTable.vue to use JSX syntax and improve rendering logic. - Enhance auth store with currency and date formatting utilities. - Add ListIcon and MoneyCheck icon components. - Implement PaymentHistory component for displaying payment history with download functionality. - Create PlanSelection component for selecting billing plans with improved UI. - Introduce UpgradeDialog component for handling plan upgrades and payment methods. --- bun.lock | 3 + components.d.ts | 4 + package.json | 1 + public/locales/en/translation.json | 10 +- public/locales/vi/translation.json | 10 +- src/components/icons/ListIcon.vue | 7 + src/components/icons/MoneyCheck.vue | 10 + src/components/ui/AppButton.vue | 55 +- src/components/ui/AppDialog.vue | 115 ++-- src/lib/utils.ts | 106 +++- src/routes/settings/AdsVast/AdsVast.vue | 2 +- .../AdsVast/components/AdsVastTable.tsx | 4 +- src/routes/settings/Billing/Billing.vue | 590 ++++-------------- .../components/BillingHistorySection.vue | 114 ---- .../components/BillingPlansSection.vue | 98 --- .../components/BillingUsageSection.vue | 64 +- .../Billing/components/BillingWalletRow.vue | 49 -- .../Billing/components/PaymentHistory.tsx | 200 ++++++ .../Billing/components/PlanSelection.tsx | 158 +++++ .../Billing/components/UpgradeDialog.vue | 189 ++++++ .../components/PlayerConfigsTable.vue | 140 +++-- src/stores/auth.ts | 21 +- 22 files changed, 1007 insertions(+), 943 deletions(-) create mode 100644 src/components/icons/ListIcon.vue create mode 100644 src/components/icons/MoneyCheck.vue delete mode 100644 src/routes/settings/Billing/components/BillingHistorySection.vue delete mode 100644 src/routes/settings/Billing/components/BillingPlansSection.vue delete mode 100644 src/routes/settings/Billing/components/BillingWalletRow.vue create mode 100644 src/routes/settings/Billing/components/PaymentHistory.tsx create mode 100644 src/routes/settings/Billing/components/PlanSelection.tsx create mode 100644 src/routes/settings/Billing/components/UpgradeDialog.vue diff --git a/bun.lock b/bun.lock index 9586b2b..359c04c 100644 --- a/bun.lock +++ b/bun.lock @@ -17,6 +17,7 @@ "@unhead/vue": "^2.1.12", "@vueuse/core": "^14.2.1", "aws4fetch": "^1.0.20", + "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "hono": "^4.12.7", "i18next": "^25.8.18", @@ -433,6 +434,8 @@ "chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], + "class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="], + "cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], diff --git a/components.d.ts b/components.d.ts index d3b46db..2de6cb8 100644 --- a/components.d.ts +++ b/components.d.ts @@ -57,8 +57,10 @@ declare module 'vue' { Layout: typeof import('./src/components/icons/Layout.vue')['default'] LayoutDashboard: typeof import('./src/components/icons/LayoutDashboard.vue')['default'] LinkIcon: typeof import('./src/components/icons/LinkIcon.vue')['default'] + ListIcon: typeof import('./src/components/icons/ListIcon.vue')['default'] LockIcon: typeof import('./src/components/icons/LockIcon.vue')['default'] MailIcon: typeof import('./src/components/icons/MailIcon.vue')['default'] + MoneyCheck: typeof import('./src/components/icons/MoneyCheck.vue')['default'] MonitorIcon: typeof import('./src/components/icons/MonitorIcon.vue')['default'] NotificationDrawer: typeof import('./src/components/NotificationDrawer.vue')['default'] OfflineOverlay: typeof import('./src/components/OfflineOverlay.vue')['default'] @@ -142,8 +144,10 @@ declare global { const Layout: typeof import('./src/components/icons/Layout.vue')['default'] const LayoutDashboard: typeof import('./src/components/icons/LayoutDashboard.vue')['default'] const LinkIcon: typeof import('./src/components/icons/LinkIcon.vue')['default'] + const ListIcon: typeof import('./src/components/icons/ListIcon.vue')['default'] const LockIcon: typeof import('./src/components/icons/LockIcon.vue')['default'] const MailIcon: typeof import('./src/components/icons/MailIcon.vue')['default'] + const MoneyCheck: typeof import('./src/components/icons/MoneyCheck.vue')['default'] const MonitorIcon: typeof import('./src/components/icons/MonitorIcon.vue')['default'] const NotificationDrawer: typeof import('./src/components/NotificationDrawer.vue')['default'] const OfflineOverlay: typeof import('./src/components/OfflineOverlay.vue')['default'] diff --git a/package.json b/package.json index 67e5ea8..d4ab2dd 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@unhead/vue": "^2.1.12", "@vueuse/core": "^14.2.1", "aws4fetch": "^1.0.20", + "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "hono": "^4.12.7", "i18next": "^25.8.18", diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 64b07b6..703a50b 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -503,7 +503,7 @@ "username": "Username", "email": "Email Address", "storageUsage": "Storage Usage", - "storageUsedOfLimit": "{{used}} of {{limit}} used", + "storageUsedOfLimit": "{{used}} used", "editProfile": "Edit Profile", "changePassword": "Change Password" }, @@ -534,9 +534,9 @@ "processing": "Processing...", "upgrade": "Upgrade", "storage": "Storage", - "storageUsedOfLimit": "{{used}} of {{limit}} used", + "storageUsedOfLimit": "{{used}} used", "totalVideos": "Total videos", - "totalVideosUsedOfLimit": "{{used}} of {{limit}} videos", + "totalVideosUsedOfLimit": "{{used}} videos", "paymentHistory": "Payment History", "paymentHistorySubtitle": "Your past payments and invoices", "noPaymentHistory": "No payment history found.", @@ -552,9 +552,9 @@ }, "subscription": { "activeTitle": "Plan active", - "activeDescription": " {{plan}} is active until {{date}}", + "activeDescription": " Active until {{date}}", "expiringTitle": "Expiring soon", - "expiringDescription": " {{plan}} expires on {{date}}", + "expiringDescription": " Expires on {{date}}", "expiredTitle": "Plan expired", "expiredDescription": "Your last subscription ended on {{date}}", "freeTitle": "Free access", diff --git a/public/locales/vi/translation.json b/public/locales/vi/translation.json index 4e3bd74..979df13 100644 --- a/public/locales/vi/translation.json +++ b/public/locales/vi/translation.json @@ -503,7 +503,7 @@ "username": "Tên người dùng", "email": "Địa chỉ email", "storageUsage": "Dung lượng sử dụng", - "storageUsedOfLimit": "Đã dùng {{used}} trên {{limit}}", + "storageUsedOfLimit": "Đã dùng {{used}}", "editProfile": "Chỉnh sửa hồ sơ", "changePassword": "Đổi mật khẩu" }, @@ -534,9 +534,9 @@ "processing": "Đang xử lý...", "upgrade": "Nâng cấp", "storage": "Dung lượng", - "storageUsedOfLimit": "Đã dùng {{used}} trên {{limit}}", + "storageUsedOfLimit": "Đã dùng {{used}}", "totalVideos": "Tổng video", - "totalVideosUsedOfLimit": "{{used}} trên {{limit}} video", + "totalVideosUsedOfLimit": "{{used}} video", "paymentHistory": "Lịch sử thanh toán", "paymentHistorySubtitle": "Các khoản thanh toán và hóa đơn trước đây của bạn", "noPaymentHistory": "Không tìm thấy lịch sử thanh toán.", @@ -551,9 +551,9 @@ }, "subscription": { "activeTitle": "Gói đang hoạt động", - "activeDescription": " {{plan}} có hiệu lực đến {{date}}", + "activeDescription": " Hiệu lực đến {{date}}", "expiringTitle": "Sắp hết hạn", - "expiringDescription": " {{plan}} sẽ hết hạn vào {{date}}", + "expiringDescription": "Hết hạn vào {{date}}", "expiredTitle": "Gói đã hết hạn", "expiredDescription": "Gói gần nhất của bạn đã kết thúc vào {{date}}", "freeTitle": "Gói miễn phí", diff --git a/src/components/icons/ListIcon.vue b/src/components/icons/ListIcon.vue new file mode 100644 index 0000000..3678b0c --- /dev/null +++ b/src/components/icons/ListIcon.vue @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/src/components/icons/MoneyCheck.vue b/src/components/icons/MoneyCheck.vue new file mode 100644 index 0000000..ba019a7 --- /dev/null +++ b/src/components/icons/MoneyCheck.vue @@ -0,0 +1,10 @@ + + + diff --git a/src/components/ui/AppButton.vue b/src/components/ui/AppButton.vue index 99ff6f1..d9e2549 100644 --- a/src/components/ui/AppButton.vue +++ b/src/components/ui/AppButton.vue @@ -1,6 +1,7 @@