import Badge from '@/components/ui/Badge.tsx'; import Button from '@/components/ui/Button.tsx'; import Input from '@/components/ui/Input.tsx'; import VerifiedBadge from '@/components/ui/VerifiedBadge.tsx'; import { getSectorDisplay } from '@/constants.tsx'; import { useOrganizationTable } from '@/hooks/features/useOrganizationTable.ts'; import { useTranslation } from '@/hooks/useI18n.tsx'; import { getTranslatedSectorName } from '@/lib/sector-mapper.ts'; import { getOrganizationSubtypeLabel } from '@/schemas/organizationSubtype.ts'; import { Organization } from '@/types.ts'; import React, { useCallback } from 'react'; interface OrganizationTableProps { onUpdateOrganization: (org: Organization) => void; } const VerifyButton = React.memo( ({ org, onVerify }: { org: Organization; onVerify: (org: Organization) => void }) => { const { t } = useTranslation(); const handleClick = useCallback(() => { onVerify(org); }, [onVerify, org]); return ( ); } ); VerifyButton.displayName = 'VerifyButton'; const OrganizationTable = ({ onUpdateOrganization }: OrganizationTableProps) => { const { t } = useTranslation(); const { filter, setFilter, searchTerm, setSearchTerm, filteredOrgs } = useOrganizationTable(); const handleVerify = useCallback( (org: Organization) => { onUpdateOrganization({ ...org, Verified: !org.Verified }); }, [onUpdateOrganization] ); return (
| {t('adminPage.orgTable.logo')} | {t('adminPage.orgTable.name')} | {t('adminPage.orgTable.sector')} | {t('adminPage.orgTable.type')} | {t('adminPage.orgTable.needsOffers')} | {t('adminPage.orgTable.status')} | {t('adminPage.orgTable.action')} |
|---|---|---|---|---|---|---|
|
{org.LogoURL ? (
{React.cloneElement(sectorDisplay.icon, {
className: 'h-5 w-5 text-primary-foreground',
})}
)}
|
{org.Name} | {getTranslatedSectorName(orgSector, t)} |
{org.Subtype ? (
|
{t('adminPage.orgTable.notAvailable')}
|
{org.Verified ? (
|
|