refactor: enhance code comments for clarity and maintainability across multiple files

This commit is contained in:
Abhimanyu Saharan
2026-02-13 02:35:32 +05:30
parent 8cced3a034
commit 4b1336534e
7 changed files with 44 additions and 1 deletions

View File

@@ -155,6 +155,7 @@ export const TaskBoard = memo(function TaskBoard({
return positions;
}, []);
// Animate card reordering smoothly by applying FLIP whenever layout positions change.
useLayoutEffect(() => {
const cardRefsSnapshot = cardRefs.current;
if (animationRafRef.current !== null) {
@@ -275,6 +276,7 @@ export const TaskBoard = memo(function TaskBoard({
return buckets;
}, [tasks]);
// Keep drag/drop state and payload handling centralized for column move interactions.
const handleDragStart =
(task: Task) => (event: React.DragEvent<HTMLDivElement>) => {
if (readOnly) {
@@ -344,6 +346,7 @@ export const TaskBoard = memo(function TaskBoard({
>
{columns.map((column) => {
const columnTasks = grouped[column.status] ?? [];
// Derive review tab counts and the active subset from one canonical task list.
const reviewCounts =
column.status === "review"
? columnTasks.reduce(

View File

@@ -40,6 +40,7 @@ type DropdownSelectProps = {
emptyMessage?: string;
};
// Resolve trigger placeholder text with explicit prop override first, then accessible fallback.
const resolvePlaceholder = (ariaLabel: string, placeholder?: string) => {
if (placeholder) {
return placeholder;
@@ -51,6 +52,7 @@ const resolvePlaceholder = (ariaLabel: string, placeholder?: string) => {
return trimmed.endsWith("...") ? trimmed : `${trimmed}...`;
};
// Resolve search input placeholder from explicit override or a normalized aria label.
const resolveSearchPlaceholder = (
ariaLabel: string,
searchPlaceholder?: string,
@@ -107,6 +109,7 @@ export default function DropdownSelect({
handleOpenChange(false);
};
// Reset list scroll when opening or refining search so results start at the top.
React.useEffect(() => {
if (!open) {
return;