From f36ae70146736533ef1178af2ac11402cf957b37 Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Thu, 26 Sep 2024 12:56:59 +0800 Subject: [PATCH] perf: custom toast style --- src/app/content/App.tsx | 13 +- src/app/content/index.tsx | 12 +- src/app/content/views/AppButton/index.tsx | 108 +++- src/app/content/views/Main/index.tsx | 32 +- src/app/content/views/Setup/index.tsx | 2 +- src/app/options/components/ProfileForm.tsx | 3 +- src/app/options/main.tsx | 1 + src/assets/styles/sonner.css | 680 +++++++++++++++++++++ src/domain/Room.ts | 18 +- src/domain/impls/PeerRoom.ts | 29 +- src/domain/impls/PeerRoom2.ts | 22 +- src/hooks/useClickAway.ts | 4 + tailwind.config.ts | 11 +- 13 files changed, 841 insertions(+), 94 deletions(-) create mode 100644 src/assets/styles/sonner.css diff --git a/src/app/content/App.tsx b/src/app/content/App.tsx index 43f02c5..1d1d6e9 100644 --- a/src/app/content/App.tsx +++ b/src/app/content/App.tsx @@ -5,11 +5,11 @@ import AppButton from '@/app/content/views/AppButton' import AppContainer from '@/app/content/views/AppContainer' import { useRemeshDomain, useRemeshQuery, useRemeshSend } from 'remesh-react' import RoomDomain from '@/domain/Room' -import { Toaster } from '@/components/ui/Sonner' import UserInfoDomain from '@/domain/UserInfo' import Setup from '@/app/content/views/Setup' import MessageListDomain from '@/domain/MessageList' import { useEffect } from 'react' +import { Toaster } from 'sonner' export default function App() { const send = useRemeshSend() @@ -23,8 +23,13 @@ export default function App() { const notUserInfo = userInfoLoadFinished && !userInfoSetFinished useEffect(() => { - if (userInfoSetFinished && messageListLoadFinished) { - send(roomDomain.command.JoinRoomCommand()) + if (messageListLoadFinished) { + if (userInfoSetFinished) { + send(roomDomain.command.JoinRoomCommand()) + } else { + // Clear simulated data when refreshing on the setup page + send(messageListDomain.command.ClearListCommand()) + } } }, [userInfoSetFinished, messageListLoadFinished]) @@ -35,9 +40,9 @@ export default function App() {