import Head from 'next/head' import type { Article } from '@/types/nostr' import { ArticleFiltersComponent, type ArticleFilters } from '@/components/ArticleFilters' import { CategoryTabs } from '@/components/CategoryTabs' import { SearchBar } from '@/components/SearchBar' import { ArticlesList } from '@/components/ArticlesList' import { AuthorsList } from '@/components/AuthorsList' import { PageHeader } from '@/components/PageHeader' import { Footer } from '@/components/Footer' import type { Dispatch, SetStateAction } from 'react' import { t } from '@/lib/i18n' interface HomeViewProps { searchQuery: string setSearchQuery: Dispatch> selectedCategory: ArticleFilters['category'] setSelectedCategory: Dispatch> filters: ArticleFilters setFilters: Dispatch> articles: Article[] allArticles: Article[] authors: Article[] allAuthors: Article[] loading: boolean error: string | null onUnlock: (article: Article) => void unlockedArticles: Set } function HomeHead(): React.ReactElement { return ( zapwall.fr ) } function ArticlesHero({ searchQuery, setSearchQuery, selectedCategory, setSelectedCategory, }: Pick): React.ReactElement { return (
) } function HomeContent({ searchQuery, setSearchQuery, selectedCategory, setSelectedCategory, filters, setFilters, articles, allArticles, authors, allAuthors, loading, error, onUnlock, unlockedArticles, }: HomeViewProps): React.ReactElement { const shouldShowFilters = !loading && allArticles.length > 0 const shouldShowAuthors = selectedCategory !== null && selectedCategory !== 'all' // At startup, we don't know yet if we're loading articles or authors // Use a generic loading message until we have content const isInitialLoad = loading && allArticles.length === 0 && allAuthors.length === 0 const articlesListProps = { articles, allArticles, loading: loading && !isInitialLoad, // Don't show loading if it's the initial generic state error, onUnlock, unlockedArticles } const authorsListProps = { authors, allAuthors, loading: loading && !isInitialLoad, error } return (
{shouldShowFilters && !shouldShowAuthors && ( )} {isInitialLoad ? (

{t('common.loading')}

) : shouldShowAuthors ? ( ) : ( )}
) } export function HomeView(props: HomeViewProps): React.ReactElement { return ( <>
) }