Author page fixes

This commit is contained in:
kvakazyambra 2023-09-03 01:14:34 +03:00
parent 50baf5b60f
commit b71c6a7515
4 changed files with 256 additions and 199 deletions

View File

@ -14,9 +14,12 @@
} }
.authorDetails { .authorDetails {
flex: 1;
@include media-breakpoint-up(sm) {
align-items: baseline; align-items: baseline;
display: flex; display: flex;
flex: 1; }
&.authorDetailsShrinked { &.authorDetailsShrinked {
flex: 0 0 auto; flex: 0 0 auto;
@ -62,7 +65,7 @@
.authorAbout { .authorAbout {
color: rgb(0 0 0 / 60%); color: rgb(0 0 0 / 60%);
font-size: 1.5rem; font-size: 1.4rem;
line-height: 1.4; line-height: 1.4;
word-break: break-word; word-break: break-word;
} }
@ -442,11 +445,19 @@
} }
} }
.subscribersContainer {
display: flex;
flex-wrap: wrap;
font-size: 1.4rem;
margin-top: 1em;
}
.subscribers { .subscribers {
align-items: center;
cursor: pointer; cursor: pointer;
display: inline-flex; display: inline-flex;
margin-right: 3rem;
vertical-align: top; vertical-align: top;
align-items: center;
.userpic { .userpic {
background: var(--background-color); background: var(--background-color);
@ -459,7 +470,12 @@
} }
} }
.listWrapper { .subscribersCounter {
overflow: auto; margin-left: -0.6rem;
max-height: 70vh; }
.listWrapper {
max-height: 70vh;
overflow: auto;
padding-right: 2rem;
} }

View File

