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 (
<>
-
+
- {notUserInfo && }
+
+ {notUserInfo && (
+
+
+
+ )}
+
-
+
+
>
)
diff --git a/src/app/content/components/MessageItem.tsx b/src/app/content/components/MessageItem.tsx
index 3d3b2b0..cb4863b 100644
--- a/src/app/content/components/MessageItem.tsx
+++ b/src/app/content/components/MessageItem.tsx
@@ -1,6 +1,5 @@
import { type FC } from 'react'
import { FrownIcon, ThumbsUpIcon } from 'lucide-react'
-import { Badge } from '@/components/ui/Badge'
import LikeButton from './LikeButton'
import FormatDate from './FormatDate'
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/Avatar'
diff --git a/src/app/content/components/MessageList.tsx b/src/app/content/components/MessageList.tsx
index 25ffd5d..c9032a2 100644
--- a/src/app/content/components/MessageList.tsx
+++ b/src/app/content/components/MessageList.tsx
@@ -14,6 +14,7 @@ const MessageList: FC = ({ children }) => {
return (
(isAtBottom ? 'smooth' : 'auto')}
initialTopMostItemIndex={{ index: 'LAST', align: 'end' }}
data={children}
diff --git a/src/app/content/views/AppButton/index.tsx b/src/app/content/views/AppButton/index.tsx
index 14ed7bf..15375bf 100644
--- a/src/app/content/views/AppButton/index.tsx
+++ b/src/app/content/views/AppButton/index.tsx
@@ -1,8 +1,7 @@
-import { type FC, useState, type MouseEvent, useRef } from 'react'
-import { SettingsIcon, MoonIcon, SunIcon } from 'lucide-react'
+import { type FC, useState, type MouseEvent, useRef, useEffect, useLayoutEffect } from 'react'
+import { SettingsIcon, MoonIcon, SunIcon, HandIcon } from 'lucide-react'
import { motion, AnimatePresence } from 'framer-motion'
-import { browser } from 'wxt/browser'
import { useRemeshDomain, useRemeshQuery, useRemeshSend } from 'remesh-react'
import { Button } from '@/components/ui/Button'
import { EVENT } from '@/constants/event'
@@ -20,6 +19,8 @@ import LogoIcon6 from '@/assets/images/logo-6.svg'
import AppStatusDomain from '@/domain/AppStatus'
import { getDay } from 'date-fns'
import { messenger } from '@/messenger'
+import useDarg from '@/hooks/useDarg'
+import { useWindowSize } from 'react-use'
const AppButton: FC = () => {
const send = useRemeshSend()
@@ -29,6 +30,9 @@ const AppButton: FC = () => {
const userInfoDomain = useRemeshDomain(UserInfoDomain())
const userInfo = useRemeshQuery(userInfoDomain.query.UserInfoQuery())
const toastDomain = useRemeshDomain(ToastDomain())
+ const appPosition = useRemeshQuery(appStatusDomain.query.PositionQuery())
+ const appStatusLoadIsFinished = useRemeshQuery(appStatusDomain.query.StatusLoadIsFinishedQuery())
+
const DayLogo = [LogoIcon0, LogoIcon1, LogoIcon2, LogoIcon3, LogoIcon4, LogoIcon5, LogoIcon6][getDay(Date())]
const isDarkMode =
@@ -38,6 +42,21 @@ const AppButton: FC = () => {
const menuRef = useRef(null)
+ const { width, height } = useWindowSize()
+
+ const { x, y, ref } = useDarg({
+ initX: appPosition.x,
+ initY: appPosition.y,
+ minX: 44,
+ maxX: width - 44,
+ maxY: height - 22,
+ minY: height / 2
+ })
+
+ useLayoutEffect(() => {
+ appStatusLoadIsFinished && send(appStatusDomain.command.UpdatePositionCommand({ x, y }))
+ }, [x, y])
+
useClickAway(menuRef, () => {
setMenuOpen(false)
}, ['click'])
@@ -65,7 +84,15 @@ const AppButton: FC = () => {
}
return (
-
+
-