diff --git a/src/components/Author/AuthorCard/AuthorCard.tsx b/src/components/Author/AuthorCard/AuthorCard.tsx index 9ee3c6b4..d9980fa6 100644 --- a/src/components/Author/AuthorCard/AuthorCard.tsx +++ b/src/components/Author/AuthorCard/AuthorCard.tsx @@ -19,7 +19,7 @@ import { TopicCard } from '../../Topic/Card' import { getNumeralsDeclension } from '../../../utils/getNumeralsDeclension' type SubscriptionFilter = 'all' | 'users' | 'topics' -type AuthorCardProps = { +type Props = { caption?: string hideWriteButton?: boolean hideDescription?: boolean @@ -46,7 +46,7 @@ function isAuthor(value: Author | Topic): value is Author { return 'name' in value } -export const AuthorCard = (props: AuthorCardProps) => { +export const AuthorCard = (props: Props) => { const { t, lang } = useLocalize() const { @@ -58,6 +58,7 @@ export const AuthorCard = (props: AuthorCardProps) => { const [isSubscribing, setIsSubscribing] = createSignal(false) const [subscriptions, setSubscriptions] = createSignal>(props.subscriptions) const [subscriptionFilter, setSubscriptionFilter] = createSignal('all') + const [userpicUrl, setUserpicUrl] = createSignal() const subscribed = createMemo(() => { return session()?.news?.authors?.some((u) => u === props.author.slug) || false @@ -115,6 +116,10 @@ export const AuthorCard = (props: AuthorCardProps) => { } }) + if (props.isAuthorPage && props.author.userpic.includes('assets.discours.io')) { + setUserpicUrl(props.author.userpic.replace('100x', '500x500')) + } + return ( <>
{
{ }) onCleanup(() => { - editor().destroy() window.removeEventListener('keydown', handleKeyDown) + editor().destroy() }) if (props.onChange) { diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 0145784b..c459f4c7 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -18,7 +18,7 @@ import { useLocalize } from '../../../context/localize' import { AuthorRatingControl } from '../../Author/AuthorRatingControl' import { hideModal } from '../../../stores/ui' -type AuthorProps = { +type Props = { shouts: Shout[] author: Author authorSlug: string @@ -31,7 +31,7 @@ export type AuthorPageSearchParams = { export const PRERENDERED_ARTICLES_COUNT = 12 const LOAD_MORE_PAGE_SIZE = 9 -export const AuthorView = (props: AuthorProps) => { +export const AuthorView = (props: Props) => { const { t } = useLocalize() const { sortedArticles } = useArticlesStore({ shouts: props.shouts }) const { searchParams, changeSearchParam } = useRouter() @@ -127,6 +127,7 @@ export const AuthorView = (props: AuthorProps) => { } } }) + return (
diff --git a/src/components/_shared/GrowingTextarea/GrowingTextarea.tsx b/src/components/_shared/GrowingTextarea/GrowingTextarea.tsx index fd533ddb..247355bc 100644 --- a/src/components/_shared/GrowingTextarea/GrowingTextarea.tsx +++ b/src/components/_shared/GrowingTextarea/GrowingTextarea.tsx @@ -1,6 +1,6 @@ import { clsx } from 'clsx' import styles from './GrowingTextarea.module.scss' -import { createSignal, Show } from 'solid-js' +import { createEffect, createSignal, onMount, Show } from 'solid-js' type Props = { class?: string @@ -15,8 +15,16 @@ type Props = { } export const GrowingTextarea = (props: Props) => { - const [value, setValue] = createSignal(props.initialValue ?? '') + const [value, setValue] = createSignal() const [isFocused, setIsFocused] = createSignal(false) + + createEffect(() => { + if (props.maxLength && props.initialValue?.length > props.maxLength) { + setValue(props.initialValue.slice(0, props.maxLength)) + } else { + setValue(props.initialValue ?? '') + } + }) const handleChangeValue = (event) => { setValue(event.target.value) } @@ -32,43 +40,45 @@ export const GrowingTextarea = (props: Props) => { } return ( -
0 - })} - > - 0}> -
{props.fieldName}
-
-
-