Show the clone date offset without requiring a segment
The offset field was rendered only when a segment had been named, from when that was the only way clone could reach reference rows. Once clone could read them directly the field became unreachable in the ordinary case -- so "shift dates by" was invisible and the only typeable-looking control was "copy rows from", which is a dropdown. It is shown whenever clone is open now, and the payload carries the offset independently of from_logid: shifting a selection through time is the common case, and narrowing to one segment is the occasional one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ee4a60475e
commit
cc3d83268f
@ -806,9 +806,10 @@ export default function OperationPanel({
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Only meaningful when borrowing across time, so it
|
{/* Always shown. This was gated on picking a segment, from
|
||||||
appears with the segment rather than always. */}
|
when naming one was the only way to reach reference rows
|
||||||
{cloneFrom && (
|
-- once clone could read them directly, the offset became
|
||||||
|
unreachable in the ordinary case. */}
|
||||||
<div className="flex items-center gap-2 flex-wrap">
|
<div className="flex items-center gap-2 flex-wrap">
|
||||||
<span className="text-gray-500 whitespace-nowrap">shift dates by</span>
|
<span className="text-gray-500 whitespace-nowrap">shift dates by</span>
|
||||||
<input value={cloneOffset} list="pf-clone-offsets"
|
<input value={cloneOffset} list="pf-clone-offsets"
|
||||||
@ -822,8 +823,7 @@ export default function OperationPanel({
|
|||||||
<option value="0 days" />
|
<option value="0 days" />
|
||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
)}
|
{cloneOffset.trim() && cloneOffset.trim() !== '0 days' && (
|
||||||
{cloneFrom && (
|
|
||||||
<p className="text-gray-500 text-[11px] leading-snug max-w-sm">
|
<p className="text-gray-500 text-[11px] leading-snug max-w-sm">
|
||||||
The cells you have selected are what gets copied. Shifting
|
The cells you have selected are what gets copied. Shifting
|
||||||
moves every date column, and the season and month
|
moves every date column, and the season and month
|
||||||
|
|||||||
@ -1241,10 +1241,11 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
|
|||||||
} else if (op === 'clone') {
|
} else if (op === 'clone') {
|
||||||
const set = Object.fromEntries(Object.entries(cloneSet).filter(([, v]) => v.trim()))
|
const set = Object.fromEntries(Object.entries(cloneSet).filter(([, v]) => v.trim()))
|
||||||
body = { ...body, note: cloneNote || undefined, set, scale: parseFloat(cloneScale) || 1 }
|
body = { ...body, note: cloneNote || undefined, set, scale: parseFloat(cloneScale) || 1 }
|
||||||
if (cloneFrom) {
|
// The offset stands on its own: shifting a selection through time is the
|
||||||
body.from_logid = Number(cloneFrom)
|
// common case, and it used to be sent only when a segment was named.
|
||||||
body.date_offset = cloneOffset.trim() || '0 days'
|
if (cloneFrom) body.from_logid = Number(cloneFrom)
|
||||||
}
|
const off = cloneOffset.trim()
|
||||||
|
if (off && off !== '0 days') body.date_offset = off
|
||||||
}
|
}
|
||||||
return body
|
return body
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user