feat(task-management): enhance task list with drag-and-drop functionality and improved styling
- Integrated drag-and-drop capabilities using @dnd-kit for task reordering within the TaskListV2 component. - Updated TaskGroupHeader to dynamically adjust colors based on group properties, improving visual clarity. - Refactored TaskRow to support drag-and-drop interactions and optimized rendering of task details. - Enhanced Redux state management for collapsed groups, transitioning from Set to array for better compatibility. - Improved task display logic to handle optional fields and ensure consistent rendering across components.
This commit is contained in:
@@ -1,3 +1,20 @@
|
||||
export const tagBackground = (color: string): string => {
|
||||
return `${color}1A`; // 1A is 10% opacity in hex
|
||||
};
|
||||
|
||||
export const getContrastColor = (hexcolor: string): string => {
|
||||
// If a color is not a valid hex, default to a sensible contrast
|
||||
if (!/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexcolor)) {
|
||||
return '#000000'; // Default to black for invalid colors
|
||||
}
|
||||
|
||||
const r = parseInt(hexcolor.slice(1, 3), 16);
|
||||
const g = parseInt(hexcolor.slice(3, 5), 16);
|
||||
const b = parseInt(hexcolor.slice(5, 7), 16);
|
||||
|
||||
// Perceptual luminance calculation (from WCAG 2.0)
|
||||
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
||||
|
||||
// Use a threshold to decide between black and white text
|
||||
return luminance > 0.5 ? '#000000' : '#FFFFFF';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user