refactor(layout): rename view-only mode to "macroplan"

Avoids the redundant ?view=view in favour of the explicit ?view=macroplan,
matching the button label.
This commit is contained in:
Julien Calixte
2026-06-19 17:48:30 +02:00
parent f42cb2b779
commit 65726a0211

View File

@@ -15,16 +15,16 @@ const confirmingDelete = ref(false)
// Which panes are visible: the Source editor, the rendered Macroplan, or both. // Which panes are visible: the Source editor, the rendered Macroplan, or both.
// Kept in the URL (?view=…) so a layout is shareable/bookmarkable, not persisted. // Kept in the URL (?view=…) so a layout is shareable/bookmarkable, not persisted.
type ViewMode = "source" | "split" | "view" type ViewMode = "source" | "split" | "macroplan"
function readViewMode(): ViewMode { function readViewMode(): ViewMode {
const v = new URLSearchParams(location.search).get("view") const v = new URLSearchParams(location.search).get("view")
return v === "source" || v === "view" ? v : "split" return v === "source" || v === "macroplan" ? v : "split"
} }
const mode = ref<ViewMode>(readViewMode()) const mode = ref<ViewMode>(readViewMode())
const showSource = computed(() => mode.value !== "view") const showSource = computed(() => mode.value !== "macroplan")
const showView = computed(() => mode.value !== "source") const showMacroplan = computed(() => mode.value !== "source")
// Reflect the choice in the URL without stacking a history entry per toggle. // Reflect the choice in the URL without stacking a history entry per toggle.
// "split" is the default, so drop the param to keep the URL clean. // "split" is the default, so drop the param to keep the URL clean.
@@ -83,17 +83,17 @@ function confirmDelete() {
</button> </button>
<button <button
class="btn btn-sm join-item" class="btn btn-sm join-item"
:class="{ 'btn-active': mode === 'view' }" :class="{ 'btn-active': mode === 'macroplan' }"
:aria-pressed="mode === 'view'" :aria-pressed="mode === 'macroplan'"
title="Show only the rendered Macroplan" title="Show only the rendered Macroplan"
@click="mode = 'view'" @click="mode = 'macroplan'"
> >
Macroplan Macroplan
</button> </button>
</div> </div>
<button <button
class="btn btn-ghost btn-sm" class="btn btn-ghost btn-sm"
:disabled="!plan || busy || !showView" :disabled="!plan || busy || !showMacroplan"
title="Copy the rendered plan to the clipboard as a PNG" title="Copy the rendered plan to the clipboard as a PNG"
@click="copyPng(exportRoot)" @click="copyPng(exportRoot)"
> >
@@ -102,7 +102,7 @@ function confirmDelete() {
</button> </button>
<button <button
class="btn btn-ghost btn-sm" class="btn btn-ghost btn-sm"
:disabled="!plan || busy || !showView" :disabled="!plan || busy || !showMacroplan"
title="Download the rendered plan as a PNG" title="Download the rendered plan as a PNG"
@click="downloadPng(exportRoot, exportFilename(plan?.title ?? ''))" @click="downloadPng(exportRoot, exportFilename(plan?.title ?? ''))"
> >
@@ -123,7 +123,7 @@ function confirmDelete() {
v-if="showSource" v-if="showSource"
class="flex min-h-0 flex-col border-base-300" class="flex min-h-0 flex-col border-base-300"
:class=" :class="
showView ? 'max-md:h-2/5 max-md:border-b md:w-1/3 md:max-w-md md:border-r' : 'flex-1' showMacroplan ? 'max-md:h-2/5 max-md:border-b md:w-1/3 md:max-w-md md:border-r' : 'flex-1'
" "
> >
<div class="px-4 py-2 text-xs font-semibold uppercase tracking-wide text-base-content/50"> <div class="px-4 py-2 text-xs font-semibold uppercase tracking-wide text-base-content/50">
@@ -132,7 +132,7 @@ function confirmDelete() {
<PlanEditor v-model="source" :error="error" class="min-h-0 flex-1" /> <PlanEditor v-model="source" :error="error" class="min-h-0 flex-1" />
</section> </section>
<section v-if="showView" class="min-h-0 flex-1 overflow-auto p-4"> <section v-if="showMacroplan" class="min-h-0 flex-1 overflow-auto p-4">
<div v-if="plan" ref="exportRoot" class="export-root"> <div v-if="plan" ref="exportRoot" class="export-root">
<h2 class="mb-3 text-sm font-semibold text-base-content/70">{{ plan.title }}</h2> <h2 class="mb-3 text-sm font-semibold text-base-content/70">{{ plan.title }}</h2>
<MacroplanGrid :plan="plan" /> <MacroplanGrid :plan="plan" />