fix(boards): keep card order inside a column and show activity priority
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { currencySuffix } from '@/lib/money';
|
||||
import { matchesSearch } from '@/lib/search';
|
||||
import type { ActivityPriority } from '@mento/shared';
|
||||
|
||||
export type PipelineAccent = 'green' | 'orange' | 'purple' | 'blue' | 'rose' | 'slate';
|
||||
|
||||
@@ -21,6 +22,8 @@ export type PipelineDeal = {
|
||||
assigneeIds?: string[];
|
||||
/** متنهای قابل جستجو (مشتری، شرکت، یادداشت، مسئولان …) */
|
||||
searchFields?: Array<string | null | undefined>;
|
||||
/** اولویت فعالیت؛ فقط روی کارت فعالیت نشان داده میشود */
|
||||
priority?: ActivityPriority;
|
||||
};
|
||||
|
||||
export type PipelineUiCopy = {
|
||||
@@ -344,18 +347,16 @@ export function updateDealStage(
|
||||
return without.map((stage) => {
|
||||
if (stage.id !== stageId) return stage;
|
||||
const next = [...stage.deals];
|
||||
let insertAt =
|
||||
toIndex == null || toIndex < 0 || toIndex > next.length
|
||||
? next.length
|
||||
: toIndex;
|
||||
let insertAt = toIndex == null || toIndex < 0 ? next.length : toIndex;
|
||||
if (
|
||||
fromStageId === stageId &&
|
||||
fromIndex >= 0 &&
|
||||
toIndex != null &&
|
||||
toIndex > fromIndex
|
||||
) {
|
||||
insertAt = Math.max(0, insertAt - 1);
|
||||
insertAt -= 1;
|
||||
}
|
||||
insertAt = Math.max(0, Math.min(insertAt, next.length));
|
||||
next.splice(insertAt, 0, { ...moving!, stageId });
|
||||
return { ...stage, deals: next };
|
||||
});
|
||||
@@ -422,6 +423,14 @@ export function toFaDealCount(n: number): string {
|
||||
}
|
||||
|
||||
/** جابهجایی یک ستون به ایندکس جدید */
|
||||
/** نیمهٔ پایین کارت یعنی «بعد از این کارت». ایندکس نسبت به فهرست فعلی ستون است. */
|
||||
export function pointerDropIndex(index: number, event: DragEvent): number {
|
||||
const el = event.currentTarget as HTMLElement | null;
|
||||
const rect = el?.getBoundingClientRect();
|
||||
if (!rect || rect.height <= 0) return index;
|
||||
return index + (event.clientY >= rect.top + rect.height / 2 ? 1 : 0);
|
||||
}
|
||||
|
||||
export function moveStageToIndex(
|
||||
stages: PipelineStage[],
|
||||
stageId: string,
|
||||
|
||||
Reference in New Issue
Block a user