crush-level-web/src/app/(auth)/share/[userId]/test.tsx

272 lines
12 KiB
TypeScript
Raw Normal View History

2025-11-28 06:31:36 +00:00
'use client'
2025-11-13 08:38:25 +00:00
2025-11-28 06:31:36 +00:00
import { useParams } from 'next/navigation'
import { useGetAIUserBaseInfo } from '@/hooks/aiUser'
import Image from 'next/image'
2025-11-13 08:38:25 +00:00
// 按钮组件
interface MobileButtonProps {
2025-11-28 06:31:36 +00:00
showIcon?: boolean
icon?: React.ReactNode | null
btnTxt?: string
showTxt?: boolean
size?: 'Large' | 'Medium' | 'Small'
variant?: 'Contrast' | 'Basic' | 'Ghost'
type?: 'Primary' | 'Secondary' | 'Tertiary' | 'Destructive' | 'VIP'
state?: 'Default' | 'Disabled' | 'Pressed'
onClick?: () => void
2025-11-13 08:38:25 +00:00
}
2025-11-28 06:31:36 +00:00
function MobileButton({
showIcon = true,
icon = null,
btnTxt = 'Button',
showTxt = true,
size = 'Large',
variant = 'Basic',
type = 'Primary',
state = 'Default',
onClick,
2025-11-13 08:38:25 +00:00
}: MobileButtonProps) {
2025-11-28 06:31:36 +00:00
if (size === 'Small' && variant === 'Contrast' && type === 'Tertiary' && state === 'Default') {
2025-11-13 08:38:25 +00:00
return (
2025-11-28 06:31:36 +00:00
<button
2025-11-13 08:38:25 +00:00
onClick={onClick}
2025-11-28 06:31:36 +00:00
className="relative box-border flex h-8 content-stretch items-center justify-center gap-1 overflow-clip rounded-[999px] bg-[rgba(0,0,0,0.65)] px-4 py-1.5 transition-colors hover:bg-[rgba(0,0,0,0.8)]"
2025-11-13 08:38:25 +00:00
>
2025-11-28 06:31:36 +00:00
{showIcon &&
(icon || (
<div className="relative h-[15.999px] w-4 shrink-0">
<div
className="absolute right-[17.15%] left-1/4 aspect-[9.25554/12.1612] translate-y-[-50%]"
style={{ top: 'calc(50% + 0.065px)' }}
>
2025-11-13 08:38:25 +00:00
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
2025-11-28 06:31:36 +00:00
<path d="M3 2l6 4-6 4V2z" fill="white" />
2025-11-13 08:38:25 +00:00
</svg>
</div>
</div>
2025-11-28 06:31:36 +00:00
))}
2025-11-13 08:38:25 +00:00
{showTxt && (
2025-11-28 06:31:36 +00:00
<div className="relative flex shrink-0 flex-col justify-center text-center text-[12px] leading-[0] font-medium text-nowrap text-white not-italic">
2025-11-13 08:38:25 +00:00
<p className="leading-[20px] whitespace-pre">{btnTxt}</p>
</div>
)}
</button>
2025-11-28 06:31:36 +00:00
)
2025-11-13 08:38:25 +00:00
}
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
return (
2025-11-28 06:31:36 +00:00
<button
2025-11-13 08:38:25 +00:00
onClick={onClick}
2025-11-28 06:31:36 +00:00
className="relative box-border flex h-8 content-stretch items-center justify-center gap-1 overflow-clip rounded-[999px] bg-[rgba(0,0,0,0.65)] px-4 py-1.5 transition-colors hover:bg-[rgba(0,0,0,0.8)]"
2025-11-13 08:38:25 +00:00
>
{showIcon && icon}
2025-11-28 06:31:36 +00:00
{showTxt && <span className="text-[12px] font-medium text-white">{btnTxt}</span>}
2025-11-13 08:38:25 +00:00
</button>
2025-11-28 06:31:36 +00:00
)
2025-11-13 08:38:25 +00:00
}
const SharePage = () => {
2025-11-28 06:31:36 +00:00
const { userId } = useParams()
const { data: userInfo } = useGetAIUserBaseInfo({
aiId: userId ? Number(userId) : 0,
})
const { homeImageUrl } = userInfo || {}
2025-11-13 08:38:25 +00:00
const handleChatClick = () => {
// 跳转到应用或下载页面
2025-11-28 06:31:36 +00:00
window.open('https://crushlevel.com/download', '_blank')
}
2025-11-13 08:38:25 +00:00
return (
2025-11-28 06:31:36 +00:00
<div className="relative mx-auto h-screen max-w-[750px] overflow-hidden">
2025-11-13 08:38:25 +00:00
{/* 背景图片 */}
<div
className="absolute inset-0 overflow-clip"
style={{
2025-11-28 06:31:36 +00:00
background:
'linear-gradient(180deg, #211A2B 0%, rgba(33, 26, 43, 0.00) 20%, rgba(33, 26, 43, 0.00) 50%, #211A2B 100%)',
2025-11-13 08:38:25 +00:00
}}
>
<div className="absolute inset-0">
2025-11-28 06:31:36 +00:00
<Image src={homeImageUrl || ''} alt="Background" fill className="object-cover" priority />
2025-11-13 08:38:25 +00:00
</div>
<div className="absolute inset-0 bg-black/20" />
</div>
{/* 内容容器 */}
2025-11-28 06:31:36 +00:00
<div className="relative z-10 box-border flex min-h-screen flex-col content-stretch items-start justify-start px-0 pt-4 pb-0">
2025-11-13 08:38:25 +00:00
{/* 头部用户信息 */}
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex w-full shrink-0 content-stretch items-start justify-start overflow-clip px-6 py-0">
<div className="relative flex min-h-px min-w-px shrink-0 grow basis-0 content-stretch items-center justify-start gap-2 self-stretch">
2025-11-13 08:38:25 +00:00
{/* 用户头像 */}
2025-11-28 06:31:36 +00:00
<div className="relative size-10 shrink-0 overflow-clip rounded-[99px]">
2025-11-13 08:38:25 +00:00
{userInfo?.headImg ? (
<Image
src={userInfo.headImg}
alt={userInfo.nickname || 'User'}
fill
className="object-cover"
/>
) : (
2025-11-28 06:31:36 +00:00
<div className="flex h-full w-full items-center justify-center bg-gradient-to-br from-purple-400 to-pink-400">
<span className="text-lg font-bold text-white">
2025-11-13 08:38:25 +00:00
{userInfo?.nickname?.charAt(0) || 'U'}
</span>
</div>
)}
</div>
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
{/* 用户名和点赞数 */}
2025-11-28 06:31:36 +00:00
<div className="relative flex shrink-0 flex-col content-stretch items-start justify-start text-center leading-[0] text-nowrap text-white not-italic">
<div className="relative shrink-0 text-[20px] font-semibold">
2025-11-13 08:38:25 +00:00
<p className="leading-[24px] text-nowrap whitespace-pre">
{userInfo?.nickname || 'Loading...'}
</p>
</div>
2025-11-28 06:31:36 +00:00
<div className="relative shrink-0 text-[12px] font-medium">
<p className="leading-[20px] text-nowrap whitespace-pre">0 likes</p>
2025-11-13 08:38:25 +00:00
</div>
</div>
</div>
</div>
{/* 主要内容区域 */}
2025-11-28 06:31:36 +00:00
<div className="relative flex min-h-px w-full min-w-px shrink-0 grow basis-0 flex-col content-stretch items-start justify-end">
2025-11-13 08:38:25 +00:00
{/* 消息内容 */}
2025-11-28 06:31:36 +00:00
<div className="relative inline-grid shrink-0 grid-cols-[max-content] grid-rows-[max-content] place-items-start px-6 leading-[0]">
2025-11-13 08:38:25 +00:00
{/* AI信息卡片 */}
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex w-full shrink-0 flex-col content-stretch items-start justify-start gap-1 px-0 py-2">
<div className="relative box-border flex w-full shrink-0 flex-col content-stretch items-start justify-start gap-2 rounded-[16px] border border-[rgba(251,222,255,0.2)] bg-[rgba(251,222,255,0.08)] p-[16px] backdrop-blur-[32px] backdrop-filter">
2025-11-13 08:38:25 +00:00
{/* 介绍文本 */}
2025-11-28 06:31:36 +00:00
<div className="font-regular relative line-clamp-3 w-full shrink-0 overflow-hidden text-[14px] leading-[20px] text-white">
2025-11-13 08:38:25 +00:00
<p>
<span className="font-semibold">Intro: </span>
2025-11-28 06:31:36 +00:00
<span>
{userInfo?.introduction ||
'This is an AI character with unique personality and charm. Start chatting to discover more about them!'}
</span>
2025-11-13 08:38:25 +00:00
</p>
</div>
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
{/* 标签 */}
2025-11-28 06:31:36 +00:00
<div className="relative flex w-full shrink-0 content-stretch items-start justify-start gap-2">
2025-11-13 08:38:25 +00:00
{userInfo?.tagName ? (
2025-11-28 06:31:36 +00:00
userInfo.tagName
.split(',')
.slice(0, 2)
.map((tag: string, index: number) => (
<div
key={index}
className="relative box-border flex h-6 min-w-6 shrink-0 content-stretch items-center justify-center gap-1 overflow-clip rounded-[4px] bg-[#d21f77]/45 px-2 py-0.5 backdrop-blur backdrop-filter"
>
<div className="text-[12px] leading-[20px] font-medium text-white">
{tag.trim()}
</div>
2025-11-13 08:38:25 +00:00
</div>
2025-11-28 06:31:36 +00:00
))
2025-11-13 08:38:25 +00:00
) : (
<>
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex h-6 min-w-6 shrink-0 content-stretch items-center justify-center gap-1 overflow-clip rounded-[4px] bg-[#d21f77]/45 px-2 py-0.5 backdrop-blur backdrop-filter">
<div className="text-[12px] leading-[20px] font-medium text-white">
Sensual
</div>
2025-11-13 08:38:25 +00:00
</div>
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex h-6 min-w-6 shrink-0 content-stretch items-center justify-center gap-1 overflow-clip rounded-[4px] bg-[#d21f77]/45 px-2 py-0.5 backdrop-blur backdrop-filter">
<div className="text-[12px] leading-[20px] font-medium text-white">
Romantic
</div>
2025-11-13 08:38:25 +00:00
</div>
</>
)}
</div>
</div>
</div>
{/* AI生成内容提示 */}
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex w-full shrink-0 flex-col content-stretch items-center justify-start gap-1 px-0 py-2">
<div className="relative box-border flex shrink-0 content-stretch items-center justify-center gap-2 rounded-[4px] bg-[rgba(251,222,255,0.08)] px-2 py-1 backdrop-blur-[32px] backdrop-filter">
<div className="font-regular text-center text-[12px] leading-[20px] text-white">
2025-11-13 08:38:25 +00:00
Content generated by AI
</div>
</div>
</div>
{/* 示例对话消息 */}
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex w-full shrink-0 content-stretch items-start justify-start gap-4 pt-4 pr-20 pb-2 pl-0">
<div className="relative box-border flex min-h-px min-w-px shrink-0 grow basis-0 content-stretch items-start justify-start gap-2.5 rounded-[16px] bg-[rgba(0,0,0,0.65)] px-4 pt-5 pb-4 backdrop-blur-[32px] backdrop-filter">
2025-11-13 08:38:25 +00:00
{/* 语音标签 */}
2025-11-28 06:31:36 +00:00
<div className="absolute top-[-12px] left-0 box-border flex content-stretch items-center justify-center gap-2 overflow-clip rounded-tl-[8px] rounded-tr-[8px] rounded-br-[8px] bg-[#484151] px-3 py-1">
<div className="relative size-3 shrink-0">
2025-11-13 08:38:25 +00:00
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
2025-11-28 06:31:36 +00:00
<path d="M3 2l6 4-6 4V2z" fill="white" />
2025-11-13 08:38:25 +00:00
</svg>
</div>
2025-11-28 06:31:36 +00:00
<div className="text-[12px] leading-[20px] font-medium text-nowrap text-white">
2025-11-13 08:38:25 +00:00
2''
</div>
</div>
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
{/* 消息内容 */}
2025-11-28 06:31:36 +00:00
<div className="font-regular min-h-px min-w-px grow basis-0 text-[14px] leading-[20px] text-white">
<span className="text-[#958e9e]">
(Watching her parents toast you respectfully, I feel very sad.){' '}
</span>
2025-11-13 08:38:25 +00:00
<span>Are you?</span>
</div>
</div>
</div>
</div>
</div>
{/* 底部品牌区域 */}
2025-11-28 06:31:36 +00:00
<div className="relative box-border flex w-full shrink-0 content-stretch items-start justify-start gap-1 overflow-clip px-2 py-4">
<div className="relative box-border flex min-h-px min-w-px shrink-0 grow basis-0 content-stretch items-center justify-start gap-3 rounded-[16px] bg-gradient-to-r from-[#f264a4] to-[#c241e6] px-4 py-2">
2025-11-13 08:38:25 +00:00
{/* App图标 */}
2025-11-28 06:31:36 +00:00
<div className="relative size-[24px] shrink-0 overflow-clip rounded-[12px]">
2025-11-13 08:38:25 +00:00
<Image
src="/logo.svg"
alt="Crushlevel Logo"
width={24}
height={24}
className="object-contain"
/>
</div>
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
{/* 品牌信息 */}
2025-11-28 06:31:36 +00:00
<div className="relative flex min-h-px min-w-px shrink-0 grow basis-0 flex-col content-stretch items-start justify-start">
<div className="relative h-[14.422px] shrink-0 overflow-clip">
2025-11-13 08:38:25 +00:00
<Image
src="/logo.svg"
alt="Crushlevel"
width={47}
height={14}
className="object-contain"
/>
</div>
2025-11-28 06:31:36 +00:00
<div className="text-center text-[12px] leading-[20px] font-medium text-nowrap text-white">
2025-11-13 08:38:25 +00:00
Chat. Crush. AI Date
</div>
</div>
2025-11-28 06:31:36 +00:00
2025-11-13 08:38:25 +00:00
{/* Chat按钮 */}
2025-11-28 06:31:36 +00:00
<MobileButton
showIcon={false}
btnTxt="Chat"
size="Small"
variant="Contrast"
2025-11-13 08:38:25 +00:00
type="Tertiary"
onClick={handleChatClick}
/>
</div>
</div>
</div>
</div>
2025-11-28 06:31:36 +00:00
)
2025-11-13 08:38:25 +00:00
}
2025-11-28 06:31:36 +00:00
export default SharePage