Skip to content

Commit

Permalink
Reintroduce unreadStyle and selector for questionList items
Browse files Browse the repository at this point in the history
  • Loading branch information
TehAwol committed Jan 15, 2025
1 parent 966f2e0 commit bde3b94
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
grow,
itemCenter,
justifyCenter,
unreadSignalStyle,
} from '../../../css/classes';
import { Actions } from '../../../data';
import { createTranslatableContent } from '../../../data/i18n';
Expand Down Expand Up @@ -173,12 +174,12 @@ export function QuestionLabel({
editing,
onFinishEditing,
}: QuestionLabelProps) {
// const unreadSelector = React.useCallback(() => {
// return {
// isUnread: instantiate(questionD).getInstance(Player.self()).isUnread(),
// };
// }, [questionD]);
// const { isUnread } = useStore(unreadSelector);
const unreadSelector = React.useCallback(() => {
return {
isUnread: instantiate(questionD).getInstance(Player.self()).isUnread(),
};
}, [questionD]);
const { isUnread } = useStore(unreadSelector);
const label = React.useRef<HTMLDivElement>(null);
const { lang } = React.useContext(languagesCTX);
useOnClickOutside(label, () => onFinishEditing && onFinishEditing());
Expand Down Expand Up @@ -214,18 +215,15 @@ export function QuestionLabel({
itemCenter,
css({ justifyContent: 'space-between', width: '100%' }),
'wegas-question__item',
isUnread && cx(unreadSignalStyle, 'wegas-question__item-unread'),
)}
onClick={() => {
!disabled &&
!editing &&
editingStore.dispatch(read(instantiate(questionD).getEntity()));
}}
>
{/* {isUnread ? (
<div className={cx(unreadSpaceStyle, unreadSignalStyle)} />
) : (
<div />
)} */}
{/*{isUnread && <div className={cx(unreadSpaceStyle, unreadSignalStyle)} />}*/}
{editing ? (
<Validate
value={questionDLabel}
Expand Down

0 comments on commit bde3b94

Please sign in to comment.