feat(VideoPlayer): 隐藏 logo 功能

- 添加 hideLogo 的 useMemo 计算,根据 localStorage 的值决定是否隐藏 logo
- 修改 logo 渲染逻辑,根据 hideLogo 的值确定是否显示- 更新视频资源路径,从 assets 改为 public
This commit is contained in:
zhaoweijie 2025-08-26 09:15:27 +08:00
parent f6bd08da49
commit d3a0b05910
3 changed files with 13 additions and 7 deletions

View File

@ -149,7 +149,7 @@ export const Sidebar = ({
const db = new PageAssitDatabase()
const history = await db.getChatHistory(chat.id)
setHistoryId(chat.id)
setCurrentMessageId()
setCurrentMessageId("")
setHistory(formatToChatHistory(history))
setMessages(formatToMessage(history))
stopStreamingRequest()

View File

@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from "react"
import iodVideo from "@/assets/video.mp4"
import React, { useEffect, useMemo, useRef, useState } from "react"
import iodVideo from "@/public/video.mp4"
import { useOptionLayoutContext } from "@/components/Layouts/Layout.tsx"
import {
ExpandOutlined,
@ -313,6 +313,11 @@ const VideoPlayer = () => {
// 计算进度条百分比
const progressPercent = duration ? (currentTime / duration) * 100 : 0
// 是否隐藏logo
const hideLogo = useMemo(() => {
return localStorage.getItem("hideLogo") === "true"
}, [])
return (
<div
ref={containerRef}
@ -345,12 +350,13 @@ const VideoPlayer = () => {
</div>
)}
{/* 控制栏 - 使用与原始HTML相同的类名和行为 */}
<div
className={`absolute left-0 w-full bg-gradient-to-t from-black to-transparent p-4 transition-all duration-300 ease-in-out flex flex-col gap-2.5 ${showControls ? "bottom-0" : "-bottom-40"}`}>
<div className="flex items-center justify-end gap-2 cursor-pointer" onClick={handleEnded}>
{<img src={logo} alt="logo" className="w-8" />}
<div
className="flex items-center justify-end gap-2 cursor-pointer"
onClick={handleEnded}>
{!hideLogo && <img src={logo} alt="logo" className="w-8" />}
<h2 className="text-xl font-bold text-white dark:text-zinc-300 mr-3">
<span className="text-[#d30100]"></span>
</h2>