refactor(app): tighten chat and sync boundaries
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
.panel {
|
||||
min-height: 170px;
|
||||
padding: 24px 16px 20px;
|
||||
border-top: 1px solid rgba(246, 87, 160, 0.14);
|
||||
background: #fff1f4;
|
||||
}
|
||||
|
||||
.voiceCard {
|
||||
width: 142px;
|
||||
min-height: 153px;
|
||||
padding: 12px 12px 14px;
|
||||
border: 1px solid rgba(30, 30, 30, 0.08);
|
||||
border-radius: 18px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 1px 2px rgba(30, 30, 30, 0.03);
|
||||
color: #1e1e1e;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.voiceCard:focus-visible {
|
||||
outline: 2px solid var(--color-accent, #f84d96);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.voiceIcon {
|
||||
display: block;
|
||||
width: 78px;
|
||||
height: 78px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.voiceTitle,
|
||||
.voiceMinutes {
|
||||
font-family: var(--font-athelas), Athelas, serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.08;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.voiceTitle {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.voiceMinutes {
|
||||
color: var(--color-accent, #f84d96);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
|
||||
import styles from "./chat-input-action-panel.module.css";
|
||||
|
||||
export interface ChatInputActionPanelProps {
|
||||
voiceMinutesRemaining: number;
|
||||
onVoiceMessageClick?: () => void;
|
||||
}
|
||||
|
||||
export function ChatInputActionPanel({
|
||||
voiceMinutesRemaining,
|
||||
onVoiceMessageClick,
|
||||
}: ChatInputActionPanelProps) {
|
||||
return (
|
||||
<div className={styles.panel}>
|
||||
<button
|
||||
type="button"
|
||||
className={styles.voiceCard}
|
||||
onClick={onVoiceMessageClick}
|
||||
aria-label={`Voice message, ${voiceMinutesRemaining} minutes remaining`}
|
||||
>
|
||||
<Image
|
||||
src="/images/chat/ic_voicemessage_act.png"
|
||||
alt=""
|
||||
width={78}
|
||||
height={78}
|
||||
className={styles.voiceIcon}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className={styles.voiceTitle}>voice message</span>
|
||||
<span className={styles.voiceMinutes}>({voiceMinutesRemaining}min)</span>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* ChatQuotaExhaustedBanner — 游客配额耗尽横幅
|
||||
/* ChatInsufficientCreditsBanner — 积分不足横幅
|
||||
* 视觉规格(与设计稿对齐):
|
||||
* - 粉→品红渐变背景(与 splash gradient 一致)
|
||||
* - 居中文案 + 渐变 pill 按钮
|
||||
+11
-13
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
/**
|
||||
* ChatQuotaExhaustedBanner 发送受限横幅
|
||||
* ChatInsufficientCreditsBanner 积分不足横幅
|
||||
*
|
||||
* 何时显示:
|
||||
* - 后端返回 cannotSendReason="insufficient_credits"
|
||||
@@ -8,38 +8,36 @@
|
||||
* 视觉规格(与设计稿对齐):
|
||||
* - 粉→品红渐变背景(与 splash 渐变一致)
|
||||
* - 大字号粉色/白色提示文案
|
||||
* - 粉→品红渐变 pill 按钮 → 跳 /subscription
|
||||
* - 粉→品红渐变 pill 按钮 → 跳 /subscription?type=topup
|
||||
*
|
||||
* 业务关系:
|
||||
* - 与 `src/app/sidebar/components/vip-benefits-card.tsx` 的 "Activate VIP Membership" 行为一致
|
||||
* - 与订阅页 VIP 入口行为一致
|
||||
* - 与订阅页 top up 入口行为一致
|
||||
*
|
||||
* 不做的事:
|
||||
* - 不直接管理 state machine(chat 机器不感知 UI 层)
|
||||
* - 不显示具体剩余分钟数(已用 total<=0 表达"耗尽"足够)
|
||||
*/
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { ROUTES } from "@/router/routes";
|
||||
import { ROUTE_BUILDERS } from "@/router/routes";
|
||||
|
||||
import styles from "./chat-quota-exhausted-banner.module.css";
|
||||
import styles from "./chat-insufficient-credits-banner.module.css";
|
||||
|
||||
export interface ChatQuotaExhaustedBannerProps {
|
||||
export interface ChatInsufficientCreditsBannerProps {
|
||||
title?: string;
|
||||
ctaLabel?: string;
|
||||
/**
|
||||
* 自定义点击回调(不传则默认 router.push(ROUTES.subscription))
|
||||
* 自定义点击回调(不传则默认 router.push(topup subscription))
|
||||
* - 测试时可传 mock
|
||||
* - 嵌入其他场景时(如 nested overlay)可传自定义
|
||||
*/
|
||||
onUnlock?: () => void;
|
||||
}
|
||||
|
||||
export function ChatQuotaExhaustedBanner({
|
||||
export function ChatInsufficientCreditsBanner({
|
||||
title = "Insufficient credits\nTop up to continue chatting",
|
||||
ctaLabel = "Top up credits to continue",
|
||||
onUnlock,
|
||||
}: ChatQuotaExhaustedBannerProps) {
|
||||
}: ChatInsufficientCreditsBannerProps) {
|
||||
const router = useRouter();
|
||||
const titleLines = title.split("\n");
|
||||
|
||||
@@ -48,7 +46,7 @@ export function ChatQuotaExhaustedBanner({
|
||||
onUnlock();
|
||||
return;
|
||||
}
|
||||
router.push(`${ROUTES.subscription}?type=vip`);
|
||||
router.push(ROUTE_BUILDERS.subscription("topup"));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -56,7 +54,7 @@ export function ChatQuotaExhaustedBanner({
|
||||
className={styles.banner}
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
data-testid="chat-quota-exhausted-banner"
|
||||
data-testid="chat-insufficient-credits-banner"
|
||||
>
|
||||
<p className={styles.text}>
|
||||
{titleLines.map((line, index) => (
|
||||
@@ -6,10 +6,9 @@ export * from "./ai-disclosure-banner";
|
||||
export * from "./browser-hint-overlay";
|
||||
export * from "./chat-area";
|
||||
export * from "./chat-header";
|
||||
export * from "./chat-input-action-panel";
|
||||
export * from "./chat-insufficient-credits-banner";
|
||||
export * from "./chat-input-bar";
|
||||
export * from "./chat-input-text-field";
|
||||
export * from "./chat-quota-exhausted-banner";
|
||||
export * from "./chat-send-button";
|
||||
export * from "./date-header";
|
||||
export * from "./external-browser-dialog";
|
||||
|
||||
Reference in New Issue
Block a user