mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
refactor(list-row): remove priority display logic and related components
- Eliminated the getPriorityDisplay function and the PriorityBadge component from the ListRow implementation. - Removed the pipelineConfig prop from ListRowProps interface. - Cleaned up the code to streamline the ListRow component, focusing on essential features.
This commit is contained in:
@@ -6,52 +6,9 @@ import { cn } from '@/lib/utils';
|
|||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
import { AlertCircle, Lock, Hand, Sparkles, FileText } from 'lucide-react';
|
import { AlertCircle, Lock, Hand, Sparkles, FileText } from 'lucide-react';
|
||||||
import type { Feature } from '@/store/app-store';
|
import type { Feature } from '@/store/app-store';
|
||||||
import type { PipelineConfig } from '@automaker/types';
|
|
||||||
import { RowActions, type RowActionHandlers } from './row-actions';
|
import { RowActions, type RowActionHandlers } from './row-actions';
|
||||||
import { getColumnWidth, getColumnAlign } from './list-header';
|
import { getColumnWidth, getColumnAlign } from './list-header';
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the priority display configuration
|
|
||||||
*/
|
|
||||||
function getPriorityDisplay(priority: number | undefined): {
|
|
||||||
label: string;
|
|
||||||
shortLabel: string;
|
|
||||||
colorClass: string;
|
|
||||||
bgClass: string;
|
|
||||||
borderClass: string;
|
|
||||||
} | null {
|
|
||||||
if (!priority) return null;
|
|
||||||
|
|
||||||
switch (priority) {
|
|
||||||
case 1:
|
|
||||||
return {
|
|
||||||
label: 'High Priority',
|
|
||||||
shortLabel: 'High',
|
|
||||||
colorClass: 'text-[var(--status-error)]',
|
|
||||||
bgClass: 'bg-[var(--status-error)]/15',
|
|
||||||
borderClass: 'border-[var(--status-error)]/30',
|
|
||||||
};
|
|
||||||
case 2:
|
|
||||||
return {
|
|
||||||
label: 'Medium Priority',
|
|
||||||
shortLabel: 'Medium',
|
|
||||||
colorClass: 'text-[var(--status-warning)]',
|
|
||||||
bgClass: 'bg-[var(--status-warning)]/15',
|
|
||||||
borderClass: 'border-[var(--status-warning)]/30',
|
|
||||||
};
|
|
||||||
case 3:
|
|
||||||
return {
|
|
||||||
label: 'Low Priority',
|
|
||||||
shortLabel: 'Low',
|
|
||||||
colorClass: 'text-[var(--status-info)]',
|
|
||||||
bgClass: 'bg-[var(--status-info)]/15',
|
|
||||||
borderClass: 'border-[var(--status-info)]/30',
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ListRowProps {
|
export interface ListRowProps {
|
||||||
/** The feature to display */
|
/** The feature to display */
|
||||||
feature: Feature;
|
feature: Feature;
|
||||||
@@ -59,8 +16,6 @@ export interface ListRowProps {
|
|||||||
handlers: RowActionHandlers;
|
handlers: RowActionHandlers;
|
||||||
/** Whether this feature is the current auto task (agent is running) */
|
/** Whether this feature is the current auto task (agent is running) */
|
||||||
isCurrentAutoTask?: boolean;
|
isCurrentAutoTask?: boolean;
|
||||||
/** Pipeline configuration for custom status colors */
|
|
||||||
pipelineConfig?: PipelineConfig | null;
|
|
||||||
/** Whether the row is selected */
|
/** Whether the row is selected */
|
||||||
isSelected?: boolean;
|
isSelected?: boolean;
|
||||||
/** Whether to show the checkbox for selection */
|
/** Whether to show the checkbox for selection */
|
||||||
@@ -201,39 +156,6 @@ const IndicatorBadges = memo(function IndicatorBadges({
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* PriorityBadge displays the priority indicator in the table
|
|
||||||
*/
|
|
||||||
const PriorityBadge = memo(function PriorityBadge({ priority }: { priority: number | undefined }) {
|
|
||||||
const display = getPriorityDisplay(priority);
|
|
||||||
|
|
||||||
if (!display) {
|
|
||||||
return <span className="text-muted-foreground">-</span>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TooltipProvider delayDuration={200}>
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<span
|
|
||||||
className={cn(
|
|
||||||
'inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-medium',
|
|
||||||
display.colorClass,
|
|
||||||
display.bgClass,
|
|
||||||
display.borderClass
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{display.shortLabel}
|
|
||||||
</span>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="top" className="text-xs">
|
|
||||||
<p>{display.label}</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</TooltipProvider>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ListRow displays a single feature row in the list view table.
|
* ListRow displays a single feature row in the list view table.
|
||||||
*
|
*
|
||||||
@@ -264,7 +186,6 @@ export const ListRow = memo(function ListRow({
|
|||||||
feature,
|
feature,
|
||||||
handlers,
|
handlers,
|
||||||
isCurrentAutoTask = false,
|
isCurrentAutoTask = false,
|
||||||
pipelineConfig,
|
|
||||||
isSelected = false,
|
isSelected = false,
|
||||||
showCheckbox = false,
|
showCheckbox = false,
|
||||||
onToggleSelect,
|
onToggleSelect,
|
||||||
|
|||||||
Reference in New Issue
Block a user