Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 52 additions & 41 deletions bilibili/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ dayjs.extend(_relativeTime);

function App() {
const scrollableNodeRef = useRef<HTMLDivElement>(null);
const [groupOpen, setGroupOpen] = useState(false);
const groupRef = useRef<HTMLDivElement>(null);
const [tabs] = useState<TabItem[]>(defTab);
const { increase, decrease } = useFontSizeStore();

Expand Down Expand Up @@ -310,49 +312,58 @@ function App() {
tooltip={{ title: "回到顶部", placement: "left" }}
target={() => scrollableNodeRef.current || window}
/>
<FloatButton.Group
trigger="hover"
shape="circle"
style={{ insetInlineEnd: 24, bottom: 88 }}
icon={<AppstoreOutlined />}
>
{/* 搜索按钮 */}
<FloatButton
onClick={() => setSearchDrawerOpen(true)}
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
/>
{/* 播放待看列表前10条 */}
{activeKey === "watchlater" && list.length > 0 && (
<div ref={groupRef}>
<FloatButton.Group
trigger="click"
open={groupOpen}
onOpenChange={(open) => {
const event = window.event as MouseEvent;
if (event && groupRef.current?.contains(event.target as Node)) {
setGroupOpen(open);
}
}}
shape="circle"
style={{ insetInlineEnd: 24, bottom: 88 }}
icon={<AppstoreOutlined />}
>
{/* 搜索按钮 */}
<FloatButton
onClick={() => {
const top10 = list.slice(0, 10);
usePlayerStore.getState().replacePlaylistAndPlay(top10);
message.success(`已开始播放前${top10.length}条视频`);
}}
icon={<PlaySquareOutlined style={{ color: "#fb7299" }} />}
tooltip={{ title: "播放前10条", placement: "left" }}
onClick={() => setSearchDrawerOpen(true)}
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
/>
)}
{/* 减小字体 */}
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
{/* 加大字体 */}
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "加大字体", placement: "left" }}
/>
{/* 刷新 */}
<FloatButton
onClick={refreshData}
icon={<RedoOutlined style={{ color: "#fb7299" }} />}
tooltip={{ title: "刷新", placement: "left" }}
/>
</FloatButton.Group>
{/* 播放待看列表前10条 */}
{activeKey === "watchlater" && list.length > 0 && (
<FloatButton
onClick={() => {
const top10 = list.slice(0, 10);
usePlayerStore.getState().replacePlaylistAndPlay(top10);
message.success(`已开始播放前${top10.length}条视频`);
}}
icon={<PlaySquareOutlined style={{ color: "#fb7299" }} />}
tooltip={{ title: "播放前10条", placement: "left" }}
/>
)}
{/* 减小字体 */}
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
{/* 加大字体 */}
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "加大字体", placement: "left" }}
/>
{/* 刷新 */}
<FloatButton
onClick={refreshData}
icon={<RedoOutlined style={{ color: "#fb7299" }} />}
tooltip={{ title: "刷新", placement: "left" }}
/>
</FloatButton.Group>
</div>

