From 6589836336e5843d721e30b26a698ced77ceacfb Mon Sep 17 00:00:00 2001 From: Chris Veleris Date: Sun, 12 Oct 2025 08:38:00 +0300 Subject: [PATCH] Fix tags badge inconsistency --- .../components/Project/ProjectDetails.tsx | 132 +++++++----------- frontend/components/Shared/BannerBadge.tsx | 15 ++ 2 files changed, 69 insertions(+), 78 deletions(-) create mode 100644 frontend/components/Shared/BannerBadge.tsx diff --git a/frontend/components/Project/ProjectDetails.tsx b/frontend/components/Project/ProjectDetails.tsx index 87f50bb..0a3909b 100644 --- a/frontend/components/Project/ProjectDetails.tsx +++ b/frontend/components/Project/ProjectDetails.tsx @@ -47,7 +47,7 @@ import AutoSuggestNextActionBox from './AutoSuggestNextActionBox'; import SortFilterButton, { SortOption } from '../Shared/SortFilterButton'; import LoadingSpinner from '../Shared/LoadingSpinner'; import { usePersistedModal } from '../../hooks/usePersistedModal'; -import { getCurrentUser } from '../../utils/userUtils'; +import BannerBadge from '../Shared/BannerBadge'; const ProjectDetails: React.FC = () => { const { uidSlug } = useParams<{ uidSlug: string }>(); @@ -83,15 +83,6 @@ const ProjectDetails: React.FC = () => { const [isConfirmDialogOpen, setIsConfirmDialogOpen] = useState(false); - // Check if current user is the owner - const currentUser = getCurrentUser(); - const isOwner = useMemo(() => { - return ( - currentUser && - project && - (project as any).user_uid === currentUser.uid - ); - }, [currentUser, project]); const [showCompleted, setShowCompleted] = useState(false); const [showAutoSuggestForm, setShowAutoSuggestForm] = useState(false); const [autoSuggestEnabled, setAutoSuggestEnabled] = useState(false); @@ -808,27 +799,23 @@ const ProjectDetails: React.FC = () => {
{/* Project State Display */} {project.state && ( -
+ {getStateIcon(project.state)} -
- - - {t( - `projects.states.${project.state}` - )} - - -
-
+ + {t(`projects.states.${project.state}`)} + + )} {/* Tags Display */} {project.tags && project.tags.length > 0 && ( -
+ -
+ {project.tags.map((tag, index) => ( - + {index < (project.tags?.length || 0) - 1 && ( - + ,{' '} )} - + ))} -
-
+ + )} {/* Area Display */} {(project.area || (project as any).Area) && ( -
+ -
- - - -
-
+ // Navigate to projects filtered by this area (same as Areas page) + const areaSlug = projectArea.name + .toLowerCase() + .replace(/[^a-z0-9]+/g, '-') + .replace(/^-|-$/g, ''); + navigate( + `/projects?area=${areaUid}-${areaSlug}` + ); + }} + className="text-xs text-white/90 hover:text-blue-200 transition-colors cursor-pointer font-medium" + > + { + (project.area || (project as any).Area) + ?.name + } + + )} {/* Shared Badge */} {project.is_shared && ( -
+ {t('projects.shared', 'Shared')} -
+ )}
diff --git a/frontend/components/Shared/BannerBadge.tsx b/frontend/components/Shared/BannerBadge.tsx new file mode 100644 index 0000000..c84447c --- /dev/null +++ b/frontend/components/Shared/BannerBadge.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +interface BannerBadgeProps { + children: React.ReactNode; +} + +const BannerBadge: React.FC = ({ children }) => { + return ( +
+ {children} +
+ ); +}; + +export default BannerBadge;