2024-08-02 22:12:54 +08:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
import { Mask, Image,Button } from "antd-mobile";
|
2024-08-05 15:48:59 +08:00
|
|
|
import {getStreamer} from "@/api/streamer";
|
2024-08-02 22:12:54 +08:00
|
|
|
import { useRouter } from "next/navigation";
|
|
|
|
import {remove} from "@/utils/storeInfo"
|
|
|
|
export default function StreamerNavigator({
|
2024-08-05 15:48:59 +08:00
|
|
|
userId,
|
2024-08-02 22:12:54 +08:00
|
|
|
}) {
|
|
|
|
const [streamerInfo,setStreamerInfo] = useState(null);
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
useEffect(()=>{
|
2024-08-05 16:02:01 +08:00
|
|
|
userId && getStreamer(userId).then(res=>{
|
2024-08-02 22:12:54 +08:00
|
|
|
setStreamerInfo(res);
|
|
|
|
})
|
|
|
|
},[])
|
|
|
|
const handleCloseMask = ()=>{
|
|
|
|
remove("inviter")
|
2024-08-05 21:10:36 +08:00
|
|
|
setStreamerInfo(null)
|
2024-08-02 22:12:54 +08:00
|
|
|
}
|
|
|
|
return (
|
2024-08-05 21:10:36 +08:00
|
|
|
<Mask visible={(!!streamerInfo)} onMaskClick={handleCloseMask}>
|
2024-08-02 22:12:54 +08:00
|
|
|
<div
|
2024-08-05 17:24:27 +08:00
|
|
|
className="fixed top-[20%] left-[12.5%] w-3/4 flex-1 justify-center items-center "
|
2024-08-02 22:12:54 +08:00
|
|
|
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className="rounded-2xl bg-[#1E1C29] items-center overflow-hidden"
|
|
|
|
>
|
|
|
|
<div className="flex flex-col w-full">
|
|
|
|
<Image
|
|
|
|
src={streamerInfo?.streamer_ext?.cover?.images[0]?.urls[0]}
|
|
|
|
fit="cover"
|
|
|
|
style={{ aspectRatio: 1}}
|
|
|
|
className="w-full"
|
|
|
|
/>
|
|
|
|
<div className="p-4">
|
|
|
|
<div className="flex flex-row items-center">
|
|
|
|
<p
|
|
|
|
className="text-xl text-white font-medium mr-1"
|
|
|
|
>
|
|
|
|
{streamerInfo?.streamer_ext?.name}
|
|
|
|
</p>
|
|
|
|
<div className="w-5 h-5">
|
|
|
|
<Image src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/verification.png"} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p className="text-sm text-[#FFFFFFB2] mt-1 truncate ">
|
2024-08-05 17:24:27 +08:00
|
|
|
{!streamerInfo?.streamer_ext?.zones?.length ? streamerInfo?.streamer_ext?.bio:streamerInfo?.streamer_ext?.zones[0]?.profile}
|
2024-08-02 22:12:54 +08:00
|
|
|
</p>
|
|
|
|
<div
|
|
|
|
onClick={
|
|
|
|
streamerInfo?.streamer_ext?.zones?.length === 0
|
|
|
|
? () => {
|
|
|
|
handleCloseMask();
|
2024-08-05 17:24:27 +08:00
|
|
|
router.replace("/profile/"+streamerInfo?.streamer_ext?.mid);
|
2024-08-02 22:12:54 +08:00
|
|
|
}
|
|
|
|
: () => {
|
|
|
|
handleCloseMask();
|
2024-08-05 17:24:27 +08:00
|
|
|
router.replace("/space/person_space_introduce/"+streamerInfo?.streamer_ext?.mid);
|
2024-08-02 22:12:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
className="w-full p-2 mt-4 text-base rounded-full bg-[#FF669E] text-center"
|
|
|
|
>
|
|
|
|
{streamerInfo?.streamer_ext?.zones?.length === 0 ? "查看主页" : "查看空间"}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Mask>
|
|
|
|
);
|
|
|
|
}
|