Merge branch 'dev' of github.com:Discours/discoursio-webapp into dev
This commit is contained in:
commit
1a3d7a9520
|
@ -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)
|
||||
|
|
|
@ -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 (
|
||||
<li
|
||||
id={`comment_${comment().id}`}
|
||||
class={clsx(styles.comment, props.class, { [styles.isNew]: comment()?.created_at > props.lastSeen })}
|
||||
id={`comment_${props.comment.id}`}
|
||||
class={clsx(styles.comment, props.class, {
|
||||
[styles.isNew]: props.comment?.created_at > props.lastSeen,
|
||||
})}
|
||||
>
|
||||
<Show when={!!body()}>
|
||||
<div class={styles.commentContent}>
|
||||
|
@ -123,21 +124,21 @@ export const Comment = (props: Props) => {
|
|||
fallback={
|
||||
<div>
|
||||
<Userpic
|
||||
name={comment().created_by.name}
|
||||
userpic={comment().created_by.pic}
|
||||
name={props.comment.created_by.name}
|
||||
userpic={props.comment.created_by.pic}
|
||||
class={clsx({
|
||||
[styles.compactUserpic]: props.compact,
|
||||
})}
|
||||
/>
|
||||
<small>
|
||||
<a href={`#comment_${comment()?.id}`}>{comment()?.shout.title || ''}</a>
|
||||
<a href={`#comment_${props.comment?.id}`}>{props.comment?.shout.title || ''}</a>
|
||||
</small>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div class={styles.commentDetails}>
|
||||
<div class={styles.commentAuthor}>
|
||||
<AuthorLink author={comment()?.created_by as Author} />
|
||||
<AuthorLink author={props.comment?.created_by as Author} />
|
||||
</div>
|
||||
|
||||
<Show when={props.isArticleAuthor}>
|
||||
|
@ -148,23 +149,23 @@ export const Comment = (props: Props) => {
|
|||
<div class={styles.articleLink}>
|
||||
<Icon name="arrow-right" class={styles.articleLinkIcon} />
|
||||
<a
|
||||
href={`${getPagePath(router, 'article', { slug: comment().shout.slug })}?commentId=${
|
||||
comment().id
|
||||
}`}
|
||||
href={`${getPagePath(router, 'article', {
|
||||
slug: props.comment.shout.slug,
|
||||
})}?commentId=${props.comment.id}`}
|
||||
>
|
||||
{comment().shout.title}
|
||||
{props.comment.shout.title}
|
||||
</a>
|
||||
</div>
|
||||
</Show>
|
||||
<CommentDate showOnHover={true} comment={comment()} isShort={true} />
|
||||
<CommentRatingControl comment={comment()} />
|
||||
<CommentDate showOnHover={true} comment={props.comment} isShort={true} />
|
||||
<CommentRatingControl comment={props.comment} />
|
||||
</div>
|
||||
</Show>
|
||||
<div class={styles.commentBody}>
|
||||
<Show when={editMode()} fallback={<div innerHTML={body()} />}>
|
||||
<Suspense fallback={<p>{t('Loading')}</p>}>
|
||||
<SimplifiedEditor
|
||||
initialContent={comment().body}
|
||||
initialContent={props.comment.body}
|
||||
submitButtonText={t('Save')}
|
||||
quoteEnabled={true}
|
||||
imageEnabled={true}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { For, Show, createEffect, createSignal, on, onMount } from 'solid-js'
|
|||
import { useFollowing } from '../../context/following'
|
||||
import { useLocalize } from '../../context/localize'
|
||||
import { apiClient } from '../../graphql/client/core'
|
||||
import { Author } from '../../graphql/schema/core.gen'
|
||||
import { setAuthorsByFollowers, setAuthorsByShouts, useAuthorsStore } from '../../stores/zine/authors'
|
||||
import { AuthorBadge } from '../Author/AuthorBadge'
|
||||
import { InlineLoader } from '../InlineLoader'
|
||||
|
@ -17,6 +18,7 @@ type Props = {
|
|||
}
|
||||
|
||||
const PAGE_SIZE = 20
|
||||
|
||||
export const AuthorsList = (props: Props) => {
|
||||
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 (
|
||||
|
|
|
@ -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: (
|
||||
|
|
|
@ -96,7 +96,6 @@ export const SendResetLinkForm = () => {
|
|||
placeholder={t('Email')}
|
||||
onInput={(event) => handleEmailInput(event.currentTarget.value)}
|
||||
/>
|
||||
|
||||
<label for="email">{t('Email')}</label>
|
||||
<Show when={isUserNotFound()}>
|
||||
<div class={styles.validationError}>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -153,7 +153,7 @@ export const useRouter = <TSearchParams extends Record<string, string> = Record<
|
|||
}
|
||||
|
||||
const clearSearchParams = (replace = false) => {
|
||||
// searchParamsStore.open({}, replace)
|
||||
searchParamsStore.open({}, replace)
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue
Block a user