From c65b8ff1b969b714f07ca023d550e4ff6b00f3e0 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Sun, 12 Oct 2025 18:54:31 -0500 Subject: [PATCH] Remove showcase header, search bar, and tag filters - Remove "Community Showcase" title and subtitle - Remove search bar functionality - Remove tag filtering UI and logic - Simplify component to show all apps without filters - Keep section headers for Featured Apps, Halloween Hackathon, All Apps, and Templates - Maintain collapsible "All Apps" section - Clean up unused imports and state variables --- src/components/AppShowcase.tsx | 416 +++++++++------------------------ 1 file changed, 105 insertions(+), 311 deletions(-) diff --git a/src/components/AppShowcase.tsx b/src/components/AppShowcase.tsx index a3eb858c..a2a6e75b 100644 --- a/src/components/AppShowcase.tsx +++ b/src/components/AppShowcase.tsx @@ -1,12 +1,10 @@ -import React, { useState, useMemo, useEffect } from "react"; -import { Plus, Search, Filter, Eye, EyeOff } from "lucide-react"; +import React, { useState, useMemo } from "react"; +import { Search } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; -import { Input } from "@/components/ui/input"; import { useCurrentUser } from "@/hooks/useCurrentUser"; import { useAppSubmissions } from "@/hooks/useAppSubmissions"; import { AppShowcaseCard } from "@/components/AppShowcaseCard"; -import { useIsMobile } from "@/hooks/useIsMobile"; import { Collapsible, CollapsibleContent, @@ -22,11 +20,7 @@ import { RelaySelector } from "@/components/RelaySelector"; export function AppShowcase() { const { user } = useCurrentUser(); const { data: submissions = [], isLoading } = useAppSubmissions(); - const isMobile = useIsMobile(); - const [searchTerm, setSearchTerm] = useState(""); - const [selectedTag, setSelectedTag] = useState(null); const [showAllApps, setShowAllApps] = useState(false); - const [showAllTags, setShowAllTags] = useState(false); const MODERATOR_NPUB = 'npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc'; const MODERATOR_HEX = (() => { @@ -72,74 +66,10 @@ export function AppShowcase() { [nonHalloweenSubmissions] ); - // Apply search and tag filters - const filterApps = (apps: AppSubmission[]) => { - return apps.filter(app => { - const matchesSearch = !searchTerm || - app.appName.toLowerCase().includes(searchTerm.toLowerCase()) || - app.description.toLowerCase().includes(searchTerm.toLowerCase()) || - app.appTags.some(tag => tag.toLowerCase().includes(searchTerm.toLowerCase())); - - const matchesTag = !selectedTag || app.appTags.includes(selectedTag); - - return matchesSearch && matchesTag; - }); - }; - - const filteredFeaturedApps = filterApps(featuredApps); - const filteredHalloweenApps = filterApps(halloweenApps); - const filteredApprovedApps = filterApps(approvedApps); - const filteredTemplateApps = filterApps(templateApps); - - // Get all unique tags from approved and featured apps only (exclude pending, hidden, and template apps) - const allTags = Array.from(new Set([...featuredApps, ...approvedApps].flatMap(app => app.appTags))).sort(); - - // Get the most popular tags based on frequency (excluding Halloween Hackathon 2025 tag) - const tagCounts = new Map(); - [...featuredApps, ...approvedApps, ...templateApps].forEach(app => { - app.appTags.forEach(tag => { - // Don't include Halloween Hackathon 2025 in the tag filters - if (tag !== 'Halloween Hackathon 2025') { - tagCounts.set(tag, (tagCounts.get(tag) || 0) + 1); - } - }); - }); - - const sortedTags = Array.from(tagCounts.entries()) - .sort((a, b) => b[1] - a[1]) // Sort by count descending - .map(([tag]) => tag); // Extract just the tag names - - // Always show Template as the first tag if templates exist - const topTags: string[] = []; - if (templateApps.length > 0) { - topTags.push('Template'); - // Remove Template from sortedTags to avoid duplication - const templateIndex = sortedTags.indexOf('Template'); - if (templateIndex > -1) { - sortedTags.splice(templateIndex, 1); - } - } - - // Show fewer tags on mobile, more on desktop - const maxTagsToShow = isMobile ? 3 : 5; - const availableSlots = maxTagsToShow - topTags.length; - const popularTags = [...topTags, ...sortedTags.slice(0, availableSlots)]; - const remainingTags = sortedTags.slice(availableSlots); - - const handleTagSelect = (tag: string | null) => { - setSelectedTag(tag); - }; - // Don't show showcase if no apps exist if (isLoading) { return (
-
-

Community Showcase

-

- Discover amazing applications built by our community -

-
{Array.from({ length: 6 }).map((_, i) => ( @@ -176,12 +106,6 @@ export function AppShowcase() { if (!submissions.length) { return (
-
-

Community Showcase

-

- Discover amazing applications built by our community -

-
@@ -198,247 +122,117 @@ export function AppShowcase() { return (
- {/* Header */} -
-

Community Showcase

-

- Discover amazing applications built by our community -

- - {/* Search and Filter */} -
-
- - setSearchTerm(e.target.value)} - className="pl-10" - /> -
- - {/* Tag Filters */} -
-
- - {popularTags.map((tag) => ( - - ))} - - {/* Show More Tags Button */} - {remainingTags.length > 0 && ( - - )} -
- - {/* Additional Tags (Collapsible) */} - {showAllTags && remainingTags.length > 0 && ( -
- {remainingTags.map((tag) => ( - - ))} -
- )} -
-
-
- {/* Apps Grid */}
- {/* When Template tag is selected, show only Templates */} - {selectedTag === 'Template' ? ( - <> - {/* Templates Section */} - {filteredTemplateApps.length > 0 && ( -
-
-
- 📋 -
-
-

Templates

-

Ready-to-use templates to kickstart your project

-
-
-
- {filteredTemplateApps.slice(0, 6).map((app) => ( - - ))} -
+ {/* Featured Apps */} + {featuredApps.length > 0 && ( +
+
+
+ ⭐
- )} - - ) : ( - <> - {/* Featured Apps */} - {filteredFeaturedApps.length > 0 && (
-
-
- ⭐ -
-
-

Featured Apps

-

Handpicked applications showcasing the best of our community

-
-
-
- {filteredFeaturedApps.slice(0, 6).map((app) => ( - - ))} -
+

Featured Apps

+

Handpicked applications showcasing the best of our community

- )} - - {/* Halloween Hackathon 2025 Apps */} - {filteredHalloweenApps.length > 0 && ( -
-
-
- 🎃 -
-
-

Halloween Hackathon 2025

-

Featured spooky creations from our Halloween hackathon

-
-
-
- {filteredHalloweenApps.slice(0, 6).map((app) => ( - - ))} -
-
- )} - - {/* All Apps (Approved) - Collapsible */} - {filteredApprovedApps.length > 0 && ( -
- - - - - -
- {filteredApprovedApps.map((app) => ( - - ))} -
-
-
-
- )} - - {/* Templates Section */} - {filteredTemplateApps.length > 0 && ( -
-
-
- 📋 -
-
-

Templates

-

Ready-to-use templates to kickstart your project

-
-
-
- {filteredTemplateApps.slice(0, 6).map((app) => ( - - ))} -
-
- )} - +
+
+ {featuredApps.slice(0, 6).map((app) => ( + + ))} +
+
)} - {/* Empty State */} - {(() => { - if (selectedTag === 'Template') { - return filteredTemplateApps.length === 0; - } - return filteredFeaturedApps.length === 0 && filteredHalloweenApps.length === 0 && filteredApprovedApps.length === 0 && filteredTemplateApps.length === 0; - })() && ( -
-
- + {/* Halloween Hackathon 2025 Apps */} + {halloweenApps.length > 0 && ( +
+
+
+ 🎃 +
+
+

Halloween Hackathon 2025

+

Featured spooky creations from our Halloween hackathon

+
+
+
+ {halloweenApps.slice(0, 6).map((app) => ( + + ))} +
+
+ )} + + {/* All Apps (Approved) - Collapsible */} + {approvedApps.length > 0 && ( +
+ + + + + +
+ {approvedApps.map((app) => ( + + ))} +
+
+
+
+ )} + + {/* Templates Section */} + {templateApps.length > 0 && ( +
+
+
+ 📋 +
+
+

Templates

+

Ready-to-use templates to kickstart your project

+
+
+
+ {templateApps.slice(0, 6).map((app) => ( + + ))}
-

- {selectedTag === 'Template' ? 'No templates found' : 'No apps found'} -

-

- {searchTerm || selectedTag - ? "Try adjusting your search or filters" - : "Be the first to submit an app to the showcase!" - } -

)}