diff --git a/src/components/App.tsx b/src/components/App.tsx index b024f194..c595ec15 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -94,10 +94,6 @@ export const App = (props: Props) => { const is404 = createMemo(() => props.is404) createEffect(() => { - if (!searchParams().m) { - hideModal() - } - const modal = MODALS[searchParams().m] if (modal) { showModal(modal) 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 { t } = useLocalize() const { isOwnerSubscribed } = useFollowing() @@ -27,8 +29,6 @@ export const AuthorsList = (props: Props) => { const fetchAuthors = async (queryType: Props['query'], page: number) => { setLoading(true) - - console.log('!!! AAA:') const offset = PAGE_SIZE * page const result = await apiClient.loadAuthorsBy({ by: { order: queryType }, @@ -42,7 +42,6 @@ export const AuthorsList = (props: Props) => { setAuthorsByFollowers((prev) => [...prev, ...result]) } setLoading(false) - return result } const loadMoreAuthors = () => { @@ -57,7 +56,7 @@ export const AuthorsList = (props: Props) => { () => props.query, (query) => { const authorsList = query === 'shouts' ? authorsByShouts() : authorsByFollowers() - if (authorsList.length === 0 || currentPage()[query] === 0) { + if (authorsList.length === 0 && currentPage()[query] === 0) { setCurrentPage((prev) => ({ ...prev, [query]: 0 })) fetchAuthors(query, 0).then(() => setCurrentPage((prev) => ({ ...prev, [query]: 1 }))) } @@ -75,7 +74,7 @@ export const AuthorsList = (props: Props) => { // }) createEffect(() => { - setAllLoaded(authorsByShouts().length === authorsList.length) + setAllLoaded(props.allAuthorsLength === authorsList.length) }) return ( diff --git a/src/components/Nav/AuthModal/RegisterForm.tsx b/src/components/Nav/AuthModal/RegisterForm.tsx index fd3b2467..ec78b44e 100644 --- a/src/components/Nav/AuthModal/RegisterForm.tsx +++ b/src/components/Nav/AuthModal/RegisterForm.tsx @@ -53,7 +53,6 @@ export const RegisterForm = () => { const handleSubmit = async (event: Event) => { event.preventDefault() - if (passwordError()) { setValidationErrors((errors) => ({ ...errors, password: passwordError() })) } else { @@ -102,7 +101,7 @@ export const RegisterForm = () => { redirect_uri: window.location.origin, } const { errors } = await signUp(opts) - if (errors) return + if (errors.length > 0) return setIsSuccess(true) } catch (error) { console.error(error) @@ -134,7 +133,6 @@ export const RegisterForm = () => { ), })) break - case 'verified': setValidationErrors((prev) => ({ email: ( diff --git a/src/components/Nav/AuthModal/SendResetLinkForm.tsx b/src/components/Nav/AuthModal/SendResetLinkForm.tsx index b1880d9d..f429a256 100644 --- a/src/components/Nav/AuthModal/SendResetLinkForm.tsx +++ b/src/components/Nav/AuthModal/SendResetLinkForm.tsx @@ -96,7 +96,6 @@ export const SendResetLinkForm = () => { placeholder={t('Email')} onInput={(event) => handleEmailInput(event.currentTarget.value)} /> -
    diff --git a/src/context/session.tsx b/src/context/session.tsx index f1c3ecc1..e6086097 100644 --- a/src/context/session.tsx +++ b/src/context/session.tsx @@ -122,7 +122,13 @@ export const SessionProvider = (props: { m: 'auth', access_token, }) - else if (token) changeSearchParams({ mode: 'change-password', modal: 'auth', token }) + else if (token) { + changeSearchParams({ + mode: 'change-password', + m: 'auth', + token, + }) + } }) // load @@ -207,7 +213,6 @@ export const SessionProvider = (props: { if (session()) { const token = session()?.access_token if (token) { - // console.log('[context.session] token observer got token', token) if (!inboxClient.private) { apiClient.connect(token) notifierClient.connect(token) @@ -333,7 +338,6 @@ export const SessionProvider = (props: { const response = await authorizer().graphqlQuery({ query: `query { is_registered(email: "${email}") { message }}`, }) - // console.log(response) return response?.data?.is_registered?.message } catch (error) { console.warn(error) diff --git a/src/pages/types.ts b/src/pages/types.ts index 05fd3f61..96701c6c 100644 --- a/src/pages/types.ts +++ b/src/pages/types.ts @@ -25,6 +25,7 @@ export type PageProps = { export type RootSearchParams = { m: string // modal lang: string + token: string } export type LayoutType = 'article' | 'audio' | 'video' | 'image' | 'literature' diff --git a/src/stores/router.ts b/src/stores/router.ts index 2533b252..be197bd1 100644 --- a/src/stores/router.ts +++ b/src/stores/router.ts @@ -153,7 +153,7 @@ export const useRouter = = Record< } const clearSearchParams = (replace = false) => { - // searchParamsStore.open({}, replace) + searchParamsStore.open({}, replace) } return {