Skip to content

Latest commit

 

History

History
193 lines (148 loc) · 8.85 KB

File metadata and controls

193 lines (148 loc) · 8.85 KB

Smart Hiring System — UI Redesign Recommendation

Prepared as part of the comprehensive bug-fix & feature sprint.
This document covers visual, interaction, and architectural suggestions for the next UI iteration.


1. Executive Summary

The current frontend is a Vanilla JS single-page application rendered entirely through DOM manipulation in three monolithic files (app.js, company.js, candidate.js). While functional, this architecture creates scaling pain: global variable collisions, no component isolation, brittle event wiring via inline onclick strings, and template literals that embed raw HTML without consistent XSS guards.

Recommended direction: Migrate incrementally to a component-based architecture (React / Vue / Svelte) while preserving the existing REST API surface. This can be done module-by-module — start with the candidate portal, then company, then admin.


2. Current Pain Points

Area Issue Impact
Script coupling company.js (2 400 lines), candidate.js (1 900 lines) — single files Any edit risks breaking unrelated features
State management Globals: authToken, currentUser, currentRole, blindMode, selectedApplications Race conditions between tabs; no reactivity
Inline styles 60 %+ of UI uses inline style="..." in template literals Dark-mode must target [style*=] selectors — fragile
XSS surface Mixed use of escapeHtml, esc, and raw interpolation Semi-patched but still risky in new code
Accessibility No ARIA roles on dynamic content; no focus management on modals WCAG 2.1 AA non-compliant
Mobile Layouts rely on fixed widths; no responsive breakpoints in key views Unusable below 768 px

3. Design System Recommendations

3.1 Design Tokens

Replace scattered color literals with CSS custom properties:

:root {
  --color-primary:    #4F46E5;
  --color-primary-hover: #4338CA;
  --color-success:    #10b981;
  --color-danger:     #ef4444;
  --color-warning:    #f59e0b;
  --color-surface:    #ffffff;
  --color-surface-alt:#f8fafc;
  --color-text:       #1e293b;
  --color-text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --font-display: 'Clash Display', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --color-surface:    #1e1e2e;
  --color-surface-alt:#2a2a3e;
  --color-text:       #e2e8f0;
  --color-text-muted: #94a3b8;
}

Every component should reference var(--color-*) — zero hardcoded colors anywhere.

3.2 Component Library

Build a shared set of reusable components:

Component Purpose
<StatusBadge status="hired"/> Consistent color/icon mapping
<Modal title="" onClose/> Focus-trap, ESC key, backdrop click
<DataTable columns rows pagination/> Sortable, filterable, mobile-responsive
<StatsCard icon label value trend/> KPI cards across all dashboards
<Timeline events/> Status history, audit trail
<QuizEngine questions onSubmit/> Reusable assessment taking flow
<InterviewCard session/> Type badge, recording, proctoring

3.3 Layout

┌──────────────────────────────────────────────────┐
│  Top Bar (logo, search, notifications, avatar)   │
├──────────┬───────────────────────────────────────┤
│ Sidebar  │  Main Content Area                    │
│ (nav)    │  ┌─────────────────────────────────┐  │
│          │  │ Page Header + Breadcrumbs        │  │
│ • Dash   │  ├─────────────────────────────────┤  │
│ • Jobs   │  │ Content                         │  │
│ • Apps   │  │                                 │  │
│ • ...    │  │                                 │  │
│          │  └─────────────────────────────────┘  │
├──────────┴───────────────────────────────────────┤
│  Footer (minimal — version, links)               │
└──────────────────────────────────────────────────┘
  • Sidebar collapses to icons on screens < 1024 px.
  • Full hamburger menu on mobile (< 768 px).

4. Interaction Improvements

4.1 Real-Time Notifications

Replace the current showNotification() toast with a notification center:

  • Bell icon in top bar with unread count badge.
  • Dropdown panel showing last 20 notifications.
  • Backend: add a notifications MongoDB collection with user_id, type, message, read, created_at.
  • WebSocket (socket.io) or SSE push for live updates when:
    • Application status changes
    • Interview scheduled
    • New message from recruiter
    • Assessment graded

4.2 Email Flow Enhancements

Wire up transactional emails for all lifecycle events:

Trigger Email
Application submitted Confirmation to candidate + alert to recruiter
Status → Shortlisted Congratulations + next steps
Status → Interviewed Interview invitation with calendar .ics attachment
Interview completed Thank-you + recruiter review prompt
Status → Hired Offer letter + onboarding link
Status → Rejected Graceful decline with optional feedback
Assessment graded Score report to candidate

4.3 Candidate Experience

  • Application tracker view: Kanban-style pipeline showing where each application sits.
  • Interview prep: Show a "Prepare" button 15 min before scheduled interview with system check (webcam, mic, bandwidth).
  • Skill gap analysis: After assessment, show a radar chart comparing candidate skills vs. job requirements.

4.4 Recruiter Experience

  • Pipeline board: Drag-and-drop Kanban for each job's applicants (Pending → Shortlisted → Interviewed → Hired/Rejected).
  • Bulk actions toolbar: Floating action bar when checkboxes are selected.
  • Interview replay: In-app video player for recorded interviews with timestamped malpractice markers.
  • Comparative view: Side-by-side candidate comparison with scores, skills, and interview notes.

5. Technical Migration Path

Phase 1 (Quick Wins — 1 week)

  • Extract inline styles to CSS classes (already partially done with enterprise-ui.css)
  • Fix all XSS vulnerabilities (completed in this sprint)
  • Add comprehensive dark mode support (completed)
  • Add data-app-id attributes to checkboxes instead of parsing onchange.toString()
  • Add ARIA labels to all interactive elements

Phase 2 (Component Extraction — 2 weeks)

  • Split each JS file into modules (ES6 import/export or simple IIFE modules)
  • Create a shared components/ directory with template functions
  • Centralize API calls into an ApiService class with interceptors for auth, error-handling
  • Add a lightweight router (window.hashchange or history.pushState)

Phase 3 (Framework Migration — 4 weeks)

  • Choose React (team familiarity) or Vue (lower barrier)
  • Scaffold with Vite for fast dev server
  • Migrate one portal at a time, starting with candidate (smallest surface)
  • Keep the Flask backend unchanged — it's a clean REST API

Phase 4 (Polish — 2 weeks)

  • Implement design system tokens globally
  • Add skeleton loaders for all async content
  • Add keyboard navigation and screen reader support
  • Implement dark/light mode via system preference with manual override
  • Performance audit: lazy-load non-critical JS, optimize images, add service worker

6. Performance Recommendations

Metric Current Target
First Contentful Paint ~2.5s (CDN scripts) < 1.5s
Time to Interactive ~4s < 2.5s
Bundle Size ~300 KB (unminified) < 150 KB (minified + gzipped)
  • Defer Chart.js loading until analytics tab is actually opened.
  • Lazy-load Google Fonts — use font-display: swap.
  • Add loading="lazy" to all images.
  • Minify and bundle JS/CSS for production (esbuild or rollup).

7. Summary

The current system works and the bug-fix sprint has made it significantly more robust. The highest-ROI next step is Phase 2 — splitting the monolithic JS files into reusable modules without changing the visual design. This alone will reduce regression risk, make dark mode maintenance trivial, and set the stage for an eventual framework migration.