@ -39,6 +39,7 @@ type AuthorCardProps = {
class?: string class?: string
followers?: Author[] followers?: Author[]
subscriptions?: Array<Author | Topic> subscriptions?: Array<Author | Topic>
showPublicationsCounter?: boolean
} }
function isAuthor(value: Author | Topic): value is Author { function isAuthor(value: Author | Topic): value is Author {
@ -115,6 +116,7 @@ export const AuthorCard = (props: AuthorCardProps) => {
}) })
return ( return (
<>
<div <div
class={clsx(styles.author, props.class)} class={clsx(styles.author, props.class)}
classList={{ classList={{
@ -174,7 +176,16 @@ export const AuthorCard = (props: AuthorCardProps) => {
</ConditionalWrapper> </ConditionalWrapper>
</div> </div>
{/*TODO: implement plurals by i18n*/} {/*TODO: implement plurals by i18n*/}
<Show when={props.author.bio} fallback={<div>{props.author.stat?.shouts} публикаций</div>}> <Show
when={props.author.bio}
fallback={
props.showPublicationsCounter ? (
<div class={styles.authorAbout}>{props.author.stat?.shouts} публикаций</div>
) : (
''
)
}
>
<div <div
class={styles.authorAbout} class={styles.authorAbout}
classList={{ 'text-truncate': props.truncateBio }} classList={{ 'text-truncate': props.truncateBio }}
@ -182,12 +193,19 @@ export const AuthorCard = (props: AuthorCardProps) => {
/> />
</Show> </Show>
<Show
when={
(props.followers && props.followers.length > 0) ||
(props.subscriptions && props.subscriptions.length > 0)
}
>
<div class={styles.subscribersContainer}>
<Show when={props.followers && props.followers.length > 0}> <Show when={props.followers && props.followers.length > 0}>
<div class={styles.subscribers} onClick={() => showModal('followers')}> <div class={styles.subscribers} onClick={() => showModal('followers')}>
<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} />}
</For> </For>
<div> <div class={styles.subscribersCounter}>
{props.followers.length}&nbsp; {props.followers.length}&nbsp;
{getNumeralsDeclension(props.followers.length, [ {getNumeralsDeclension(props.followers.length, [
t('subscriber'), t('subscriber'),
@ -198,7 +216,6 @@ export const AuthorCard = (props: AuthorCardProps) => {
</div> </div>
</Show> </Show>
<Show when={props.subscriptions && props.subscriptions.length > 0}> <Show when={props.subscriptions && props.subscriptions.length > 0}>
<div>
<div class={styles.subscribers} onClick={() => showModal('subscriptions')}> <div class={styles.subscribers} onClick={() => showModal('subscriptions')}>
<For each={props.subscriptions.slice(0, 3)}> <For each={props.subscriptions.slice(0, 3)}>
{(f) => { {(f) => {
@ -210,7 +227,7 @@ export const AuthorCard = (props: AuthorCardProps) => {
return null return null
}} }}
</For> </For>
<div> <div class={styles.subscribersCounter}>
{props.subscriptions.length}&nbsp; {props.subscriptions.length}&nbsp;
{getNumeralsDeclension(props.subscriptions.length, [ {getNumeralsDeclension(props.subscriptions.length, [
t('subscription'), t('subscription'),
@ -219,6 +236,7 @@ export const AuthorCard = (props: AuthorCardProps) => {
])} ])}
</div> </div>
</div> </div>
</Show>
</div> </div>
</Show> </Show>
</div> </div>
@ -318,24 +336,35 @@ export const AuthorCard = (props: AuthorCardProps) => {
</Show> </Show>
</ShowOnlyOnClient> </ShowOnlyOnClient>
</div> </div>
</div>
<Show when={props.followers}> <Show when={props.followers}>
<Modal variant="wide" name="followers"> <Modal variant="wide" name="followers">
<> <>
<h2>{t('Followers')}</h2> <h2>{t('Followers')}</h2>
<div class={styles.listWrapper}> <div class={styles.listWrapper}>
<div class="row"> <div class="row">
<div class="col-24">
<For each={props.followers}> <For each={props.followers}>
{(follower: Author) => ( {(follower: Author) => (
<div class="col-xs-12"> <AuthorCard
<AuthorCard author={follower} hideWriteButton={true} hasLink={true} /> author={follower}
</div> hideWriteButton={true}
hasLink={true}
isTextButton={true}
liteButtons={true}
truncateBio={true}
showPublicationsCounter={true}
/>
)} )}
</For> </For>
</div> </div>
</div> </div>
</div>
</> </>
</Modal> </Modal>
</Show> </Show>
<Show when={props.subscriptions}> <Show when={props.subscriptions}>
<Modal variant="wide" name="subscriptions"> <Modal variant="wide" name="subscriptions">
<> <>
@ -357,29 +386,32 @@ export const AuthorCard = (props: AuthorCardProps) => {
</button> </button>
</li> </li>
</ul> </ul>
<br />
<div class={styles.listWrapper}> <div class={styles.listWrapper}>
<div class="row"> <div class="row">
<div class="col-24">
<For each={subscriptions()}> <For each={subscriptions()}>
{(subscription: Author | Topic) => ( {(subscription: Author | Topic) =>
<div class="col-xs-12"> isAuthor(subscription) ? (
{isAuthor(subscription) ? (
<AuthorCard <AuthorCard
author={subscription} author={subscription}
hideWriteButton={true} hideWriteButton={true}
hasLink={true} hasLink={true}
isTextButton={true} isTextButton={true}
truncateBio={true}
showPublicationsCounter={true}
/> />
) : ( ) : (
<TopicCard compact isTopicInRow showDescription topic={subscription} /> <TopicCard compact isTopicInRow showDescription isCardMode topic={subscription} />
)} )
</div> }
)}
</For> </For>
</div> </div>
</div> </div>
</div>
</> </>
</Modal> </Modal>
</Show> </Show>
</div> </>
) )
} }

View File

@ -398,8 +398,10 @@
padding: 0 2.4rem; padding: 0 2.4rem;
width: 100%; width: 100%;
@include media-breakpoint-down(sm) { @include media-breakpoint-down(xl) {
padding-top: 100%; aspect-ratio: auto;
height: 100%;
padding-top: 30%;
} }
&.swiper-slide { &.swiper-slide {
@ -450,6 +452,12 @@
justify-content: end; justify-content: end;
padding: 2.4rem; padding: 2.4rem;
z-index: 1; z-index: 1;
@include media-breakpoint-down(xl) {
padding-left: 0;
padding-right: 0;
position: relative;
}
} }
.shoutCardCover { .shoutCardCover {

View File

@ -19,6 +19,7 @@
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 0;
button { button {
margin-top: 0; margin-top: 0;