From 05666455c1d4a2a806612c4320f48d771d1d44cb Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 26 Mar 2024 22:42:03 +0800 Subject: [PATCH] chore: better style for navigation bar --- .../chat-window/attached/attached-preview.tsx | 10 ---------- src/home/chat-window/chat-window.tsx | 17 +++-------------- src/state/layout-state.ts | 4 ---- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/home/chat-window/attached/attached-preview.tsx b/src/home/chat-window/attached/attached-preview.tsx index f2dc815..199d958 100644 --- a/src/home/chat-window/attached/attached-preview.tsx +++ b/src/home/chat-window/attached/attached-preview.tsx @@ -9,7 +9,6 @@ import {findPrompt, Prompt, promptState} from "../../../state/promt-state.ts"; import {AttachedItem} from "./attached-item.tsx"; import {cx} from "../../../util/util.tsx"; import {PromptEditor} from "../prompt/prompt-editor.tsx"; -import {subscribe} from "valtio"; import {CloseIcon} from "../compnent/widget/icon.tsx"; type HPProps = { @@ -71,15 +70,6 @@ export const AttachedPreview: React.FC = ({chatProxy}) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [isPAPinning]); - useEffect(() => { - const scroll = () => { - if (scrollRef.current) { - scrollRef.current.scrollTop += layoutState.PAButtonWheelDeltaY - } - } - scroll() - return subscribe(layoutState, scroll) - }, []); return (
{ const [chatProxy, setChatProxy] = useState(undefined) // console.info("ChatWindow rendered", new Date().toLocaleString()) - const buttonRef = useRef(null) const {isPAPinning} = useSnapshot(layoutState) const {showRecorder} = useSnapshot(appState.pref) @@ -31,17 +29,8 @@ export const ChatWindow: React.FC = () => { }, []) - const handleMouseMove = throttle((event: React.MouseEvent) => { - if (buttonRef.current) { - const rect = buttonRef.current.getBoundingClientRect() - const [x, y] = [(rect.left + 18), (rect.top + 18)] - layoutState.PAButtonDistance = Math.hypot(x - event.clientX, y - event.clientY) - } - }, 50) - return (
{
<> -
+
appState.pref.showSidebar = !appState.pref.showSidebar} > diff --git a/src/state/layout-state.ts b/src/state/layout-state.ts index dd952b7..3861e93 100644 --- a/src/state/layout-state.ts +++ b/src/state/layout-state.ts @@ -6,8 +6,6 @@ export type Layout = { isMessageListOverflow: boolean isMessageListAtBottom: boolean isPAPinning: boolean - PAButtonDistance: number - PAButtonWheelDeltaY: number } export const layoutState = proxy({ @@ -15,6 +13,4 @@ export const layoutState = proxy({ isMessageListOverflow: false, isMessageListAtBottom: false, isPAPinning: false, - PAButtonDistance: 1000, - PAButtonWheelDeltaY:0, }) \ No newline at end of file