refactor(app): remove unused components
This commit is contained in:
@@ -13,7 +13,6 @@ import { MessageAvatar } from "../message-avatar";
|
||||
import { PrivateMessageCard } from "../private-message-card";
|
||||
import { PwaInstallDialog } from "../pwa-install-dialog";
|
||||
import { TextBubble } from "../text-bubble";
|
||||
import { VoiceUnlockOptionsDialog } from "../voice-unlock-options-dialog";
|
||||
|
||||
vi.mock("@/router/use-app-navigator", () => ({
|
||||
useAppNavigator: () => ({
|
||||
@@ -296,37 +295,4 @@ describe("chat Tailwind components", () => {
|
||||
expect(html).toContain("Top up now");
|
||||
});
|
||||
|
||||
it("renders VoiceUnlockOptionsDialog action choices", () => {
|
||||
expect(
|
||||
renderToStaticMarkup(
|
||||
<VoiceUnlockOptionsDialog
|
||||
open={false}
|
||||
onClose={() => undefined}
|
||||
onBuyVoicePackage={() => undefined}
|
||||
onActivateVip={() => undefined}
|
||||
/>,
|
||||
),
|
||||
).toBe("");
|
||||
|
||||
const html = renderToStaticMarkup(
|
||||
<VoiceUnlockOptionsDialog
|
||||
open
|
||||
onClose={() => undefined}
|
||||
onBuyVoicePackage={() => undefined}
|
||||
onActivateVip={() => undefined}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain('aria-labelledby="voice-unlock-options-title"');
|
||||
expect(html).toContain("z-72");
|
||||
expect(html).toContain("Unlock voice message");
|
||||
expect(html).toContain("购买语音包");
|
||||
expect(html).toContain("开通 VIP");
|
||||
expect(html).toContain("免费10条语言消息+无限畅聊");
|
||||
expect(html).toContain("Cancel");
|
||||
expect(html).toContain("bg-[linear-gradient(90deg,#ff67e0_0%,#ff52a2_100%)]");
|
||||
expect(html).toContain(
|
||||
"bg-[linear-gradient(#ffffff,#ffffff)_padding-box,linear-gradient(90deg,#ff67e0,#ff52a2)_border-box]",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,4 +26,3 @@ export * from "./pwa-install-dialog";
|
||||
export * from "./pwa-install-overlay";
|
||||
export * from "./text-bubble";
|
||||
export * from "./voice-bubble";
|
||||
export * from "./voice-unlock-options-dialog";
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* - 生产环境有效;开发环境 1s 后立即弹出(测试用)
|
||||
*
|
||||
* 注意:PWA install prompt API(`beforeinstallprompt`)在浏览器差异较大,
|
||||
* 本轮仅实现"显示时机"逻辑,具体 install prompt 调用由 Dialog 内部处理。
|
||||
* 本轮仅实现"显示时机"逻辑,具体 install prompt 调用由 PwaInstallDialog 处理。
|
||||
*/
|
||||
import { useEffect } from "react";
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
"use client";
|
||||
|
||||
export interface VoiceUnlockOptionsDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onBuyVoicePackage: () => void;
|
||||
onActivateVip: () => void;
|
||||
}
|
||||
|
||||
export function VoiceUnlockOptionsDialog({
|
||||
open,
|
||||
onClose,
|
||||
onBuyVoicePackage,
|
||||
onActivateVip,
|
||||
}: VoiceUnlockOptionsDialogProps) {
|
||||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-72 flex items-center justify-center bg-[rgba(0,0,0,0.5)] pb-[calc(var(--dialog-safe-margin,16px)+var(--app-safe-bottom,0px))] pl-[calc(var(--dialog-safe-margin,16px)+var(--app-safe-left,0px))] pr-[calc(var(--dialog-safe-margin,16px)+var(--app-safe-right,0px))] pt-[calc(var(--dialog-safe-margin,16px)+var(--app-safe-top,0px))]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="voice-unlock-options-title"
|
||||
>
|
||||
<div className="w-full max-w-(--dialog-max-width,380px) rounded-(--responsive-card-radius,36px) bg-(--color-page-background,#ffffff) px-(--responsive-card-padding,18px) pb-(--responsive-card-padding,18px) pt-(--responsive-card-padding-lg,24px) shadow-[0_18px_40px_rgba(0,0,0,0.16)]">
|
||||
<h2
|
||||
id="voice-unlock-options-title"
|
||||
className="m-0 mb-[clamp(7px,1.481vw,8px)] text-center text-(length:--responsive-page-title,var(--font-size-22,22px)) font-bold leading-[1.2] text-(--color-text-foreground,#171717)"
|
||||
>
|
||||
Unlock voice message
|
||||
</h2>
|
||||
<p className="mx-(--spacing-md,12px) mb-(--page-section-gap-lg,20px) mt-0 text-center text-(length:--responsive-body,var(--font-size-md,14px)) leading-[1.5] text-[#393939]">
|
||||
Choose how you would like to unlock this voice message.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-col gap-(--spacing-md,12px)">
|
||||
<button
|
||||
type="button"
|
||||
className="flex min-h-(--responsive-control-height,48px) w-full cursor-pointer flex-col items-center justify-center gap-(--responsive-inline-gap-xs,4px) rounded-(--radius-bottom-sheet,28px) border-0 bg-[linear-gradient(90deg,#ff67e0_0%,#ff52a2_100%)] px-(--responsive-card-padding,16px) py-[clamp(9px,1.852vw,10px)] text-(length:--responsive-body,var(--font-size-lg,16px)) font-bold text-white shadow-[0_5px_7px_rgba(247,89,168,0.24)] focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#f657a0]"
|
||||
onClick={onBuyVoicePackage}
|
||||
>
|
||||
购买语音包
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="flex min-h-(--responsive-control-height,48px) w-full cursor-pointer flex-col items-center justify-center gap-(--responsive-inline-gap-xs,4px) rounded-(--radius-bottom-sheet,28px) border border-transparent bg-[linear-gradient(#ffffff,#ffffff)_padding-box,linear-gradient(90deg,#ff67e0,#ff52a2)_border-box] px-(--responsive-card-padding,16px) py-[clamp(9px,1.852vw,10px)] text-(length:--responsive-body,var(--font-size-lg,16px)) font-bold text-[#f657a0] focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#f657a0]"
|
||||
onClick={onActivateVip}
|
||||
>
|
||||
<span className="leading-[1.2]">开通 VIP</span>
|
||||
<span className="text-(length:--responsive-caption,13px) font-medium leading-[1.25] text-[#3c3b3b]">
|
||||
免费10条语言消息+无限畅聊
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="mt-[clamp(12px,2.593vw,14px)] min-h-(--responsive-control-height,48px) w-full cursor-pointer rounded-(--radius-bottom-sheet,28px) border-0 bg-(--color-text-secondary,#9e9e9e) text-(length:--responsive-body,var(--font-size-lg,16px)) font-bold text-white focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#f657a0]"
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user