import { createMemo, For, Show } from 'solid-js' import { Shout, Reaction, ReactionKind, Topic, Author } from '../../graphql/types.gen' import '../../styles/Feed.scss' import Icon from '../Nav/Icon' import { byCreated, sortBy } from '../../utils/sortby' import { TopicCard } from '../Topic/Card' import { ArticleCard } from '../Feed/Card' import { t } from '../../utils/intl' import { useStore } from '@nanostores/solid' import { session } from '../../stores/auth' import CommentCard from '../Article/Comment' import { loadMoreAll, useArticlesStore } from '../../stores/zine/articles' import { useReactionsStore } from '../../stores/zine/reactions' import { useAuthorsStore } from '../../stores/zine/authors' import { FeedSidebar } from '../Feed/Sidebar' import { useTopicsStore } from '../../stores/zine/topics' import { unique } from '../../utils' import { AuthorCard } from '../Author/Card' interface FeedProps { recentArticles: Shout[] reactions: Reaction[] } const AUTHORSHIP_REACTIONS = [ ReactionKind.Accept, ReactionKind.Reject, ReactionKind.Propose, ReactionKind.Ask ] export const FeedPage = (props: FeedProps) => { // state const { getSortedArticles: articles } = useArticlesStore({ sortedArticles: props.recentArticles }) const reactions = useReactionsStore(props.reactions) const { // getAuthorEntities: authorsBySlug, getSortedAuthors: authors } = useAuthorsStore() // test if it catches preloaded authors const auth = useStore(session) const topics = createMemo(() => { const ttt = [] articles().forEach((s: Shout) => s.topics.forEach((tpc: Topic) => ttt.push(tpc))) return unique(ttt) }) const { getSortedTopics } = useTopicsStore({ topics: topics() }) // derived const topReactions = createMemo(() => sortBy(reactions(), byCreated)) const topAuthors = createMemo(() => sortBy(authors(), 'shouts')) // note this became synthetic // methods const expectingFocus = createMemo(() => { // 1 co-author notifications needs // TODO: list of articles where you are co-author // TODO: preload proposals // TODO: (maybe?) and changes history console.debug(reactions().filter((r) => r.kind in AUTHORSHIP_REACTIONS)) // 2 community self-regulating mechanics // TODO: query all new posts to be rated for publishing // TODO: query all reactions where user is in authors list return [] }) return ( <>
0}> {(article) => }

{t('Popular authors')}

{t('All authors')}
    {(author: Author) => (
  • )}
{(article) => }

) }