{/* 搜索抽屉 */}
<SearchDrawer
Expand Down
67 changes: 39 additions & 28 deletions netease/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* QQ音乐主应用
*/
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useState, useRef } from "react";
import {
Avatar,
Button,
Expand Down Expand Up @@ -49,6 +49,8 @@ import {
import "./style/index.less";

function App() {
const [groupOpen, setGroupOpen] = useState(false);
const groupRef = useRef<HTMLDivElement>(null);
const [activeTab, setActiveTab] = useState("recommend");
const [loginModalOpen, setLoginModalOpen] = useState(false);
const [searchDrawerOpen, setSearchDrawerOpen] = useState(false);
Expand Down Expand Up @@ -637,33 +639,42 @@ function App() {
icon={<VerticalAlignTopOutlined />}
tooltip={{ title: "回到顶部", placement: "left" }}
/>
<FloatButton.Group
trigger="hover"
shape="circle"
style={{ insetInlineEnd: 24, bottom: currentSong ? 96 : 88 }}
icon={<AppstoreOutlined />}
>
<FloatButton
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
onClick={() => setSearchDrawerOpen(true)}
/>
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "增大字体", placement: "left" }}
/>
<FloatButton
icon={<ReloadOutlined style={{ color: "#1890ff" }} />}
tooltip={{ title: "刷新当前页", placement: "left" }}
onClick={handleRefresh}
/>
</FloatButton.Group>
<div ref={groupRef}>
<FloatButton.Group
trigger="click"
open={groupOpen}
onOpenChange={(open) => {
const event = window.event as MouseEvent;
if (event && groupRef.current?.contains(event.target as Node)) {
setGroupOpen(open);
}
}}
shape="circle"
style={{ insetInlineEnd: 24, bottom: currentSong ? 96 : 88 }}
icon={<AppstoreOutlined />}
>
<FloatButton
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
onClick={() => setSearchDrawerOpen(true)}
/>
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "增大字体", placement: "left" }}
/>
<FloatButton
icon={<ReloadOutlined style={{ color: "#1890ff" }} />}
tooltip={{ title: "刷新当前页", placement: "left" }}
onClick={handleRefresh}
/>
</FloatButton.Group>
</div>
</div>
);
}
Expand Down
67 changes: 39 additions & 28 deletions qqmusic/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* QQ音乐主应用
*/
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useState, useRef } from "react";
import {
Avatar,
Button,
Expand Down Expand Up @@ -49,6 +49,8 @@ import {
import "./style/index.less";

function App() {
const [groupOpen, setGroupOpen] = useState(false);
const groupRef = useRef<HTMLDivElement>(null);
const [activeTab, setActiveTab] = useState("recommend");
const [loginModalOpen, setLoginModalOpen] = useState(false);
const [searchDrawerOpen, setSearchDrawerOpen] = useState(false);
Expand Down Expand Up @@ -636,33 +638,42 @@ function App() {
icon={<VerticalAlignTopOutlined />}
tooltip={{ title: "回到顶部", placement: "left" }}
/>
<FloatButton.Group
trigger="hover"
shape="circle"
style={{ insetInlineEnd: 24, bottom: currentSong ? 96 : 88 }}
icon={<AppstoreOutlined />}
>
<FloatButton
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
onClick={() => setSearchDrawerOpen(true)}
/>
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "增大字体", placement: "left" }}
/>
<FloatButton
icon={<ReloadOutlined style={{ color: "#1890ff" }} />}
tooltip={{ title: "刷新当前页", placement: "left" }}
onClick={handleRefresh}
/>
</FloatButton.Group>
<div ref={groupRef}>
<FloatButton.Group
trigger="click"
open={groupOpen}
onOpenChange={(open) => {
const event = window.event as MouseEvent;
if (event && groupRef.current?.contains(event.target as Node)) {
setGroupOpen(open);
}
}}
shape="circle"
style={{ insetInlineEnd: 24, bottom: currentSong ? 96 : 88 }}
icon={<AppstoreOutlined />}
>
<FloatButton
icon={<SearchOutlined style={{ color: "#faad14" }} />}
tooltip={{ title: "搜索", placement: "left" }}
onClick={() => setSearchDrawerOpen(true)}
/>
<FloatButton
onClick={decrease}
icon={<MinusOutlined style={{ color: "#52c41a" }} />}
tooltip={{ title: "减小字体", placement: "left" }}
/>
<FloatButton
onClick={increase}
icon={<PlusOutlined style={{ color: "#ff4d4f" }} />}
tooltip={{ title: "增大字体", placement: "left" }}
/>
<FloatButton
icon={<ReloadOutlined style={{ color: "#1890ff" }} />}
tooltip={{ title: "刷新当前页", placement: "left" }}
onClick={handleRefresh}
/>
</FloatButton.Group>
</div>
</div>
);
}
Expand Down
Loading