Add flashing to category headers.
Category headers now flash if any jobs within require attention. Loading of jobs for 'Acquisition', 'Running', and 'Selling' categories is now prioritized.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
import { IndJob } from '@/lib/types';
|
||||
import { getStatusColor } from '@/utils/jobStatusUtils';
|
||||
import { jobNeedsAttention, getAttentionGlowClasses } from '@/utils/jobAttentionUtils';
|
||||
import JobCard from './JobCard';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
@@ -29,10 +30,13 @@ const JobGroup: React.FC<JobGroupProps> = ({
|
||||
isTracked = false,
|
||||
isLoading = false
|
||||
}) => {
|
||||
// Check if any jobs in this group need attention
|
||||
const hasAttentionJobs = jobs.some(job => jobNeedsAttention(job));
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div
|
||||
className={`${getStatusColor(status)} rounded-lg cursor-pointer select-none transition-colors hover:opacity-90`}
|
||||
className={`${getStatusColor(status)} rounded-lg cursor-pointer select-none transition-colors hover:opacity-90 ${hasAttentionJobs ? getAttentionGlowClasses() : ''}`}
|
||||
onClick={() => onToggle(status)}
|
||||
>
|
||||
<div className="flex items-center justify-between p-4">
|
||||
|
@@ -33,6 +33,7 @@ export function useDashboard() {
|
||||
|
||||
const scrollPositionRef = useRef<number>(0);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const attentionStatusesLoaded = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
@@ -55,6 +56,15 @@ export function useDashboard() {
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, []);
|
||||
|
||||
// Load attention-relevant statuses after initial load
|
||||
useEffect(() => {
|
||||
if (!loading && !attentionStatusesLoaded.current) {
|
||||
const attentionStatuses = ['Acquisition', 'Running', 'Selling'];
|
||||
loadJobsForStatuses(attentionStatuses);
|
||||
attentionStatusesLoaded.current = true;
|
||||
}
|
||||
}, [loading, loadJobsForStatuses]);
|
||||
|
||||
return {
|
||||
// State
|
||||
jobs,
|
||||
|
@@ -16,6 +16,9 @@ interface DashboardHandlersProps {
|
||||
loadingStatuses: Set<string>;
|
||||
}
|
||||
|
||||
// Statuses that need attention checking
|
||||
const ATTENTION_STATUSES = ['Acquisition', 'Running', 'Selling'];
|
||||
|
||||
export function useDashboardHandlers({
|
||||
createJob,
|
||||
updateJob,
|
||||
@@ -104,7 +107,8 @@ export function useDashboardHandlers({
|
||||
setCollapsedGroups(newState);
|
||||
localStorage.setItem('jobGroupsCollapsed', JSON.stringify(newState));
|
||||
|
||||
if (collapsedGroups[status] && !loadingStatuses.has(status)) {
|
||||
// If we're opening a group that needs attention checking, load its jobs
|
||||
if (collapsedGroups[status] && ATTENTION_STATUSES.includes(status) && !loadingStatuses.has(status)) {
|
||||
await loadJobsForStatuses([status]);
|
||||
|
||||
setTimeout(() => {
|
||||
|
Reference in New Issue
Block a user