diff --git a/core-web/src/components/Projects/components/CardDetailModal.tsx b/core-web/src/components/Projects/components/CardDetailModal.tsx index 0839d6b4..4c11c90a 100644 --- a/core-web/src/components/Projects/components/CardDetailModal.tsx +++ b/core-web/src/components/Projects/components/CardDetailModal.tsx @@ -20,6 +20,7 @@ import LabelPicker from './LabelPicker'; import AssigneePicker from './AssigneePicker'; import StackedAvatars from './StackedAvatars'; import IssueComments from './IssueComments'; +import { PROJECT_PRIORITY_OPTIONS } from './priorityOptions'; interface CardDetailModalProps { card: ProjectIssue; @@ -27,15 +28,6 @@ interface CardDetailModalProps { initialEdit?: boolean; } -// Priority: 4=highest, 3=high, 2=medium, 1=low,image.png 0=none -const PRIORITY_OPTIONS = [ - { value: 0, label: 'None', color: 'text-gray-300', bg: 'bg-gray-50' }, - { value: 1, label: '1', color: 'text-slate-500', bg: 'bg-slate-100' }, - { value: 2, label: '2', color: 'text-amber-500', bg: 'bg-amber-50' }, - { value: 3, label: '3', color: 'text-orange-500', bg: 'bg-orange-50' }, - { value: 4, label: '4', color: 'text-rose-500', bg: 'bg-rose-50' }, -] as const; - export default function CardDetailModal({ card, onClose, initialEdit = false }: CardDetailModalProps) { const [isEditing, setIsEditing] = useState(initialEdit); const [isVisible, setIsVisible] = useState(true); @@ -95,7 +87,7 @@ export default function CardDetailModal({ card, onClose, initialEdit = false }: const imageInputRef = useRef(null); const column = states.find((s) => s.id === card.state_id); - const priorityConfig = PRIORITY_OPTIONS.find((p) => p.value === priority); + const priorityConfig = PROJECT_PRIORITY_OPTIONS.find((p) => p.value === priority); // Track which images were added/removed for atomic operations const [addedImageKeys, setAddedImageKeys] = useState([]); @@ -353,7 +345,7 @@ export default function CardDetailModal({ card, onClose, initialEdit = false }: No priority {priority === 0 && } - {PRIORITY_OPTIONS.filter((o) => o.value > 0).map((option) => ( + {PROJECT_PRIORITY_OPTIONS.filter((o) => o.value > 0).map((option) => ( - {[1, 2, 3, 4].map((p) => ( + {PROJECT_PRIORITY_OPTIONS.filter((option) => option.value > 0).map((option) => ( ))} diff --git a/core-web/src/components/Projects/components/PriorityPicker.tsx b/core-web/src/components/Projects/components/PriorityPicker.tsx index 132fd799..39d95c4d 100644 --- a/core-web/src/components/Projects/components/PriorityPicker.tsx +++ b/core-web/src/components/Projects/components/PriorityPicker.tsx @@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'; import { Flag } from '@phosphor-icons/react'; import { CheckIcon } from '@heroicons/react/24/outline'; import { useUpdateIssue } from '../../../hooks/queries/useProjects'; +import { PROJECT_PRIORITY_OPTIONS } from './priorityOptions'; interface PriorityPickerProps { issueId: string; @@ -11,14 +12,6 @@ interface PriorityPickerProps { buttonClassName?: string; } -const PRIORITY_OPTIONS = [ - { value: 0, label: 'No priority', color: 'text-gray-400', bg: 'bg-gray-50' }, - { value: 1, label: 'Urgent', color: 'text-rose-500', bg: 'bg-rose-50' }, - { value: 2, label: 'High', color: 'text-orange-500', bg: 'bg-orange-50' }, - { value: 3, label: 'Medium', color: 'text-amber-500', bg: 'bg-amber-50' }, - { value: 4, label: 'Low', color: 'text-slate-500', bg: 'bg-slate-100' }, -] as const; - export default function PriorityPicker({ issueId, boardId, priority, buttonClassName = '' }: PriorityPickerProps) { const [isOpen, setIsOpen] = useState(false); const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0 }); @@ -28,7 +21,8 @@ export default function PriorityPicker({ issueId, boardId, priority, buttonClass // React Query mutations const updateIssue = useUpdateIssue(boardId ?? null); - const currentOption = PRIORITY_OPTIONS.find((p) => p.value === priority) || PRIORITY_OPTIONS[0]; + const currentOption = + PROJECT_PRIORITY_OPTIONS.find((p) => p.value === priority) || PROJECT_PRIORITY_OPTIONS[0]; const handleUpdate = (value: number) => { setIsOpen(false); @@ -94,7 +88,7 @@ export default function PriorityPicker({ issueId, boardId, priority, buttonClass className="fixed z-[100] bg-white rounded-lg shadow-lg border border-gray-200 overflow-hidden py-1 w-40" style={{ top: dropdownPosition.top, left: dropdownPosition.left }} > - {PRIORITY_OPTIONS.map((option) => ( + {PROJECT_PRIORITY_OPTIONS.map((option) => (