Hide modal after route to profile from another profile

This commit is contained in:
ilya-bkv 2024-03-21 11:42:28 +03:00
parent 97b1ec4386
commit d4ce74b491

View File

@ -26,6 +26,7 @@ import { Loading } from '../../_shared/Loading'
import { byCreated } from '../../../utils/sortby' import { byCreated } from '../../../utils/sortby'
import stylesArticle from '../../Article/Article.module.scss' import stylesArticle from '../../Article/Article.module.scss'
import styles from './Author.module.scss' import styles from './Author.module.scss'
import { hideModal, MODALS } from "../../../stores/ui";
type Props = { type Props = {
shouts: Shout[] shouts: Shout[]
@ -40,13 +41,14 @@ export const AuthorView = (props: Props) => {
const { loadSubscriptions } = useFollowing() const { loadSubscriptions } = useFollowing()
const { sortedArticles } = useArticlesStore({ shouts: props.shouts }) const { sortedArticles } = useArticlesStore({ shouts: props.shouts })
const { authorEntities } = useAuthorsStore({ authors: [props.author] }) const { authorEntities } = useAuthorsStore({ authors: [props.author] })
const { page: getPage } = useRouter() const { page: getPage, searchParams } = useRouter()
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false) const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
const [isBioExpanded, setIsBioExpanded] = createSignal(false) const [isBioExpanded, setIsBioExpanded] = createSignal(false)
const [followers, setFollowers] = createSignal<Author[]>([]) const [followers, setFollowers] = createSignal<Author[]>([])
const [following, setFollowing] = createSignal<Array<Author | Topic>>([]) const [following, setFollowing] = createSignal<Array<Author | Topic>>([])
const [showExpandBioControl, setShowExpandBioControl] = createSignal(false) const [showExpandBioControl, setShowExpandBioControl] = createSignal(false)
const [commented, setCommented] = createSignal<Reaction[]>() const [commented, setCommented] = createSignal<Reaction[]>()
const modal = MODALS[searchParams().m]
// current author // current author
const [author, setAuthor] = createSignal<Author>() const [author, setAuthor] = createSignal<Author>()
@ -92,7 +94,13 @@ export const AuthorView = (props: Props) => {
} }
} }
onMount(() => fetchData(props.authorSlug)) onMount(() => {
fetchData(props.authorSlug)
if (!modal) {
hideModal()
}
});
const loadMore = async () => { const loadMore = async () => {
saveScrollPosition() saveScrollPosition()