From 4eba638a367d4be2dc3d0b3e378298fd98a9ff5d Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Sat, 19 Oct 2024 01:18:07 +0800 Subject: [PATCH] feat: app button support drag --- eslint.config.ts | 7 +- package.json | 2 +- src/app/content/App.tsx | 18 ++-- src/app/content/components/MessageItem.tsx | 1 - src/app/content/components/MessageList.tsx | 1 + src/app/content/views/AppButton/index.tsx | 44 ++++++++-- src/app/content/views/AppContainer/index.tsx | 48 ----------- src/app/content/views/AppMain/index.tsx | 67 ++++++++++++++ src/app/content/views/Main/index.tsx | 32 +++---- src/app/content/views/Setup/index.tsx | 1 + src/components/Markdown.tsx | 4 +- src/components/ui/ScrollArea.tsx | 9 +- src/domain/AppStatus.ts | 31 ++++++- src/domain/Danmaku.ts | 2 +- src/domain/impls/Storage.ts | 22 +---- src/domain/modules/StorageEffect.ts | 2 +- src/hooks/useDarg.ts | 91 ++++++++++++++++++++ src/hooks/useResizable.ts | 20 +++-- 18 files changed, 277 insertions(+), 125 deletions(-) delete mode 100644 src/app/content/views/AppContainer/index.tsx create mode 100644 src/app/content/views/AppMain/index.tsx create mode 100644 src/hooks/useDarg.ts diff --git a/eslint.config.ts b/eslint.config.ts index a7eb001..e58683f 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,4 +1,4 @@ -// import type { Linter } from 'eslint' +import type { Linter } from 'eslint' import globals from 'globals' import pluginJs from '@eslint/js' import tseslint from 'typescript-eslint' @@ -34,8 +34,9 @@ export default [ '@typescript-eslint/no-unused-expressions': 'off', '@eslint-react/no-array-index-key': 'off', '@eslint-react/hooks-extra/no-redundant-custom-hook': 'off', - '@eslint-react/dom/no-missing-button-type': 'off' + '@eslint-react/dom/no-missing-button-type': 'off', + '@eslint-react/hooks-extra/prefer-use-state-lazy-initialization': 'off' } } ] -// satisfies Linter.Config[] +// satisfies Linter.Config[] diff --git a/package.json b/package.json index abb9552..82e9733 100644 --- a/package.json +++ b/package.json @@ -101,8 +101,8 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "@types/eslint": "^9.6.1", - "@types/eslint__js": "^8.42.3", "@types/eslint-plugin-tailwindcss": "^3.17.0", + "@types/eslint__js": "^8.42.3", "@types/node": "^22.7.5", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", diff --git a/src/app/content/App.tsx b/src/app/content/App.tsx index 0e64338..130f05a 100644 --- a/src/app/content/App.tsx +++ b/src/app/content/App.tsx @@ -2,7 +2,7 @@ import Header from '@/app/content/views/Header' import Footer from '@/app/content/views/Footer' import Main from '@/app/content/views/Main' import AppButton from '@/app/content/views/AppButton' -import AppContainer from '@/app/content/views/AppContainer' +import AppMain from '@/app/content/views/AppMain' import { useRemeshDomain, useRemeshQuery, useRemeshSend } from 'remesh-react' import RoomDomain from '@/domain/Room' import UserInfoDomain from '@/domain/UserInfo' @@ -10,6 +10,7 @@ import Setup from '@/app/content/views/Setup' import MessageListDomain from '@/domain/MessageList' import { useEffect, useRef } from 'react' import { Toaster } from 'sonner' +import { AnimatePresence, motion } from 'framer-motion' import DanmakuContainer from './components/DanmakuContainer' import DanmakuDomain from '@/domain/Danmaku' @@ -31,8 +32,8 @@ export default function App() { const danmakuDomain = useRemeshDomain(DanmakuDomain()) const danmakuIsEnabled = useRemeshQuery(danmakuDomain.query.IsEnabledQuery()) const userInfoSetFinished = useRemeshQuery(userInfoDomain.query.UserInfoSetIsFinishedQuery()) - const userInfoLoadFinished = useRemeshQuery(userInfoDomain.query.UserInfoLoadIsFinishedQuery()) const messageListLoadFinished = useRemeshQuery(messageListDomain.query.LoadIsFinishedQuery()) + const userInfoLoadFinished = useRemeshQuery(userInfoDomain.query.UserInfoLoadIsFinishedQuery()) const notUserInfo = userInfoLoadFinished && !userInfoSetFinished @@ -58,14 +59,21 @@ export default function App() { return ( <> - +