-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Layout * Empty starred list * Favorite room * Pinned messages * fix last messages * fix date on pinned messages
- Loading branch information
1 parent
bb5e29f
commit b1bb815
Showing
24 changed files
with
739 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as types from './actionsTypes'; | ||
|
||
export function openPinnedMessages(rid) { | ||
return { | ||
type: types.PINNED_MESSAGES.OPEN, | ||
rid | ||
}; | ||
} | ||
|
||
export function closePinnedMessages() { | ||
return { | ||
type: types.PINNED_MESSAGES.CLOSE | ||
}; | ||
} | ||
|
||
export function pinnedMessageReceived(message) { | ||
return { | ||
type: types.PINNED_MESSAGES.MESSAGE_RECEIVED, | ||
message | ||
}; | ||
} | ||
|
||
export function pinnedMessageUnpinned(messageId) { | ||
return { | ||
type: types.PINNED_MESSAGES.MESSAGE_UNPINNED, | ||
messageId | ||
}; | ||
} |
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,28 @@ | ||
import * as types from './actionsTypes'; | ||
|
||
export function openStarredMessages(rid) { | ||
return { | ||
type: types.STARRED_MESSAGES.OPEN, | ||
rid | ||
}; | ||
} | ||
|
||
export function closeStarredMessages() { | ||
return { | ||
type: types.STARRED_MESSAGES.CLOSE | ||
}; | ||
} | ||
|
||
export function starredMessageReceived(message) { | ||
return { | ||
type: types.STARRED_MESSAGES.MESSAGE_RECEIVED, | ||
message | ||
}; | ||
} | ||
|
||
export function starredMessageUnstarred(messageId) { | ||
return { | ||
type: types.STARRED_MESSAGES.MESSAGE_UNSTARRED, | ||
messageId | ||
}; | ||
} |
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
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,24 @@ | ||
import { PINNED_MESSAGES } from '../actions/actionsTypes'; | ||
|
||
const initialState = { | ||
messages: [] | ||
}; | ||
|
||
export default function server(state = initialState, action) { | ||
switch (action.type) { | ||
case PINNED_MESSAGES.MESSAGE_RECEIVED: | ||
return { | ||
...state, | ||
messages: [...state.messages, action.message] | ||
}; | ||
case PINNED_MESSAGES.MESSAGE_UNPINNED: | ||
return { | ||
...state, | ||
messages: state.messages.filter(message => message._id !== action.messageId) | ||
}; | ||
case PINNED_MESSAGES.CLOSE: | ||
return initialState; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { STARRED_MESSAGES } from '../actions/actionsTypes'; | ||
|
||
const initialState = { | ||
messages: [] | ||
}; | ||
|
||
export default function server(state = initialState, action) { | ||
switch (action.type) { | ||
case STARRED_MESSAGES.MESSAGE_RECEIVED: | ||
return { | ||
...state, | ||
messages: [...state.messages, action.message] | ||
}; | ||
case STARRED_MESSAGES.MESSAGE_UNSTARRED: | ||
return { | ||
...state, | ||
messages: state.messages.filter(message => message._id !== action.messageId) | ||
}; | ||
case STARRED_MESSAGES.CLOSE: | ||
return initialState; | ||
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
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,14 @@ | ||
import { take, takeLatest } from 'redux-saga/effects'; | ||
import * as types from '../actions/actionsTypes'; | ||
import RocketChat from '../lib/rocketchat'; | ||
|
||
const watchPinnedMessagesRoom = function* watchPinnedMessagesRoom({ rid }) { | ||
const sub = yield RocketChat.subscribe('pinnedMessages', rid, 50); | ||
yield take(types.PINNED_MESSAGES.CLOSE); | ||
sub.unsubscribe().catch(e => alert(e)); | ||
}; | ||
|
||
const root = function* root() { | ||
yield takeLatest(types.PINNED_MESSAGES.OPEN, watchPinnedMessagesRoom); | ||
}; | ||
export default root; |
Oops, something went wrong.