Skip to content

Commit

Permalink
[refactor] boostcampwm-2022#66 boostcampwm-2022#85 친구 목록 전역 타입 변경
Browse files Browse the repository at this point in the history
- id 제거 후, name으로 key 값 설정
  • Loading branch information
ktmihs committed Dec 1, 2022
1 parent bc0ef88 commit 220cace
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
6 changes: 3 additions & 3 deletions frontend/src/component/Sidebar/Friends/friendItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import unfollow from '../../../assets/icon/unfollowIcon.svg';
import axios from 'axios';

const FriendItem = (data: friendType) => {
const { id, isOnline, name } = data;
const { isOnline, name } = data;

const sendChatting = () => {
alert(`${name}님과 채팅하기`);
Expand All @@ -27,8 +27,8 @@ const FriendItem = (data: friendType) => {
};

return (
<Content draggable={isOnline} key={id}>
<section id={id} css={friendItemWrapper(isOnline)}>
<Content draggable={isOnline} key={name}>
<section id={name} css={friendItemWrapper(isOnline)}>
<div css={userName(isOnline)}>{name}</div>
<div>
<img src={message} alt="채팅하기" onClick={sendChatting}></img>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/component/Sidebar/Friends/friends.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export type friendType = {
id: string;
isCalling: boolean;
isOnline: boolean;
name: string;
Expand Down
35 changes: 13 additions & 22 deletions frontend/src/store/atom/friends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { atom } from 'recoil';

export interface friendsProps {
[key: string]: {
id: string;
name: string;
isOnline: boolean;
isCalling: boolean;
Expand All @@ -12,52 +11,44 @@ export interface friendsProps {
export const friendsState = atom<friendsProps>({
key: 'friendsState',
default: {
'1': {
id: '1',
isOnline: false,
안현서: {
isOnline: true,
name: '안현서',
isCalling: false,
},
'2': {
id: '2',
원종빈: {
isOnline: true,
name: '원종빈',
isCalling: true,
},
'3': {
id: '3',
강성준: {
isOnline: true,
name: '강성준',
isCalling: true,
},
'4': {
id: '4',
이형진: {
isOnline: true,
name: '이형진',
isCalling: false,
},
'5': {
id: '5',
안현서2: {
isOnline: false,
name: '안현서',
name: '안현서2',
isCalling: false,
},
'6': {
id: '6',
원종빈2: {
isOnline: false,
name: '원종빈',
name: '원종빈2',
isCalling: false,
},
'7': {
id: '7',
강성준2: {
isOnline: true,
name: '강성준',
name: '강성준2',
isCalling: false,
},
'8': {
id: '8',
이형진2: {
isOnline: true,
name: '이형진',
name: '이형진2',
isCalling: false,
},
},
Expand Down

0 comments on commit 220cace

Please sign in to comment.