From 6e3ef8ab7ed5903d50ec43ba60544fd88d779c3e Mon Sep 17 00:00:00 2001 From: ppanel-web Date: Sun, 8 Feb 2026 08:49:17 +0000 Subject: [PATCH] fix(user): satisfy biome check for oauth/payment UI --- apps/user/public/oauth/google/index.html | 41 ++++++++++--------- apps/user/public/oauth/telegram/index.html | 39 +++++++++--------- .../sections/subscribe/payment-methods.tsx | 4 +- apps/user/src/sections/user/announcement.tsx | 7 ++-- .../user/src/sections/user/payment/stripe.tsx | 12 ++++-- 5 files changed, 54 insertions(+), 49 deletions(-) diff --git a/apps/user/public/oauth/google/index.html b/apps/user/public/oauth/google/index.html index 2961fd0..23f4bd1 100644 --- a/apps/user/public/oauth/google/index.html +++ b/apps/user/public/oauth/google/index.html @@ -1,28 +1,29 @@ - - + + OAuth Redirect - + - - Redirecting… - + Redirecting… diff --git a/apps/user/public/oauth/telegram/index.html b/apps/user/public/oauth/telegram/index.html index 82deea9..e650481 100644 --- a/apps/user/public/oauth/telegram/index.html +++ b/apps/user/public/oauth/telegram/index.html @@ -1,27 +1,28 @@ - - + + OAuth Redirect - + - - Redirecting… - + Redirecting… diff --git a/apps/user/src/sections/subscribe/payment-methods.tsx b/apps/user/src/sections/subscribe/payment-methods.tsx index c9695f6..b98bbfe 100644 --- a/apps/user/src/sections/subscribe/payment-methods.tsx +++ b/apps/user/src/sections/subscribe/payment-methods.tsx @@ -9,7 +9,7 @@ import { import { cn } from "@workspace/ui/lib/utils"; import { getAvailablePaymentMethods } from "@workspace/ui/services/user/portal"; import type React from "react"; -import React, { memo } from "react"; +import { memo, useEffect } from "react"; import { useTranslation } from "react-i18next"; interface PaymentMethodsProps { @@ -37,7 +37,7 @@ const PaymentMethods: React.FC = ({ // Only set a default when the current value is not a valid option. // This avoids resetting the user's selection on refetch (common on mobile). // Prefer non-balance methods when possible. - React.useEffect(() => { + useEffect(() => { if (!data || data.length === 0) return; const valid = data.some((m) => String(m.id) === String(value)); if (valid) return; diff --git a/apps/user/src/sections/user/announcement.tsx b/apps/user/src/sections/user/announcement.tsx index 5e31bb6..bcb962a 100644 --- a/apps/user/src/sections/user/announcement.tsx +++ b/apps/user/src/sections/user/announcement.tsx @@ -18,6 +18,7 @@ import { useGlobalStore } from "@/stores/global"; export default function Announcement({ type }: { type: "popup" | "pinned" }) { const { t } = useTranslation("dashboard"); const { user } = useGlobalStore(); + const [open, setOpen] = useState(false); const { data } = useQuery({ queryKey: ["announcement", type], @@ -38,14 +39,12 @@ export default function Announcement({ type }: { type: "popup" | "pinned" }) { enabled: !!user, }); - if (!data) return null; - - const [open, setOpen] = useState(false); - useEffect(() => { if (type === "popup" && !!data) setOpen(true); }, [data, type]); + if (!data) return null; + if (type === "popup") { return ( diff --git a/apps/user/src/sections/user/payment/stripe.tsx b/apps/user/src/sections/user/payment/stripe.tsx index 18ac75e..27752ce 100644 --- a/apps/user/src/sections/user/payment/stripe.tsx +++ b/apps/user/src/sections/user/payment/stripe.tsx @@ -276,7 +276,9 @@ const CheckoutForm: React.FC> = ({ const stripe = useStripe(); const [errorMessage, setErrorMessage] = useState(null); const [qrCodeUrl, setQrCodeUrl] = useState(null); - const [qrCodeImageDataUrl, setQrCodeImageDataUrl] = useState(null); + const [qrCodeImageDataUrl, setQrCodeImageDataUrl] = useState( + null + ); const [isSubmitted, setIsSubmitted] = useState(false); const { t } = useTranslation("payment"); const qrCodeMap: Record = { @@ -342,7 +344,7 @@ const CheckoutForm: React.FC> = ({ const imageDataUrl = wechat?.image_data_url; // data:image/png;base64,... setQrCodeUrl(data || null); - setQrCodeImageDataUrl(!data ? imageDataUrl || null : null); + setQrCodeImageDataUrl(data ? null : imageDataUrl || null); } } } catch (_error) { @@ -362,11 +364,13 @@ const CheckoutForm: React.FC> = ({ <> {qrCodeImageDataUrl ? ( {qrCodeMap[method] ) : (