Hide Featured headers when no events are surfaced

Regression-of: 9663b05e
This commit is contained in:
lemon
2026-05-28 12:55:13 -07:00
parent 73df1484b7
commit 749c325b91
2 changed files with 19 additions and 31 deletions
+10 -16
View File
@@ -288,7 +288,7 @@ export default function ActionsPage() {
.sort((a, b) => (pledgeModeration.featuredOrder.get(b) ?? 0) - (pledgeModeration.featuredOrder.get(a) ?? 0));
}, [pledgeModeration, pledgeModerationReady]);
const { data: featuredPledges, isLoading: featuredPledgesLoading } = useActions({
const { data: featuredPledges } = useActions({
coordinates: featuredPledgeCoords,
limit: featuredPledgeCoords.length || 1,
enabled: pledgeModerationReady,
@@ -424,7 +424,7 @@ export default function ActionsPage() {
</section>
)}
{(featuredPledgesLoading || orderedFeaturedPledges.length > 0) && (
{orderedFeaturedPledges.length > 0 && (
<section className="space-y-5">
<div>
<h2 className="text-2xl sm:text-3xl font-bold tracking-tight inline-flex items-center gap-2">
@@ -433,20 +433,14 @@ export default function ActionsPage() {
</h2>
<p className="text-sm text-muted-foreground mt-1">{t('pledges.list.featuredPledgesTagline')}</p>
</div>
{featuredPledgesLoading && orderedFeaturedPledges.length === 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5">
{Array.from({ length: 4 }).map((_, i) => <ActionSkeleton key={i} />)}
</div>
) : (
<ActionSection
items={visibleFeatured}
total={orderedFeaturedPledges.length}
visible={DEFAULT_VISIBLE}
showAll={showAllFeatured}
onToggle={() => setShowAllFeatured(!showAllFeatured)}
btcPrice={btcPrice}
/>
)}
<ActionSection
items={visibleFeatured}
total={orderedFeaturedPledges.length}
visible={DEFAULT_VISIBLE}
showAll={showAllFeatured}
onToggle={() => setShowAllFeatured(!showAllFeatured)}
btcPrice={btcPrice}
/>
</section>
)}
+9 -15
View File
@@ -137,7 +137,7 @@ export function AllCampaignsPage() {
.sort((a, b) => (moderation.featuredOrder.get(b) ?? 0) - (moderation.featuredOrder.get(a) ?? 0));
}, [moderation, moderationReady]);
const { data: featuredCampaigns, isLoading: featuredLoading } = useCampaigns({
const { data: featuredCampaigns } = useCampaigns({
coordinates: featuredCoords,
limit: featuredCoords.length || 1,
enabled: moderationReady,
@@ -211,7 +211,7 @@ export function AllCampaignsPage() {
</section>
)}
{(featuredLoading || orderedFeaturedCampaigns.length > 0) && (
{orderedFeaturedCampaigns.length > 0 && (
<section className="space-y-5">
<div>
<h2 className="text-2xl sm:text-3xl font-bold tracking-tight">
@@ -221,19 +221,13 @@ export function AllCampaignsPage() {
{t('campaigns.home.featuredDesc', { appName: config.appName })}
</p>
</div>
{featuredLoading && orderedFeaturedCampaigns.length === 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5">
{Array.from({ length: 4 }).map((_, i) => <CampaignCardSkeleton key={i} />)}
</div>
) : (
<CampaignSection
campaigns={visibleFeatured}
total={orderedFeaturedCampaigns.length}
visible={DEFAULT_VISIBLE}
showAll={showAllFeatured}
onToggle={() => setShowAllFeatured(!showAllFeatured)}
/>
)}
<CampaignSection
campaigns={visibleFeatured}
total={orderedFeaturedCampaigns.length}
visible={DEFAULT_VISIBLE}
showAll={showAllFeatured}
onToggle={() => setShowAllFeatured(!showAllFeatured)}
/>
</section>
)}