diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 55d4d5d0..9cfa0200 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -4,12 +4,7 @@ import { useFeed } from '~/context/feed' import { useLocalize } from '~/context/localize' import { COMMENTS_PER_PAGE, useReactions } from '~/context/reactions' import { useSession } from '~/context/session' -import { - Reaction, - ReactionKind, - ReactionSort, - Shout -} from '~/graphql/schema/core.gen' +import { Reaction, ReactionKind, ReactionSort, Shout } from '~/graphql/schema/core.gen' import { byCreated, byStat } from '~/lib/sort' import { SortFunction } from '~/types/common' import { Button } from '../_shared/Button' diff --git a/src/components/Article/RatingControl.tsx b/src/components/Article/RatingControl.tsx index f492118c..f56fe5e1 100644 --- a/src/components/Article/RatingControl.tsx +++ b/src/components/Article/RatingControl.tsx @@ -26,8 +26,14 @@ export const RatingControl = (props: RatingControlProps) => { const [_, changeSearchParams] = useSearchParams() const snackbar = useSnackbar() const { session } = useSession() - const { reactionEntities, reactionsByShout, createReaction, deleteReaction, loadShoutRatings, loadCommentRatings } = - useReactions() + const { + reactionEntities, + reactionsByShout, + createReaction, + deleteReaction, + loadShoutRatings, + loadCommentRatings + } = useReactions() const [myRate, setMyRate] = createSignal() const [ratingReactions, setRatingReactions] = createSignal([]) const [isLoading, setIsLoading] = createSignal(false) @@ -85,7 +91,7 @@ export const RatingControl = (props: RatingControlProps) => { } })) } - } catch(err) { + } catch (err) { snackbar?.showSnackbar({ type: 'error', body: `${t('Error')}: ${error || err || ''}` }) } setIsLoading(false) diff --git a/src/components/Editor/SimplifiedEditor.tsx b/src/components/Editor/SimplifiedEditor.tsx index 66d7b262..1a1dc712 100644 --- a/src/components/Editor/SimplifiedEditor.tsx +++ b/src/components/Editor/SimplifiedEditor.tsx @@ -262,135 +262,135 @@ const SimplifiedEditor = (props: Props) => { return ( -
(wrapperEditorElRef = el)} - class={clsx(styles.SimplifiedEditor, { - [styles.smallHeight]: props.smallHeight, - [styles.minimal]: props.variant === 'minimal', - [styles.bordered]: props.variant === 'bordered', - [styles.isFocused]: isFocused() || !isEmpty(), - [styles.labelVisible]: props.label && counter() > 0 - })} - > - -
{maxLength - counter()}
-
- 0}> -
{props.label}
-
+
(wrapperEditorElRef = el)} + class={clsx(styles.SimplifiedEditor, { + [styles.smallHeight]: props.smallHeight, + [styles.minimal]: props.variant === 'minimal', + [styles.bordered]: props.variant === 'bordered', + [styles.isFocused]: isFocused() || !isEmpty(), + [styles.labelVisible]: props.label && counter() > 0 + })} + > + +
{maxLength - counter()}
+
+ 0}> +
{props.label}
+
- (editorElRef = el)} />}> -
(editorElRef = el)} /> - + (editorElRef = el)} />}> +
(editorElRef = el)} /> + - -
-
- - {(triggerRef: (el: HTMLElement) => void) => ( - - )} - - - {(triggerRef) => ( - - )} - - - {(triggerRef) => ( - - )} - - - + +
+
+ + {(triggerRef: (el: HTMLElement) => void) => ( + + )} + + {(triggerRef) => ( )} - - - + {(triggerRef) => ( )} - -
- -
- - + )} + - }> - + )} +
+ +
+ +
+
+
+
+ + + + value && renderImage(value)} /> + + + + + + (textBubbleMenuRef = el)} + /> -
- - - - - value && renderImage(value)} /> - - - - - - (textBubbleMenuRef = el)} + ref={(el) => (linkBubbleMenuRef = el)} + onClose={handleHideLinkBubble} /> - (linkBubbleMenuRef = el)} - onClose={handleHideLinkBubble} - /> - -
+
) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 0cb88453..333c9afa 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -261,7 +261,6 @@ export const AuthorView = (props: AuthorViewProps) => {
-
diff --git a/src/components/_shared/LoadMoreWrapper.tsx b/src/components/_shared/LoadMoreWrapper.tsx index a5aa30a2..0ad14020 100644 --- a/src/components/_shared/LoadMoreWrapper.tsx +++ b/src/components/_shared/LoadMoreWrapper.tsx @@ -53,14 +53,12 @@ export const LoadMoreWrapper = (props: LoadMoreProps) => { return ( <> {props.children} - + + +
-
diff --git a/src/context/reactions.tsx b/src/context/reactions.tsx index 28e3a125..2605e8e0 100644 --- a/src/context/reactions.tsx +++ b/src/context/reactions.tsx @@ -2,7 +2,12 @@ import type { JSX } from 'solid-js' import { createContext, onCleanup, useContext } from 'solid-js' import { createStore, reconcile } from 'solid-js/store' -import { loadCommentRatings, loadReactions, loadShoutComments, loadShoutRatings } from '~/graphql/api/public' +import { + loadCommentRatings, + loadReactions, + loadShoutComments, + loadShoutRatings +} from '~/graphql/api/public' import createReactionMutation from '~/graphql/mutation/core/reaction-create' import destroyReactionMutation from '~/graphql/mutation/core/reaction-destroy' import updateReactionMutation from '~/graphql/mutation/core/reaction-update' @@ -69,7 +74,11 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => { return result } - const loadShoutRatingsAdding = async (shout: number, limit = RATINGS_PER_PAGE, offset = 0): Promise => { + const loadShoutRatingsAdding = async ( + shout: number, + limit = RATINGS_PER_PAGE, + offset = 0 + ): Promise => { const fetcher = await loadShoutRatings({ shout, limit, offset }) const result = (await fetcher()) || [] console.debug('[context.reactions] shout ratings loaded', result) @@ -77,7 +86,11 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => { return result } - const loadCommentRatingsAdding = async (comment: number, limit = RATINGS_PER_PAGE, offset = 0): Promise => { + const loadCommentRatingsAdding = async ( + comment: number, + limit = RATINGS_PER_PAGE, + offset = 0 + ): Promise => { const fetcher = await loadCommentRatings({ comment, limit, offset }) const result = (await fetcher()) || [] console.debug('[context.reactions] shout ratings loaded', result) @@ -85,7 +98,11 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => { return result } - const loadShoutCommentsAdding = async (shout: number, limit = COMMENTS_PER_PAGE, offset = 0): Promise => { + const loadShoutCommentsAdding = async ( + shout: number, + limit = COMMENTS_PER_PAGE, + offset = 0 + ): Promise => { const fetcher = await loadShoutComments({ shout, limit, offset }) const result = (await fetcher()) || [] console.debug('[context.reactions] shout comments loaded', result) diff --git a/src/graphql/api/public.ts b/src/graphql/api/public.ts index 5188508a..9d538a47 100644 --- a/src/graphql/api/public.ts +++ b/src/graphql/api/public.ts @@ -62,7 +62,7 @@ export const loadShouts = (options: LoadShoutsOptions) => { } export const loadShoutComments = (options: QueryLoad_Shout_RatingsArgs) => { - const page = `${options.offset || 0}-${(options.limit||1) + (options.offset || 0)}` + const page = `${options.offset || 0}-${(options.limit || 1) + (options.offset || 0)}` return cache(async () => { const resp = await defaultClient.query(loadShoutCommentsQuery, options).toPromise() const result = resp?.data?.load_reactions_by @@ -71,7 +71,7 @@ export const loadShoutComments = (options: QueryLoad_Shout_RatingsArgs) => { } export const loadShoutRatings = (options: QueryLoad_Shout_RatingsArgs) => { - const page = `${options.offset || 0}-${(options.limit||1) + (options.offset || 0)}` + const page = `${options.offset || 0}-${(options.limit || 1) + (options.offset || 0)}` return cache(async () => { const resp = await defaultClient.query(loadShoutRatingsQuery, options).toPromise() const result = resp?.data?.load_reactions_by @@ -81,7 +81,7 @@ export const loadShoutRatings = (options: QueryLoad_Shout_RatingsArgs) => { // biome-ignore lint/suspicious/noExplicitAny: FIXME: wait backend export const loadCommentRatings = (options: any) => { - const page = `${options.offset || 0}-${(options.limit||1) + (options.offset || 0)}` + const page = `${options.offset || 0}-${(options.limit || 1) + (options.offset || 0)}` return cache(async () => { const resp = await defaultClient.query(loadCommentRatingsQuery, options).toPromise() const result = resp?.data?.load_reactions_by diff --git a/src/routes/author/[slug]/[...tab].tsx b/src/routes/author/[slug]/[...tab].tsx index abaffcf9..67606e23 100644 --- a/src/routes/author/[slug]/[...tab].tsx +++ b/src/routes/author/[slug]/[...tab].tsx @@ -54,7 +54,10 @@ export default function AuthorPage(props: RouteSectionProps) { const { authorsEntities } = useAuthors() const { addFeed, feedByAuthor } = useFeed() const { t } = useLocalize() - const author = createAsync(async() => props.data.author || authorsEntities()[props.params.slug] || await fetchAuthor(props.params.slug)) + const author = createAsync( + async () => + props.data.author || authorsEntities()[props.params.slug] || (await fetchAuthor(props.params.slug)) + ) const shoutsByAuthor = createMemo(() => feedByAuthor()[props.params.slug]) const title = createMemo(() => `${author()?.name || ''}`) const cover = createMemo(() => @@ -74,7 +77,6 @@ export default function AuthorPage(props: RouteSectionProps) { } }) - // author shouts const loadAuthorShoutsMore = async (offset: number) => { const loadedShouts = await fetchAuthorShouts(props.params.slug, offset)