From 578c79cec3da369ba9949d1f76d1d6f9540f1e79 Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Sun, 22 Sep 2024 03:25:55 +0800 Subject: [PATCH] feat: add setup page --- package.json | 3 +- pnpm-lock.yaml | 15 +++ src/app/content/App.tsx | 9 +- src/app/content/components/EmojiButton.tsx | 2 +- src/app/content/components/MessageItem.tsx | 2 +- src/app/content/index.tsx | 2 +- src/app/content/views/AppButton/index.tsx | 14 +-- src/app/content/views/AppContainer/index.tsx | 6 +- src/app/content/views/Header/index.tsx | 3 - src/app/content/views/Main/index.tsx | 2 +- src/app/content/views/Setup/index.tsx | 108 +++++++++++++++++++ src/app/options/components/AvatarSelect.tsx | 2 +- src/app/options/components/ProfileForm.tsx | 41 ++----- src/assets/images/example.jpg | Bin 0 -> 28772 bytes src/assets/react.svg | 1 - src/assets/you.jpg | Bin 31171 -> 0 bytes src/components/ui/Markdown.tsx | 37 +++++++ src/constants/config.ts | 9 ++ src/domain/Room.ts | 12 +-- src/domain/UserInfo.ts | 3 - src/utils/compressImage.ts | 82 ++++++++------ src/utils/generateRandomAvatar.ts | 30 ++++++ src/utils/generateRandomName.ts | 6 +- src/utils/index.ts | 2 + tailwind.config.ts | 6 +- 25 files changed, 289 insertions(+), 108 deletions(-) create mode 100644 src/app/content/views/Setup/index.tsx create mode 100644 src/assets/images/example.jpg delete mode 100644 src/assets/react.svg delete mode 100644 src/assets/you.jpg create mode 100644 src/utils/generateRandomAvatar.ts diff --git a/package.json b/package.json index 098b61e..7041e5d 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "@radix-ui/react-scroll-area": "^1.1.0", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", + "@resreq/timer": "^1.1.5", "@tailwindcss/typography": "^0.5.15", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", @@ -90,8 +91,8 @@ "@eslint-react/eslint-plugin": "^1.14.1", "@eslint/js": "^9.10.0", "@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.5.5", "@types/react": "^18.3.7", "@types/react-dom": "^18.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a1a6cb..64d5244 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,6 +44,9 @@ importers: '@radix-ui/react-switch': specifier: ^1.1.0 version: 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.7)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@resreq/timer': + specifier: ^1.1.5 + version: 1.1.5 '@tailwindcss/typography': specifier: ^0.5.15 version: 0.5.15(tailwindcss@3.4.12) @@ -1643,6 +1646,12 @@ packages: '@radix-ui/rect@1.1.0': resolution: {integrity: sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==} + '@resreq/event-hub@1.6.0': + resolution: {integrity: sha512-SEzPuAc2bQdMV9cKrBIjW3EvntpU8NcBxdgdEo9yLKAeRfvdM4oM/sG8pFPRZOpYwOytaJqWGqwjc+RSRFFTvQ==} + + '@resreq/timer@1.1.5': + resolution: {integrity: sha512-QZrY3+1nbDd3e15muzFGRxJAaKYYJ9xC5+E/cm/B3cEXQbD8pjy/lilsMOaOpvligpUE1jXxiSZzuvH334fq5w==} + '@rollup/pluginutils@5.1.0': resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} @@ -7710,6 +7719,12 @@ snapshots: '@radix-ui/rect@1.1.0': {} + '@resreq/event-hub@1.6.0': {} + + '@resreq/timer@1.1.5': + dependencies: + '@resreq/event-hub': 1.6.0 + '@rollup/pluginutils@5.1.0(rollup@4.21.3)': dependencies: '@types/estree': 1.0.5 diff --git a/src/app/content/App.tsx b/src/app/content/App.tsx index 99e4e84..79f9b67 100644 --- a/src/app/content/App.tsx +++ b/src/app/content/App.tsx @@ -3,25 +3,28 @@ 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 { useRemeshDomain, useRemeshSend } from 'remesh-react' +import { useRemeshDomain, useRemeshQuery, useRemeshSend } from 'remesh-react' import RoomDomain from '@/domain/Room' import { stringToHex } from '@/utils' import { Toaster } from '@/components/ui/Sonner' +import UserInfoDomain from '@/domain/UserInfo' +import Setup from '@/app/content/views/Setup' const hostRoomId = stringToHex(document.location.host) export default function App() { const send = useRemeshSend() const roomDomain = useRemeshDomain(RoomDomain()) - + const userInfoDomain = useRemeshDomain(UserInfoDomain()) send(roomDomain.command.JoinRoomCommand(hostRoomId)) - + const isLogin = useRemeshQuery(userInfoDomain.query.IsLoginQuery()) return ( <>