From 183743f7d5b3f54bd2ab49e1a54f3ada432640c4 Mon Sep 17 00:00:00 2001 From: Destroyer795 Date: Thu, 12 Mar 2026 01:07:30 +0530 Subject: [PATCH 1/2] Fix UI issues in light mode and high contrast --- frontend/src/i18n.ts | 3 ++- frontend/src/index.css | 16 ++++++++++++++ .../src/pages/dashboard/AdminDashboard.tsx | 8 +++---- frontend/src/pages/dashboard/DiscoveryMap.tsx | 6 ++--- frontend/src/pages/dashboard/DonorHome.tsx | 2 +- .../src/pages/dashboard/FeedbackRatings.tsx | 8 +++---- frontend/src/pages/dashboard/History.tsx | 8 +++---- frontend/src/pages/dashboard/Impact.tsx | 22 +++++++++---------- .../src/pages/dashboard/NearExpiryAlerts.tsx | 6 ++--- .../src/pages/dashboard/Notifications.tsx | 2 +- frontend/src/pages/dashboard/Preferences.tsx | 16 +++++++------- frontend/src/pages/dashboard/Profile.tsx | 12 +++++----- .../src/pages/dashboard/SupportTickets.tsx | 6 ++--- .../pages/dashboard/VolunteerDashboard.tsx | 16 +++++++------- .../src/pages/dashboard/VolunteerTracking.tsx | 6 ++--- 15 files changed, 77 insertions(+), 60 deletions(-) diff --git a/frontend/src/i18n.ts b/frontend/src/i18n.ts index 3a7a8da..810f695 100644 --- a/frontend/src/i18n.ts +++ b/frontend/src/i18n.ts @@ -1,4 +1,4 @@ -import i18n from 'i18next'; +import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import hiStrings from './locales/hi'; import taStrings from './locales/ta'; @@ -607,6 +607,7 @@ export const enStrings: Record = { minLabel: 'min', claimNow: 'Claim Now', alreadyClaimedStatus: 'Already Claimed', + noExpiringSoon: 'No donations expiring soon. All good!', // —— Leaderboards —— leaderboardsTitle: 'Leaderboards', leaderboardsDesc: 'Top contributors ranked by karma points and activity.', diff --git a/frontend/src/index.css b/frontend/src/index.css index 0795278..4021560 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -351,6 +351,11 @@ } .a11y-contrast .card, .a11y-contrast .card-elevated { + border-color: rgba(0, 0, 0, 0.5) !important; + border-width: 2px !important; +} +.dark.a11y-contrast .card, +.dark.a11y-contrast .card-elevated { border-color: rgba(255, 255, 255, 0.5) !important; border-width: 2px !important; } @@ -358,10 +363,21 @@ .a11y-contrast button { text-decoration-thickness: 2px; outline-offset: 3px; + outline-color: rgba(0,0,0,0.8); +} +.dark.a11y-contrast a, +.dark.a11y-contrast button { + outline-color: rgba(255,255,255,0.8); } .a11y-contrast input, .a11y-contrast select, .a11y-contrast textarea { + border-color: rgba(0, 0, 0, 0.5) !important; + border-width: 2px !important; +} +.dark.a11y-contrast input, +.dark.a11y-contrast select, +.dark.a11y-contrast textarea { border-color: rgba(255, 255, 255, 0.5) !important; border-width: 2px !important; } diff --git a/frontend/src/pages/dashboard/AdminDashboard.tsx b/frontend/src/pages/dashboard/AdminDashboard.tsx index f4f84d6..83acaab 100644 --- a/frontend/src/pages/dashboard/AdminDashboard.tsx +++ b/frontend/src/pages/dashboard/AdminDashboard.tsx @@ -9,7 +9,7 @@ import { RefreshCw, MessageSquare, } from 'lucide-react'; -// ─── Types ─────────────────────────────────────────────────────────────────── + type AdminTab = 'notifications' | 'pending' | 'users' | 'donations' | 'flagged' | 'tickets'; @@ -43,7 +43,7 @@ interface FlaggedItem { createdAt: string; } -// ─── Style Maps ────────────────────────────────────────────────────────────── + const priorityStyle: Record = { high: 'bg-red-500/10 text-red-400 border-red-500/20', @@ -66,7 +66,7 @@ const statusStyle: Record = { ESCALATED: 'bg-purple-500/10 text-purple-400 border-purple-500/20', }; -// ─── Ticket Modal ───────────────────────────────────────────────────────────── + function TicketModal({ ticket, onClose, onUpdate }: { ticket: SupportTicket; onClose: () => void; onUpdate: () => void; @@ -160,7 +160,7 @@ function TicketModal({ ticket, onClose, onUpdate }: { ); } -// ─── Main ───────────────────────────────────────────────────────────────────── + export default function AdminDashboard() { const [activeTab, setActiveTab] = useState('notifications'); diff --git a/frontend/src/pages/dashboard/DiscoveryMap.tsx b/frontend/src/pages/dashboard/DiscoveryMap.tsx index f3f15e9..aca8f2c 100644 --- a/frontend/src/pages/dashboard/DiscoveryMap.tsx +++ b/frontend/src/pages/dashboard/DiscoveryMap.tsx @@ -284,7 +284,7 @@ export default function DiscoveryMap() { className="w-full h-full object-cover" /> {/* Image Counter */} -
+
{currentImageIndex + 1} / {selectedDonation.imageUrls.length}
{/* Navigation Buttons */} @@ -292,13 +292,13 @@ export default function DiscoveryMap() { <> diff --git a/frontend/src/pages/dashboard/DonorHome.tsx b/frontend/src/pages/dashboard/DonorHome.tsx index 2de4231..066671c 100644 --- a/frontend/src/pages/dashboard/DonorHome.tsx +++ b/frontend/src/pages/dashboard/DonorHome.tsx @@ -279,7 +279,7 @@ export default function DonorHome() { className="w-full h-full object-cover" /> {/* Image Counter */} -
+
{currentImageIndex + 1} / {selectedDonation.imageUrls.length}
{/* Navigation Buttons */} diff --git a/frontend/src/pages/dashboard/FeedbackRatings.tsx b/frontend/src/pages/dashboard/FeedbackRatings.tsx index 7ef1e71..263ea55 100644 --- a/frontend/src/pages/dashboard/FeedbackRatings.tsx +++ b/frontend/src/pages/dashboard/FeedbackRatings.tsx @@ -113,7 +113,7 @@ export default function FeedbackRatings() { return (
-

{t('ngoFeedbackRatings')}

+

{t('ngoFeedbackRatings')}

{t('feedbackDesc')}

@@ -141,7 +141,7 @@ export default function FeedbackRatings() {

{t('yourDonorRating')}

- {donorRating.averageScore.toFixed(1)} + {donorRating.averageScore.toFixed(1)} {'★'.repeat(Math.round(donorRating.averageScore))}{'☆'.repeat(5 - Math.round(donorRating.averageScore))}

{t('basedOnReviews', { count: donorRating.totalReviews })}

@@ -151,7 +151,7 @@ export default function FeedbackRatings() { )} {isNGO && (
-

+

{t('leaveReview')}

@@ -199,7 +199,7 @@ export default function FeedbackRatings() { {/* Rating Summary & Reviews */}
-

{t('ratingSummary')}

+

{t('ratingSummary')}

{avgRating.toFixed(1)} / 5 diff --git a/frontend/src/pages/dashboard/History.tsx b/frontend/src/pages/dashboard/History.tsx index beea137..88cdff1 100644 --- a/frontend/src/pages/dashboard/History.tsx +++ b/frontend/src/pages/dashboard/History.tsx @@ -5,7 +5,7 @@ import type { Donation } from '../../services/api' import { socketService } from '../../services/socket' import { TrendingUp, BarChart2, Package } from 'lucide-react' -// ─── Inline SVG Bar Chart ───────────────────────────────────────────────────── + interface BarChartProps { data: { label: string; value: number; color?: string }[] @@ -100,7 +100,7 @@ function BarChart({ data, height = 180, unit = '', title, subtitle, accentColor ) } -// ─── Line/Area Trend Chart ──────────────────────────────────────────────────── + interface LineChartProps { data: { label: string; value: number }[] @@ -183,7 +183,7 @@ function LineChart({ data, title, subtitle, accentColor = '#6366f1' }: LineChart ) } -// ─── Monthly Data Helpers ───────────────────────────────────────────────────── + const MONTH_ABBR = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] const LAST_6_MONTHS = Array.from({ length: 6 }, (_, i) => { @@ -202,7 +202,7 @@ function aggregateByMonth(donations: Donation[], statusFilter?: string) { }) } -// ─── Main History Component ─────────────────────────────────────────────────── + const userRole = (): string => { try { diff --git a/frontend/src/pages/dashboard/Impact.tsx b/frontend/src/pages/dashboard/Impact.tsx index 1e73314..dd227ff 100644 --- a/frontend/src/pages/dashboard/Impact.tsx +++ b/frontend/src/pages/dashboard/Impact.tsx @@ -9,7 +9,7 @@ import { Award, Download, Leaf, Droplets, Globe } from 'lucide-react' -// ─── BADGE CATALOG (mirrors backend BADGE_RULES exactly) ───────────────────── + const BADGE_CATALOG_KEYS = [ { threshold: 10, nameKey: 'newcomer', icon: '🌱', descKey: 'newcomerDesc' }, @@ -19,7 +19,7 @@ const BADGE_CATALOG_KEYS = [ { threshold: 500, nameKey: 'superhero', icon: '💫', descKey: 'superheroDesc' }, ] -// ─── INLINE SVG BAR CHART ───────────────────────────────────────────────────── + function SvgBarChart({ data, title, subtitle, color = '#10b981', @@ -137,7 +137,7 @@ function SvgLineChart({ ) } -// ─── CERTIFICATE MODAL ──────────────────────────────────────────────────────── + function CertificateModal({ user, role, onClose }: { user: User; role: string; onClose: () => void }) { const { t } = useTranslation() @@ -208,7 +208,7 @@ function CertificateModal({ user, role, onClose }: { user: User; role: string; o
{/* Toolbar */}
-

+

{t('certificateOfAppreciation')}

@@ -218,7 +218,7 @@ function CertificateModal({ user, role, onClose }: { user: User; role: string; o {t('printSavePDF')}
@@ -275,12 +275,12 @@ function CertificateModal({ user, role, onClose }: { user: User; role: string; o

{t('platformDirector')}

-

{t('surplusSyncNetwork')}

+

{t('surplusSyncNetwork')}

🏅

{t('dateOfIssue')}

-

{today}

+

{today}

@@ -290,7 +290,7 @@ function CertificateModal({ user, role, onClose }: { user: User; role: string; o ) } -// ─── GAMIFICATION: KARMA PROGRESS BAR ──────────────────────────────────────── + function KarmaProgress({ karma, badgeCatalog }: { karma: number; badgeCatalog?: { id: string; name: string; icon: string; description: string; earned: boolean; requirement: number }[] }) { const { t } = useTranslation() @@ -373,7 +373,7 @@ function KarmaProgress({ karma, badgeCatalog }: { karma: number; badgeCatalog?: ) } -// ─── COMMUNITY COUNTERS ─────────────────────────────────────────────────────── + function CommunityCounters({ stats }: { stats: CommunityStats }) { const { t } = useTranslation() @@ -412,7 +412,7 @@ function CommunityCounters({ stats }: { stats: CommunityStats }) { ) } -// ─── NGO GROWTH CHARTS ──────────────────────────────────────────────────────── + function NGOGrowthCharts({ monthly }: { monthly: MonthlyStatPoint[] }) { const { t } = useTranslation() @@ -476,7 +476,7 @@ function NGOGrowthCharts({ monthly }: { monthly: MonthlyStatPoint[] }) { ) } -// ─── MAIN IMPACT PAGE ───────────────────────────────────────────────────────── + export default function Impact() { const { t } = useTranslation() diff --git a/frontend/src/pages/dashboard/NearExpiryAlerts.tsx b/frontend/src/pages/dashboard/NearExpiryAlerts.tsx index 7aaf83d..1af39de 100644 --- a/frontend/src/pages/dashboard/NearExpiryAlerts.tsx +++ b/frontend/src/pages/dashboard/NearExpiryAlerts.tsx @@ -115,7 +115,7 @@ export default function NearExpiryAlerts() {
-

{t('nearExpiryAlerts')}

+

{t('nearExpiryAlerts')}

{t('nearExpiryDesc')}

@@ -149,7 +149,7 @@ export default function NearExpiryAlerts() {
-

+

{alert.food}

diff --git a/frontend/src/pages/dashboard/Notifications.tsx b/frontend/src/pages/dashboard/Notifications.tsx index a8f5b48..453b4ac 100644 --- a/frontend/src/pages/dashboard/Notifications.tsx +++ b/frontend/src/pages/dashboard/Notifications.tsx @@ -128,7 +128,7 @@ export default function Notifications() {
{t('loadingNotifications')}
) : filtered.length === 0 ? (
- +

{filter === 'unread' ? t('noUnreadNotifications') : t('noNotificationsYet')}

diff --git a/frontend/src/pages/dashboard/Preferences.tsx b/frontend/src/pages/dashboard/Preferences.tsx index 08254ae..dc8748f 100644 --- a/frontend/src/pages/dashboard/Preferences.tsx +++ b/frontend/src/pages/dashboard/Preferences.tsx @@ -24,8 +24,8 @@ export default function Preferences() { return (
-

Accessibility

-

Configure keyboard navigation and readability settings.

+

Preferences

+

Configure keyboard navigation and readability settings.

@@ -59,12 +59,12 @@ export default function Preferences() {
{keyboardHints && ( -
-
+
+
Keyboard Navigation
-
    +
    • Tab — move focus forward
    • Shift+Tab — move focus backward
    • Enter / Space — activate buttons & toggles
    • @@ -88,18 +88,18 @@ function ToggleRow({ icon, label, desc, enabled, onToggle }: ToggleRowProps) { return (
      -

      +

      {icon} {label}

      - {desc &&

      {desc}

      } + {desc &&

      {desc}

      }
      diff --git a/frontend/src/pages/dashboard/Profile.tsx b/frontend/src/pages/dashboard/Profile.tsx index 3d845e4..c92c50e 100644 --- a/frontend/src/pages/dashboard/Profile.tsx +++ b/frontend/src/pages/dashboard/Profile.tsx @@ -4,7 +4,7 @@ import { getUserProfile, updateUserProfile, type User } from '../../services/api import { User as UserIcon, Building, Phone, Mail, MapPin, Shield, Edit2, Check, Trophy, Star, AlertCircle, Loader2, Download, Award } from 'lucide-react' import { toast } from 'sonner' -// ─── Certificate Modal (All Roles) ─────────────────────────────────────────── + interface CertificateProps { user: User @@ -88,7 +88,7 @@ function CertificateModal({ user, onClose }: CertificateProps) { {/* Toolbar */}
      -

      +

      {t('certificateOfAppreciation')}

      @@ -100,7 +100,7 @@ function CertificateModal({ user, onClose }: CertificateProps) { {t('printSavePDF')} -
      @@ -176,12 +176,12 @@ function CertificateModal({ user, onClose }: CertificateProps) {

      {t('platformDirector')}

      -

      {t('surplusSyncNetwork')}

      +

      {t('surplusSyncNetwork')}

      🏅

      {t('dateOfIssue')}

      -

      {today}

      +

      {today}

      @@ -191,7 +191,7 @@ function CertificateModal({ user, onClose }: CertificateProps) { ) } -// ─── Main Profile Component ─────────────────────────────────────────────────── + export default function Profile() { const { t } = useTranslation() diff --git a/frontend/src/pages/dashboard/SupportTickets.tsx b/frontend/src/pages/dashboard/SupportTickets.tsx index 0b3963d..03802b1 100644 --- a/frontend/src/pages/dashboard/SupportTickets.tsx +++ b/frontend/src/pages/dashboard/SupportTickets.tsx @@ -90,7 +90,7 @@ export default function SupportTickets() {
      -

      {t('supportTicketsTitle')}

      +

      {t('supportTicketsTitle')}

      {t('supportDesc')}