feat(ux): implement UX audit recommendations
- Redesign landing page with unified Omnibox search - Add ComparisonToast for better comparison flow visibility - Add visual 'Added' state to SchoolCard - Add info tooltips to educational metrics - Optimize mobile map view with Bottom Sheet - Standardize distance display to miles
This commit is contained in:
45
nextjs-app/components/ComparisonToast.tsx
Normal file
45
nextjs-app/components/ComparisonToast.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { useComparison } from '@/hooks/useComparison';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import styles from './ComparisonToast.module.css';
|
||||
|
||||
export function ComparisonToast() {
|
||||
const { selectedSchools, clearAll } = useComparison();
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const pathname = usePathname();
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) return null;
|
||||
|
||||
// Don't show toast on the compare page itself
|
||||
if (pathname === '/compare') return null;
|
||||
|
||||
if (selectedSchools.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className={styles.toastContainer}>
|
||||
<div className={styles.toastContent}>
|
||||
<div className={styles.toastInfo}>
|
||||
<span className={styles.toastBadge}>{selectedSchools.length}</span>
|
||||
<span className={styles.toastText}>
|
||||
{selectedSchools.length === 1 ? 'school' : 'schools'} selected
|
||||
</span>
|
||||
</div>
|
||||
<div className={styles.toastActions}>
|
||||
<button onClick={clearAll} className={styles.btnClear}>
|
||||
Clear
|
||||
</button>
|
||||
<Link href="/compare" className={styles.btnCompare}>
|
||||
Compare Now
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user