Feature/update topic badge (#250)
* update TopicBadge view * Shouts and comments count in profile page
This commit is contained in:
parent
b6252838a1
commit
f85a3e84fe
|
@ -39,18 +39,12 @@
|
||||||
.title {
|
.title {
|
||||||
color: var(--blue-500);
|
color: var(--blue-500);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.description {
|
||||||
color: var(--black-400);
|
color: var(--black-400);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
flex-direction: row;
|
|
||||||
color: var(--default-color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
|
|
|
@ -51,27 +51,17 @@ export const TopicBadge = (props: Props) => {
|
||||||
style={props.topic.pic && { 'background-image': `url('${imageProxy(props.topic.pic)}')` }}
|
style={props.topic.pic && { 'background-image': `url('${imageProxy(props.topic.pic)}')` }}
|
||||||
/>
|
/>
|
||||||
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
||||||
<span class={styles.title}>{capitalize(props.topic.title)}</span>
|
<span class={styles.title}>{props.topic.title}</span>
|
||||||
<Show when={props.topic.body}>
|
<Show
|
||||||
|
when={props.topic.body}
|
||||||
|
fallback={
|
||||||
|
<div class={styles.description}>
|
||||||
|
{props.topic.stat.shouts ?? 0} {t('Publications')}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div>
|
<div class={clsx('text-truncate', styles.description)}>{props.topic.body}</div>
|
||||||
</Show>
|
</Show>
|
||||||
<span class={styles.stat}>
|
|
||||||
<Show when={props.topic.stat.authors}>
|
|
||||||
<div>
|
|
||||||
{t('Authors')}: {props.topic.stat.authors}
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
<Show when={props.topic.stat.followers}>
|
|
||||||
<div>
|
|
||||||
{t('Followers')}: {props.topic.stat.followers}
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
<Show when={props.topic.stat.shouts}>
|
|
||||||
<div>
|
|
||||||
{t('Publications')}: {props.topic.stat.shouts}
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
<Show when={isAuthenticated()}>
|
<Show when={isAuthenticated()}>
|
||||||
<div class={styles.actions}>
|
<div class={styles.actions}>
|
||||||
|
|
|
@ -36,6 +36,7 @@ export const AuthorView = (props: Props) => {
|
||||||
const { page } = useRouter()
|
const { page } = useRouter()
|
||||||
const author = createMemo(() => authorEntities()[props.authorSlug])
|
const author = createMemo(() => authorEntities()[props.authorSlug])
|
||||||
|
|
||||||
|
console.log('!!! author:', author())
|
||||||
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[]>([])
|
||||||
|
@ -139,11 +140,13 @@ export const AuthorView = (props: Props) => {
|
||||||
<div class="col-md-16">
|
<div class="col-md-16">
|
||||||
<ul class="view-switcher">
|
<ul class="view-switcher">
|
||||||
<li classList={{ 'view-switcher__item--selected': page().route === 'author' }}>
|
<li classList={{ 'view-switcher__item--selected': page().route === 'author' }}>
|
||||||
<a href={getPagePath(router, 'author', { slug: props.authorSlug })}>{t('Publications')}</a>
|
<a href={getPagePath(router, 'author', { slug: props.authorSlug })}>
|
||||||
|
{t('Publications')} ({author().stat.shouts})
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li classList={{ 'view-switcher__item--selected': page().route === 'authorComments' }}>
|
<li classList={{ 'view-switcher__item--selected': page().route === 'authorComments' }}>
|
||||||
<a href={getPagePath(router, 'authorComments', { slug: props.authorSlug })}>
|
<a href={getPagePath(router, 'authorComments', { slug: props.authorSlug })}>
|
||||||
{t('Comments')}
|
{t('Comments')} ({author().stat.commented})
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li classList={{ 'view-switcher__item--selected': page().route === 'authorAbout' }}>
|
<li classList={{ 'view-switcher__item--selected': page().route === 'authorAbout' }}>
|
||||||
|
|
|
@ -9,14 +9,17 @@ export default gql`
|
||||||
bio
|
bio
|
||||||
about
|
about
|
||||||
userpic
|
userpic
|
||||||
communities
|
# communities
|
||||||
links
|
links
|
||||||
createdAt
|
createdAt
|
||||||
lastSeen
|
lastSeen
|
||||||
# ratings {
|
stat {
|
||||||
# rater
|
shouts
|
||||||
# value
|
followers
|
||||||
# }
|
followings
|
||||||
|
rating
|
||||||
|
commented
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
|
@ -318,7 +318,7 @@ export type ProfileInput = {
|
||||||
|
|
||||||
export type Query = {
|
export type Query = {
|
||||||
authorsAll: Array<Maybe<Author>>
|
authorsAll: Array<Maybe<Author>>
|
||||||
getAuthor?: Maybe<User>
|
getAuthor?: Maybe<Author>
|
||||||
getTopic?: Maybe<Topic>
|
getTopic?: Maybe<Topic>
|
||||||
isEmailUsed: Scalars['Boolean']
|
isEmailUsed: Scalars['Boolean']
|
||||||
loadAuthorsBy: Array<Maybe<Author>>
|
loadAuthorsBy: Array<Maybe<Author>>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user