refactor(task-management): optimize task management components with performance enhancements
- Updated import statements for consistency and clarity. - Refined task sorting and update logic to improve responsiveness. - Enhanced error logging for better debugging during task sort order changes. - Increased overscan count in virtualized task lists for smoother scrolling experience. - Introduced lazy loading for heavy components to reduce initial load times. - Improved CSS styles for better responsiveness and user interaction across task management components.
This commit is contained in:
@@ -118,7 +118,7 @@ const onTaskSortOrderChange = async (io: Server, socket: Socket, data: ChangeReq
|
||||
project_id,
|
||||
team_id,
|
||||
user_id: userId,
|
||||
update_type: 'task_sort_order_change',
|
||||
update_type: "task_sort_order_change",
|
||||
task_id: task.id,
|
||||
from_group,
|
||||
to_group,
|
||||
@@ -126,7 +126,7 @@ const onTaskSortOrderChange = async (io: Server, socket: Socket, data: ChangeReq
|
||||
};
|
||||
|
||||
// Emit to all users in the project room
|
||||
io.to(`project_${project_id}`).emit('project_updates', projectUpdateData);
|
||||
io.to(`project_${project_id}`).emit("project_updates", projectUpdateData);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Optimized activity logging
|
||||
const activityLogData = {
|
||||
@@ -139,15 +139,15 @@ const onTaskSortOrderChange = async (io: Server, socket: Socket, data: ChangeReq
|
||||
// Log activity asynchronously to avoid blocking the response
|
||||
setImmediate(async () => {
|
||||
try {
|
||||
if (group_by === 'phase') {
|
||||
if (group_by === "phase") {
|
||||
await logPhaseChange(activityLogData);
|
||||
} else if (group_by === 'status') {
|
||||
} else if (group_by === "status") {
|
||||
await logStatusChange(activityLogData);
|
||||
} else if (group_by === 'priority') {
|
||||
} else if (group_by === "priority") {
|
||||
await logPriorityChange(activityLogData);
|
||||
}
|
||||
} catch (error) {
|
||||
log_error("Error logging task sort order change activity", error);
|
||||
log_error(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ const onTaskSortOrderChange = async (io: Server, socket: Socket, data: ChangeReq
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
log_error("Error in onTaskSortOrderChange", error);
|
||||
log_error(error);
|
||||
socket.emit(SocketEvents.TASK_SORT_ORDER_CHANGE.toString(), {
|
||||
error: "Internal server error"
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import { on_task_description_change } from "./commands/on-task-description-chang
|
||||
import { on_get_task_progress } from "./commands/on-get-task-progress";
|
||||
import { on_task_timer_start } from "./commands/on-task-timer-start";
|
||||
import { on_task_timer_stop } from "./commands/on-task-timer-stop";
|
||||
import { on_task_sort_order_change } from "./commands/on-task-sort-order-change";
|
||||
import on_task_sort_order_change from "./commands/on-task-sort-order-change";
|
||||
import { on_join_project_room as on_join_or_leave_project_room } from "./commands/on-join-or-leave-project-room";
|
||||
import { on_task_subscriber_change } from "./commands/on-task-subscriber-change";
|
||||
import { on_project_subscriber_change } from "./commands/on-project-subscriber-change";
|
||||
|
||||
@@ -38,11 +38,12 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = ({
|
||||
onTaskRender?.(task, index);
|
||||
|
||||
return (
|
||||
<div className="virtualized-task-row">
|
||||
<div className="virtualized-task-row" style={style}>
|
||||
<EnhancedKanbanTaskCard
|
||||
task={task}
|
||||
isActive={task.id === activeTaskId}
|
||||
isDropTarget={overId === task.id}
|
||||
sectionId={task.status || 'default'}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -52,10 +53,11 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = ({
|
||||
const VirtualizedList = useMemo(() => (
|
||||
<List
|
||||
height={height}
|
||||
width="100%"
|
||||
itemCount={tasks.length}
|
||||
itemSize={itemHeight}
|
||||
itemData={taskData}
|
||||
overscanCount={5} // Render 5 extra items for smooth scrolling
|
||||
overscanCount={10} // Increased overscan for smoother scrolling experience
|
||||
className="virtualized-task-list"
|
||||
>
|
||||
{Row}
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
import React, { useState, useCallback, Suspense } from 'react';
|
||||
import { Card, Typography, Space, Button, Divider } from 'antd';
|
||||
import {
|
||||
UserAddOutlined,
|
||||
CalendarOutlined,
|
||||
FlagOutlined,
|
||||
TagOutlined,
|
||||
LoadingOutlined
|
||||
} from '@ant-design/icons';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
|
||||
// Simulate heavy components that would normally load immediately
|
||||
const HeavyAssigneeSelector = React.lazy(() =>
|
||||
new Promise<{ default: React.ComponentType }>((resolve) =>
|
||||
setTimeout(() => resolve({
|
||||
default: () => (
|
||||
<div className="p-4 border rounded bg-blue-50">
|
||||
<Text strong>🚀 Heavy Assignee Selector Loaded!</Text>
|
||||
<br />
|
||||
<Text type="secondary">This component contains:</Text>
|
||||
<ul className="mt-2 text-sm">
|
||||
<li>Team member search logic</li>
|
||||
<li>Avatar rendering</li>
|
||||
<li>Permission checking</li>
|
||||
<li>Socket connections</li>
|
||||
<li>Optimistic updates</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}), 1000) // Simulate 1s load time
|
||||
)
|
||||
);
|
||||
|
||||
const HeavyDatePicker = React.lazy(() =>
|
||||
new Promise<{ default: React.ComponentType }>((resolve) =>
|
||||
setTimeout(() => resolve({
|
||||
default: () => (
|
||||
<div className="p-4 border rounded bg-green-50">
|
||||
<Text strong>📅 Heavy Date Picker Loaded!</Text>
|
||||
<br />
|
||||
<Text type="secondary">This component contains:</Text>
|
||||
<ul className="mt-2 text-sm">
|
||||
<li>Calendar rendering logic</li>
|
||||
<li>Date validation</li>
|
||||
<li>Timezone handling</li>
|
||||
<li>Locale support</li>
|
||||
<li>Accessibility features</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}), 800) // Simulate 0.8s load time
|
||||
)
|
||||
);
|
||||
|
||||
const HeavyPrioritySelector = React.lazy(() =>
|
||||
new Promise<{ default: React.ComponentType }>((resolve) =>
|
||||
setTimeout(() => resolve({
|
||||
default: () => (
|
||||
<div className="p-4 border rounded bg-orange-50">
|
||||
<Text strong>🔥 Heavy Priority Selector Loaded!</Text>
|
||||
<br />
|
||||
<Text type="secondary">This component contains:</Text>
|
||||
<ul className="mt-2 text-sm">
|
||||
<li>Priority level logic</li>
|
||||
<li>Color calculations</li>
|
||||
<li>Business rules</li>
|
||||
<li>Validation</li>
|
||||
<li>State management</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}), 600) // Simulate 0.6s load time
|
||||
)
|
||||
);
|
||||
|
||||
const HeavyLabelsSelector = React.lazy(() =>
|
||||
new Promise<{ default: React.ComponentType }>((resolve) =>
|
||||
setTimeout(() => resolve({
|
||||
default: () => (
|
||||
<div className="p-4 border rounded bg-purple-50">
|
||||
<Text strong>🏷️ Heavy Labels Selector Loaded!</Text>
|
||||
<br />
|
||||
<Text type="secondary">This component contains:</Text>
|
||||
<ul className="mt-2 text-sm">
|
||||
<li>Label management</li>
|
||||
<li>Color picker</li>
|
||||
<li>Search functionality</li>
|
||||
<li>CRUD operations</li>
|
||||
<li>Drag & drop</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}), 700) // Simulate 0.7s load time
|
||||
)
|
||||
);
|
||||
|
||||
// Lightweight placeholder buttons (what loads immediately)
|
||||
const PlaceholderButton: React.FC<{
|
||||
icon: React.ReactNode;
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
loaded?: boolean;
|
||||
}> = ({ icon, label, onClick, loaded = false }) => (
|
||||
<Button
|
||||
size="small"
|
||||
icon={loaded ? <LoadingOutlined spin /> : icon}
|
||||
onClick={onClick}
|
||||
className={`${loaded ? 'border-blue-500 bg-blue-50' : ''}`}
|
||||
>
|
||||
{loaded ? 'Loading...' : label}
|
||||
</Button>
|
||||
);
|
||||
|
||||
const AsanaStyleLazyDemo: React.FC = () => {
|
||||
const [loadedComponents, setLoadedComponents] = useState<{
|
||||
assignee: boolean;
|
||||
date: boolean;
|
||||
priority: boolean;
|
||||
labels: boolean;
|
||||
}>({
|
||||
assignee: false,
|
||||
date: false,
|
||||
priority: false,
|
||||
labels: false,
|
||||
});
|
||||
|
||||
const [showComponents, setShowComponents] = useState<{
|
||||
assignee: boolean;
|
||||
date: boolean;
|
||||
priority: boolean;
|
||||
labels: boolean;
|
||||
}>({
|
||||
assignee: false,
|
||||
date: false,
|
||||
priority: false,
|
||||
labels: false,
|
||||
});
|
||||
|
||||
const handleLoad = useCallback((component: keyof typeof loadedComponents) => {
|
||||
setLoadedComponents(prev => ({ ...prev, [component]: true }));
|
||||
setTimeout(() => {
|
||||
setShowComponents(prev => ({ ...prev, [component]: true }));
|
||||
}, 100);
|
||||
}, []);
|
||||
|
||||
const resetDemo = useCallback(() => {
|
||||
setLoadedComponents({
|
||||
assignee: false,
|
||||
date: false,
|
||||
priority: false,
|
||||
labels: false,
|
||||
});
|
||||
setShowComponents({
|
||||
assignee: false,
|
||||
date: false,
|
||||
priority: false,
|
||||
labels: false,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Card className="max-w-4xl mx-auto">
|
||||
<Title level={3}>🎯 Asana-Style Lazy Loading Demo</Title>
|
||||
|
||||
<div className="mb-4 p-4 bg-gray-50 rounded">
|
||||
<Text strong>Performance Benefits:</Text>
|
||||
<ul className="mt-2 text-sm">
|
||||
<li>✅ <strong>Faster Initial Load:</strong> Only lightweight placeholders load initially</li>
|
||||
<li>✅ <strong>Reduced Bundle Size:</strong> Heavy components split into separate chunks</li>
|
||||
<li>✅ <strong>Better UX:</strong> Instant visual feedback, components load on demand</li>
|
||||
<li>✅ <strong>Memory Efficient:</strong> Components only consume memory when needed</li>
|
||||
<li>✅ <strong>Network Optimized:</strong> Parallel loading of components as user interacts</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Text strong>Task Management Components (Click to Load):</Text>
|
||||
<div className="mt-2 flex gap-2 flex-wrap">
|
||||
<PlaceholderButton
|
||||
icon={<UserAddOutlined />}
|
||||
label="Add Assignee"
|
||||
onClick={() => handleLoad('assignee')}
|
||||
loaded={loadedComponents.assignee && !showComponents.assignee}
|
||||
/>
|
||||
<PlaceholderButton
|
||||
icon={<CalendarOutlined />}
|
||||
label="Set Date"
|
||||
onClick={() => handleLoad('date')}
|
||||
loaded={loadedComponents.date && !showComponents.date}
|
||||
/>
|
||||
<PlaceholderButton
|
||||
icon={<FlagOutlined />}
|
||||
label="Set Priority"
|
||||
onClick={() => handleLoad('priority')}
|
||||
loaded={loadedComponents.priority && !showComponents.priority}
|
||||
/>
|
||||
<PlaceholderButton
|
||||
icon={<TagOutlined />}
|
||||
label="Add Labels"
|
||||
onClick={() => handleLoad('labels')}
|
||||
loaded={loadedComponents.labels && !showComponents.labels}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={resetDemo} size="small">
|
||||
Reset Demo
|
||||
</Button>
|
||||
<Text type="secondary" className="self-center">
|
||||
Components loaded: {Object.values(showComponents).filter(Boolean).length}/4
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
||||
<div className="space-y-4">
|
||||
{showComponents.assignee && (
|
||||
<Suspense fallback={<div className="p-4 border rounded bg-gray-100">Loading assignee selector...</div>}>
|
||||
<HeavyAssigneeSelector />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{showComponents.date && (
|
||||
<Suspense fallback={<div className="p-4 border rounded bg-gray-100">Loading date picker...</div>}>
|
||||
<HeavyDatePicker />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{showComponents.priority && (
|
||||
<Suspense fallback={<div className="p-4 border rounded bg-gray-100">Loading priority selector...</div>}>
|
||||
<HeavyPrioritySelector />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{showComponents.labels && (
|
||||
<Suspense fallback={<div className="p-4 border rounded bg-gray-100">Loading labels selector...</div>}>
|
||||
<HeavyLabelsSelector />
|
||||
</Suspense>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
||||
<div className="text-sm text-gray-600">
|
||||
<Text strong>How it works:</Text>
|
||||
<ol className="mt-2 space-y-1">
|
||||
<li>1. Page loads instantly with lightweight placeholder buttons</li>
|
||||
<li>2. User clicks a button to interact with a feature</li>
|
||||
<li>3. Heavy component starts loading in the background</li>
|
||||
<li>4. Loading state shows immediate feedback</li>
|
||||
<li>5. Full component renders when ready</li>
|
||||
<li>6. Subsequent interactions are instant (component cached)</li>
|
||||
</ol>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default AsanaStyleLazyDemo;
|
||||
@@ -0,0 +1,270 @@
|
||||
import React, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { UserAddOutlined } from '@ant-design/icons';
|
||||
import { RootState } from '@/app/store';
|
||||
import { IProjectTask } from '@/types/project/projectTasksViewModel.types';
|
||||
import { ITeamMembersViewModel } from '@/types/teamMembers/teamMembersViewModel.types';
|
||||
import { useSocket } from '@/socket/socketContext';
|
||||
import { SocketEvents } from '@/shared/socket-events';
|
||||
import { useAuthService } from '@/hooks/useAuth';
|
||||
import { Avatar, Button, Checkbox } from '@/components';
|
||||
import { sortTeamMembers } from '@/utils/sort-team-members';
|
||||
import { useAppDispatch } from '@/hooks/useAppDispatch';
|
||||
import { toggleProjectMemberDrawer } from '@/features/projects/singleProject/members/projectMembersSlice';
|
||||
import { ILocalSession } from '@/types/auth/session.types';
|
||||
import { Socket } from 'socket.io-client';
|
||||
import { DefaultEventsMap } from '@socket.io/component-emitter';
|
||||
import { ThunkDispatch } from '@reduxjs/toolkit';
|
||||
import { Dispatch } from 'redux';
|
||||
|
||||
interface AssigneeDropdownContentProps {
|
||||
task: IProjectTask;
|
||||
groupId?: string | null;
|
||||
isDarkMode?: boolean;
|
||||
projectId: string | null;
|
||||
currentSession: ILocalSession | null;
|
||||
socket: Socket<DefaultEventsMap, DefaultEventsMap> | null;
|
||||
dispatch: ThunkDispatch<any, any, any> & Dispatch<any>;
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
position: { top: number; left: number };
|
||||
}
|
||||
|
||||
const AssigneeDropdownContent: React.FC<AssigneeDropdownContentProps> = ({
|
||||
task,
|
||||
groupId = null,
|
||||
isDarkMode = false,
|
||||
projectId,
|
||||
currentSession,
|
||||
socket,
|
||||
dispatch,
|
||||
isOpen,
|
||||
onClose,
|
||||
position,
|
||||
}) => {
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [teamMembers, setTeamMembers] = useState<ITeamMembersViewModel>({ data: [], total: 0 });
|
||||
const [optimisticAssignees, setOptimisticAssignees] = useState<string[]>([]);
|
||||
const [pendingChanges, setPendingChanges] = useState<Set<string>>(new Set());
|
||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const members = useSelector((state: RootState) => state.teamMembersReducer.teamMembers);
|
||||
|
||||
const filteredMembers = useMemo(() => {
|
||||
return teamMembers?.data?.filter(member =>
|
||||
member.name?.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
);
|
||||
}, [teamMembers, searchQuery]);
|
||||
|
||||
// Initialize team members data when component mounts
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
const assignees = task?.assignees?.map(assignee => assignee.team_member_id);
|
||||
const membersData = (members?.data || []).map(member => ({
|
||||
...member,
|
||||
selected: assignees?.includes(member.id),
|
||||
}));
|
||||
const sortedMembers = sortTeamMembers(membersData);
|
||||
setTeamMembers({ data: sortedMembers });
|
||||
|
||||
// Focus search input after opening
|
||||
setTimeout(() => {
|
||||
searchInputRef.current?.focus();
|
||||
}, 0);
|
||||
}
|
||||
}, [isOpen, members, task]);
|
||||
|
||||
const handleMemberToggle = useCallback((memberId: string, checked: boolean) => {
|
||||
if (!memberId || !projectId || !task?.id || !currentSession?.id) return;
|
||||
|
||||
// Add to pending changes for visual feedback
|
||||
setPendingChanges(prev => new Set(prev).add(memberId));
|
||||
|
||||
// OPTIMISTIC UPDATE: Update local state immediately for instant UI feedback
|
||||
const currentAssignees = task?.assignees?.map(a => a.team_member_id) || [];
|
||||
let newAssigneeIds: string[];
|
||||
|
||||
if (checked) {
|
||||
// Adding assignee
|
||||
newAssigneeIds = [...currentAssignees, memberId];
|
||||
} else {
|
||||
// Removing assignee
|
||||
newAssigneeIds = currentAssignees.filter(id => id !== memberId);
|
||||
}
|
||||
|
||||
// Update optimistic state for immediate UI feedback in dropdown
|
||||
setOptimisticAssignees(newAssigneeIds);
|
||||
|
||||
// Update local team members state for dropdown UI
|
||||
setTeamMembers(prev => ({
|
||||
...prev,
|
||||
data: (prev.data || []).map(member =>
|
||||
member.id === memberId
|
||||
? { ...member, selected: checked }
|
||||
: member
|
||||
)
|
||||
}));
|
||||
|
||||
const body = {
|
||||
team_member_id: memberId,
|
||||
project_id: projectId,
|
||||
task_id: task.id,
|
||||
reporter_id: currentSession.id,
|
||||
mode: checked ? 0 : 1,
|
||||
parent_task: task.parent_task_id,
|
||||
};
|
||||
|
||||
// Emit socket event - the socket handler will update Redux with proper types
|
||||
socket?.emit(SocketEvents.QUICK_ASSIGNEES_UPDATE.toString(), JSON.stringify(body));
|
||||
|
||||
// Remove from pending changes after a short delay (optimistic)
|
||||
setTimeout(() => {
|
||||
setPendingChanges(prev => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(memberId);
|
||||
return newSet;
|
||||
});
|
||||
}, 500); // Remove pending state after 500ms
|
||||
}, [task, projectId, currentSession, socket]);
|
||||
|
||||
const checkMemberSelected = useCallback((memberId: string) => {
|
||||
if (!memberId) return false;
|
||||
// Use optimistic assignees if available, otherwise fall back to task assignees
|
||||
const assignees = optimisticAssignees.length > 0
|
||||
? optimisticAssignees
|
||||
: task?.assignees?.map(assignee => assignee.team_member_id) || [];
|
||||
return assignees.includes(memberId);
|
||||
}, [optimisticAssignees, task]);
|
||||
|
||||
const handleInviteProjectMemberDrawer = useCallback(() => {
|
||||
onClose(); // Close the assignee dropdown first
|
||||
dispatch(toggleProjectMemberDrawer()); // Then open the invite drawer
|
||||
}, [onClose, dispatch]);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={dropdownRef}
|
||||
className={`
|
||||
fixed z-[9999] w-72 rounded-md shadow-lg border
|
||||
${isDarkMode
|
||||
? 'bg-gray-800 border-gray-600'
|
||||
: 'bg-white border-gray-200'
|
||||
}
|
||||
`}
|
||||
style={{
|
||||
top: position.top,
|
||||
left: position.left,
|
||||
}}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className={`p-2 border-b ${isDarkMode ? 'border-gray-600' : 'border-gray-300'}`}>
|
||||
<input
|
||||
ref={searchInputRef}
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
placeholder="Search members..."
|
||||
className={`
|
||||
w-full px-2 py-1 text-xs rounded border
|
||||
${isDarkMode
|
||||
? 'bg-gray-700 border-gray-600 text-gray-100 placeholder-gray-400 focus:border-blue-500'
|
||||
: 'bg-white border-gray-300 text-gray-900 placeholder-gray-500 focus:border-blue-500'
|
||||
}
|
||||
focus:outline-none focus:ring-1 focus:ring-blue-500
|
||||
`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Members List */}
|
||||
<div className="max-h-64 overflow-y-auto">
|
||||
{filteredMembers && filteredMembers.length > 0 ? (
|
||||
filteredMembers.map((member) => (
|
||||
<div
|
||||
key={member.id}
|
||||
className={`
|
||||
flex items-center gap-2 p-2 cursor-pointer transition-colors relative
|
||||
${member.pending_invitation
|
||||
? 'opacity-50 cursor-not-allowed'
|
||||
: isDarkMode
|
||||
? 'hover:bg-gray-700'
|
||||
: 'hover:bg-gray-50'
|
||||
}
|
||||
`}
|
||||
onClick={() => {
|
||||
if (!member.pending_invitation) {
|
||||
const isSelected = checkMemberSelected(member.id || '');
|
||||
handleMemberToggle(member.id || '', !isSelected);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<Checkbox
|
||||
checked={checkMemberSelected(member.id || '')}
|
||||
onChange={(checked) => handleMemberToggle(member.id || '', checked)}
|
||||
disabled={member.pending_invitation || pendingChanges.has(member.id || '')}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
{pendingChanges.has(member.id || '') && (
|
||||
<div className={`absolute inset-0 flex items-center justify-center ${
|
||||
isDarkMode ? 'bg-gray-800/50' : 'bg-white/50'
|
||||
}`}>
|
||||
<div className={`w-3 h-3 border border-t-transparent rounded-full animate-spin ${
|
||||
isDarkMode ? 'border-blue-400' : 'border-blue-600'
|
||||
}`} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Avatar
|
||||
src={member.avatar_url}
|
||||
name={member.name || ''}
|
||||
size={24}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className={`text-xs font-medium truncate ${isDarkMode ? 'text-gray-100' : 'text-gray-900'}`}>
|
||||
{member.name}
|
||||
</div>
|
||||
<div className={`text-xs truncate ${isDarkMode ? 'text-gray-400' : 'text-gray-500'}`}>
|
||||
{member.email}
|
||||
{member.pending_invitation && (
|
||||
<span className="text-red-400 ml-1">(Pending)</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className="p-4 text-center">
|
||||
<div className={`text-xs ${isDarkMode ? 'text-gray-400' : 'text-gray-500'}`}>
|
||||
No members found
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Footer - Invite button */}
|
||||
<div className={`p-2 border-t ${isDarkMode ? 'border-gray-600' : 'border-gray-300'}`}>
|
||||
<Button
|
||||
icon={<UserAddOutlined />}
|
||||
type="text"
|
||||
onClick={handleInviteProjectMemberDrawer}
|
||||
className={`
|
||||
w-full text-left justify-start
|
||||
${isDarkMode
|
||||
? 'text-blue-400 hover:bg-gray-700'
|
||||
: 'text-blue-600 hover:bg-blue-50'
|
||||
}
|
||||
`}
|
||||
style={{ fontSize: '12px' }}
|
||||
>
|
||||
Invite team member
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AssigneeDropdownContent;
|
||||
@@ -368,7 +368,7 @@ const FilterDropdown: React.FC<{
|
||||
: `${themeClasses.buttonBg} ${themeClasses.buttonBorder} ${themeClasses.buttonText}`
|
||||
}
|
||||
hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
||||
${themeClasses.containerBg === 'bg-gray-800' ? 'focus:ring-offset-gray-900' : 'focus:ring-offset-white'}
|
||||
${isDarkMode ? 'focus:ring-offset-gray-900' : 'focus:ring-offset-white'}
|
||||
`}
|
||||
aria-expanded={isOpen}
|
||||
aria-haspopup="true"
|
||||
@@ -399,7 +399,7 @@ const FilterDropdown: React.FC<{
|
||||
placeholder={`Search ${section.label.toLowerCase()}...`}
|
||||
className={`w-full pl-8 pr-2 py-1 rounded border focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors duration-150 ${
|
||||
isDarkMode
|
||||
? 'bg-gray-700 text-gray-100 placeholder-gray-400 border-gray-600'
|
||||
? 'bg-[#141414] text-[#d9d9d9] placeholder-gray-400 border-[#303030]'
|
||||
: 'bg-white text-gray-900 placeholder-gray-400 border-gray-300'
|
||||
}`}
|
||||
/>
|
||||
@@ -539,7 +539,7 @@ const SearchFilter: React.FC<{
|
||||
placeholder={placeholder}
|
||||
className={`w-full pr-4 pl-8 py-1 rounded border focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors duration-150 ${
|
||||
isDarkMode
|
||||
? 'bg-gray-700 text-gray-100 placeholder-gray-400 border-gray-600'
|
||||
? 'bg-[#141414] text-[#d9d9d9] placeholder-gray-400 border-[#303030]'
|
||||
: 'bg-white text-gray-900 placeholder-gray-400 border-gray-300'
|
||||
}`}
|
||||
/>
|
||||
@@ -623,7 +623,7 @@ const FieldsDropdown: React.FC<{ themeClasses: any; isDarkMode: boolean }> = ({
|
||||
: `${themeClasses.buttonBg} ${themeClasses.buttonBorder} ${themeClasses.buttonText}`
|
||||
}
|
||||
hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
||||
${themeClasses.containerBg === 'bg-gray-800' ? 'focus:ring-offset-gray-900' : 'focus:ring-offset-white'}
|
||||
${isDarkMode ? 'focus:ring-offset-gray-900' : 'focus:ring-offset-white'}
|
||||
`}
|
||||
aria-expanded={open}
|
||||
aria-haspopup="true"
|
||||
@@ -748,25 +748,26 @@ const ImprovedTaskFilters: React.FC<ImprovedTaskFiltersProps> = ({
|
||||
const { projectView } = useTabSearchParam();
|
||||
|
||||
// Theme-aware class names - memoize to prevent unnecessary re-renders
|
||||
// Using task list row colors for consistency: --task-bg-primary: #1f1f1f, --task-bg-secondary: #141414
|
||||
const themeClasses = useMemo(() => ({
|
||||
containerBg: isDarkMode ? 'bg-gray-800' : 'bg-white',
|
||||
containerBorder: isDarkMode ? 'border-gray-700' : 'border-gray-200',
|
||||
buttonBg: isDarkMode ? 'bg-gray-700 hover:bg-gray-600' : 'bg-white hover:bg-gray-50',
|
||||
buttonBorder: isDarkMode ? 'border-gray-600' : 'border-gray-300',
|
||||
buttonText: isDarkMode ? 'text-gray-200' : 'text-gray-700',
|
||||
dropdownBg: isDarkMode ? 'bg-gray-800' : 'bg-white',
|
||||
dropdownBorder: isDarkMode ? 'border-gray-700' : 'border-gray-200',
|
||||
optionText: isDarkMode ? 'text-gray-200' : 'text-gray-700',
|
||||
optionHover: isDarkMode ? 'hover:bg-gray-700' : 'hover:bg-gray-50',
|
||||
secondaryText: isDarkMode ? 'text-gray-400' : 'text-gray-500',
|
||||
dividerBorder: isDarkMode ? 'border-gray-700' : 'border-gray-200',
|
||||
pillBg: isDarkMode ? 'bg-gray-700' : 'bg-gray-100',
|
||||
pillText: isDarkMode ? 'text-gray-200' : 'text-gray-700',
|
||||
containerBg: isDarkMode ? 'bg-[#1f1f1f]' : 'bg-white',
|
||||
containerBorder: isDarkMode ? 'border-[#303030]' : 'border-gray-200',
|
||||
buttonBg: isDarkMode ? 'bg-[#141414] hover:bg-[#262626]' : 'bg-white hover:bg-gray-50',
|
||||
buttonBorder: isDarkMode ? 'border-[#303030]' : 'border-gray-300',
|
||||
buttonText: isDarkMode ? 'text-[#d9d9d9]' : 'text-gray-700',
|
||||
dropdownBg: isDarkMode ? 'bg-[#1f1f1f]' : 'bg-white',
|
||||
dropdownBorder: isDarkMode ? 'border-[#303030]' : 'border-gray-200',
|
||||
optionText: isDarkMode ? 'text-[#d9d9d9]' : 'text-gray-700',
|
||||
optionHover: isDarkMode ? 'hover:bg-[#262626]' : 'hover:bg-gray-50',
|
||||
secondaryText: isDarkMode ? 'text-[#8c8c8c]' : 'text-gray-500',
|
||||
dividerBorder: isDarkMode ? 'border-[#404040]' : 'border-gray-200',
|
||||
pillBg: isDarkMode ? 'bg-[#141414]' : 'bg-gray-100',
|
||||
pillText: isDarkMode ? 'text-[#d9d9d9]' : 'text-gray-700',
|
||||
pillActiveBg: isDarkMode ? 'bg-blue-600' : 'bg-blue-100',
|
||||
pillActiveText: isDarkMode ? 'text-white' : 'text-blue-800',
|
||||
searchBg: isDarkMode ? 'bg-gray-700' : 'bg-gray-50',
|
||||
searchBorder: isDarkMode ? 'border-gray-600' : 'border-gray-300',
|
||||
searchText: isDarkMode ? 'text-gray-200' : 'text-gray-900',
|
||||
searchBg: isDarkMode ? 'bg-[#141414]' : 'bg-gray-50',
|
||||
searchBorder: isDarkMode ? 'border-[#303030]' : 'border-gray-300',
|
||||
searchText: isDarkMode ? 'text-[#d9d9d9]' : 'text-gray-900',
|
||||
}), [isDarkMode]);
|
||||
|
||||
// Initialize debounced functions
|
||||
@@ -1043,7 +1044,7 @@ const ImprovedTaskFilters: React.FC<ImprovedTaskFiltersProps> = ({
|
||||
onChange={toggleArchived}
|
||||
className={`w-3.5 h-3.5 text-blue-600 rounded focus:ring-blue-500 transition-colors duration-150 ${
|
||||
isDarkMode
|
||||
? 'border-gray-600 bg-gray-700 focus:ring-offset-gray-800'
|
||||
? 'border-[#303030] bg-[#141414] focus:ring-offset-gray-800'
|
||||
: 'border-gray-300 bg-white focus:ring-offset-white'
|
||||
}`}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import React, { useState, useCallback, Suspense } from 'react';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { IProjectTask } from '@/types/project/projectTasksViewModel.types';
|
||||
|
||||
// Lazy load the existing AssigneeSelector component only when needed (Asana-style)
|
||||
const LazyAssigneeSelector = React.lazy(() =>
|
||||
import('@/components/AssigneeSelector').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
interface LazyAssigneeSelectorProps {
|
||||
task: IProjectTask;
|
||||
groupId?: string | null;
|
||||
isDarkMode?: boolean;
|
||||
}
|
||||
|
||||
// Lightweight loading placeholder
|
||||
const LoadingPlaceholder: React.FC<{ isDarkMode: boolean }> = ({ isDarkMode }) => (
|
||||
<div
|
||||
className={`
|
||||
w-5 h-5 rounded-full border border-dashed flex items-center justify-center
|
||||
transition-colors duration-200 animate-pulse
|
||||
${isDarkMode
|
||||
? 'border-gray-600 bg-gray-800 text-gray-400'
|
||||
: 'border-gray-300 bg-gray-100 text-gray-600'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<PlusOutlined className="text-xs" />
|
||||
</div>
|
||||
);
|
||||
|
||||
const LazyAssigneeSelectorWrapper: React.FC<LazyAssigneeSelectorProps> = ({
|
||||
task,
|
||||
groupId = null,
|
||||
isDarkMode = false
|
||||
}) => {
|
||||
const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
|
||||
const [showComponent, setShowComponent] = useState(false);
|
||||
|
||||
const handleInteraction = useCallback((e: React.MouseEvent) => {
|
||||
// Don't prevent the event from bubbling, just mark as loaded
|
||||
if (!hasLoadedOnce) {
|
||||
setHasLoadedOnce(true);
|
||||
setShowComponent(true);
|
||||
}
|
||||
}, [hasLoadedOnce]);
|
||||
|
||||
// If not loaded yet, show a simple placeholder button
|
||||
if (!hasLoadedOnce) {
|
||||
return (
|
||||
<button
|
||||
onClick={handleInteraction}
|
||||
onMouseEnter={handleInteraction} // Preload on hover for better UX
|
||||
className={`
|
||||
w-5 h-5 rounded-full border border-dashed flex items-center justify-center
|
||||
transition-colors duration-200
|
||||
${isDarkMode
|
||||
? 'border-gray-600 hover:border-gray-500 hover:bg-gray-800 text-gray-400'
|
||||
: 'border-gray-300 hover:border-gray-400 hover:bg-gray-100 text-gray-600'
|
||||
}
|
||||
`}
|
||||
title="Add assignee"
|
||||
>
|
||||
<PlusOutlined className="text-xs" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
// Once loaded, show the full component
|
||||
return (
|
||||
<Suspense fallback={<LoadingPlaceholder isDarkMode={isDarkMode} />}>
|
||||
<LazyAssigneeSelector
|
||||
task={task}
|
||||
groupId={groupId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default LazyAssigneeSelectorWrapper;
|
||||
@@ -0,0 +1,101 @@
|
||||
import React, { useState, useCallback, Suspense } from 'react';
|
||||
import { CalendarOutlined } from '@ant-design/icons';
|
||||
import { formatDate } from '@/utils/date-time';
|
||||
|
||||
// Lazy load the DatePicker component only when needed
|
||||
const LazyDatePicker = React.lazy(() =>
|
||||
import('antd/es/date-picker').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
interface LazyDatePickerProps {
|
||||
value?: string | null;
|
||||
onChange?: (date: string | null) => void;
|
||||
placeholder?: string;
|
||||
isDarkMode?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
// Lightweight loading placeholder
|
||||
const DateLoadingPlaceholder: React.FC<{ isDarkMode: boolean; value?: string | null; placeholder?: string }> = ({
|
||||
isDarkMode,
|
||||
value,
|
||||
placeholder
|
||||
}) => (
|
||||
<div
|
||||
className={`
|
||||
flex items-center gap-1 px-2 py-1 text-xs rounded border cursor-pointer
|
||||
transition-colors duration-200 animate-pulse min-w-[80px]
|
||||
${isDarkMode
|
||||
? 'border-gray-600 bg-gray-800 text-gray-400'
|
||||
: 'border-gray-300 bg-gray-100 text-gray-600'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<CalendarOutlined className="text-xs" />
|
||||
<span>{value ? formatDate(value) : (placeholder || 'Select date')}</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
const LazyDatePickerWrapper: React.FC<LazyDatePickerProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
placeholder = 'Select date',
|
||||
isDarkMode = false,
|
||||
className = ''
|
||||
}) => {
|
||||
const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
|
||||
|
||||
const handleInteraction = useCallback((e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (!hasLoadedOnce) {
|
||||
setHasLoadedOnce(true);
|
||||
}
|
||||
}, [hasLoadedOnce]);
|
||||
|
||||
// If not loaded yet, show a simple placeholder
|
||||
if (!hasLoadedOnce) {
|
||||
return (
|
||||
<div
|
||||
onClick={handleInteraction}
|
||||
onMouseEnter={handleInteraction} // Preload on hover
|
||||
className={`
|
||||
flex items-center gap-1 px-2 py-1 text-xs rounded border cursor-pointer
|
||||
transition-colors duration-200 min-w-[80px] ${className}
|
||||
${isDarkMode
|
||||
? 'border-gray-600 hover:border-gray-500 hover:bg-gray-800 text-gray-400'
|
||||
: 'border-gray-300 hover:border-gray-400 hover:bg-gray-100 text-gray-600'
|
||||
}
|
||||
`}
|
||||
title="Select date"
|
||||
>
|
||||
<CalendarOutlined className="text-xs" />
|
||||
<span>{value ? formatDate(value) : placeholder}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Once loaded, show the full DatePicker
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
<DateLoadingPlaceholder
|
||||
isDarkMode={isDarkMode}
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<LazyDatePicker
|
||||
value={value ? new Date(value) : null}
|
||||
onChange={(date) => onChange?.(date ? date.toISOString() : null)}
|
||||
placeholder={placeholder}
|
||||
className={className}
|
||||
size="small"
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default LazyDatePickerWrapper;
|
||||
@@ -487,13 +487,40 @@ const TaskGroup: React.FC<TaskGroupProps> = React.memo(({
|
||||
transition: all 0.3s ease;
|
||||
padding: 0 12px;
|
||||
width: 100%;
|
||||
max-width: 500px; /* Fixed maximum width */
|
||||
min-width: 300px; /* Minimum width for mobile */
|
||||
min-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 0 0 6px 6px;
|
||||
margin-left: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.task-group-add-task:hover {
|
||||
background: var(--task-hover-bg, #fafafa);
|
||||
transform: translateX(2px);
|
||||
}
|
||||
|
||||
/* Responsive adjustments for add task row */
|
||||
@media (max-width: 768px) {
|
||||
.task-group-add-task {
|
||||
max-width: 400px;
|
||||
min-width: 280px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.task-group-add-task {
|
||||
max-width: calc(100vw - 40px);
|
||||
min-width: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.task-group-add-task {
|
||||
max-width: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
.task-table-fixed-columns {
|
||||
|
||||
@@ -98,6 +98,11 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
|
||||
// Prevent duplicate API calls in React StrictMode
|
||||
const hasInitialized = useRef(false);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Frame rate monitoring and throttling
|
||||
const frameTimeRef = useRef(performance.now());
|
||||
const renderCountRef = useRef(0);
|
||||
const [shouldThrottle, setShouldThrottle] = useState(false);
|
||||
|
||||
|
||||
// Refs for performance optimization
|
||||
@@ -119,19 +124,21 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
const isDarkMode = useSelector((state: RootState) => state.themeReducer?.mode === 'dark');
|
||||
const themeClass = isDarkMode ? 'dark' : 'light';
|
||||
|
||||
// Build a tasksById map for efficient lookup
|
||||
// PERFORMANCE OPTIMIZATION: Build a tasksById map with memory-conscious approach
|
||||
const tasksById = useMemo(() => {
|
||||
const map: Record<string, Task> = {};
|
||||
// Cache all tasks for full functionality - performance optimizations are handled at the virtualization level
|
||||
tasks.forEach(task => { map[task.id] = task; });
|
||||
return map;
|
||||
}, [tasks]);
|
||||
|
||||
// Drag and Drop sensors - optimized for better performance
|
||||
// Drag and Drop sensors - optimized for smoother experience
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor, {
|
||||
activationConstraint: {
|
||||
distance: 0, // No distance requirement for immediate response
|
||||
distance: 3, // Small distance to prevent accidental drags
|
||||
delay: 0, // No delay for immediate activation
|
||||
tolerance: 5, // Tolerance for small movements
|
||||
},
|
||||
}),
|
||||
useSensor(KeyboardSensor, {
|
||||
@@ -139,59 +146,44 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
})
|
||||
);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Monitor frame rate and enable throttling if needed
|
||||
useEffect(() => {
|
||||
const monitorPerformance = () => {
|
||||
const now = performance.now();
|
||||
const frameTime = now - frameTimeRef.current;
|
||||
renderCountRef.current++;
|
||||
|
||||
// If frame time is consistently over 16.67ms (60fps), enable throttling
|
||||
if (frameTime > 20 && renderCountRef.current > 10) {
|
||||
setShouldThrottle(true);
|
||||
} else if (frameTime < 12 && renderCountRef.current > 50) {
|
||||
setShouldThrottle(false);
|
||||
renderCountRef.current = 0; // Reset counter
|
||||
}
|
||||
|
||||
frameTimeRef.current = now;
|
||||
};
|
||||
|
||||
const interval = setInterval(monitorPerformance, 100);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
// Fetch task groups when component mounts or dependencies change
|
||||
useEffect(() => {
|
||||
if (projectId && !hasInitialized.current) {
|
||||
hasInitialized.current = true;
|
||||
|
||||
// Start performance monitoring
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const stopPerformanceCheck = debugPerformance.runPerformanceCheck();
|
||||
|
||||
// Monitor task loading performance
|
||||
const startTime = performance.now();
|
||||
|
||||
// Monitor API call specifically
|
||||
const apiStartTime = performance.now();
|
||||
|
||||
// Fetch real tasks from V3 API (minimal processing needed)
|
||||
dispatch(fetchTasksV3(projectId)).then((result: any) => {
|
||||
const apiTime = performance.now() - apiStartTime;
|
||||
const totalLoadTime = performance.now() - startTime;
|
||||
|
||||
console.log(`API call took: ${apiTime.toFixed(2)}ms`);
|
||||
console.log(`Total task loading took: ${totalLoadTime.toFixed(2)}ms`);
|
||||
console.log(`Tasks loaded: ${result.payload?.tasks?.length || 0}`);
|
||||
console.log(`Groups created: ${result.payload?.groups?.length || 0}`);
|
||||
|
||||
if (apiTime > 5000) {
|
||||
console.error(`🚨 API call is extremely slow: ${apiTime.toFixed(2)}ms - Check backend performance`);
|
||||
}
|
||||
|
||||
if (totalLoadTime > 1000) {
|
||||
console.warn(`🚨 Slow task loading detected: ${totalLoadTime.toFixed(2)}ms`);
|
||||
}
|
||||
|
||||
// Log performance metrics after loading
|
||||
debugPerformance.logMemoryUsage();
|
||||
debugPerformance.logDOMNodes();
|
||||
|
||||
return stopPerformanceCheck;
|
||||
}).catch((error) => {
|
||||
console.error('Task loading failed:', error);
|
||||
return stopPerformanceCheck;
|
||||
});
|
||||
} else {
|
||||
// Fetch real tasks from V3 API (minimal processing needed)
|
||||
dispatch(fetchTasksV3(projectId));
|
||||
}
|
||||
// Fetch real tasks from V3 API (minimal processing needed)
|
||||
dispatch(fetchTasksV3(projectId));
|
||||
}
|
||||
}, [projectId, dispatch]);
|
||||
|
||||
// Memoized calculations - optimized
|
||||
const totalTasks = useMemo(() => {
|
||||
return taskGroups.reduce((total, g) => total + g.taskIds.length, 0);
|
||||
}, [taskGroups]);
|
||||
const total = taskGroups.reduce((sum, g) => sum + g.taskIds.length, 0);
|
||||
console.log(`[TASK-LIST-BOARD] Total tasks in groups: ${total}, Total tasks in store: ${tasks.length}, Groups: ${taskGroups.length}`);
|
||||
return total;
|
||||
}, [taskGroups, tasks.length]);
|
||||
|
||||
const hasAnyTasks = useMemo(() => totalTasks > 0, [totalTasks]);
|
||||
|
||||
@@ -231,55 +223,53 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
[tasks, currentGrouping]
|
||||
);
|
||||
|
||||
// Immediate drag over handler for instant response
|
||||
const handleDragOver = useCallback((event: DragOverEvent) => {
|
||||
const { active, over } = event;
|
||||
// Throttled drag over handler for smoother performance
|
||||
const handleDragOver = useCallback(
|
||||
throttle((event: DragOverEvent) => {
|
||||
const { active, over } = event;
|
||||
|
||||
if (!over || !dragState.activeTask) return;
|
||||
if (!over || !dragState.activeTask) return;
|
||||
|
||||
const activeTaskId = active.id as string;
|
||||
const overContainer = over.id as string;
|
||||
const activeTaskId = active.id as string;
|
||||
const overContainer = over.id as string;
|
||||
|
||||
// Clear any existing timeout
|
||||
if (dragOverTimeoutRef.current) {
|
||||
clearTimeout(dragOverTimeoutRef.current);
|
||||
}
|
||||
// PERFORMANCE OPTIMIZATION: Immediate response for instant UX
|
||||
// Only update if we're hovering over a different container
|
||||
const targetTask = tasks.find(t => t.id === overContainer);
|
||||
let targetGroupId = overContainer;
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Immediate response for instant UX
|
||||
// Only update if we're hovering over a different container
|
||||
const targetTask = tasks.find(t => t.id === overContainer);
|
||||
let targetGroupId = overContainer;
|
||||
|
||||
if (targetTask) {
|
||||
// PERFORMANCE OPTIMIZATION: Use switch instead of multiple if statements
|
||||
switch (currentGrouping) {
|
||||
case 'status':
|
||||
targetGroupId = `status-${targetTask.status}`;
|
||||
break;
|
||||
case 'priority':
|
||||
targetGroupId = `priority-${targetTask.priority}`;
|
||||
break;
|
||||
case 'phase':
|
||||
targetGroupId = `phase-${targetTask.phase}`;
|
||||
break;
|
||||
if (targetTask) {
|
||||
// PERFORMANCE OPTIMIZATION: Use switch instead of multiple if statements
|
||||
switch (currentGrouping) {
|
||||
case 'status':
|
||||
targetGroupId = `status-${targetTask.status}`;
|
||||
break;
|
||||
case 'priority':
|
||||
targetGroupId = `priority-${targetTask.priority}`;
|
||||
break;
|
||||
case 'phase':
|
||||
targetGroupId = `phase-${targetTask.phase}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetGroupId !== dragState.activeGroupId) {
|
||||
// PERFORMANCE OPTIMIZATION: Use findIndex for better performance
|
||||
const targetGroupIndex = taskGroups.findIndex(g => g.id === targetGroupId);
|
||||
if (targetGroupIndex !== -1) {
|
||||
const targetGroup = taskGroups[targetGroupIndex];
|
||||
dispatch(
|
||||
optimisticTaskMove({
|
||||
taskId: activeTaskId,
|
||||
newGroupId: targetGroupId,
|
||||
newIndex: targetGroup.taskIds.length,
|
||||
})
|
||||
);
|
||||
if (targetGroupId !== dragState.activeGroupId) {
|
||||
// PERFORMANCE OPTIMIZATION: Use findIndex for better performance
|
||||
const targetGroupIndex = taskGroups.findIndex(g => g.id === targetGroupId);
|
||||
if (targetGroupIndex !== -1) {
|
||||
const targetGroup = taskGroups[targetGroupIndex];
|
||||
dispatch(
|
||||
optimisticTaskMove({
|
||||
taskId: activeTaskId,
|
||||
newGroupId: targetGroupId,
|
||||
newIndex: targetGroup.taskIds.length,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [dragState, tasks, taskGroups, currentGrouping, dispatch]);
|
||||
}, 16), // 60fps throttling for smooth performance
|
||||
[dragState, tasks, taskGroups, currentGrouping, dispatch]
|
||||
);
|
||||
|
||||
const handleDragEnd = useCallback(
|
||||
(event: DragEndEvent) => {
|
||||
@@ -393,7 +383,6 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
|
||||
const handleToggleSubtasks = useCallback((taskId: string) => {
|
||||
// Implementation for toggling subtasks
|
||||
console.log('Toggle subtasks for task:', taskId);
|
||||
}, []);
|
||||
|
||||
// Memoized DragOverlay content for better performance
|
||||
@@ -448,79 +437,88 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
</div>
|
||||
|
||||
{/* Performance Analysis - Only show in development */}
|
||||
{process.env.NODE_ENV === 'development' && (
|
||||
{/* {process.env.NODE_ENV === 'development' && (
|
||||
<PerformanceAnalysis projectId={projectId} />
|
||||
)}
|
||||
)} */}
|
||||
|
||||
{/* Virtualized Task Groups Container */}
|
||||
<div className="task-groups-container">
|
||||
{loading ? (
|
||||
<Card>
|
||||
<div className="flex justify-center items-center py-8">
|
||||
<Spin size="large" />
|
||||
{/* Fixed Height Task Groups Container - Asana Style */}
|
||||
<div className="task-groups-container-fixed">
|
||||
<div className="task-groups-scrollable">
|
||||
{loading ? (
|
||||
<div className="loading-container">
|
||||
<div className="flex justify-center items-center py-8">
|
||||
<Spin size="large" />
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
) : taskGroups.length === 0 ? (
|
||||
<Card>
|
||||
<Empty
|
||||
description={
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<div style={{ fontSize: '14px', fontWeight: 500, marginBottom: '4px' }}>
|
||||
No task groups available
|
||||
) : taskGroups.length === 0 ? (
|
||||
<div className="empty-container">
|
||||
<Empty
|
||||
description={
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<div style={{ fontSize: '14px', fontWeight: 500, marginBottom: '4px' }}>
|
||||
No task groups available
|
||||
</div>
|
||||
<div style={{ fontSize: '12px', color: 'var(--task-text-secondary, #595959)' }}>
|
||||
Create tasks to see them organized in groups
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ fontSize: '12px', color: 'var(--task-text-secondary, #595959)' }}>
|
||||
Create tasks to see them organized in groups
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
/>
|
||||
</Card>
|
||||
) : (
|
||||
<div className="virtualized-task-groups">
|
||||
{taskGroups.map((group, index) => {
|
||||
// PERFORMANCE OPTIMIZATION: Pre-calculate height values to avoid recalculation
|
||||
const groupTasks = group.taskIds.length;
|
||||
const baseHeight = 120; // Header + column headers + add task row
|
||||
const taskRowsHeight = groupTasks * 40; // 40px per task row
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Simplified height calculation
|
||||
const shouldVirtualizeGroup = groupTasks > 15; // Reduced threshold
|
||||
const minGroupHeight = shouldVirtualizeGroup ? 180 : 120; // Smaller minimum
|
||||
const maxGroupHeight = shouldVirtualizeGroup ? 600 : 300; // Smaller maximum
|
||||
const calculatedHeight = baseHeight + taskRowsHeight;
|
||||
const groupHeight = Math.max(
|
||||
minGroupHeight,
|
||||
Math.min(calculatedHeight, maxGroupHeight)
|
||||
);
|
||||
}
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="virtualized-task-groups">
|
||||
{taskGroups.map((group, index) => {
|
||||
// PERFORMANCE OPTIMIZATION: More aggressive height calculation for better performance
|
||||
const groupTasks = group.taskIds.length;
|
||||
const baseHeight = 120; // Header + column headers + add task row
|
||||
const taskRowsHeight = groupTasks * 40; // 40px per task row
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Enhanced virtualization threshold for better UX
|
||||
const shouldVirtualizeGroup = groupTasks > 25; // Increased threshold for smoother experience
|
||||
const minGroupHeight = shouldVirtualizeGroup ? 200 : 120; // Minimum height for virtualized groups
|
||||
const maxGroupHeight = shouldVirtualizeGroup ? 600 : 1000; // Allow more height for virtualized groups
|
||||
const calculatedHeight = baseHeight + taskRowsHeight;
|
||||
const groupHeight = Math.max(
|
||||
minGroupHeight,
|
||||
Math.min(calculatedHeight, maxGroupHeight)
|
||||
);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Memoize group rendering
|
||||
return (
|
||||
<VirtualizedTaskList
|
||||
key={group.id}
|
||||
group={group}
|
||||
projectId={projectId}
|
||||
currentGrouping={
|
||||
(currentGrouping as 'status' | 'priority' | 'phase') || 'status'
|
||||
}
|
||||
selectedTaskIds={selectedTaskIds}
|
||||
onSelectTask={handleSelectTask}
|
||||
onToggleSubtasks={handleToggleSubtasks}
|
||||
height={groupHeight}
|
||||
width={1200}
|
||||
tasksById={tasksById}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
// PERFORMANCE OPTIMIZATION: Removed group throttling to show all tasks
|
||||
// Virtualization within each group handles performance for large task lists
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Memoize group rendering
|
||||
return (
|
||||
<VirtualizedTaskList
|
||||
key={group.id}
|
||||
group={group}
|
||||
projectId={projectId}
|
||||
currentGrouping={
|
||||
(currentGrouping as 'status' | 'priority' | 'phase') || 'status'
|
||||
}
|
||||
selectedTaskIds={selectedTaskIds}
|
||||
onSelectTask={handleSelectTask}
|
||||
onToggleSubtasks={handleToggleSubtasks}
|
||||
height={groupHeight}
|
||||
width={1200}
|
||||
tasksById={tasksById}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DragOverlay
|
||||
adjustScale={false}
|
||||
dropAnimation={null}
|
||||
dropAnimation={{
|
||||
duration: 200,
|
||||
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)',
|
||||
}}
|
||||
style={{
|
||||
cursor: 'grabbing',
|
||||
zIndex: 9999,
|
||||
}}
|
||||
>
|
||||
{dragOverlayContent}
|
||||
@@ -528,13 +526,87 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
</DndContext>
|
||||
|
||||
<style>{`
|
||||
.task-groups-container {
|
||||
padding: 8px 8px 8px 0;
|
||||
border-radius: 8px;
|
||||
/* Fixed height container - Asana style */
|
||||
.task-groups-container-fixed {
|
||||
height: calc(100vh - 200px); /* Fixed height, adjust based on your header height */
|
||||
min-height: 400px;
|
||||
max-height: calc(100vh - 120px);
|
||||
position: relative;
|
||||
border: 1px solid var(--task-border-primary, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
background: var(--task-bg-primary, white);
|
||||
overflow: hidden;
|
||||
/* GPU acceleration for smooth scrolling */
|
||||
transform: translateZ(0);
|
||||
will-change: scroll-position;
|
||||
/* Responsive adjustments */
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* Responsive height adjustments */
|
||||
@media (max-height: 800px) {
|
||||
.task-groups-container-fixed {
|
||||
height: calc(100vh - 160px);
|
||||
min-height: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 600px) {
|
||||
.task-groups-container-fixed {
|
||||
height: calc(100vh - 120px);
|
||||
min-height: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-height: 1200px) {
|
||||
.task-groups-container-fixed {
|
||||
height: calc(100vh - 240px);
|
||||
max-height: none;
|
||||
}
|
||||
}
|
||||
|
||||
.task-groups-scrollable {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 8px 8px 8px 0;
|
||||
/* Smooth scrolling */
|
||||
scroll-behavior: smooth;
|
||||
/* Custom scrollbar styling */
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--task-border-tertiary, #d9d9d9) transparent;
|
||||
/* Performance optimizations */
|
||||
contain: layout style paint;
|
||||
transform: translateZ(0);
|
||||
will-change: scroll-position;
|
||||
}
|
||||
|
||||
.task-groups-scrollable::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.task-groups-scrollable::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.task-groups-scrollable::-webkit-scrollbar-thumb {
|
||||
background-color: var(--task-border-tertiary, #d9d9d9);
|
||||
border-radius: 3px;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.task-groups-scrollable::-webkit-scrollbar-thumb:hover {
|
||||
background-color: var(--task-border-primary, #e8e8e8);
|
||||
}
|
||||
|
||||
/* Loading and empty state containers */
|
||||
.loading-container,
|
||||
.empty-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.virtualized-task-groups {
|
||||
@@ -565,7 +637,7 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
|
||||
.task-group-header-row {
|
||||
display: inline-flex;
|
||||
height: auto;
|
||||
height: inherit;
|
||||
max-height: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -627,37 +699,76 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Add task row styles */
|
||||
/* Add task row styles - Fixed width responsive design */
|
||||
.task-group-add-task {
|
||||
background: var(--task-bg-primary, white);
|
||||
border-top: 1px solid var(--task-border-secondary, #f0f0f0);
|
||||
transition: all 0.3s ease;
|
||||
padding: 0 12px;
|
||||
width: 100%;
|
||||
max-width: 500px; /* Fixed maximum width */
|
||||
min-width: 300px; /* Minimum width for mobile */
|
||||
min-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 0 0 6px 6px;
|
||||
margin-left: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.task-group-add-task:hover {
|
||||
background: var(--task-hover-bg, #fafafa);
|
||||
transform: translateX(2px);
|
||||
}
|
||||
|
||||
/* Responsive adjustments for add task row */
|
||||
@media (max-width: 768px) {
|
||||
.task-group-add-task {
|
||||
max-width: 400px;
|
||||
min-width: 280px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.task-group-add-task {
|
||||
max-width: calc(100vw - 40px);
|
||||
min-width: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.task-group-add-task {
|
||||
max-width: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
.task-table-fixed-columns {
|
||||
display: flex;
|
||||
background: var(--task-bg-secondary, #f5f5f5);
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 11;
|
||||
border-right: 2px solid var(--task-border-primary, #e8e8e8);
|
||||
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
/* Background will be set inline to match theme */
|
||||
}
|
||||
|
||||
/* Ensure task rows have proper overflow handling */
|
||||
.task-row-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-width: fit-content;
|
||||
}
|
||||
|
||||
.task-row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-width: fit-content;
|
||||
}
|
||||
|
||||
.task-table-scrollable-columns {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.task-table-cell {
|
||||
@@ -700,6 +811,43 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
/* Simplified drag overlay styles */
|
||||
.drag-overlay-simplified {
|
||||
position: relative;
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
transform: translateZ(0);
|
||||
will-change: transform;
|
||||
user-select: none;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
animation: dragOverlayEntrance 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
}
|
||||
|
||||
@keyframes dragOverlayEntrance {
|
||||
0% {
|
||||
transform: scale(0.95) translateZ(0);
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1.02) translateZ(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.drag-overlay-simplified:hover {
|
||||
/* Disable hover effects during drag */
|
||||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
/* Smooth drag handle animation */
|
||||
.drag-handle-icon {
|
||||
transition: transform 0.1s ease-out;
|
||||
}
|
||||
|
||||
.task-title-drag {
|
||||
transition: color 0.1s ease-out;
|
||||
}
|
||||
|
||||
/* Ensure drag overlay follows cursor properly */
|
||||
[data-dnd-context] {
|
||||
position: relative;
|
||||
@@ -742,8 +890,10 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
--task-drag-over-border: #40a9ff;
|
||||
}
|
||||
|
||||
.dark .task-groups-container,
|
||||
[data-theme="dark"] .task-groups-container {
|
||||
.dark .task-groups-container-fixed,
|
||||
[data-theme="dark"] .task-groups-container-fixed,
|
||||
.dark .task-groups-scrollable,
|
||||
[data-theme="dark"] .task-groups-scrollable {
|
||||
--task-bg-primary: #1f1f1f;
|
||||
--task-bg-secondary: #141414;
|
||||
--task-bg-tertiary: #262626;
|
||||
@@ -761,6 +911,17 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
--task-drag-over-border: #40a9ff;
|
||||
}
|
||||
|
||||
/* Dark mode scrollbar */
|
||||
.dark .task-groups-scrollable::-webkit-scrollbar-thumb,
|
||||
[data-theme="dark"] .task-groups-scrollable::-webkit-scrollbar-thumb {
|
||||
background-color: #505050;
|
||||
}
|
||||
|
||||
.dark .task-groups-scrollable::-webkit-scrollbar-thumb:hover,
|
||||
[data-theme="dark"] .task-groups-scrollable::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #606060;
|
||||
}
|
||||
|
||||
/* Dark mode empty state */
|
||||
.dark .empty-tasks-container .ant-empty-description,
|
||||
[data-theme="dark"] .empty-tasks-container .ant-empty-description {
|
||||
@@ -779,6 +940,20 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
|
||||
.task-row {
|
||||
contain: layout style;
|
||||
/* GPU acceleration for smooth scrolling */
|
||||
transform: translateZ(0);
|
||||
will-change: transform;
|
||||
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.task-row.is-dragging {
|
||||
transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), filter 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* Smooth hover effects */
|
||||
.task-row:hover:not(.is-dragging) {
|
||||
transform: translateZ(0) translateY(-1px);
|
||||
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* Reduce layout thrashing */
|
||||
@@ -786,6 +961,33 @@ const TaskListBoard: React.FC<TaskListBoardProps> = ({ projectId, className = ''
|
||||
contain: layout;
|
||||
}
|
||||
|
||||
/* Optimize progressive component loading */
|
||||
.progressive-component-placeholder {
|
||||
contain: layout style paint;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
/* Shimmer animation optimization */
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
background-position: -200px 0;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
background-position: calc(200px + 100%) 0;
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimize shimmer performance */
|
||||
.shimmer-element {
|
||||
background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.2) 50%, transparent 75%);
|
||||
background-size: 200px 100%;
|
||||
animation: shimmer 1.5s infinite linear;
|
||||
transform: translateZ(0);
|
||||
will-change: background-position;
|
||||
}
|
||||
|
||||
/* React Window specific optimizations */
|
||||
.react-window-list {
|
||||
outline: none;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { dayjs } from './antd-imports';
|
||||
// Performance constants
|
||||
export const PERFORMANCE_CONSTANTS = {
|
||||
CACHE_CLEAR_INTERVAL: 300000, // 5 minutes
|
||||
VIRTUALIZATION_THRESHOLD: 50,
|
||||
VIRTUALIZATION_THRESHOLD: 25, // Updated to match main virtualization threshold
|
||||
DRAG_THROTTLE_MS: 50,
|
||||
RENDER_TIMEOUT_MS: 16, // 60fps target
|
||||
MAX_CACHE_SIZE: 1000,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useMemo, useCallback, useState, useRef, useEffect } from 'react';
|
||||
import React, { useMemo, useCallback, useState, useRef, useEffect, lazy } from 'react';
|
||||
import { useSortable } from '@dnd-kit/sortable';
|
||||
import { CSS } from '@dnd-kit/utilities';
|
||||
import { useSelector } from 'react-redux';
|
||||
@@ -170,6 +170,192 @@ const TaskReporter = React.memo<{ reporter?: string; isDarkMode: boolean }>(({ r
|
||||
</div>
|
||||
));
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Lightweight placeholder components for better performance
|
||||
const AssigneePlaceholder = React.memo<{ isDarkMode: boolean; memberCount?: number }>(({ isDarkMode, memberCount = 0 }) => (
|
||||
<div className="flex items-center gap-1">
|
||||
{memberCount > 0 ? (
|
||||
<div className="flex -space-x-1">
|
||||
{Array.from({ length: Math.min(memberCount, 3) }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className={`w-6 h-6 rounded-full border-2 ${
|
||||
isDarkMode ? 'bg-gray-600 border-gray-700' : 'bg-gray-200 border-gray-300'
|
||||
}`}
|
||||
style={{ zIndex: 3 - i }}
|
||||
/>
|
||||
))}
|
||||
{memberCount > 3 && (
|
||||
<div
|
||||
className={`w-6 h-6 rounded-full border-2 flex items-center justify-center text-xs font-medium ${
|
||||
isDarkMode
|
||||
? 'bg-gray-600 border-gray-700 text-gray-300'
|
||||
: 'bg-gray-200 border-gray-300 text-gray-600'
|
||||
}`}
|
||||
style={{ zIndex: 0 }}
|
||||
>
|
||||
+{memberCount - 3}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className={`w-6 h-6 rounded-full ${isDarkMode ? 'bg-gray-600' : 'bg-gray-200'}`} />
|
||||
)}
|
||||
<div className={`w-4 h-4 rounded ${isDarkMode ? 'bg-gray-600' : 'bg-gray-200'}`} />
|
||||
</div>
|
||||
));
|
||||
|
||||
const StatusPlaceholder = React.memo<{ status?: string; isDarkMode: boolean }>(({ status, isDarkMode }) => (
|
||||
<div
|
||||
className={`px-2 py-1 text-xs rounded-full min-w-16 h-6 flex items-center justify-center ${
|
||||
isDarkMode ? 'bg-gray-600 text-gray-300' : 'bg-gray-200 text-gray-600'
|
||||
}`}
|
||||
>
|
||||
{status || '...'}
|
||||
</div>
|
||||
));
|
||||
|
||||
const PriorityPlaceholder = React.memo<{ priority?: string; isDarkMode: boolean }>(({ priority, isDarkMode }) => (
|
||||
<div className="flex items-center gap-2">
|
||||
<div className={`w-2 h-2 rounded-full ${isDarkMode ? 'bg-gray-500' : 'bg-gray-300'}`} />
|
||||
<span className={`text-xs ${isDarkMode ? 'text-gray-300' : 'text-gray-600'}`}>
|
||||
{priority || '...'}
|
||||
</span>
|
||||
</div>
|
||||
));
|
||||
|
||||
const PhasePlaceholder = React.memo<{ phase?: string; isDarkMode: boolean }>(({ phase, isDarkMode }) => (
|
||||
<div
|
||||
className={`px-2 py-1 text-xs rounded min-w-16 h-6 flex items-center justify-center ${
|
||||
isDarkMode ? 'bg-gray-600 text-gray-300' : 'bg-gray-200 text-gray-600'
|
||||
}`}
|
||||
>
|
||||
{phase || '...'}
|
||||
</div>
|
||||
));
|
||||
|
||||
const LabelsPlaceholder = React.memo<{ labelCount?: number; isDarkMode: boolean }>(({ labelCount = 0, isDarkMode }) => (
|
||||
<div className="flex items-center gap-1 flex-wrap">
|
||||
{labelCount > 0 ? (
|
||||
Array.from({ length: Math.min(labelCount, 3) }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className={`px-2 py-0.5 text-xs rounded-full ${
|
||||
isDarkMode ? 'bg-gray-600 text-gray-300' : 'bg-gray-200 text-gray-600'
|
||||
}`}
|
||||
style={{
|
||||
width: `${40 + Math.random() * 30}px`,
|
||||
height: '20px'
|
||||
}}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<div className={`w-4 h-4 rounded ${isDarkMode ? 'bg-gray-600' : 'bg-gray-200'}`} />
|
||||
)}
|
||||
</div>
|
||||
));
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Simplified placeholders without animations under memory pressure
|
||||
const SimplePlaceholder = React.memo<{ width: number; height: number; isDarkMode: boolean }>(({ width, height, isDarkMode }) => (
|
||||
<div
|
||||
className={`rounded ${isDarkMode ? 'bg-gray-600' : 'bg-gray-200'}`}
|
||||
style={{ width, height }}
|
||||
/>
|
||||
));
|
||||
|
||||
// Lazy-loaded components with Suspense fallbacks
|
||||
const LazyAssigneeSelector = React.lazy(() =>
|
||||
import('./lazy-assignee-selector').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
const LazyTaskStatusDropdown = React.lazy(() =>
|
||||
import('./task-status-dropdown').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
const LazyTaskPriorityDropdown = React.lazy(() =>
|
||||
import('./task-priority-dropdown').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
const LazyTaskPhaseDropdown = React.lazy(() =>
|
||||
import('./task-phase-dropdown').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
const LazyLabelsSelector = React.lazy(() =>
|
||||
import('@/components/LabelsSelector').then(module => ({ default: module.default }))
|
||||
);
|
||||
|
||||
// Enhanced component wrapper with progressive loading
|
||||
const ProgressiveComponent = React.memo<{
|
||||
isLoaded: boolean;
|
||||
placeholder: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
fallback?: React.ReactNode;
|
||||
}>(({ isLoaded, placeholder, children, fallback }) => {
|
||||
if (!isLoaded) {
|
||||
return <>{placeholder}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Suspense fallback={fallback || placeholder}>
|
||||
{children}
|
||||
</React.Suspense>
|
||||
);
|
||||
});
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Frame-rate aware rendering hooks
|
||||
const useFrameRateOptimizedLoading = (index?: number) => {
|
||||
const [canRender, setCanRender] = useState((index !== undefined && index < 3) || false);
|
||||
const renderRequestRef = useRef<number | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (index === undefined || canRender) return;
|
||||
|
||||
// Use requestIdleCallback for non-critical rendering
|
||||
const scheduleRender = () => {
|
||||
if ('requestIdleCallback' in window) {
|
||||
(window as any).requestIdleCallback(() => {
|
||||
setCanRender(true);
|
||||
}, { timeout: 100 });
|
||||
} else {
|
||||
// Fallback for browsers without requestIdleCallback
|
||||
setTimeout(() => setCanRender(true), 50);
|
||||
}
|
||||
};
|
||||
|
||||
renderRequestRef.current = requestAnimationFrame(scheduleRender);
|
||||
|
||||
return () => {
|
||||
if (renderRequestRef.current) {
|
||||
cancelAnimationFrame(renderRequestRef.current);
|
||||
}
|
||||
};
|
||||
}, [index, canRender]);
|
||||
|
||||
return canRender;
|
||||
};
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Memory pressure detection
|
||||
const useMemoryPressure = () => {
|
||||
const [isUnderPressure, setIsUnderPressure] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!('memory' in performance)) return;
|
||||
|
||||
const checkMemory = () => {
|
||||
const memory = (performance as any).memory;
|
||||
if (memory) {
|
||||
const usedRatio = memory.usedJSHeapSize / memory.jsHeapSizeLimit;
|
||||
setIsUnderPressure(usedRatio > 0.6); // Conservative threshold
|
||||
}
|
||||
};
|
||||
|
||||
checkMemory();
|
||||
const interval = setInterval(checkMemory, 2000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
|
||||
return isUnderPressure;
|
||||
};
|
||||
|
||||
const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
task,
|
||||
projectId,
|
||||
@@ -184,12 +370,18 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
fixedColumns,
|
||||
scrollableColumns,
|
||||
}) => {
|
||||
// PERFORMANCE OPTIMIZATION: Aggressive progressive loading for large lists
|
||||
// Only fully load first 5 tasks and tasks that are visible
|
||||
const [isFullyLoaded, setIsFullyLoaded] = useState((index !== undefined && index < 5) || false);
|
||||
// PERFORMANCE OPTIMIZATION: Frame-rate aware loading
|
||||
const canRenderComplex = useFrameRateOptimizedLoading(index);
|
||||
const isMemoryPressured = useMemoryPressure();
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: More aggressive performance - only load first 2 immediately
|
||||
const [isFullyLoaded, setIsFullyLoaded] = useState((index !== undefined && index < 2) || false);
|
||||
const [isIntersecting, setIsIntersecting] = useState(false);
|
||||
const rowRef = useRef<HTMLDivElement>(null);
|
||||
const hasBeenFullyLoadedOnce = useRef((index !== undefined && index < 5) || false); // Track if we've ever been fully loaded
|
||||
const hasBeenFullyLoadedOnce = useRef((index !== undefined && index < 2) || false);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Conditional component loading based on memory pressure
|
||||
const [shouldShowComponents, setShouldShowComponents] = useState((index !== undefined && index < 2) || false);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Only connect to socket after component is visible
|
||||
const { socket, connected } = useSocket();
|
||||
@@ -216,15 +408,20 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
const [entry] = entries;
|
||||
if (entry.isIntersecting && !isIntersecting && !hasBeenFullyLoadedOnce.current) {
|
||||
setIsIntersecting(true);
|
||||
// More aggressive loading - load immediately when visible
|
||||
// Immediate loading when intersecting - no delay
|
||||
setIsFullyLoaded(true);
|
||||
hasBeenFullyLoadedOnce.current = true; // Mark as fully loaded once
|
||||
|
||||
// Add a tiny delay for component loading to prevent browser freeze
|
||||
setTimeout(() => {
|
||||
setShouldShowComponents(true);
|
||||
}, 8); // Half frame delay for even more responsive experience
|
||||
}
|
||||
},
|
||||
{
|
||||
root: null,
|
||||
rootMargin: '50px', // Reduced from 100px - load closer to viewport
|
||||
threshold: 0.1,
|
||||
rootMargin: '200px', // Increased to load components earlier before they're visible
|
||||
threshold: 0, // Load as soon as any part enters the extended viewport
|
||||
}
|
||||
);
|
||||
|
||||
@@ -237,11 +434,14 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Skip expensive operations during initial render
|
||||
// Once fully loaded, always render full to prevent blanking during real-time updates
|
||||
const shouldRenderFull = isFullyLoaded || hasBeenFullyLoadedOnce.current || isDragOverlay || editTaskName;
|
||||
const shouldRenderFull = (isFullyLoaded && shouldShowComponents) || hasBeenFullyLoadedOnce.current || isDragOverlay || editTaskName;
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Minimal initial render for non-visible tasks
|
||||
// Only render essential columns during initial load to reduce DOM nodes
|
||||
const shouldRenderMinimal = !shouldRenderFull && !isDragOverlay;
|
||||
|
||||
// DRAG OVERLAY: When dragging, show only task name for cleaner experience
|
||||
const shouldRenderDragOverlay = isDragOverlay;
|
||||
|
||||
// REAL-TIME UPDATES: Ensure content stays loaded during socket updates
|
||||
useEffect(() => {
|
||||
@@ -277,6 +477,22 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
// Translation hook
|
||||
const { t } = useTranslation('task-management');
|
||||
|
||||
// Optimized task name save handler
|
||||
const handleTaskNameSave = useCallback(() => {
|
||||
const newTaskName = taskName?.trim();
|
||||
if (newTaskName && connected && newTaskName !== task.title) {
|
||||
socket?.emit(
|
||||
SocketEvents.TASK_NAME_CHANGE.toString(),
|
||||
JSON.stringify({
|
||||
task_id: task.id,
|
||||
name: newTaskName,
|
||||
parent_task: null,
|
||||
})
|
||||
);
|
||||
}
|
||||
setEditTaskName(false);
|
||||
}, [connected, socket, task.id, task.title, taskName]);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Only setup click outside detection when editing
|
||||
useEffect(() => {
|
||||
if (!editTaskName || !shouldRenderFull) return;
|
||||
@@ -293,23 +509,7 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleClickOutside);
|
||||
};
|
||||
}, [editTaskName, shouldRenderFull]);
|
||||
|
||||
// Optimized task name save handler
|
||||
const handleTaskNameSave = useCallback(() => {
|
||||
const newTaskName = taskName?.trim();
|
||||
if (newTaskName && connected && newTaskName !== task.title) {
|
||||
socket?.emit(
|
||||
SocketEvents.TASK_NAME_CHANGE.toString(),
|
||||
JSON.stringify({
|
||||
task_id: task.id,
|
||||
name: newTaskName,
|
||||
parent_task: null,
|
||||
})
|
||||
);
|
||||
}
|
||||
setEditTaskName(false);
|
||||
}, [connected, socket, task.id, task.title, taskName]);
|
||||
}, [editTaskName, shouldRenderFull, handleTaskNameSave]);
|
||||
|
||||
// Handle adding new subtask
|
||||
const handleAddSubtask = useCallback(() => {
|
||||
@@ -340,11 +540,12 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
|
||||
return {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition: 'none', // Disable all transitions for instant response
|
||||
opacity: isDragging ? 0.5 : 1,
|
||||
transition: isDragging ? 'opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1)' : 'none',
|
||||
opacity: isDragging ? 0.3 : 1,
|
||||
zIndex: isDragging ? 1000 : 'auto',
|
||||
// PERFORMANCE OPTIMIZATION: Force GPU acceleration
|
||||
willChange: isDragging ? 'transform' : 'auto',
|
||||
willChange: 'transform, opacity',
|
||||
filter: isDragging ? 'blur(0.5px)' : 'none',
|
||||
};
|
||||
}, [transform, isDragging]);
|
||||
|
||||
@@ -712,19 +913,37 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return (
|
||||
<div key={col.key} className={`flex items-center px-2 ${borderClasses} overflow-visible`} style={{ width: col.width }}>
|
||||
<div className="flex items-center gap-2 overflow-visible">
|
||||
{task.assignee_names && task.assignee_names.length > 0 && (
|
||||
<AvatarGroup
|
||||
members={task.assignee_names}
|
||||
size={24}
|
||||
maxCount={3}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
)}
|
||||
<AssigneeSelector
|
||||
task={adapters.assignee}
|
||||
groupId={groupId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
<ProgressiveComponent
|
||||
isLoaded={shouldRenderFull}
|
||||
placeholder={
|
||||
<AssigneePlaceholder
|
||||
isDarkMode={isDarkMode}
|
||||
memberCount={task.assignee_names?.length || 0}
|
||||
/>
|
||||
}
|
||||
fallback={
|
||||
<AssigneePlaceholder
|
||||
isDarkMode={isDarkMode}
|
||||
memberCount={task.assignee_names?.length || 0}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div className="flex items-center gap-2 overflow-visible">
|
||||
{task.assignee_names && task.assignee_names.length > 0 && (
|
||||
<AvatarGroup
|
||||
members={task.assignee_names}
|
||||
size={24}
|
||||
maxCount={3}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
)}
|
||||
<LazyAssigneeSelector
|
||||
task={adapters.assignee}
|
||||
groupId={groupId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</div>
|
||||
</ProgressiveComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -733,26 +952,44 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return (
|
||||
<div key={col.key} className={`max-w-[200px] flex items-center px-2 ${borderClasses}`} style={{ width: col.width }}>
|
||||
<div className="flex items-center gap-1 flex-wrap h-full w-full overflow-visible relative">
|
||||
{task.labels?.map((label, index) => (
|
||||
label.end && label.names && label.name ? (
|
||||
<CustomNumberLabel
|
||||
key={`${label.id}-${index}`}
|
||||
labelList={label.names}
|
||||
namesString={label.name}
|
||||
<ProgressiveComponent
|
||||
isLoaded={shouldRenderFull}
|
||||
placeholder={
|
||||
<LabelsPlaceholder
|
||||
labelCount={task.labels?.length || 0}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
) : (
|
||||
<CustomColordLabel
|
||||
key={`${label.id}-${index}`}
|
||||
label={label}
|
||||
}
|
||||
fallback={
|
||||
<LabelsPlaceholder
|
||||
labelCount={task.labels?.length || 0}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
)
|
||||
))}
|
||||
<LabelsSelector
|
||||
task={adapters.labels}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<>
|
||||
{task.labels?.map((label, index) => (
|
||||
label.end && label.names && label.name ? (
|
||||
<CustomNumberLabel
|
||||
key={`${label.id}-${index}`}
|
||||
labelList={label.names}
|
||||
namesString={label.name}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
) : (
|
||||
<CustomColordLabel
|
||||
key={`${label.id}-${index}`}
|
||||
label={label}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
)
|
||||
))}
|
||||
<LazyLabelsSelector
|
||||
task={adapters.labels}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</>
|
||||
</ProgressiveComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -761,11 +998,27 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return (
|
||||
<div key={col.key} className={`flex items-center px-2 ${borderClasses} overflow-visible`} style={{ width: col.width, minWidth: col.width }}>
|
||||
<div className="w-full">
|
||||
<TaskPhaseDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
<ProgressiveComponent
|
||||
isLoaded={shouldRenderFull}
|
||||
placeholder={
|
||||
<PhasePlaceholder
|
||||
phase={task.phase}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
fallback={
|
||||
<PhasePlaceholder
|
||||
phase={task.phase}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<LazyTaskPhaseDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</ProgressiveComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -774,11 +1027,27 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return (
|
||||
<div key={col.key} className={`flex items-center px-2 ${borderClasses} overflow-visible`} style={{ width: col.width, minWidth: col.width }}>
|
||||
<div className="w-full">
|
||||
<TaskStatusDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
<ProgressiveComponent
|
||||
isLoaded={shouldRenderFull}
|
||||
placeholder={
|
||||
<StatusPlaceholder
|
||||
status={task.status}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
fallback={
|
||||
<StatusPlaceholder
|
||||
status={task.status}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<LazyTaskStatusDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</ProgressiveComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -787,11 +1056,27 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
return (
|
||||
<div key={col.key} className={`flex items-center px-2 ${borderClasses} overflow-visible`} style={{ width: col.width, minWidth: col.width }}>
|
||||
<div className="w-full">
|
||||
<TaskPriorityDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
<ProgressiveComponent
|
||||
isLoaded={shouldRenderFull}
|
||||
placeholder={
|
||||
<PriorityPlaceholder
|
||||
priority={task.priority}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
fallback={
|
||||
<PriorityPlaceholder
|
||||
priority={task.priority}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<LazyTaskPriorityDropdown
|
||||
task={task}
|
||||
projectId={projectId}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</ProgressiveComponent>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -900,6 +1185,58 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
console.log('TaskRow isDragging:', task.id);
|
||||
}
|
||||
|
||||
// DRAG OVERLAY: Render simplified version when dragging
|
||||
if (isDragOverlay) {
|
||||
return (
|
||||
<div
|
||||
className={`drag-overlay-simplified ${themeClass}`}
|
||||
style={{
|
||||
padding: '10px 16px',
|
||||
backgroundColor: isDarkMode ? 'rgba(42, 42, 42, 0.95)' : 'rgba(255, 255, 255, 0.95)',
|
||||
border: `1px solid ${isDarkMode ? 'rgba(74, 158, 255, 0.8)' : 'rgba(24, 144, 255, 0.8)'}`,
|
||||
borderRadius: '8px',
|
||||
boxShadow: isDarkMode
|
||||
? '0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(74, 158, 255, 0.2)'
|
||||
: '0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(24, 144, 255, 0.15)',
|
||||
backdropFilter: 'blur(8px)',
|
||||
maxWidth: '320px',
|
||||
minWidth: '200px',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
transform: 'scale(1.02)',
|
||||
transition: 'none',
|
||||
willChange: 'transform',
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<div
|
||||
className={`drag-handle-icon ${isDarkMode ? 'text-blue-400' : 'text-blue-600'}`}
|
||||
style={{
|
||||
fontSize: '14px',
|
||||
opacity: 0.8,
|
||||
transform: 'translateZ(0)',
|
||||
}}
|
||||
>
|
||||
<HolderOutlined />
|
||||
</div>
|
||||
<span
|
||||
className={`task-title-drag ${isDarkMode ? 'text-gray-100' : 'text-gray-900'}`}
|
||||
title={task.title}
|
||||
style={{
|
||||
fontSize: '14px',
|
||||
fontWeight: 500,
|
||||
letterSpacing: '0.01em',
|
||||
lineHeight: '1.4',
|
||||
}}
|
||||
>
|
||||
{task.title}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={(node) => {
|
||||
@@ -917,9 +1254,15 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
{/* Fixed Columns */}
|
||||
{fixedColumns && fixedColumns.length > 0 && (
|
||||
<div
|
||||
className="flex overflow-visible"
|
||||
className="task-table-fixed-columns flex overflow-visible"
|
||||
style={{
|
||||
width: fixedColumns.reduce((sum, col) => sum + col.width, 0),
|
||||
position: 'sticky',
|
||||
left: 0,
|
||||
zIndex: 10,
|
||||
background: isDarkMode ? 'var(--task-bg-primary, #1f1f1f)' : 'var(--task-bg-primary, white)',
|
||||
borderRight: scrollableColumns && scrollableColumns.length > 0 ? '2px solid var(--task-border-primary, #e8e8e8)' : 'none',
|
||||
boxShadow: scrollableColumns && scrollableColumns.length > 0 ? '2px 0 4px rgba(0, 0, 0, 0.1)' : 'none',
|
||||
}}
|
||||
>
|
||||
{fixedColumns.map((col, index) =>
|
||||
@@ -933,9 +1276,10 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
{/* Scrollable Columns */}
|
||||
{scrollableColumns && scrollableColumns.length > 0 && (
|
||||
<div
|
||||
className="overflow-visible"
|
||||
className="task-table-scrollable-columns overflow-visible"
|
||||
style={{
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
minWidth: scrollableColumns.reduce((sum, col) => sum + col.width, 0)
|
||||
}}
|
||||
>
|
||||
@@ -955,9 +1299,15 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
{/* Fixed Columns for Add Subtask */}
|
||||
{fixedColumns && fixedColumns.length > 0 && (
|
||||
<div
|
||||
className="flex overflow-visible"
|
||||
className="task-table-fixed-columns flex overflow-visible"
|
||||
style={{
|
||||
width: fixedColumns.reduce((sum, col) => sum + col.width, 0),
|
||||
position: 'sticky',
|
||||
left: 0,
|
||||
zIndex: 10,
|
||||
background: isDarkMode ? 'var(--task-bg-primary, #1f1f1f)' : 'var(--task-bg-primary, white)',
|
||||
borderRight: scrollableColumns && scrollableColumns.length > 0 ? '2px solid var(--task-border-primary, #e8e8e8)' : 'none',
|
||||
boxShadow: scrollableColumns && scrollableColumns.length > 0 ? '2px 0 4px rgba(0, 0, 0, 0.1)' : 'none',
|
||||
}}
|
||||
>
|
||||
{fixedColumns.map((col, index) => {
|
||||
@@ -1024,9 +1374,10 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
{/* Scrollable Columns for Add Subtask */}
|
||||
{scrollableColumns && scrollableColumns.length > 0 && (
|
||||
<div
|
||||
className="overflow-visible"
|
||||
className="task-table-scrollable-columns overflow-visible"
|
||||
style={{
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
minWidth: scrollableColumns.reduce((sum, col) => sum + col.width, 0)
|
||||
}}
|
||||
>
|
||||
@@ -1074,9 +1425,9 @@ const TaskRow: React.FC<TaskRowProps> = React.memo(({
|
||||
// REAL-TIME UPDATES: Compare assignees and labels content (not just length)
|
||||
if (prevProps.task.assignees?.length !== nextProps.task.assignees?.length) return false;
|
||||
if (prevProps.task.assignees?.length > 0) {
|
||||
// Deep compare assignee IDs
|
||||
const prevAssigneeIds = prevProps.task.assignees.sort();
|
||||
const nextAssigneeIds = nextProps.task.assignees.sort();
|
||||
// Deep compare assignee IDs - create copies before sorting to avoid mutating read-only arrays
|
||||
const prevAssigneeIds = [...prevProps.task.assignees].sort();
|
||||
const nextAssigneeIds = [...nextProps.task.assignees].sort();
|
||||
for (let i = 0; i < prevAssigneeIds.length; i++) {
|
||||
if (prevAssigneeIds[i] !== nextAssigneeIds[i]) return false;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ const VirtualizedTaskGroup: React.FC<VirtualizedTaskGroupProps> = React.memo(({
|
||||
width={width}
|
||||
itemCount={groupTasks.length + 3} // +3 for header, column headers, and add task row
|
||||
itemSize={TASK_ROW_HEIGHT}
|
||||
overscanCount={5} // Render 5 extra items for smooth scrolling
|
||||
overscanCount={10} // Increased overscan for smoother scrolling experience
|
||||
>
|
||||
{Row}
|
||||
</List>
|
||||
|
||||
@@ -43,26 +43,45 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
// Get field visibility from taskListFields slice
|
||||
const taskListFields = useSelector((state: RootState) => state.taskManagementFields) as TaskListField[];
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Aggressive virtualization for large lists
|
||||
const VIRTUALIZATION_THRESHOLD = 5; // Reduced from 10 to 5 - virtualize everything
|
||||
// PERFORMANCE OPTIMIZATION: Improved virtualization for better user experience
|
||||
const VIRTUALIZATION_THRESHOLD = 25; // Increased threshold - virtualize when there are more tasks
|
||||
const TASK_ROW_HEIGHT = 40;
|
||||
const HEADER_HEIGHT = 40;
|
||||
const COLUMN_HEADER_HEIGHT = 40;
|
||||
const ADD_TASK_ROW_HEIGHT = 40;
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Batch rendering to prevent long tasks
|
||||
const RENDER_BATCH_SIZE = 5; // Render max 5 tasks per frame
|
||||
const FRAME_BUDGET_MS = 8; // Leave 8ms per frame for other operations
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Add early return for empty groups
|
||||
if (!group || !group.taskIds || group.taskIds.length === 0) {
|
||||
const emptyGroupHeight = HEADER_HEIGHT + COLUMN_HEADER_HEIGHT + 120 + ADD_TASK_ROW_HEIGHT; // 120px for empty state
|
||||
|
||||
return (
|
||||
<div className="virtualized-task-list empty-group" style={{ height: emptyGroupHeight }}>
|
||||
<div className="virtualized-task-list empty-group" style={{ height: emptyGroupHeight, position: 'relative' }}>
|
||||
{/* Sticky Group Color Border */}
|
||||
<div
|
||||
className="sticky-group-border"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
width: '4px',
|
||||
backgroundColor: group?.color || '#f0f0f0',
|
||||
zIndex: 15,
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="task-group-header" style={{ height: HEADER_HEIGHT }}>
|
||||
<div className="task-group-header-row">
|
||||
<div
|
||||
className="task-group-header-content"
|
||||
style={{
|
||||
backgroundColor: group?.color || '#f0f0f0',
|
||||
borderLeft: `4px solid ${group?.color || '#f0f0f0'}`
|
||||
// No margin - header should overlap the sticky border
|
||||
}}
|
||||
>
|
||||
<span className="task-group-header-text">
|
||||
@@ -74,7 +93,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
|
||||
{/* Column Headers */}
|
||||
<div className="task-group-column-headers" style={{
|
||||
borderLeft: `4px solid ${group?.color || '#f0f0f0'}`,
|
||||
marginLeft: '4px', // Account for sticky border
|
||||
height: COLUMN_HEADER_HEIGHT,
|
||||
background: 'var(--task-bg-secondary, #f5f5f5)',
|
||||
borderBottom: '1px solid var(--task-border-tertiary, #d9d9d9)',
|
||||
@@ -93,7 +112,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderLeft: `4px solid ${group?.color || '#f0f0f0'}`,
|
||||
marginLeft: '4px', // Account for sticky border
|
||||
backgroundColor: 'var(--task-bg-primary, white)'
|
||||
}}>
|
||||
<Empty
|
||||
@@ -115,7 +134,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="task-group-add-task" style={{ borderLeft: `4px solid ${group?.color || '#f0f0f0'}`, height: ADD_TASK_ROW_HEIGHT }}>
|
||||
<div className="task-group-add-task" style={{ marginLeft: '4px', height: ADD_TASK_ROW_HEIGHT }}>
|
||||
<AddTaskListRow groupId={group?.id} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -184,9 +203,10 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
});
|
||||
}, [groupTasks, selectedTaskIds, onSelectTask]);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Simplified height calculation
|
||||
// PERFORMANCE OPTIMIZATION: Use passed height prop and calculate available space for tasks
|
||||
const taskRowsHeight = groupTasks.length * TASK_ROW_HEIGHT;
|
||||
const groupHeight = HEADER_HEIGHT + COLUMN_HEADER_HEIGHT + taskRowsHeight + ADD_TASK_ROW_HEIGHT;
|
||||
const groupHeight = height; // Use the height passed from parent
|
||||
const availableTaskRowsHeight = Math.max(0, groupHeight - HEADER_HEIGHT - COLUMN_HEADER_HEIGHT - ADD_TASK_ROW_HEIGHT);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Limit visible columns for large lists
|
||||
const maxVisibleColumns = groupTasks.length > 50 ? 6 : 12; // Further reduce columns for large lists
|
||||
@@ -253,12 +273,13 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
const scrollableWidth = scrollableColumns.reduce((sum, col) => sum + col.width, 0);
|
||||
const totalTableWidth = fixedWidth + scrollableWidth;
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Optimize overscan for large lists
|
||||
// PERFORMANCE OPTIMIZATION: Enhanced overscan for smoother scrolling experience
|
||||
const shouldVirtualize = groupTasks.length > VIRTUALIZATION_THRESHOLD;
|
||||
const overscanCount = useMemo(() => {
|
||||
if (groupTasks.length <= 10) return 2;
|
||||
if (groupTasks.length <= 50) return 3;
|
||||
return 5; // Reduced from 10 for better performance
|
||||
if (groupTasks.length <= 20) return 5; // Small lists: 5 items overscan
|
||||
if (groupTasks.length <= 100) return 10; // Medium lists: 10 items overscan
|
||||
if (groupTasks.length <= 500) return 15; // Large lists: 15 items overscan
|
||||
return 20; // Very large lists: 20 items overscan for smooth scrolling
|
||||
}, [groupTasks.length]);
|
||||
|
||||
// PERFORMANCE OPTIMIZATION: Memoize row renderer with better dependency management
|
||||
@@ -274,6 +295,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
className="task-row-container"
|
||||
style={{
|
||||
...style,
|
||||
marginLeft: '4px', // Account for sticky border
|
||||
'--group-color': group.color || '#f0f0f0',
|
||||
contain: 'layout style', // CSS containment for better performance
|
||||
} as React.CSSProperties}
|
||||
@@ -318,7 +340,22 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
}, [handleScroll]);
|
||||
|
||||
return (
|
||||
<div className="virtualized-task-list" style={{ height: groupHeight }}>
|
||||
<div className="virtualized-task-list" style={{ height: groupHeight, position: 'relative' }}>
|
||||
{/* Sticky Group Color Border */}
|
||||
<div
|
||||
className="sticky-group-border"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
width: '4px',
|
||||
backgroundColor: group.color || '#f0f0f0',
|
||||
zIndex: 15,
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Group Header */}
|
||||
<div className="task-group-header" style={{ height: HEADER_HEIGHT }}>
|
||||
<div className="task-group-header-row">
|
||||
@@ -326,7 +363,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
className="task-group-header-content"
|
||||
style={{
|
||||
backgroundColor: group.color || '#f0f0f0',
|
||||
borderLeft: `4px solid ${group.color || '#f0f0f0'}`
|
||||
// No margin - header should overlap the sticky border
|
||||
}}
|
||||
>
|
||||
<span className="task-group-header-text">
|
||||
@@ -343,9 +380,21 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
>
|
||||
<div
|
||||
className="task-group-column-headers"
|
||||
style={{ borderLeft: `4px solid ${group.color || '#f0f0f0'}`, minWidth: totalTableWidth, display: 'flex', position: 'relative' }}
|
||||
style={{ marginLeft: '4px', minWidth: totalTableWidth, display: 'flex', position: 'relative' }}
|
||||
>
|
||||
<div className="fixed-columns-header" style={{ display: 'flex', position: 'sticky', left: 0, zIndex: 2, background: 'inherit', width: fixedWidth }}>
|
||||
<div
|
||||
className="task-table-fixed-columns fixed-columns-header"
|
||||
style={{
|
||||
display: 'flex',
|
||||
position: 'sticky',
|
||||
left: 0,
|
||||
zIndex: 12,
|
||||
background: isDarkMode ? 'var(--task-bg-secondary, #141414)' : 'var(--task-bg-secondary, #f5f5f5)',
|
||||
width: fixedWidth,
|
||||
borderRight: scrollableColumns.length > 0 ? '2px solid var(--task-border-primary, #e8e8e8)' : 'none',
|
||||
boxShadow: scrollableColumns.length > 0 ? '2px 0 4px rgba(0, 0, 0, 0.1)' : 'none',
|
||||
}}
|
||||
>
|
||||
{fixedColumns.map(col => (
|
||||
<div
|
||||
key={col.key}
|
||||
@@ -389,15 +438,15 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
overflowY: 'auto',
|
||||
width: '100%',
|
||||
minWidth: totalTableWidth,
|
||||
height: groupTasks.length > 0 ? taskRowsHeight : 'auto',
|
||||
height: groupTasks.length > 0 ? availableTaskRowsHeight : 'auto',
|
||||
contain: 'layout style', // CSS containment for better performance
|
||||
}}
|
||||
>
|
||||
<SortableContext items={group.taskIds} strategy={verticalListSortingStrategy}>
|
||||
{shouldVirtualize ? (
|
||||
<List
|
||||
height={taskRowsHeight}
|
||||
width={width}
|
||||
height={availableTaskRowsHeight}
|
||||
width={totalTableWidth}
|
||||
itemCount={groupTasks.length}
|
||||
itemSize={TASK_ROW_HEIGHT}
|
||||
overscanCount={overscanCount}
|
||||
@@ -425,6 +474,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
className="task-row-container"
|
||||
style={{
|
||||
height: TASK_ROW_HEIGHT,
|
||||
marginLeft: '4px', // Account for sticky border
|
||||
'--group-color': group.color || '#f0f0f0',
|
||||
contain: 'layout style', // CSS containment
|
||||
} as React.CSSProperties}
|
||||
@@ -451,7 +501,7 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
{/* Add Task Row - Always show at the bottom */}
|
||||
<div
|
||||
className="task-group-add-task"
|
||||
style={{ borderLeft: `4px solid ${group.color || '#f0f0f0'}`, height: ADD_TASK_ROW_HEIGHT }}
|
||||
style={{ marginLeft: '4px', height: ADD_TASK_ROW_HEIGHT }}
|
||||
>
|
||||
<AddTaskListRow groupId={group.id} />
|
||||
</div>
|
||||
@@ -504,16 +554,6 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
position: relative;
|
||||
background: var(--task-bg-primary, white);
|
||||
}
|
||||
.task-row-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
background-color: var(--group-color, #f0f0f0);
|
||||
z-index: 10;
|
||||
}
|
||||
/* Ensure no gaps between list items */
|
||||
.react-window-list > div {
|
||||
margin: 0;
|
||||
@@ -567,20 +607,47 @@ const VirtualizedTaskList: React.FC<VirtualizedTaskListProps> = React.memo(({
|
||||
letter-spacing: 0.5px;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
/* Add task row styles */
|
||||
/* Add task row styles - Fixed width responsive design */
|
||||
.task-group-add-task {
|
||||
background: var(--task-bg-primary, white);
|
||||
border-top: 1px solid var(--task-border-secondary, #f0f0f0);
|
||||
transition: all 0.3s ease;
|
||||
padding: 0 12px;
|
||||
width: 100%;
|
||||
max-width: 500px; /* Fixed maximum width */
|
||||
min-width: 300px; /* Minimum width for mobile */
|
||||
min-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
border-radius: 0 0 6px 6px;
|
||||
margin-left: 0;
|
||||
position: relative;
|
||||
}
|
||||
.task-group-add-task:hover {
|
||||
background: var(--task-hover-bg, #fafafa);
|
||||
transform: translateX(2px);
|
||||
}
|
||||
|
||||
/* Responsive adjustments for add task row */
|
||||
@media (max-width: 768px) {
|
||||
.task-group-add-task {
|
||||
max-width: 400px;
|
||||
min-width: 280px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.task-group-add-task {
|
||||
max-width: calc(100vw - 40px);
|
||||
min-width: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.task-group-add-task {
|
||||
max-width: 600px;
|
||||
}
|
||||
}
|
||||
.task-table-fixed-columns {
|
||||
display: flex;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px 6px 0 0;
|
||||
background: transparent;
|
||||
border: 1px solid transparent;
|
||||
border: none;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
font-weight: 500;
|
||||
font-size: 13px;
|
||||
@@ -42,13 +42,11 @@
|
||||
[data-theme="default"] .project-view-tabs .ant-tabs-tab {
|
||||
color: #64748b;
|
||||
background: #f8fafc;
|
||||
border-color: #e2e8f0;
|
||||
}
|
||||
|
||||
[data-theme="default"] .project-view-tabs .ant-tabs-tab:hover {
|
||||
color: #3b82f6;
|
||||
background: #eff6ff;
|
||||
border-color: #bfdbfe;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
@@ -56,32 +54,26 @@
|
||||
[data-theme="default"] .project-view-tabs .ant-tabs-tab-active {
|
||||
color: #1e40af !important;
|
||||
background: #ffffff !important;
|
||||
border-color: #3b82f6 !important;
|
||||
border-bottom-color: #ffffff !important;
|
||||
box-shadow: 0 -2px 8px rgba(59, 130, 246, 0.1), 0 4px 16px rgba(59, 130, 246, 0.1);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Dark mode tab styles */
|
||||
/* Dark mode tab styles - matching task list row colors */
|
||||
[data-theme="dark"] .project-view-tabs .ant-tabs-tab {
|
||||
color: #94a3b8;
|
||||
background: #1e293b;
|
||||
border-color: #334155;
|
||||
background: #141414;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .project-view-tabs .ant-tabs-tab:hover {
|
||||
color: #60a5fa;
|
||||
background: #1e3a8a;
|
||||
border-color: #3b82f6;
|
||||
background: #262626;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .project-view-tabs .ant-tabs-tab-active {
|
||||
color: #60a5fa !important;
|
||||
background: #0f172a !important;
|
||||
border-color: #3b82f6 !important;
|
||||
border-bottom-color: #0f172a !important;
|
||||
background: #1f1f1f !important;
|
||||
box-shadow: 0 -2px 8px rgba(96, 165, 250, 0.15), 0 4px 16px rgba(96, 165, 250, 0.15);
|
||||
z-index: 1;
|
||||
}
|
||||
@@ -102,8 +94,8 @@
|
||||
}
|
||||
|
||||
[data-theme="dark"] .project-view-tabs .ant-tabs-content-holder {
|
||||
background: #0f172a;
|
||||
border: 1px solid #334155;
|
||||
background: #1f1f1f;
|
||||
border: 1px solid #303030;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
|
||||
@@ -472,23 +472,23 @@
|
||||
background-color: #262626 !important;
|
||||
}
|
||||
|
||||
/* System preference fallback */
|
||||
/* System preference fallback - only apply when explicitly in dark mode */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.task-list-board:not(.light) {
|
||||
.task-list-board.dark:not(.light) {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.task-group:not(.light) {
|
||||
.task-group.dark:not(.light) {
|
||||
background-color: #1f1f1f;
|
||||
}
|
||||
|
||||
.task-row:not(.light) {
|
||||
.task-row.dark:not(.light) {
|
||||
background-color: #1f1f1f;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
border-color: #303030;
|
||||
}
|
||||
|
||||
.task-row:not(.light):hover {
|
||||
.task-row.dark:not(.light):hover {
|
||||
background-color: #262626 !important;
|
||||
border-left-color: #595959;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user