forked from PoolC/Haribo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from PoolC/feat/99
message UI 및 보내기 기능
- Loading branch information
Showing
14 changed files
with
369 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
apps/web-client/src/components/message/MessageAllListContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Button, List, Space, Typography } from 'antd'; | ||
import { ArrowLeftOutlined } from '@ant-design/icons'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { createStyles } from 'antd-style'; | ||
|
||
const useStyles = createStyles(({ css }) => ({ | ||
wrapper: css` | ||
width: 100%; | ||
max-width: 1200px; | ||
box-sizing: border-box; | ||
`, | ||
fullWidth: css` | ||
width: 100%; | ||
`, | ||
metaInfo: css` | ||
justify-content: space-between; | ||
width: 100%; | ||
`, | ||
messageType: css` | ||
font-weight: 700; | ||
`, | ||
topBox: css` | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
`, | ||
topBoxName: css` | ||
margin-bottom: 0; | ||
font-weight: 700; | ||
font-size: 20px; | ||
`, | ||
})); | ||
|
||
export default function MessageAllListContent() { | ||
const { styles } = useStyles(); | ||
const history = useHistory(); | ||
|
||
// TODO: API 호출로 대체 | ||
const data = [ | ||
{ | ||
title: 'Ant Design Title 1', | ||
}, | ||
{ | ||
title: 'Ant Design Title 2', | ||
}, | ||
{ | ||
title: 'Ant Design Title 3', | ||
}, | ||
{ | ||
title: 'Ant Design Title 4', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Space direction="vertical" className={styles.fullWidth} size="large"> | ||
<Space className={styles.topBox}> | ||
<Space> | ||
<Button shape="circle" type="text" onClick={() => history.goBack()}> | ||
<ArrowLeftOutlined /> | ||
</Button> | ||
<Typography.Text className={styles.topBoxName}>대화목록</Typography.Text> | ||
</Space> | ||
</Space> | ||
<List | ||
itemLayout="horizontal" | ||
dataSource={data} | ||
renderItem={() => ( | ||
<List.Item> | ||
<Space direction="vertical" className={styles.fullWidth}> | ||
<Space className={styles.metaInfo}> | ||
<Typography.Text className={styles.messageType}>받은 쪽지</Typography.Text> | ||
<Typography.Text>2023.08.15 19:20:50</Typography.Text> | ||
</Space> | ||
<Typography.Text>내용내용내용</Typography.Text> | ||
</Space> | ||
</List.Item> | ||
)} | ||
/> | ||
</Space> | ||
); | ||
} |
25 changes: 25 additions & 0 deletions
25
apps/web-client/src/components/message/MessageAllListView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { createStyles } from 'antd-style'; | ||
import { Suspense } from 'react'; | ||
import { Block, WhiteBlock } from '~/styles/common/Block.styles'; | ||
import MessageAllListContent from './MessageAllListContent'; | ||
import Spinner from '../common/Spinner/Spinner'; | ||
|
||
const useStyles = createStyles(({ css }) => ({ | ||
whiteBlock: css` | ||
padding: 30px 20px; | ||
`, | ||
})); | ||
|
||
export default function MessageAllListView() { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<Block> | ||
<WhiteBlock className={styles.whiteBlock}> | ||
<Suspense fallback={<Spinner />}> | ||
<MessageAllListContent /> | ||
</Suspense> | ||
</WhiteBlock> | ||
</Block> | ||
); | ||
} |
86 changes: 86 additions & 0 deletions
86
apps/web-client/src/components/message/MessageFormView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { ArrowLeftOutlined } from '@ant-design/icons'; | ||
import { Button, Input, Space, Typography } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
import { FormEventHandler, useState } from 'react'; | ||
import { useHistory, useParams } from 'react-router-dom'; | ||
import { MENU } from '~/constants/menus'; | ||
import { MessageControllerService, useAppMutation } from '~/lib/api-v2'; | ||
import { Block, WhiteBlock } from '~/styles/common/Block.styles'; | ||
|
||
const useStyles = createStyles(({ css }) => ({ | ||
whiteBlock: css` | ||
padding: 30px 20px; | ||
`, | ||
wrapper: css` | ||
width: 100%; | ||
max-width: 1200px; | ||
box-sizing: border-box; | ||
`, | ||
fullWidth: css` | ||
width: 100%; | ||
`, | ||
topBox: css` | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
`, | ||
topBoxName: css` | ||
margin-bottom: 0; | ||
font-weight: 700; | ||
font-size: 20px; | ||
`, | ||
textarea: css` | ||
min-height: 300px !important; | ||
resize: none; | ||
`, | ||
})); | ||
|
||
export default function MessageFormView() { | ||
const { styles } = useStyles(); | ||
// TODO: react-hook-form 기반으로 변경 | ||
const [content, setContent] = useState(''); | ||
const history = useHistory(); | ||
const { conversationId } = useParams<{ conversationId: string }>(); | ||
|
||
const { mutate: sendMessage } = useAppMutation({ | ||
mutationFn: () => | ||
MessageControllerService.sendMessageUsingPost({ | ||
request: { | ||
content, | ||
conversationId, | ||
}, | ||
}), | ||
}); | ||
|
||
const onFormSubmit: FormEventHandler = (e) => { | ||
e.preventDefault(); | ||
sendMessage(undefined, { | ||
onSuccess: () => { | ||
history.push(`/${MENU.MESSAGE}/${conversationId}`); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Block> | ||
<WhiteBlock className={styles.whiteBlock}> | ||
<form onSubmit={onFormSubmit} className={styles.fullWidth}> | ||
<Space direction="vertical" className={styles.fullWidth} size="large"> | ||
<Space className={styles.topBox}> | ||
<Space> | ||
<Button shape="circle" type="text" onClick={() => history.goBack()}> | ||
<ArrowLeftOutlined /> | ||
</Button> | ||
<Typography.Text className={styles.topBoxName}>쪽지보내기</Typography.Text> | ||
</Space> | ||
</Space> | ||
<Input.TextArea className={styles.textarea} value={content} onChange={(e) => setContent(e.target.value)} /> | ||
<Button type="primary" block htmlType="submit"> | ||
보내기 | ||
</Button> | ||
</Space> | ||
</form> | ||
</WhiteBlock> | ||
</Block> | ||
); | ||
} |
92 changes: 92 additions & 0 deletions
92
apps/web-client/src/components/message/MessageListContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { Button, List, Space, Typography } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
import { ArrowLeftOutlined } from '@ant-design/icons'; | ||
import { Link, useHistory } from 'react-router-dom'; | ||
import { Block, WhiteBlock } from '~/styles/common/Block.styles'; | ||
import { MENU } from '~/constants/menus'; | ||
|
||
const useStyles = createStyles(({ css }) => ({ | ||
whiteBlock: css` | ||
padding: 30px 20px; | ||
`, | ||
wrapper: css` | ||
width: 100%; | ||
max-width: 1200px; | ||
box-sizing: border-box; | ||
`, | ||
fullWidth: css` | ||
width: 100%; | ||
`, | ||
metaInfo: css` | ||
justify-content: space-between; | ||
width: 100%; | ||
`, | ||
messageType: css` | ||
font-weight: 700; | ||
`, | ||
topBox: css` | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
`, | ||
topBoxName: css` | ||
margin-bottom: 0; | ||
font-weight: 700; | ||
font-size: 20px; | ||
`, | ||
})); | ||
|
||
export default function MessageListContent() { | ||
const { styles } = useStyles(); | ||
const history = useHistory(); | ||
|
||
const data = [ | ||
{ | ||
title: 'Ant Design Title 1', | ||
}, | ||
{ | ||
title: 'Ant Design Title 2', | ||
}, | ||
{ | ||
title: 'Ant Design Title 3', | ||
}, | ||
{ | ||
title: 'Ant Design Title 4', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Block> | ||
<WhiteBlock className={styles.whiteBlock}> | ||
<Space direction="vertical" className={styles.fullWidth} size="large"> | ||
<Space className={styles.topBox}> | ||
<Space> | ||
<Button shape="circle" type="text" onClick={() => history.goBack()}> | ||
<ArrowLeftOutlined /> | ||
</Button> | ||
<Typography.Text className={styles.topBoxName}>익명</Typography.Text> | ||
</Space> | ||
<Link to={`/${MENU.MY_PAGE}/${MENU.MESSAGE_FORM}`}> | ||
<Button>쪽지 보내기</Button> | ||
</Link> | ||
</Space> | ||
<List | ||
itemLayout="horizontal" | ||
dataSource={data} | ||
renderItem={() => ( | ||
<List.Item> | ||
<Space direction="vertical" className={styles.fullWidth}> | ||
<Space className={styles.metaInfo}> | ||
<Typography.Text className={styles.messageType}>받은 쪽지</Typography.Text> | ||
<Typography.Text>2023.08.15 19:20:50</Typography.Text> | ||
</Space> | ||
<Typography.Text>내용내용내용</Typography.Text> | ||
</Space> | ||
</List.Item> | ||
)} | ||
/> | ||
</Space> | ||
</WhiteBlock> | ||
</Block> | ||
); | ||
} |
Oops, something went wrong.