Files
remark42/frontend/app/store/thread/getters.ts
T
2022-01-18 01:38:30 -06:00

19 lines
479 B
TypeScript

import type { Comment } from 'common/types';
import { StaticStore } from 'common/static-store';
import { StoreState } from '../index';
export const getThreadIsCollapsed =
(comment: Comment) =>
(state: StoreState): boolean => {
const collapsed = state.collapsedThreads[comment.id];
if (collapsed !== null && collapsed !== undefined) {
return collapsed;
}
const score = comment.score || 0;
return score <= StaticStore.config.critical_score;
};