diff --git a/src/web/pages/token-routes/RouteCard.test.tsx b/src/web/pages/token-routes/RouteCard.test.tsx index 322027e..d207569 100644 --- a/src/web/pages/token-routes/RouteCard.test.tsx +++ b/src/web/pages/token-routes/RouteCard.test.tsx @@ -213,5 +213,20 @@ describe('RouteCard', () => { expect(text).toContain('P1 · 1'); expect(text).toContain('user_a'); expect(text).toContain('user_b'); + + const p0RailNode = root.root.find((node) => ( + node.type === 'div' + && collectText(node) === 'P0 · 1' + && node.props?.style?.borderRadius === 999 + )); + const p1RailNode = root.root.find((node) => ( + node.type === 'div' + && collectText(node) === 'P1 · 1' + && node.props?.style?.borderRadius === 999 + )); + + expect(p0RailNode.props.style.background).not.toBe('var(--color-bg)'); + expect(p1RailNode.props.style.background).not.toBe('var(--color-bg)'); + expect(p0RailNode.props.style.color).not.toBe(p1RailNode.props.style.color); }); }); diff --git a/src/web/pages/token-routes/RouteCard.tsx b/src/web/pages/token-routes/RouteCard.tsx index 0fa146c..9ef4c40 100644 --- a/src/web/pages/token-routes/RouteCard.tsx +++ b/src/web/pages/token-routes/RouteCard.tsx @@ -42,11 +42,13 @@ import { isExplicitGroupRoute, resolveRouteTitle, resolveRouteIcon, + getPriorityTagStyle, } from './utils.js'; import { buildPriorityBuckets, } from './priorityBuckets.js'; import { + buildPriorityDragPreviewStyle, buildPriorityRailSections, createPriorityRailNewLayerId, isPriorityRailNewLayerId, @@ -160,15 +162,18 @@ function PriorityRailNewLayerRow({ function PriorityDragPreview({ channel, displayPriority, + activeRowWidth, }: { channel: RouteChannel; displayPriority: number; + activeRowWidth?: number | null; }) { return (
(null); + const [activeDragRowWidth, setActiveDragRowWidth] = useState(null); const [dragOverId, setDragOverId] = useState(null); const activeDragChannel = activeDragChannelId == null ? null @@ -291,12 +298,14 @@ function RouteCardInner({ const clearDragState = () => { setActiveDragChannelId(null); + setActiveDragRowWidth(null); setDragOverId(null); }; const handleDragStart = (event: DragStartEvent) => { const nextId = Number(event.active.id); setActiveDragChannelId(Number.isFinite(nextId) ? nextId : null); + setActiveDragRowWidth(event.active.rect.current.initial?.width ?? null); setDragOverId(event.active.id); }; @@ -670,6 +679,7 @@ function RouteCardInner({ const hoveredExistingLayer = activeDragChannelId != null && hoveredBucketIndex === bucketIndex; const hoveredCrossLayer = hoveredExistingLayer && activeDragBucketIndex !== bucketIndex; const hoveredNewLayer = activeDragChannelId != null && hoveredNewLayerBucketIndex === bucketIndex; + const railTone = getPriorityTagStyle(bucketIndex); return (
) : null} diff --git a/src/web/pages/token-routes/SortableChannelRow.tsx b/src/web/pages/token-routes/SortableChannelRow.tsx index fd59eeb..707ce09 100644 --- a/src/web/pages/token-routes/SortableChannelRow.tsx +++ b/src/web/pages/token-routes/SortableChannelRow.tsx @@ -50,7 +50,7 @@ export function SortableChannelRow({ const rowStyle: CSSProperties = { transform: CSS.Transform.toString(transform), transition, - opacity: isDragging ? 0.72 : channel.enabled === false ? 0.5 : 1, + opacity: isDragging ? (mobile ? 0.72 : 0) : channel.enabled === false ? 0.5 : 1, zIndex: isDragging ? 10 : 1, display: 'grid', gridTemplateColumns: managementLocked || mobile ? 'minmax(0, 1fr)' : 'minmax(0, 1fr) auto auto auto', diff --git a/src/web/pages/token-routes/priorityRail.test.ts b/src/web/pages/token-routes/priorityRail.test.ts index b652467..6780638 100644 --- a/src/web/pages/token-routes/priorityRail.test.ts +++ b/src/web/pages/token-routes/priorityRail.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; import { applyPriorityRailDrop, + buildPriorityDragPreviewStyle, buildPriorityRailDragTargets, buildPriorityRailSections, createPriorityRailNewLayerId, @@ -74,4 +75,11 @@ describe('priorityRail helpers', () => { { id: 21, priority: 2 }, ]); }); + + it('uses the active row width for drag preview alignment when available', () => { + expect(buildPriorityDragPreviewStyle(640)).toMatchObject({ + width: 640, + maxWidth: 'calc(100vw - 32px)', + }); + }); }); diff --git a/src/web/pages/token-routes/priorityRail.ts b/src/web/pages/token-routes/priorityRail.ts index 6ed6f6a..b606291 100644 --- a/src/web/pages/token-routes/priorityRail.ts +++ b/src/web/pages/token-routes/priorityRail.ts @@ -1,3 +1,4 @@ +import type { CSSProperties } from 'react'; import type { PriorityRailDragTarget, PriorityRailSection } from './types.js'; type PriorityRailChannelLike = { @@ -117,3 +118,11 @@ export function applyPriorityRailDrop( )), ); } + +export function buildPriorityDragPreviewStyle(activeRowWidth?: number | null): CSSProperties { + const resolvedWidth = Number.isFinite(activeRowWidth ?? Number.NaN) ? activeRowWidth ?? undefined : undefined; + return { + width: resolvedWidth, + maxWidth: 'calc(100vw - 32px)', + }; +}