series building
This commit is contained in:
parent
05382f34ab
commit
16560e0b52
@ -12,6 +12,7 @@ interface ArticlesListProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function LoadingState() {
|
function LoadingState() {
|
||||||
|
// Use generic loading message at startup, then specific message once we know what we're loading
|
||||||
return (
|
return (
|
||||||
<div className="text-center py-12">
|
<div className="text-center py-12">
|
||||||
<p className="text-cyber-accent/70">{t('common.loading.articles')}</p>
|
<p className="text-cyber-accent/70">{t('common.loading.articles')}</p>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { PageHeader } from '@/components/PageHeader'
|
|||||||
import { Footer } from '@/components/Footer'
|
import { Footer } from '@/components/Footer'
|
||||||
import { FundingGauge } from '@/components/FundingGauge'
|
import { FundingGauge } from '@/components/FundingGauge'
|
||||||
import type { Dispatch, SetStateAction } from 'react'
|
import type { Dispatch, SetStateAction } from 'react'
|
||||||
|
import { t } from '@/lib/i18n'
|
||||||
|
|
||||||
interface HomeViewProps {
|
interface HomeViewProps {
|
||||||
searchQuery: string
|
searchQuery: string
|
||||||
@ -97,12 +98,19 @@ function HomeContent({
|
|||||||
}: HomeViewProps) {
|
}: HomeViewProps) {
|
||||||
const shouldShowFilters = !loading && allArticles.length > 0
|
const shouldShowFilters = !loading && allArticles.length > 0
|
||||||
const shouldShowAuthors = selectedCategory !== null && selectedCategory !== 'all'
|
const shouldShowAuthors = selectedCategory !== null && selectedCategory !== 'all'
|
||||||
const articlesListProps = { articles, allArticles, loading, error, onUnlock, unlockedArticles }
|
|
||||||
const authorsListProps = { authors, allAuthors, loading, error }
|
|
||||||
|
|
||||||
// Determine loading state: if showing authors, authors are loaded from articles, so loading is the same
|
// At startup, we don't know yet if we're loading articles or authors
|
||||||
// But we need to check if authors are actually being loaded (when no articles yet)
|
// Use a generic loading message until we have content
|
||||||
const authorsLoading = loading && shouldShowAuthors && allAuthors.length === 0
|
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 (
|
return (
|
||||||
<div className="max-w-4xl mx-auto px-4 py-8">
|
<div className="max-w-4xl mx-auto px-4 py-8">
|
||||||
@ -117,10 +125,14 @@ function HomeContent({
|
|||||||
<ArticleFiltersComponent filters={filters} onFiltersChange={setFilters} articles={allArticles} />
|
<ArticleFiltersComponent filters={filters} onFiltersChange={setFilters} articles={allArticles} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{shouldShowAuthors ? (
|
{isInitialLoad ? (
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<p className="text-cyber-accent/70">{t('common.loading')}</p>
|
||||||
|
</div>
|
||||||
|
) : shouldShowAuthors ? (
|
||||||
<AuthorsList {...authorsListProps} />
|
<AuthorsList {...authorsListProps} />
|
||||||
) : (
|
) : (
|
||||||
<ArticlesList {...articlesListProps} />
|
<ArticlesList {...articlesListProps} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<HomeIntroSection />
|
<HomeIntroSection />
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import Link from 'next/link'
|
||||||
import { useNostrAuth } from '@/hooks/useNostrAuth'
|
import { useNostrAuth } from '@/hooks/useNostrAuth'
|
||||||
|
|
||||||
export function KeyIndicator() {
|
export function KeyIndicator() {
|
||||||
@ -6,18 +7,16 @@ export function KeyIndicator() {
|
|||||||
// Red if private key is accessible (unlocked)
|
// Red if private key is accessible (unlocked)
|
||||||
// Green if only public key is accessible (connected but not unlocked)
|
// Green if only public key is accessible (connected but not unlocked)
|
||||||
const color = isUnlocked ? 'text-red-500' : 'text-green-500'
|
const color = isUnlocked ? 'text-red-500' : 'text-green-500'
|
||||||
const title = isUnlocked ? 'Private key accessible' : pubkey ? 'Public key accessible' : 'Repository Git'
|
const title = isUnlocked ? 'Private key accessible (Settings)' : pubkey ? 'Public key accessible (Settings)' : 'Settings'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<Link
|
||||||
href="https://git.4nkweb.com/4nk/story-research-zapwall"
|
href="/settings"
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className={`ml-2 text-xl ${color} hover:opacity-80 transition-opacity cursor-pointer`}
|
className={`ml-2 text-xl ${color} hover:opacity-80 transition-opacity cursor-pointer`}
|
||||||
title={title}
|
title={title}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
🔑
|
🔑
|
||||||
</a>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user