Fix profile modals (#260)
This commit is contained in:
parent
2674717f04
commit
6de5590223
|
@ -118,10 +118,6 @@ export const AuthorCard = (props: Props) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleCloseFollowModals = () => {
|
|
||||||
redirectPage(router, 'author', { slug: props.author.slug })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (props.isAuthorPage && props.author.userpic?.includes('assets.discours.io')) {
|
if (props.isAuthorPage && props.author.userpic?.includes('assets.discours.io')) {
|
||||||
setUserpicUrl(props.author.userpic.replace('100x', '500x500'))
|
setUserpicUrl(props.author.userpic.replace('100x', '500x500'))
|
||||||
}
|
}
|
||||||
|
@ -219,7 +215,7 @@ export const AuthorCard = (props: Props) => {
|
||||||
{(f) => <Userpic name={f.name} userpic={f.userpic} class={styles.userpic} />}
|
{(f) => <Userpic name={f.name} userpic={f.userpic} class={styles.userpic} />}
|
||||||
</For>
|
</For>
|
||||||
<div class={styles.subscribersCounter}>
|
<div class={styles.subscribersCounter}>
|
||||||
{t('SubscriptionWithCount', { count: props.followers.length })}
|
{t('SubscriberWithCount', { count: props.followers.length })}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</Match>
|
</Match>
|
||||||
|
@ -232,7 +228,8 @@ export const AuthorCard = (props: Props) => {
|
||||||
</Match>
|
</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
||||||
<Show when={props.following && props.following.length > 0}>
|
<Switch>
|
||||||
|
<Match when={!props.isCurrentUser && props.following && props.following.length > 0}>
|
||||||
<a href="?modal=following" class={styles.subscribers}>
|
<a href="?modal=following" class={styles.subscribers}>
|
||||||
<For each={props.following.slice(0, 3)}>
|
<For each={props.following.slice(0, 3)}>
|
||||||
{(f) => {
|
{(f) => {
|
||||||
|
@ -245,10 +242,21 @@ export const AuthorCard = (props: Props) => {
|
||||||
}}
|
}}
|
||||||
</For>
|
</For>
|
||||||
<div class={styles.subscribersCounter}>
|
<div class={styles.subscribersCounter}>
|
||||||
{t('SubscriberWithCount', { count: props?.following.length ?? 0 })}
|
{t('SubscriptionWithCount', { count: props?.following.length ?? 0 })}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</Show>
|
</Match>
|
||||||
|
<Match when={props.isCurrentUser && props.following && props.following.length > 0}>
|
||||||
|
<SharePopup
|
||||||
|
containerCssClass={stylesHeader.control}
|
||||||
|
title={props.author.name}
|
||||||
|
description={props.author.bio}
|
||||||
|
imageUrl={props.author.userpic}
|
||||||
|
shareUrl={getShareUrl({ pathname: `/author/${props.author.slug}` })}
|
||||||
|
trigger={<Button variant="secondary" value={t('Share')} />}
|
||||||
|
/>
|
||||||
|
</Match>
|
||||||
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
@ -357,7 +365,7 @@ export const AuthorCard = (props: Props) => {
|
||||||
</Show>
|
</Show>
|
||||||
</ShowOnlyOnClient>
|
</ShowOnlyOnClient>
|
||||||
<Show when={props.followers}>
|
<Show when={props.followers}>
|
||||||
<Modal variant="medium" name="followers" onClose={handleCloseFollowModals} maxHeight>
|
<Modal variant="medium" name="followers" maxHeight>
|
||||||
<>
|
<>
|
||||||
<h2>{t('Followers')}</h2>
|
<h2>{t('Followers')}</h2>
|
||||||
<div class={styles.listWrapper}>
|
<div class={styles.listWrapper}>
|
||||||
|
@ -372,22 +380,8 @@ export const AuthorCard = (props: Props) => {
|
||||||
</>
|
</>
|
||||||
</Modal>
|
</Modal>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={props.isCurrentUser}>
|
|
||||||
<div class={styles.subscribersContainer}>
|
|
||||||
<SharePopup
|
|
||||||
containerCssClass={stylesHeader.control}
|
|
||||||
title={props.author.name}
|
|
||||||
description={props.author.bio}
|
|
||||||
imageUrl={props.author.userpic}
|
|
||||||
shareUrl={getShareUrl({ pathname: `/author/${props.author.slug}` })}
|
|
||||||
trigger={<Button variant="secondary" value={t('Share')} />}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={props.following}>
|
<Show when={props.following}>
|
||||||
<Modal variant="medium" name="following" onClose={handleCloseFollowModals} maxHeight>
|
<Modal variant="medium" name="following" maxHeight>
|
||||||
<>
|
<>
|
||||||
<h2>{t('Subscriptions')}</h2>
|
<h2>{t('Subscriptions')}</h2>
|
||||||
<ul class="view-switcher">
|
<ul class="view-switcher">
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
.CreateModalContent {
|
.CreateModalContent {
|
||||||
padding: 24px;
|
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import formattedTime from '../../utils/formatDateTime'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import styles from './DialogCard.module.scss'
|
import styles from './DialogCard.module.scss'
|
||||||
import { useLocalize } from '../../context/localize'
|
import { useLocalize } from '../../context/localize'
|
||||||
import MD from '../Article/MD'
|
|
||||||
|
|
||||||
type DialogProps = {
|
type DialogProps = {
|
||||||
online?: boolean
|
online?: boolean
|
||||||
|
@ -26,7 +25,8 @@ const DialogCard = (props: DialogProps) => {
|
||||||
() => props.members && props.members.filter((member) => member.id !== props.ownId)
|
() => props.members && props.members.filter((member) => member.id !== props.ownId)
|
||||||
)
|
)
|
||||||
|
|
||||||
const names = createMemo(() =>
|
const names = createMemo(
|
||||||
|
() =>
|
||||||
companions()
|
companions()
|
||||||
?.map((companion) => companion.name)
|
?.map((companion) => companion.name)
|
||||||
.join(', ')
|
.join(', ')
|
||||||
|
@ -55,7 +55,7 @@ const DialogCard = (props: DialogProps) => {
|
||||||
<div class={styles.message}>
|
<div class={styles.message}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Match when={props.message && !props.isChatHeader}>
|
<Match when={props.message && !props.isChatHeader}>
|
||||||
<MD body={props.message} />
|
<div innerHTML={props.message} />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={props.isChatHeader && companions().length > 1}>{names()}</Match>
|
<Match when={props.isChatHeader && companions().length > 1}>{names()}</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
|
@ -45,7 +45,7 @@ export const Message = (props: Props) => {
|
||||||
<Show when={props.replyBody}>
|
<Show when={props.replyBody}>
|
||||||
<QuotedMessage body={props.replyBody} variant="inline" isOwn={isOwn} />
|
<QuotedMessage body={props.replyBody} variant="inline" isOwn={isOwn} />
|
||||||
</Show>
|
</Show>
|
||||||
<MD body={props.content.body} />
|
<div innerHTML={props.content.body} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class={styles.time}>{formattedTime(props.content.createdAt * 1000)()}</div>
|
<div class={styles.time}>{formattedTime(props.content.createdAt * 1000)()}</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.Search {
|
.Search {
|
||||||
|
flex: 1;
|
||||||
.field {
|
.field {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createEffect, createMemo, createSignal, Show } from 'solid-js'
|
import { createEffect, createMemo, createSignal, on, Show } from 'solid-js'
|
||||||
import type { JSX } from 'solid-js'
|
import type { JSX } from 'solid-js'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { hideModal, useModalStore } from '../../../stores/ui'
|
import { hideModal, useModalStore } from '../../../stores/ui'
|
||||||
|
@ -8,6 +8,7 @@ import styles from './Modal.module.scss'
|
||||||
import { redirectPage } from '@nanostores/router'
|
import { redirectPage } from '@nanostores/router'
|
||||||
import { router } from '../../../stores/router'
|
import { router } from '../../../stores/router'
|
||||||
import { Icon } from '../../_shared/Icon'
|
import { Icon } from '../../_shared/Icon'
|
||||||
|
import { resetSortedArticles } from '../../../stores/zine/articles'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
name: string
|
name: string
|
||||||
|
@ -38,6 +39,7 @@ export const Modal = (props: Props) => {
|
||||||
useEscKeyDownHandler(handleHide)
|
useEscKeyDownHandler(handleHide)
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
console.log('!!! modal:', modal())
|
||||||
setVisible(modal() === props.name)
|
setVisible(modal() === props.name)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ export const AuthorView = (props: Props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
hideModal()
|
|
||||||
try {
|
try {
|
||||||
const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug })
|
const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug })
|
||||||
setFollowers(userSubscribers)
|
setFollowers(userSubscribers)
|
||||||
|
|
|
@ -33,7 +33,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
||||||
const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
|
const newChats = await apiClient.getChats({ limit: 50, offset: 0 })
|
||||||
setChats(newChats)
|
setChats(newChats)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log('[loadChats]', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ export type Notification = {
|
||||||
reaction?: Maybe<Scalars['Int']>
|
reaction?: Maybe<Scalars['Int']>
|
||||||
seen: Scalars['Boolean']
|
seen: Scalars['Boolean']
|
||||||
shout?: Maybe<Scalars['Int']>
|
shout?: Maybe<Scalars['Int']>
|
||||||
type?: Maybe<NotificationType>
|
type: NotificationType
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum NotificationType {
|
export enum NotificationType {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user