Files
remark42/frontend/app/store/comments/getters.ts
T
2019-04-28 19:27:36 +03:00

13 lines
367 B
TypeScript

import { Comment, CommentMode } from '@app/common/types';
import { StoreState } from '../index';
export const getCommentMode = (state: StoreState, id: Comment['id']): CommentMode => {
if (state.activeComment === null) {
return CommentMode.None;
}
if (state.activeComment.id !== id) {
return CommentMode.None;
}
return state.activeComment.state;
};