refactori
This commit is contained in:
parent
fc2d956349
commit
e11916298e
|
@ -26,7 +26,7 @@ export const markdownOptions: AstroUserConfig['markdown'] = {
|
|||
remarkPlugins: [remarkCodeTitles],
|
||||
rehypePlugins: [
|
||||
rehypeSlug,
|
||||
[rehypeToc as RehypePlugin<any[]>, { headings: ['h1', 'h2', 'h3'] }],
|
||||
[rehypeToc as RehypePlugin<any>, { headings: ['h1', 'h2', 'h3'] }],
|
||||
[rehypeAutolinkHeadings, { behavior: 'prepend' }],
|
||||
[addClasses, { 'h1,h2,h3': 'title' }]
|
||||
],
|
||||
|
|
|
@ -63,8 +63,8 @@ export const FeedSidebar = (props: FeedSidebarProps) => {
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<For each={session()?.info?.authors}>
|
||||
{(authorSlug) => (
|
||||
<For each={session()?.news?.authors}>
|
||||
{(authorSlug: string) => (
|
||||
<li>
|
||||
<a href={`/author/${authorSlug}`} classList={{ unread: checkAuthorIsSeen(authorSlug) }}>
|
||||
<small>@{authorSlug}</small>
|
||||
|
@ -74,8 +74,8 @@ export const FeedSidebar = (props: FeedSidebarProps) => {
|
|||
)}
|
||||
</For>
|
||||
|
||||
<For each={session()?.info?.topics}>
|
||||
{(topicSlug) => (
|
||||
<For each={session()?.news?.topics}>
|
||||
{(topicSlug: string) => (
|
||||
<li>
|
||||
<a href={`/author/${topicSlug}`} classList={{ unread: checkTopicIsSeen(topicSlug) }}>
|
||||
{topicEntities()[topicSlug]?.title}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default () => {
|
|||
<a href="/inbox">
|
||||
{/*FIXME: replace with route*/}
|
||||
<div classList={{ entered: getPage().path === '/inbox' }}>
|
||||
<Icon name="inbox-white" counter={session().info?.unread || 0} />
|
||||
<Icon name="inbox-white" counter={session()?.news?.unread || 0} />
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -24,11 +24,11 @@ export const TopicCard = (props: TopicProps) => {
|
|||
const { session } = useAuthStore()
|
||||
|
||||
const subscribed = createMemo(() => {
|
||||
if (!session()?.user?.slug || !session()?.info?.topics) {
|
||||
if (!session()?.user?.slug || !session()?.news?.topics) {
|
||||
return false
|
||||
}
|
||||
|
||||
return props.topic.slug in session().info.topics
|
||||
return session()?.news.topics.includes(props.topic.slug)
|
||||
})
|
||||
|
||||
// FIXME use store actions
|
||||
|
|
|
@ -14,7 +14,7 @@ type Props = {
|
|||
export const FullTopic = (props: Props) => {
|
||||
const { session } = useAuthStore()
|
||||
|
||||
const subscribed = createMemo(() => session()?.info?.topics?.includes(props.topic?.slug))
|
||||
const subscribed = createMemo(() => session()?.news?.topics?.includes(props.topic?.slug))
|
||||
return (
|
||||
<div class="topic-full container">
|
||||
<div class="row">
|
||||
|
|
|
@ -26,7 +26,7 @@ export const AllAuthorsView = (props: Props) => {
|
|||
|
||||
const { session } = useAuthStore()
|
||||
|
||||
const subscribed = (s) => Boolean(session()?.info?.authors && session()?.info?.authors?.includes(s || ''))
|
||||
const subscribed = (s) => Boolean(session()?.news?.authors && session()?.news?.authors?.includes(s || ''))
|
||||
|
||||
const { getSearchParams } = useRouter<AllAuthorsPageSearchParams>()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
|||
setSortAllTopicsBy(getSearchParams().by || 'shouts')
|
||||
})
|
||||
|
||||
const subscribed = (s) => Boolean(session()?.info?.topics && session()?.info?.topics?.includes(s || ''))
|
||||
const subscribed = (s) => Boolean(session()?.news?.topics && session()?.news?.topics?.includes(s || ''))
|
||||
|
||||
return (
|
||||
<div class="all-topics-page">
|
||||
|
|
|
@ -13,7 +13,8 @@ export default gql`
|
|||
userpic
|
||||
links
|
||||
}
|
||||
info {
|
||||
news {
|
||||
unread
|
||||
inbox
|
||||
topics
|
||||
authors
|
||||
|
|
|
@ -16,7 +16,7 @@ export type Scalars = {
|
|||
|
||||
export type AuthResult = {
|
||||
error?: Maybe<Scalars['String']>
|
||||
info?: Maybe<SessionInfo>
|
||||
news?: Maybe<UserFollowings>
|
||||
token?: Maybe<Scalars['String']>
|
||||
user?: Maybe<User>
|
||||
}
|
||||
|
@ -638,14 +638,6 @@ export type Role = {
|
|||
permissions: Array<Permission>
|
||||
}
|
||||
|
||||
export type SessionInfo = {
|
||||
authors?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
communities?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
reactions?: Maybe<Array<Maybe<Scalars['Int']>>>
|
||||
topics?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
unread?: Maybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type Shout = {
|
||||
authors?: Maybe<Array<Maybe<Author>>>
|
||||
body: Scalars['String']
|
||||
|
@ -773,6 +765,14 @@ export type User = {
|
|||
wasOnlineAt?: Maybe<Scalars['DateTime']>
|
||||
}
|
||||
|
||||
export type UserFollowings = {
|
||||
authors?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
communities?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
reactions?: Maybe<Array<Maybe<Scalars['Int']>>>
|
||||
topics?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||
unread?: Maybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type UserNotification = {
|
||||
id: Scalars['Int']
|
||||
kind: Scalars['String']
|
||||
|
|
Loading…
Reference in New Issue
Block a user