Fixed author page controls visibiity

This commit is contained in:
kvakazyambra 2023-10-17 01:14:43 +03:00
parent b22e27bce6
commit ef281b0e31
2 changed files with 70 additions and 65 deletions

View File

@ -426,6 +426,10 @@
} }
} }
.shareControl {
display: inline-block;
}
.buttonSubscribe { .buttonSubscribe {
align-items: center; align-items: center;
aspect-ratio: 1/1; aspect-ratio: 1/1;

View File

@ -208,8 +208,7 @@ export const AuthorCard = (props: Props) => {
} }
> >
<div class={styles.subscribersContainer}> <div class={styles.subscribersContainer}>
<Switch> <Show when={props.followers && props.followers.length > 0}>
<Match when={props.followers && props.followers.length > 0 && !props.isCurrentUser}>
<a href="?modal=followers" class={styles.subscribers}> <a href="?modal=followers" class={styles.subscribers}>
<For each={props.followers.slice(0, 3)}> <For each={props.followers.slice(0, 3)}>
{(f) => <Userpic name={f.name} userpic={f.userpic} class={styles.userpic} />} {(f) => <Userpic name={f.name} userpic={f.userpic} class={styles.userpic} />}
@ -218,18 +217,9 @@ export const AuthorCard = (props: Props) => {
{t('SubscriberWithCount', { count: props.followers.length })} {t('SubscriberWithCount', { count: props.followers.length })}
</div> </div>
</a> </a>
</Match> </Show>
<Match when={props.followers && props.followers.length > 0 && props.isCurrentUser}>
<Button
variant="secondary"
onClick={() => redirectPage(router, 'profileSettings')}
value={t('Edit profile')}
/>
</Match>
</Switch>
<Switch> <Show when={props.following && props.following.length > 0}>
<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,23 +235,13 @@ export const AuthorCard = (props: Props) => {
{t('SubscriptionWithCount', { count: props?.following.length ?? 0 })} {t('SubscriptionWithCount', { count: props?.following.length ?? 0 })}
</div> </div>
</a> </a>
</Match> </Show>
<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>
<ShowOnlyOnClient> <ShowOnlyOnClient>
<Show when={isSessionLoaded() && props.author.links}> <Show when={isSessionLoaded()}>
<Show when={props.author.links && props.author.links.length}>
<div class={styles.authorSubscribeSocial}> <div class={styles.authorSubscribeSocial}>
<For each={props.author.links}> <For each={props.author.links}>
{(link) => ( {(link) => (
@ -278,6 +258,7 @@ export const AuthorCard = (props: Props) => {
)} )}
</For> </For>
</div> </div>
</Show>
<Show when={canFollow()}> <Show when={canFollow()}>
<div class={styles.authorSubscribe}> <div class={styles.authorSubscribe}>
<Show <Show
@ -362,6 +343,26 @@ export const AuthorCard = (props: Props) => {
</Show> </Show>
</div> </div>
</Show> </Show>
<Show when={props.isCurrentUser}>
<div class={styles.authorSubscribe}>
<Button
variant="secondary"
onClick={() => redirectPage(router, 'profileSettings')}
value={t('Edit profile')}
class={styles.button}
/>
<SharePopup
containerCssClass={styles.shareControl}
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> </Show>
</ShowOnlyOnClient> </ShowOnlyOnClient>
<Show when={props.followers}> <Show when={props.followers}>