-
Notifications
You must be signed in to change notification settings - Fork 6
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 #207 from boostcamp-2020/develop
Release Thread Page, User Modal
- Loading branch information
Showing
76 changed files
with
1,293 additions
and
186 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { DefaultSectionName } from './default-section-name'; | ||
import { KeyCode } from './key-code'; | ||
import { ChatroomEventType } from './chatroom-event-type'; | ||
import { ScrollEventType } from './scroll-event-type'; | ||
|
||
export { DefaultSectionName, KeyCode, ChatroomEventType }; | ||
export { DefaultSectionName, KeyCode, ScrollEventType }; |
2 changes: 1 addition & 1 deletion
2
...c/common/constants/chatroom-event-type.ts → ...src/common/constants/scroll-event-type.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { JOIN_CHATROOM, joinChatroomState } from '@socket/types/chatroom-types'; | ||
import { JOIN_CHATROOM } from '@socket/types/chatroom-types'; | ||
import socket from '../socketIO'; | ||
|
||
export const joinChatroom = (chatroomId: joinChatroomState) => { | ||
export const joinChatroom = (chatroomId: number) => { | ||
socket.emit(JOIN_CHATROOM, { chatroomId }); | ||
}; |
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,6 @@ | ||
import { CREATE_REPLY, createThreadState } from '@socket/types/thread-types'; | ||
import socket from '../socketIO'; | ||
|
||
export const createReply = (reply: createThreadState) => { | ||
socket.emit(CREATE_REPLY, reply); | ||
}; |
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 |
---|---|---|
@@ -1,5 +1 @@ | ||
export const JOIN_CHATROOM = 'join chatroom'; | ||
|
||
export interface joinChatroomState { | ||
chatroomId: number; | ||
} |
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,6 @@ | ||
export const CREATE_REPLY = 'create reply'; | ||
|
||
export interface createThreadState { | ||
content: string; | ||
messageId: number | null; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LOAD_THREAD_ASYNC, INSERT_REPLY, LOAD_NEXT_REPLIES_ASYNC, replyState } from '@store/types/thread-types'; | ||
|
||
export const loadThread = (messageId: number) => ({ type: LOAD_THREAD_ASYNC, payload: { messageId } }); | ||
export const InsertReply = (payload: replyState) => ({ type: INSERT_REPLY, payload }); | ||
export const loadNextReplies = (payload: any) => ({ type: LOAD_NEXT_REPLIES_ASYNC, payload }); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { LOAD_THREAD, threadState, INSERT_REPLY, ThreadTypes, LOAD_NEXT_REPLIES } from '@store/types/thread-types'; | ||
|
||
const initialState: threadState = { | ||
message: { | ||
messageId: 0, | ||
content: '', | ||
createdAt: new Date(), | ||
updateAt: new Date(), | ||
deleteAt: new Date(), | ||
user: { | ||
userId: 0, | ||
profileUri: '', | ||
displayName: '' | ||
}, | ||
chatroom: {}, | ||
messageReactions: [] | ||
}, | ||
replies: [] | ||
}; | ||
|
||
export default function threadReducer(state = initialState, action: ThreadTypes) { | ||
switch (action.type) { | ||
case LOAD_THREAD: | ||
return { | ||
...state, | ||
message: action.payload.message, | ||
replies: action.payload.replies | ||
}; | ||
case INSERT_REPLY: | ||
const newReplies = state.replies; | ||
if (action.payload.messageId === state.message.messageId) newReplies.push(action.payload); | ||
|
||
return { | ||
...state, | ||
messages: newReplies | ||
}; | ||
case LOAD_NEXT_REPLIES: | ||
const nextreplies = action.payload.replies; | ||
nextreplies.push(...state.replies); | ||
|
||
return { | ||
...state, | ||
replies: nextreplies | ||
}; | ||
default: | ||
return state; | ||
} | ||
} |
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
Oops, something went wrong.