diff --git a/src/components/Article/Comment/Comment.tsx b/src/components/Article/Comment/Comment.tsx index d22a8da7..d5b794e6 100644 --- a/src/components/Article/Comment/Comment.tsx +++ b/src/components/Article/Comment/Comment.tsx @@ -46,14 +46,13 @@ export const Comment = (props: Props) => { const canEdit = createMemo( () => Boolean(author()?.id) && - (props.comment?.created_by?.id === author().id || session()?.user?.roles.includes('editor')), + (props.comment?.created_by?.slug === author().slug || session()?.user?.roles.includes('editor')), ) - const comment = createMemo(() => props.comment) - const body = createMemo(() => (comment().body || '').trim()) + const body = createMemo(() => (props.comment.body || '').trim()) const remove = async () => { - if (comment()?.id) { + if (props.comment?.id) { try { const isConfirmed = await showConfirm({ confirmBody: t('Are you sure you want to delete this comment?'), @@ -63,7 +62,7 @@ export const Comment = (props: Props) => { }) if (isConfirmed) { - await deleteReaction(comment().id) + await deleteReaction(props.comment.id) await showSnackbar({ body: t('Comment successfully deleted') }) } @@ -113,8 +112,10 @@ export const Comment = (props: Props) => { return (
  • props.lastSeen })} + id={`comment_${props.comment.id}`} + class={clsx(styles.comment, props.class, { + [styles.isNew]: props.comment?.created_at > props.lastSeen, + })} >
    @@ -123,21 +124,21 @@ export const Comment = (props: Props) => { fallback={
    - {comment()?.shout.title || ''} + {props.comment?.shout.title || ''}
    } >
    - +
    @@ -148,23 +149,23 @@ export const Comment = (props: Props) => { - - + +
    }> {t('Loading')}

    }> { - const uniqueNewAuthors = newAuthors.filter(newAuthor => - !prevAuthors.some(prevAuthor => prevAuthor.id === newAuthor.id)); + const uniqueNewAuthors = newAuthors.filter( + (newAuthor) => !prevAuthors.some((prevAuthor) => prevAuthor.id === newAuthor.id), + ) return [...prevAuthors, ...uniqueNewAuthors] } export const AuthorsList = (props: Props) => { @@ -43,9 +44,9 @@ export const AuthorsList = (props: Props) => { }) if (queryType === 'shouts') { - setAuthorsByShouts(prev => addUniqueAuthors(prev, result)); + setAuthorsByShouts((prev) => addUniqueAuthors(prev, result)) } else { - setAuthorsByFollowers(prev => addUniqueAuthors(prev, result)); + setAuthorsByFollowers((prev) => addUniqueAuthors(prev, result)) } setLoading(false) } @@ -106,7 +107,7 @@ export const AuthorsList = (props: Props) => { 0 && !allLoaded()}>
    diff --git a/src/stores/ui.ts b/src/stores/ui.ts index b4ae712b..a97db243 100644 --- a/src/stores/ui.ts +++ b/src/stores/ui.ts @@ -48,7 +48,9 @@ export const MODALS: Record = { const [modal, setModal] = createSignal(null) -const { changeSearchParams, clearSearchParams } = useRouter() +const { changeSearchParams, clearSearchParams } = useRouter< + AuthModalSearchParams & ConfirmEmailSearchParams & RootSearchParams +>() export const showModal = (modalType: ModalType, modalSource?: AuthModalSource) => { if (modalSource) {