Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(agent): add public share, forward and frontend rating UI (#461)
yika04a24a034a7f
diff --git a/project/web/src/api/agent.ts b/project/web/src/api/agent.tsindex 36091917..332c1d1a 100644--- a/project/web/src/api/agent.ts+++ b/project/web/src/api/agent.ts@@ -484,5 +484,15 @@ export const agentApi = {const res = await http.patch(`agent/tasks/${taskId}`, { title })return res},+ /**+ * 为任务创建或更新评分+ * @param taskId 任务ID+ * @param rating 评分值(1-5)+ * @param comment 可选评论+ */+ async createRating(taskId: string, rating: number, comment?: string) {+ const res = await http.post(`agent/tasks/${taskId}/rating`, { rating, comment })+ return res+ },}diff --git a/project/web/src/components/Chat/TaskCard/index.tsx b/project/web/src/components/Chat/TaskCard/index.tsxindex 28792052..5e1fe65a 100644--- a/project/web/src/components/Chat/TaskCard/index.tsx+++ b/project/web/src/components/Chat/TaskCard/index.tsx@@ -7,9 +7,11 @@import type React from 'react'import { useState } from 'react'-import { Loader2, MessageSquare, MoreHorizontal, Trash2, AlertCircle, CheckCircle2, Star } from 'lucide-react'+import { useRouter } from 'next/navigation'+import { Loader2, MessageSquare, MoreHorizontal, Trash2, AlertCircle, CheckCircle2 } from 'lucide-react'+import { agentApi } from '@/api/agent'+import { toast } from '@/lib/toast'import { cn, formatRelativeTime } from '@/lib/utils'-import { Button } from '@/components/ui/button'import { useGetClientLng } from '@/hooks/useSystem'import { useTransClient } from '@/app/i18n/client'import {@@ -17,9 +19,7 @@ import {DropdownMenuContent,DropdownMenuItem,DropdownMenuTrigger,- DropdownMenuSeparator,} from '@/components/ui/dropdown-menu'-import RatingModal from '@/components/Chat/Rating'export interface ITaskCardProps {/** 任务ID */@@ -34,16 +34,12 @@ export interface ITaskCardProps {updatedAt?: string | number/** 删除回调 */onDelete?: (id: string) => void | Promise<void>+ /** 评分回调(用于历史列表触发外部评分弹窗) */+ onRateClick?: (taskId: string) => void+ /** 选择回调(如果提供,点击卡片将触发选择而不是跳转) */+ onSelect?: (id: string) => void/** 自定义类名 */className?: string- /** 任务评分(1-5) */- rating?: number | null- /** 任务评价文本 */- ratingComment?: string | null- /** 在列表中显示更醒目的评分行 */- showProminentRating?: boolean- /** 列表级别的评分按钮点击回调(传入 taskId) */- onRateClick?: (taskId: string) => void}/** 获取状态显示配置 */@@ -96,21 +92,26 @@ export function TaskCard({updatedAt,onDelete,className,- rating: initialRating,- ratingComment: initialRatingComment,- showProminentRating,+ onSelect,onRateClick,}: ITaskCardProps) {-+ const router = useRouter()const lng = useGetClientLng()const { t } = useTransClient('chat')const [isDeleting, setIsDeleting] = useState(false)- const [rating, setRating] = useState<number | null>(initialRating ?? null)- const [ratingComment, setRatingComment] = useState<string | null>(initialRatingComment ?? null)+ const [isProcessing, setIsProcessing] = useState(false)const statusConfig = getStatusConfig(status, t as (key: string) => string)-+ /** 跳转到对话详情页 */+ const handleClick = () => {+ if (isDeleting) return+ if (onSelect) {+ onSelect(id)+ return+ }+ router.push(`/${lng}/chat/${id}`)+ }/** 处理删除 */const handleDelete = async (e: React.MouseEvent) => {@@ -125,10 +126,53 @@ export function TaskCard({}}+ /** 处理转发(复制会话为新任务并跳转) */+ const handleForward = async (e: React.MouseEvent) => {+ e.stopPropagation()+ if (isProcessing) return+ try {+ setIsProcessing(true)+ // 创建一个新的任务,传入 taskId 以复用会话(后端会在可用时复用 session)+ const res = await agentApi.createTask({ prompt: [], taskId: id })+ if (res && (res as any).code === 0 && (res as any).data) {+ const newTaskId = (res as any).data.id+ router.push(`/${lng}/chat/${newTaskId}`)+ } else {+ toast.error((res as any)?.msg || t('task.forwardFailed' as any) || 'Forward failed')+ }+ } catch (error) {+ console.error('Forward failed', error)+ toast.error(t('task.forwardFailed' as any) || 'Forward failed')+ } finally {+ setIsProcessing(false)+ }+ }++ /** 复制任务链接到剪贴板 */+ const handleCopyLink = async (e: React.MouseEvent) => {+ e.stopPropagation()+ try {+ const url = `${window.location.origin}/${lng}/chat/${id}`+ await navigator.clipboard.writeText(url)+ toast.success(t('task.copyLinkSuccess' as any) || 'Link copied')+ } catch (error) {+ console.error('Copy link failed', error)+ toast.error(t('task.copyLinkFailed' as any) || 'Copy failed')+ }+ }++ /** 触发评分回调(由历史列表等外部组件使用) */+ const handleRateClick = (e: React.MouseEvent) => {+ e.stopPropagation()+ if (!onRateClick) return+ onRateClick(id)+ }+return (<div+ onClick={handleClick}className={cn(- 'group relative flex flex-col p-4 rounded-xl border border-border bg-card transition-all',+ 'group relative flex flex-col p-4 rounded-xl border border-border bg-card cursor-pointer transition-all','hover:border-border hover:shadow-md',isDeleting && 'opacity-60 cursor-wait',className,@@ -144,55 +188,36 @@ export function TaskCard({</h4></div>- {/* 时间 & 状态 & 评分 */}+ {/* 时间 & 状态 */}<div className="mt-1 flex items-center justify-between gap-2"><span className="text-xs text-muted-foreground">{formatRelativeTime(new Date(updatedAt || createdAt))}</span>- <div className="flex items-center gap-2">- {status && statusConfig.label && (- <span className={cn(- 'inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium',- statusConfig.className,- )}>- {statusConfig.icon && (- <statusConfig.icon className={cn(- 'w-3 h-3',- status?.toLowerCase() === 'running' && 'animate-spin',- )} />- )}- {statusConfig.label}- </span>- )}- </div>+ {status && statusConfig.label && (+ <span className={cn(+ 'inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium',+ statusConfig.className,+ )}>+ {statusConfig.icon && (+ <statusConfig.icon className={cn(+ 'w-3 h-3',+ status?.toLowerCase() === 'running' && 'animate-spin',+ )} />+ )}+ {statusConfig.label}+ </span>+ )}</div>- {/* Prominent rating button (single compact control) */}- {showProminentRating && (- <div className="mt-3">- <div onClick={(e) => e.stopPropagation()}>- <Button- variant={rating ? 'outline' : 'ghost'}- size="sm"- onClick={(e) => { e.stopPropagation(); onRateClick?.(id) }}- className={cn(rating ? '' : 'w-full justify-center')}- >- <Star className={cn('w-4 h-4 mr-2', rating ? 'text-amber-400' : 'text-muted-foreground')} {...(rating ? { fill: 'currentColor' } : {})} />- {rating ? `${rating} / 5` : (t('task.rate' as any) || 'Rate this task')}- </Button>- </div>- </div>- )}-{/* 更多操作按钮 */}<DropdownMenu><DropdownMenuTrigger asChild><button- onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}+ onClick={(e) => e.stopPropagation()}disabled={isDeleting}className={cn('absolute top-2 right-2 w-7 h-7 rounded-md flex items-center justify-center',- 'opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity',+ 'opacity-0 group-hover:opacity-100 transition-opacity','hover:bg-muted text-muted-foreground hover:text-foreground',isDeleting && 'opacity-100 cursor-wait',)}@@ -204,36 +229,21 @@ export function TaskCard({)}</button></DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem- onClick={(e) => {- e.stopPropagation()- // 在新窗口中打开任务详情页- try {- window.open(`/${lng}/chat/${id}`, '_blank', 'noopener')- } catch (err) {- // fallback: 使用 location.assign- // eslint-disable-next-line no-console- console.error('Open new window failed', err)- }- }}- >- <MessageSquare className="w-4 h-4 mr-2" />- 打开+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={handleRateClick} className="focus:bg-muted/5">+ <CheckCircle2 className="w-4 h-4 mr-2" />+ Rate</DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem- onClick={(e) => {- e.stopPropagation()- onRateClick?.(id)- }}- >- <Star className="w-4 h-4 mr-2 text-amber-400" />- {t('task.rate' as any) || 'Rate'}+ <DropdownMenuItem onClick={handleForward} className="focus:bg-muted/5">+ {isProcessing ? <Loader2 className="w-4 h-4 mr-2 animate-spin" /> : <MessageSquare className="w-4 h-4 mr-2" />}+ Forward+ </DropdownMenuItem>+ <DropdownMenuItem onClick={handleCopyLink} className="focus:bg-muted/5">+ <MoreHorizontal className="w-4 h-4 mr-2" />+ Copy link</DropdownMenuItem>-- <DropdownMenuItem- onClick={(e) => { e.stopPropagation(); handleDelete(e); }}+ <DropdownMenuItem+ onClick={handleDelete}className="text-destructive focus:text-destructive focus:bg-destructive/10"><Trash2 className="w-4 h-4 mr-2" />diff --git a/project/web/src/components/Home/TaskPreview/index.tsx b/project/web/src/components/Home/TaskPreview/index.tsxindex bd7de7fb..cb74e9b2 100644--- a/project/web/src/components/Home/TaskPreview/index.tsx+++ b/project/web/src/components/Home/TaskPreview/index.tsx@@ -3,128 +3,212 @@* 功能:显示最近的任务卡片列表,支持"浏览全部"跳转*/-"use client";--import { useCallback, useEffect, useState } from "react";-import { useRouter, useParams } from "next/navigation";-import { ArrowRight, History } from "lucide-react";-import { TaskCard, TaskCardSkeleton } from "@/components/Chat";-import TaskHistoryList from "@/components/Chat/TaskHistoryList";-import RatingModal from "@/components/Chat/Rating";-import { toast } from "@/lib/toast";-import { agentApi, type TaskListItem } from "@/api/agent";-import { useTransClient } from "@/app/i18n/client";-import { cn } from "@/lib/utils";+'use client'++import { useCallback, useEffect, useState } from 'react'+import { useRouter, useParams } from 'next/navigation'+import { ArrowRight, History } from 'lucide-react'+import { TaskCard, TaskCardSkeleton } from '@/components/Chat'+import { agentApi, type TaskListItem } from '@/api/agent'+import { useTransClient } from '@/app/i18n/client'+import { toast } from '@/lib/toast'+import { cn } from '@/lib/utils'export interface ITaskPreviewProps {/** 显示数量 */- limit?: number;+ limit?: number/** 自定义类名 */- className?: string;+ className?: string}/*** TaskPreview - 任务预览组件*/export function TaskPreview({ limit = 4, className }: ITaskPreviewProps) {- const { t } = useTransClient("chat");- const router = useRouter();- const { lng } = useParams();+ const { t } = useTransClient('chat')+ const router = useRouter()+ const { lng } = useParams()- const [tasks, setTasks] = useState<TaskListItem[]>([]);- const [isLoading, setIsLoading] = useState(true);- const [ratingModalFor, setRatingModalFor] = useState<string | null>(null)+ const [tasks, setTasks] = useState<TaskListItem[]>([])+ const [isLoading, setIsLoading] = useState(true)+ const [selectedTaskId, setSelectedTaskId] = useState<string | null>(null)+ const [ratingValue, setRatingValue] = useState<number>(0)+ const [ratingComment, setRatingComment] = useState<string>('')+ const [isSubmittingRating, setIsSubmittingRating] = useState(false)/** 加载任务列表(始终保证尽量填满 limit 条) */const loadTasks = useCallback(async () => {- setIsLoading(true);+ setIsLoading(true)try {- const result = await agentApi.getTaskList(1, limit);+ const result = await agentApi.getTaskList(1, limit)if (result && result.code === 0 && result.data) {- setTasks(result.data.list || []);+ setTasks(result.data.list || [])}} catch (error) {- console.error("Load task list failed:", error);+ console.error('Load task list failed:', error)} finally {- setIsLoading(false);+ setIsLoading(false)}- }, [limit]);+ }, [limit])useEffect(() => {- void loadTasks();- }, [loadTasks]);+ void loadTasks()+ }, [loadTasks])/** 处理删除任务 */const handleDelete = async (id: string) => {try {- const result = await agentApi.deleteTask(id);+ const result = await agentApi.deleteTask(id)if (result && result.code === 0) {// 先本地移除,提升交互速度- setTasks((prev) => prev.filter((task) => task.id !== id));+ setTasks((prev) => prev.filter((task) => task.id !== id))// 再重新拉取列表,确保数量重新补足到 limit(如果后端还有数据)- void loadTasks();- toast.success(t("task.deleteSuccess"));+ void loadTasks()+ toast.success(t('task.deleteSuccess' as any))} else {- const msg = (result)?.message as string | undefined;- toast.error(msg || t("task.deleteFailed"));+ const msg = (result as any)?.msg as string | undefined+ toast.error(msg || t('task.deleteFailed' as any))}} catch (error) {- toast.error(t("task.deleteFailed"));+ toast.error(t('task.deleteFailed' as any))}- };+ }/** 跳转到任务记录页 */const handleViewAll = () => {- router.push(`/${lng}/tasks-history`);- };+ router.push(`/${lng}/tasks-history`)+ }++ /** 处理评分提交(放到列表外部) */+ const handleSubmitRating = async () => {+ if (!selectedTaskId) {+ toast.error(t('task.selectTaskFirst' as any) || 'Please select a task first')+ return+ }+ if (ratingValue < 1 || ratingValue > 5) {+ toast.error(t('task.ratingInvalid' as any) || 'Invalid rating')+ return+ }++ try {+ setIsSubmittingRating(true)+ const res = await agentApi.createRating(selectedTaskId, ratingValue, ratingComment)+ if (res && (res as any).code === 0) {+ toast.success(t('task.ratingSuccess' as any) || 'Rating submitted')+ // clear local state+ setRatingValue(0)+ setRatingComment('')+ // reload tasks to reflect any change+ void loadTasks()+ } else {+ toast.error((res as any)?.msg || (t('task.ratingFailed' as any) || 'Submit failed'))+ }+ } catch (error) {+ console.error('Submit rating failed', error)+ toast.error(t('task.ratingFailed' as any) || 'Submit failed')+ } finally {+ setIsSubmittingRating(false)+ }+ }// 如果没有任务且非加载中,不显示该区域if (!isLoading && tasks.length === 0) {- return null;+ return null}return (<section className={className}><div className="w-full max-w-5xl mx-auto">- {/* 标题栏 */}- <div className="flex items-center justify-between mb-4">- <div className="flex items-center gap-2">- <History className="w-5 h-5 text-muted-foreground" />- <h3 className="text-base font-medium text-foreground">- {t("home.recentTasks")}- </h3>- </div>- <button- onClick={handleViewAll}- className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer"- >- {t("home.viewAll")}- <ArrowRight className="w-4 h-4" />- </button>+ {/* 标题栏 */}+ <div className="flex items-center justify-between mb-4">+ <div className="flex items-center gap-2">+ <History className="w-5 h-5 text-muted-foreground" />+ <h3 className="text-base font-medium text-foreground">+ {t('home.recentTasks' as any)}+ </h3></div>+ <button+ onClick={handleViewAll}+ className="flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer"+ >+ {t('home.viewAll' as any)}+ <ArrowRight className="w-4 h-4" />+ </button>+ </div>- {/* 任务卡片列表 */}- <TaskHistoryList- tasks={tasks}- isLoading={isLoading}- skeletonCount={limit}- onDelete={handleDelete}- onRateClick={(taskId) => setRatingModalFor(taskId)}- className="grid-cols-2 md:grid-cols-4"- />- <RatingModal- taskId={ratingModalFor ?? ''}- open={!!ratingModalFor}- onClose={() => setRatingModalFor(null)}- onSaved={(data) => {- setTasks((prev) => prev.map((t) => (t.id === ratingModalFor ? { ...t, rating: data.rating ?? t.rating, ratingComment: data.comment ?? t.ratingComment } : t)))- setRatingModalFor(null)- toast.success(t('rating.saveSuccess') || 'Saved')- }}- />+ {/* 任务卡片列表 */}+ <div className="grid grid-cols-2 md:grid-cols-4 gap-4">+ {isLoading+ ? Array.from({ length: limit }).map((_, index) => (+ <TaskCardSkeleton key={index} />+ ))+ : tasks.map((task) => (+ <TaskCard+ key={task.id}+ id={task.id}+ title={task.title || t('task.newChat' as any)}+ status={task.status}+ createdAt={task.createdAt}+ updatedAt={task.updatedAt}+ onDelete={handleDelete}+ onSelect={(id: string) => {+ setSelectedTaskId(id)+ }}+ />+ ))}+ </div>+ {/* 外部评分区域(红框示意位置) */}+ <div className="w-full max-w-5xl mx-auto mt-4">+ <div className="rounded-lg border border-border bg-card p-4">+ <div className="flex items-center justify-between mb-2">+ <div className="text-sm font-medium text-foreground">+ {t('task.externalRating' as any) || 'Rate selected task'}+ </div>+ <div className="text-xs text-muted-foreground">+ {selectedTaskId ? `Task: ${selectedTaskId}` : t('task.noTaskSelected' as any) || 'No task selected'}+ </div>+ </div>+ <div className="flex items-start gap-4">+ <div className="flex items-center gap-1">+ {Array.from({ length: 5 }).map((_, idx) => {+ const v = idx + 1+ return (+ <button+ key={v}+ onClick={() => setRatingValue(v)}+ className={cn(+ 'w-8 h-8 rounded-md border flex items-center justify-center',+ ratingValue >= v ? 'bg-amber-100 border-amber-300' : 'bg-transparent'+ )}+ aria-label={`rate-${v}`}+ >+ {v}+ </button>+ )+ })}+ </div>+ <textarea+ value={ratingComment}+ onChange={(e) => setRatingComment(e.target.value)}+ placeholder={t('task.ratingCommentPlaceholder' as any) || 'Optional comment'}+ className="flex-1 p-2 border rounded-md resize-none h-12"+ />+ <div className="flex items-center">+ <button+ onClick={handleSubmitRating}+ disabled={isSubmittingRating || !selectedTaskId}+ className="px-3 py-1 rounded-md bg-primary text-white disabled:opacity-50"+ >+ {isSubmittingRating ? t('task.submitting' as any) || 'Submitting' : t('task.submit' as any) || 'Submit'}+ </button>+ </div>+ </div>+ </div>+ </div></div></section>- );+ )}-export default TaskPreview;+export default TaskPreview+diff --git a/project/web/src/components/SettingsModal/index.tsx b/project/web/src/components/SettingsModal/index.tsxindex 3c885c65..9915d91d 100644--- a/project/web/src/components/SettingsModal/index.tsx+++ b/project/web/src/components/SettingsModal/index.tsx@@ -109,15 +109,15 @@ export const SettingsModal = ({ open, onClose, defaultTab }: SettingsModalProps)return (<Dialog open={open} onOpenChange={isOpen => !isOpen && onClose()}><DialogContent- className="!w-[min(880px,95vw)] sm:!w-[min(880px,95vw)] !max-w-none mx-auto gap-0 overflow-hidden p-0"+ className="w-[95vw] max-w-[900px] gap-0 overflow-hidden p-0 md:w-[900px]"aria-describedby={undefined}><DialogTitle className="sr-only">{t('title')}</DialogTitle>{/* 移动端布局:垂直排列;桌面端:水平排列 */}- <div className="flex h-[80vh] max-h-[600px] flex-col md:h-[70vh] md:max-h-none md:flex-row">+ <div className="flex h-[85vh] max-h-[650px] flex-col md:h-[70vh] md:max-h-none md:flex-row">{/* 侧边栏/顶部导航 */}- <div className="flex w-full shrink-0 flex-col border-b border-border md:w-48 md:border-b-0 md:border-r">+ <div className="flex w-full shrink-0 flex-col border-b border-border md:w-52 md:border-b-0 md:border-r">{/* 侧边栏头部 - Logo + 项目名称 */}<div className="flex shrink-0 items-center gap-2 px-4 py-3 md:px-5 md:py-4"><Image src={logo} alt="Aitoearn" width={24} height={24} className="md:h-7 md:w-7" />@@ -151,13 +151,13 @@ export const SettingsModal = ({ open, onClose, defaultTab }: SettingsModalProps){/* 右侧/下方内容区域 */}<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">{/* 右侧头部 - 设置标题 */}- <div className="flex shrink-0 items-center border-b border-border px-4 py-3 md:px-8 md:py-4">+ <div className="flex shrink-0 items-center border-b border-border px-4 py-3 md:px-6 md:py-4"><h2 className="text-base font-semibold text-foreground md:text-lg">{t('title')}</h2></div>- {/* 右侧内容 - 确保内容区域可以正确滚动和换行 */}- <div className="flex-1 overflow-y-auto overflow-x-hidden px-4 py-4 md:px-8 md:py-6">- <div className="w-full">+ {/* 右侧内容 - 确保内容区域可以正确滚动 */}+ <div className="flex-1 overflow-auto px-4 py-4 md:px-6 md:py-6">+ <div className="w-full min-w-0">{renderContent()}</div></div>diff --git a/project/web/src/components/SettingsModal/tabs/MembershipTab.tsx b/project/web/src/components/SettingsModal/tabs/MembershipTab.tsxindex 50aa7a75..d0ad4b5a 100644--- a/project/web/src/components/SettingsModal/tabs/MembershipTab.tsx+++ b/project/web/src/components/SettingsModal/tabs/MembershipTab.tsx@@ -370,7 +370,7 @@ export const MembershipTab = () => {</Badge></div>- <div className="grid grid-cols-2 gap-4 text-sm">+ <div className="grid grid-cols-1 gap-3 text-sm sm:grid-cols-2 sm:gap-4"><div><span className="text-muted-foreground">{tProfile('subscriptionMode')}:</span><span className="ml-2">@@ -397,14 +397,14 @@ export const MembershipTab = () => {<span className="ml-2">{formatDate(subscription.trialEndAt)}</span></div>)}- <div className="col-span-2">+ <div className="sm:col-span-2"><span className="text-muted-foreground">{tProfile('subscriptionId')}:</span><div className="mt-1 flex items-center gap-2">- <span className="font-mono text-xs">{subscription.id}</span>+ <span className="truncate font-mono text-xs">{subscription.id}</span><Buttonvariant="ghost"size="sm"- className="h-6 w-6 p-0"+ className="h-6 w-6 shrink-0 p-0"onClick={() => handleCopy(subscription.id)}><Copy className="h-3 w-3" />@@ -512,7 +512,7 @@ export const MembershipTab = () => {key={order._id}className="space-y-3 rounded-lg border bg-card p-4">- <div className="grid grid-cols-2 gap-4 text-sm">+ <div className="grid grid-cols-1 gap-3 text-sm sm:grid-cols-2 sm:gap-4"><div><span className="text-muted-foreground">{tProfile('subscriptionMode')}:</span><span className="ml-2">{getSubscriptionModeText(order.mode)}</span>@@ -541,14 +541,14 @@ export const MembershipTab = () => {{(order as any).payment_method || tVip('alipayPayment')}</span></div>- <div className="col-span-2">+ <div className="sm:col-span-2"><span className="text-muted-foreground">{tProfile('orderId')}:</span><div className="mt-1 flex items-center gap-2">- <span className="font-mono text-xs">{order.id}</span>+ <span className="truncate font-mono text-xs">{order.id}</span><Buttonvariant="ghost"size="sm"- className="h-6 w-6 p-0"+ className="h-6 w-6 shrink-0 p-0"onClick={() => handleCopy(order.id)}><Copy className="h-3 w-3" />@@ -626,38 +626,38 @@ export const MembershipTab = () => {</div>) : (<div className="space-y-3 text-sm">- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('orderId')}:</span>- <span className="font-mono">{currentOrderDetail.id}</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('orderId')}:</span>+ <span className="truncate font-mono">{currentOrderDetail.id}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('internalId')}:</span>- <span className="font-mono">{currentOrderDetail._id}</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('internalId')}:</span>+ <span className="truncate font-mono">{currentOrderDetail._id}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('packageType')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('packageType')}:</span><span>{getPaymentTypeText(currentOrderDetail.metadata?.payment)}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('subscriptionMode')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('subscriptionMode')}:</span><span>{currentOrderDetail.mode}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('amount')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('amount')}:</span><span>CNY {(currentOrderDetail.amount / 100).toFixed(2)}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('status')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('status')}:</span><span>{getOrderStatusTag(currentOrderDetail.status)}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('createTime')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('createTime')}:</span><span>{formatDate(currentOrderDetail.created)}</span></div>- <div className="flex justify-between">- <span className="text-muted-foreground">{tProfile('paymentMethod')}:</span>+ <div className="flex flex-col gap-1 sm:flex-row sm:justify-between">+ <span className="shrink-0 text-muted-foreground">{tProfile('paymentMethod')}:</span><span>{(currentOrderDetail as any).payment_method || tProfile('unknown')}</span>diff --git a/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx b/project/web/src/components/SettingsModal/tabs/ProfileTab.tsxindex 02b23a4b..f037d29f 100644--- a/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx+++ b/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx@@ -230,10 +230,10 @@ export function ProfileTab({ onClose }: ProfileTabProps) {</div>{/* 收入信息 */}- <div className="grid grid-cols-2 gap-4">- <div className="rounded-xl border border-border bg-muted p-4 cursor-pointer" onClick={() => { router.push('/income'); onClose() }}>+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">+ <div className="rounded-xl border border-border bg-muted p-4"><p className="mb-1 text-sm text-muted-foreground">{t('profile.totalIncome')}</p>- <p className="text-2xl font-bold text-foreground">{totalIncome.toFixed(2)} USD</p>+ <p className="text-xl font-bold text-foreground sm:text-2xl">{totalIncome.toFixed(2)} USD</p></div></div>diff --git a/project/web/src/components/common/GlobalLoginModal/index.tsx b/project/web/src/components/common/GlobalLoginModal/index.tsxindex ae3800fc..349a6257 100644--- a/project/web/src/components/common/GlobalLoginModal/index.tsx+++ b/project/web/src/components/common/GlobalLoginModal/index.tsx@@ -13,3 +13,5 @@ export function GlobalLoginModal() {export default GlobalLoginModal++diff --git a/project/web/src/store/loginModal.ts b/project/web/src/store/loginModal.tsindex 44b2fcdd..f72cc313 100644--- a/project/web/src/store/loginModal.ts+++ b/project/web/src/store/loginModal.ts@@ -63,3 +63,5 @@ export function closeLoginModal() {useLoginModalStore.getState().closeLoginModal()}++