chore: adjust the dir structure

This commit is contained in:
molvqingtai 2023-08-02 04:17:50 +08:00
parent 558540a361
commit 400f5603ba
11 changed files with 32 additions and 15 deletions

View file

@ -1,8 +1,8 @@
import Header from '@/components/Header'
import Footer from '@/components/Footer'
import Main from '@/components/Main'
import AppButton from '@/components/AppButton'
import AppContainer from '@/components/AppContainer'
import Header from '@/views/Header'
import Footer from '@/views/Footer'
import Main from '@/views/Main'
import AppButton from '@/views/AppButton'
import AppContainer from '@/views/AppContainer'
export default function App() {
return (

View file

@ -2,8 +2,9 @@ import { type FC, useState } from 'react'
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/Avatar'
import { format } from 'date-fns'
import LikeButton from './LikeButton'
import LikeButton from '@/components/LikeButton'
import { FrownIcon, ThumbsUpIcon } from 'lucide-react'
export interface MessageProps {
data: {
id: string

View file

@ -9,35 +9,42 @@ const MessageInputDomain = Remesh.domain({
})
const PreviewState = domain.state({
name: 'PreviewState',
name: 'MessageInput.PreviewState',
default: false
})
const PreviewQuery = domain.query({
name: 'PreviewQuery',
name: 'MessageInput.PreviewQuery',
impl: ({ get }) => {
return get(PreviewState())
}
})
const PreviewCommand = domain.command({
name: 'PreviewCommand',
name: 'MessageInput.PreviewCommand',
impl: (_, value: boolean) => {
return PreviewState().new(value)
}
})
const EnterEvent = domain.event({
name: 'EnterEvent'
name: 'MessageInput.EnterEvent'
})
const EnterCommand = domain.command({
name: 'EnterCommand',
name: 'MessageInput.EnterCommand',
impl: () => {
return EnterEvent()
}
})
const ClearCommand = domain.command({
name: 'MessageInput.ClearCommand',
impl: () => {
return inputModule.command.InputCommand('')
}
})
return {
query: {
...inputModule.query,
@ -46,6 +53,7 @@ const MessageInputDomain = Remesh.domain({
command: {
...inputModule.command,
EnterCommand,
ClearCommand,
PreviewCommand
},
event: {

View file

@ -1,10 +1,18 @@
import { type FC } from 'react'
import { Button } from '@/components/ui/Button'
import { SmileIcon, CornerDownLeftIcon, ImageIcon } from 'lucide-react'
import MessageInput from './MessageInput'
import MessageInput from '@/components/MessageInput'
import { useRemeshDomain, useRemeshEvent, useRemeshSend } from 'remesh-react'
import MessageInputDomain from '@/domain/MessageInput'
const Footer: FC = () => {
const handleSend = () => {}
const send = useRemeshSend()
const messageInputDomain = useRemeshDomain(MessageInputDomain())
const handleSend = () => {
send(messageInputDomain.command.ClearCommand())
}
useRemeshEvent(messageInputDomain.event.EnterEvent, handleSend)
return (
<div className="grid gap-y-2 p-4">

View file

@ -1,5 +1,5 @@
import { type FC } from 'react'
import Message from './Message'
import Message from '@/components/Message'
const Main: FC = () => {
const messages = [

View file

@ -13,7 +13,7 @@
"resolveJsonModule": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"types": ["vite/client", "unplugin-icons/types/react"],
"types": ["vite/client"],
"paths": {
"@/*": ["src/*"]
}