From 364f3ecc80c3aec0c5659821ac5fc37e0482e936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=8C=EC=9A=B8=EC=B9=98=ED=82=A8?= <90738604+soulchicken@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:08:16 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20image=20props=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95,=20props=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/chat/Header.tsx | 14 ++++---------- src/components/chat/Main.tsx | 6 +++--- .../chat/characterHeader/CharacterInfo.tsx | 6 +++--- src/components/chat/messageBox/CharacterSpeak.tsx | 6 +++--- src/components/community/BoardList.tsx | 4 +--- src/components/community/CommunityHeader.tsx | 2 +- src/components/community/PostHeader.tsx | 2 +- src/components/friends/ChatLogs.tsx | 2 +- src/components/friends/Friends.tsx | 2 +- src/components/friends/Recommends.tsx | 2 +- src/components/friends/friend/FriendInfo.tsx | 6 +++--- src/components/friends/recommend/RecommendBox.tsx | 6 +++--- src/components/profile/CharacterProfileInfo.tsx | 6 +++--- src/pages/chats/[character].tsx | 4 ++-- src/pages/profile/friends/[character_id].tsx | 2 +- src/types/characterInfo.d.ts | 4 ++++ 16 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/components/chat/Header.tsx b/src/components/chat/Header.tsx index b3d4a7c..c0f9e13 100644 --- a/src/components/chat/Header.tsx +++ b/src/components/chat/Header.tsx @@ -4,19 +4,13 @@ import useSocketStore from '@/store/socket'; import useChatStore from '@/store/chat'; import color from '@/styles/color'; import { useSession } from 'next-auth/react'; +import { CharacterStateProps } from '@/types/characterInfo'; import FriendShip from './characterHeader/FriendShip'; import CharacterInfo from './characterHeader/CharacterInfo'; -interface CharacterState { - characterId: number, - characterName: string, - hashTag: string, - imageUrl: string, -} - // TODO: Back 버튼을 누르면 지금 홈으로 돌아가지만 채팅 리스트뷰가 완성되면 그쪽으로 Link 될 예정 -const Header : FC = ({ - characterId, characterName, hashTag, imageUrl, +const Header : FC = ({ + characterId, characterName, hashTag, profileImageUrl, }) => { // TODO: 친밀도를 API로 받아와야 작업이 가능함! const [userStatus, setUserStatus] = useState({ @@ -42,7 +36,7 @@ const Header : FC = ({ }, [session]); return (
- + = ({ characterId, characterName, imageUrl }) => { +const Main:FC = ({ characterId, characterName, profileImageUrl }) => { const { chatContents, clearChatContents, initChatContents } = useChatStore(); const messageEndRef = useRef(null); const [loadingHistory, setLoadingHistory] = useState(false); @@ -42,7 +42,7 @@ const Main:FC = ({ characterId, characterName, imageUrl }) => { = ({ - characterName, hashTag, imageUrl, link, + characterName, hashTag, profileImageUrl, link, }) => ( <> @@ -28,7 +28,7 @@ const CharacterInfo: FC = ({
{`/${characterName}`} = ({ - speaker, content, timestamp, imageUrl, loading = false, + speaker, content, timestamp, profileImageUrl, loading = false, }) => (
{speaker} { >
diff --git a/src/components/community/CommunityHeader.tsx b/src/components/community/CommunityHeader.tsx index a9ce92a..ed7b030 100644 --- a/src/components/community/CommunityHeader.tsx +++ b/src/components/community/CommunityHeader.tsx @@ -30,7 +30,7 @@ const CommunityHeader = () => { characterInfo ? ( { characterInfo ? ( {
diff --git a/src/components/friends/Friends.tsx b/src/components/friends/Friends.tsx index f668b5a..1697d65 100644 --- a/src/components/friends/Friends.tsx +++ b/src/components/friends/Friends.tsx @@ -31,7 +31,7 @@ const Friends = () => { diff --git a/src/components/friends/Recommends.tsx b/src/components/friends/Recommends.tsx index d56d274..6afb845 100644 --- a/src/components/friends/Recommends.tsx +++ b/src/components/friends/Recommends.tsx @@ -26,7 +26,7 @@ const Recommends = () => { characterId={characterInfo.characterId} hashTag={characterInfo.hashTag} statusMessage={characterInfo.statusMessage} - imageUrl={characterInfo.profileImageUrl} + profileImageUrl={characterInfo.profileImageUrl} /> ))}
diff --git a/src/components/friends/friend/FriendInfo.tsx b/src/components/friends/friend/FriendInfo.tsx index 3d631ed..a7faf99 100644 --- a/src/components/friends/friend/FriendInfo.tsx +++ b/src/components/friends/friend/FriendInfo.tsx @@ -6,14 +6,14 @@ import color from '@/styles/color'; interface FriendInfoProps { characterName: string, message: string, - imageUrl: string, + profileImageUrl: string, } -const FriendInfo: FC = ({ characterName, message, imageUrl }) => ( +const FriendInfo: FC = ({ characterName, message, profileImageUrl }) => (
{characterName} = ({ - characterName, characterId, hashTag, statusMessage, imageUrl, +const RecommendBox:FC = ({ + characterName, characterId, hashTag, statusMessage, profileImageUrl: imageUrl, }) => ( diff --git a/src/components/profile/CharacterProfileInfo.tsx b/src/components/profile/CharacterProfileInfo.tsx index d80f79f..03c4bcd 100644 --- a/src/components/profile/CharacterProfileInfo.tsx +++ b/src/components/profile/CharacterProfileInfo.tsx @@ -6,17 +6,17 @@ import color from '@/styles/color'; interface CharacterProfileInfoProps { characterName: string, hashTag: string, - imageUrl: string, + profileImageUrl: string, statusMessage: string, } const CharacterProfileInfo: FC = ({ - characterName, hashTag, imageUrl, statusMessage, + characterName, hashTag, profileImageUrl, statusMessage, }) => (
{`/${characterName}`} {
{ diff --git a/src/types/characterInfo.d.ts b/src/types/characterInfo.d.ts index 23c3131..8007048 100644 --- a/src/types/characterInfo.d.ts +++ b/src/types/characterInfo.d.ts @@ -6,3 +6,7 @@ export interface CharacterInfo { profileImageUrl: string, backgroundImageUrl: string, } + +export type CharacterStateProps = Omit; + +export type RecommendCharacterProps = Omit;