feat(viewer): keep plans visible while inspecting steps

This commit is contained in:
coyotte508 2026-11-03 23:07:19 +00:00
commit 98017d2d8d
30 changed files with 1215 additions and 271 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@gaia-project/old-ui",
"version": "1.2.24",
"version": "1.2.25",
"scripts": {
"serve": "vite --port 5193",
"build": "vite build",

View file

@ -5,19 +5,6 @@
</b-modal>
<Rules id="rules" />
<div v-if="analysisNotice || analysisPendingRestore" class="row">
<div class="col-12">
<AnalysisPanel
:active="analysisMode"
:notice="analysisNotice"
:pending-restore="analysisPendingRestore"
@dismiss-notice="dismissAnalysisNotice"
@restore="restoreAnalysisLine"
@discard-restore="discardPendingAnalysisLine"
/>
</div>
</div>
<b-modal
id="premove-history"
v-model="premoveHistoryVisible"
@ -61,6 +48,11 @@
:currentMove="currentMove"
:hide-spacer="true"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -85,6 +77,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"
@ -127,6 +122,11 @@
:currentMove="currentMove"
:hide-spacer="true"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -151,6 +151,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"
@ -236,6 +239,11 @@
:hide-spacer="true"
@sticky-bar-height="stickyBarHeight = $event"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -260,6 +268,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"

View file

@ -10,6 +10,22 @@ const federationFixture = () => {
return data;
};
const planningEngine = () => {
const engine = new Engine(
Engine.parseMoves(`init 2 randomSeed
p1 faction terrans
p2 faction nevlas
terrans build m -1x2
nevlas build m -1x0
nevlas build m 0x-4
terrans build m -4x-1
nevlas booster booster7
terrans booster booster3`)
);
engine.players[0].data.knowledge = 12;
return engine;
};
describe("old UI on the current engine", () => {
beforeAll(() => {
const Observer = class {
@ -78,6 +94,158 @@ terrans booster booster3`)
}
});
it("inspects plan steps directly in the old UI without losing the list, then opens the explicit pencil", async () => {
const engine = new Engine(
Engine.parseMoves(`init 2 randomSeed
p1 faction terrans
p2 faction nevlas
terrans build m -1x2
nevlas build m -1x0
nevlas build m 0x-4
terrans build m -4x-1
nevlas booster booster7
terrans booster booster3`)
);
engine.players[0].data.knowledge = 12;
const host = document.createElement("div");
host.id = "old-test";
document.body.append(host);
const viewer = launch("#old-test");
try {
viewer.emit("player", { index: 0 });
viewer.emit("state", JSON.parse(JSON.stringify(engine)));
await vi.waitFor(() => expect(viewer.app.$el.querySelector(".old-map-canvas")).not.toBeNull());
const game = (viewer.app.$el.querySelector(".old-ui-game") as any).__vue__;
game.enterAnalysisMode();
game.resetAnalysisLine();
game.applyAnalysisMove("terrans up nav.");
game.chargeAnalysisPower();
game.applyAnalysisMove("terrans up gaia.");
await game.$nextTick();
const moves = () => viewer.app.$el.querySelectorAll<HTMLButtonElement>(".analysis-moves__move");
moves()[0].click();
await game.$nextTick();
expect(game.analysisEdit).toEqual({ index: 0, appliedCount: 3, mode: "inspect" });
expect(game.engine.players[0].data.knowledge).toBe(8);
expect(game.canPlay).toBe(false);
expect(moves()).toHaveLength(2);
moves()[1].click();
await game.$nextTick();
expect(game.analysisEdit.index).toBe(2);
expect(game.engine.players[0].data.knowledge).toBe(4);
expect(viewer.app.$el.querySelector('[aria-current="step"]')?.textContent).toContain("terrans up gaia.");
viewer.app.$el.querySelectorAll<HTMLButtonElement>(".analysis-moves__edit")[1].click();
await game.$nextTick();
expect(game.analysisEdit).toEqual({ index: 2, appliedCount: 3, mode: "replace" });
expect(game.engine.players[0].data.knowledge).toBe(8);
expect(game.canPlay).toBe(true);
expect(game.analysisEntries).toHaveLength(3);
} finally {
viewer.app.$destroy();
window.localStorage.clear();
document.body.replaceChildren();
}
});
for (const uiMode of ["graphical", "table"]) {
it(`keeps hotseat final-pass resources and disables end insertion at earlier steps (${uiMode})`, async () => {
const engine = planningEngine();
engine.round = 6;
engine.clearAvailableCommands();
engine.generateAvailableCommands();
const host = document.createElement("div");
host.id = "old-test";
document.body.append(host);
const viewer = launch("#old-test");
try {
// No "player" event: this is hotseat, with no locked seat to identify the plan's owner.
viewer.emit("state", JSON.parse(JSON.stringify(engine)));
viewer.emit("preferences", { uiMode });
await vi.waitFor(() => expect(viewer.app.$el.querySelector(".old-ui-game")).not.toBeNull());
const game = (viewer.app.$el.querySelector(".old-ui-game") as any).__vue__;
await vi.waitFor(() => expect(game.engine.moveHistory).toEqual(engine.moveHistory));
await vi.waitFor(() => expect(game.uiMode).toBe(uiMode));
viewer.store.commit("hosted", false);
expect(game.myLockedSeat).toBeUndefined();
game.enterAnalysisMode();
expect(game.analysisMode).toBe(true);
game.resetAnalysisLine();
game.applyAnalysisMove("terrans up nav.");
game.applyAnalysisMove("terrans pass");
expect(game.engine.ended).toBe(true);
expect(game.analysisCanAppend).toBe(false);
game.inspectAnalysisMove(1);
await game.$nextTick();
const resourceBar = viewer.app.$el.querySelector(".sticky-resource-bar") as any;
expect(resourceBar).not.toBeNull();
expect(resourceBar.__vue__.player).toBe(game.engine.players[game.analysisSeat]);
const addAtEnd = () => viewer.app.$el.querySelector<HTMLButtonElement>('[aria-label="Add move at end"]');
expect(addAtEnd().disabled).toBe(true);
viewer.app.$el.querySelectorAll<HTMLButtonElement>(".analysis-moves__move")[0].click();
await game.$nextTick();
expect(game.analysisEdit).toEqual({ index: 0, appliedCount: 2, mode: "inspect" });
expect(game.engine.ended).toBe(false);
expect(game.analysisCanAppend).toBe(false);
expect(addAtEnd().disabled).toBe(true);
expect(viewer.app.$el.querySelector(".analysis-strip, #root > [role='alert']")).toBeNull();
} finally {
viewer.app.$destroy();
window.localStorage.clear();
document.body.replaceChildren();
}
});
it(`keeps rollback restore/discard controls inline without a top alert (${uiMode})`, async () => {
const engine = planningEngine();
const entries = [{ kind: "move", move: "terrans up nav." }];
const saveDivergentPlan = () =>
window.localStorage.setItem(
"analysis-mode::0",
JSON.stringify({ lines: [entries], active: 0, baseMoveCount: engine.moveHistory.length + 1 })
);
const host = document.createElement("div");
host.id = "old-test";
document.body.append(host);
const viewer = launch("#old-test");
try {
viewer.emit("player", { index: 0 });
viewer.emit("state", JSON.parse(JSON.stringify(engine)));
viewer.emit("preferences", { uiMode });
await vi.waitFor(() => expect(viewer.app.$el.querySelector(".old-ui-game")).not.toBeNull());
const game = (viewer.app.$el.querySelector(".old-ui-game") as any).__vue__;
await vi.waitFor(() => expect(game.engine.moveHistory).toEqual(engine.moveHistory));
await vi.waitFor(() => expect(game.uiMode).toBe(uiMode));
viewer.store.commit("hosted", false);
for (const choice of ["Restore anyway", "Discard"]) {
saveDivergentPlan();
game.enterAnalysisMode();
await game.$nextTick();
expect(game.analysisPendingRestore).not.toBeNull();
expect(viewer.app.$el.querySelector(".analysis-strip, #root > [role='alert']")).toBeNull();
const prompt = viewer.app.$el.querySelector("#move .analysis-restore");
expect(prompt).not.toBeNull();
const button = [...prompt.querySelectorAll<HTMLButtonElement>("button")].find(
(button) => button.textContent.trim() === choice
);
button.click();
await game.$nextTick();
expect(game.analysisPendingRestore).toBeNull();
expect(viewer.app.$el.querySelector(".analysis-restore")).toBeNull();
expect(game.analysisEntries).toEqual(choice === "Restore anyway" ? entries : []);
if (choice === "Restore anyway") {
expect(viewer.app.$el.querySelector(".analysis-moves__move")?.textContent).toContain("terrans up nav.");
}
game.exitAnalysisMode();
await game.$nextTick();
}
} finally {
viewer.app.$destroy();
window.localStorage.clear();
document.body.replaceChildren();
}
});
}
for (const id of ["base", ...selfContainedScenarios.map((s) => s.id)]) {
it(`renders the actual old player/map components and current controls for ${id}`, async () => {
const host = document.createElement("div");

View file

@ -1,6 +1,6 @@
{
"name": "@gaia-project/viewer",
"version": "5.22.24",
"version": "5.22.25",
"description": "Functions to visualize the map and boards for gaia project inside html canvas",
"contributors": [
"coyotte508",

View file

@ -28,13 +28,57 @@ describe("AnalysisMoves prefix programming", () => {
await buttons.at(3).trigger("click");
expect(wrapper.emitted("commit")).to.have.length(1);
// Existing edit and delete events still carry entry indices, not move counts.
await wrapper.findAll(".analysis-moves__move").at(1).trigger("click");
await wrapper.findAll(".analysis-moves__edit").at(1).trigger("click");
await wrapper.findAll(".analysis-moves__remove").at(2).trigger("click");
expect(wrapper.emitted("edit")).to.deep.equal([[2]]);
expect(wrapper.emitted("remove")).to.deep.equal([[2]]);
wrapper.destroy();
});
it("keeps the whole plan visible, highlights the inspected step and separates viewing from editing", async () => {
const wrapper = mount(AnalysisMoves, {
propsData: { ...propsData, activeIndex: 2, inspecting: true, mutationsDisabled: true },
});
expect(wrapper.findAll(".analysis-moves__row")).to.have.length(5);
expect(wrapper.findAll(".analysis-moves__past")).to.have.length(1);
expect(wrapper.findAll(".analysis-moves__row--selected")).to.have.length(1);
expect(wrapper.find('[aria-current="step"]').text()).to.contain("b");
expect(wrapper.find(".analysis-moves__selected-state").text()).to.equal("Viewing");
const moves = wrapper.findAll(".analysis-moves__move");
expect(moves.at(1).attributes("aria-label")).to.equal("View after move 3: b");
await moves.at(0).trigger("click");
await moves.at(1).trigger("click");
expect(wrapper.emitted("inspect")).to.deep.equal([[0], [2]]);
expect(wrapper.emitted("edit")).to.equal(undefined);
await wrapper.findAll(".analysis-moves__edit").at(1).trigger("click");
expect(wrapper.emitted("edit")).to.deep.equal([[2]]);
await wrapper.find(".analysis-moves__remove").trigger("click");
await wrapper.find(".analysis-moves__program").trigger("click");
expect(wrapper.emitted("remove")).to.equal(undefined);
expect(wrapper.emitted("commit")).to.equal(undefined);
// A blocked move can be repaired, but its after-position does not exist yet.
await moves.at(2).trigger("click");
await wrapper.findAll(".analysis-moves__edit").at(2).trigger("click");
expect(wrapper.emitted("inspect")).to.have.length(2);
expect(wrapper.emitted("edit")).to.deep.equal([[2], [3]]);
wrapper.destroy();
});
it("highlights editing and insertion without hiding the remaining rows", async () => {
const wrapper = mount(AnalysisMoves, { propsData: { ...propsData, activeIndex: 0 } });
expect(wrapper.find(".analysis-moves__selected-state").text()).to.equal("Editing");
expect(wrapper.findAll(".analysis-moves__row")).to.have.length(5);
await wrapper.setProps({ inserting: true, activeIndex: 2 });
expect(wrapper.find(".analysis-moves__row--selected").exists()).to.equal(false);
expect(wrapper.find(".analysis-moves__insert--selected").attributes("aria-label")).to.equal("Insert before move 3");
await wrapper.setProps({ disabled: true });
await wrapper.find(".analysis-moves__move").trigger("click");
await wrapper.find(".analysis-moves__edit").trigger("click");
expect(wrapper.emitted("inspect")).to.equal(undefined);
expect(wrapper.emitted("edit")).to.equal(undefined);
wrapper.destroy();
});
it("disables simulated but uncommittable endpoints and all controls during an unfinished move", async () => {
const wrapper = mount(AnalysisMoves, { propsData: { ...propsData, appliedCount: 5, committableMoves: 1 } });
expect(wrapper.findAll(".analysis-moves__program").at(1).attributes("disabled")).to.equal("disabled");

View file

@ -10,6 +10,7 @@
v-if="entry.kind !== 'faction'"
type="button"
class="analysis-moves__insert"
:class="{ 'analysis-moves__insert--selected': activeIndex === index && inserting }"
:disabled="disabled || index > appliedCount"
:aria-label="insertLabel(index)"
:title="insertLabel(index)"
@ -18,7 +19,11 @@
>
<span aria-hidden="true">+</span>
</button>
<div class="analysis-moves__row">
<div
class="analysis-moves__row"
:class="{ 'analysis-moves__row--selected': activeIndex === index && !inserting }"
:aria-current="activeIndex === index && !inserting ? 'step' : null"
>
<button
v-if="entry.kind === 'move'"
type="button"
@ -26,10 +31,10 @@
:class="{
'analysis-moves__move--blocked': index === appliedCount,
}"
:disabled="disabled || index > appliedCount"
:aria-label="`Edit move ${moveNumber(index)}: ${entry.move}`"
title="Replay this move from the beginning"
@click="$emit('edit', index)"
:disabled="disabled || index >= appliedCount"
:aria-label="`View after move ${moveNumber(index)}: ${entry.move}`"
title="View position after this move"
@click="$emit('inspect', index)"
@keydown.stop
>
<span class="analysis-moves__number">{{ moveNumber(index) }}</span>
@ -41,20 +46,39 @@
class="analysis-moves__changes"
/>
</span>
<span v-if="index === appliedCount" class="analysis-moves__state">Needs update</span>
<span v-if="activeIndex === index && !inserting" class="analysis-moves__selected-state">{{
inspecting ? "Viewing" : "Editing"
}}</span>
<span v-else-if="index === appliedCount" class="analysis-moves__state">Needs update</span>
<span v-else-if="index > appliedCount" class="analysis-moves__state">Not simulated</span>
<svg class="analysis-moves__pencil" viewBox="0 0 16 16" aria-hidden="true">
<path d="m10.7 2.3 3 3-8.4 8.4-3.8.8.8-3.8Zm1.1-1.1 1-1a1 1 0 0 1 1.4 0l1.6 1.6a1 1 0 0 1 0 1.4l-1 1Z" />
</svg>
</button>
<span v-else class="analysis-moves__adjustment">{{
entry.kind === "adjust" ? `Assume ${entry.charge} power charged` : `Faction setup: ${entry.lineup.join(", ")}`
}}</span>
<button
v-if="entry.kind === 'move'"
type="button"
class="analysis-moves__edit"
:disabled="disabled || index > appliedCount"
:aria-label="`Edit move ${moveNumber(index)}: ${entry.move}`"
title="Replay this move from the beginning"
@click="$emit('edit', index)"
@keydown.stop
>
<svg class="analysis-moves__pencil" viewBox="0 0 16 16" aria-hidden="true">
<path d="m10.7 2.3 3 3-8.4 8.4-3.8.8.8-3.8Zm1.1-1.1 1-1a1 1 0 0 1 1.4 0l1.6 1.6a1 1 0 0 1 0 1.4l-1 1Z" />
</svg>
</button>
<button
v-if="entry.kind === 'move'"
type="button"
class="analysis-moves__program"
:disabled="disabled || index >= appliedCount || moveNumber(index) - played.length > committableMoves"
:disabled="
disabled ||
mutationsDisabled ||
index >= appliedCount ||
moveNumber(index) - played.length > committableMoves
"
:title="`Program up to move ${moveNumber(index)}`"
:aria-label="`Program up to move ${moveNumber(index)}`"
@click="$emit('commit', moveNumber(index) - played.length)"
@ -68,7 +92,7 @@
v-if="entry.kind !== 'faction'"
type="button"
class="analysis-moves__remove"
:disabled="disabled"
:disabled="disabled || mutationsDisabled"
:aria-label="
entry.kind === 'move' ? `Remove move ${moveNumber(index)}` : `Remove simulated charge at step ${index + 1}`
"
@ -97,6 +121,7 @@
<button
type="button"
class="analysis-moves__insert"
:class="{ 'analysis-moves__insert--selected': activeIndex === entries.length && inserting }"
:disabled="disabled || appliedCount < entries.length || !canAppend"
aria-label="Add move at end"
title="Add move at end"
@ -126,6 +151,10 @@ export default Vue.extend({
appliedCount: { type: Number, default: 0 },
committableMoves: { type: Number, default: 0 },
disabled: Boolean,
mutationsDisabled: Boolean,
activeIndex: { type: Number, default: -1 },
inspecting: Boolean,
inserting: Boolean,
canAppend: { type: Boolean, default: true },
},
methods: {
@ -151,6 +180,19 @@ export default Vue.extend({
.analysis-moves__row {
display: flex;
align-items: stretch;
border-radius: 3px;
&--selected {
background: var(--ui-info-bg);
box-shadow: inset 3px 0 var(--ui-info-text);
.analysis-moves__move,
.analysis-moves__move:hover:enabled {
background: transparent;
}
}
}
.analysis-moves__selected-state {
font-size: 0.75rem;
color: var(--ui-info-text);
}
.analysis-moves__past {
display: flex;
@ -198,6 +240,11 @@ export default Vue.extend({
opacity: 0.4;
}
}
.analysis-moves__insert--selected {
background: var(--ui-info-bg);
color: var(--ui-info-text);
}
.analysis-moves__edit,
.analysis-moves__program,
.analysis-moves__remove {
display: inline-flex;
@ -223,6 +270,12 @@ export default Vue.extend({
opacity: 0.4;
}
}
.analysis-moves__edit {
&:hover:enabled,
&:focus-visible {
color: var(--ui-info-text);
}
}
.analysis-moves__program {
flex-basis: 2.5rem;
min-height: 2.5rem;

View file

@ -6,86 +6,56 @@ import AnalysisPanel from "./AnalysisPanel.vue";
Vue.use(BootstrapVue);
// What is left of this surface: staleness notices and the saved-line prompt, the only two things
// that have to be readable while sandbox mode is NOT active. Everything else - move count, resource
// figures, Undo/Reset/Commit, the help text, the enter and exit buttons, and round 0's faction
// picker - lives in the striped header, the player board, the info modal, the map's corner button
// and Commands.vue's action area respectively. See AnalysisHeaderControls.spec.ts and
// Commands.spec.ts for those halves.
// Ordinary board changes are reflected in the plan rows, never a top notice. This component is
// solely the inline rollback/divergence recovery prompt beside Commands.vue's plan list.
describe("AnalysisPanel", () => {
it("renders nothing at all when there is no notice, no prompt and no picker", () => {
it("renders nothing when there is no saved plan awaiting recovery", () => {
const { container } = render(AnalysisPanel, { props: { active: true } });
expect(container.querySelector(".analysis-strip")).to.equal(null);
expect(container.querySelector(".analysis-restore")).to.equal(null);
expect(container.querySelector(".analysis-strip, [role='alert'], button")).to.equal(null);
});
it("no longer offers an enter or exit button - the map's corner button is the only one (§12)", () => {
const { container } = render(AnalysisPanel, { props: { active: false, notice: "something happened" } });
const labels = Array.from(container.querySelectorAll("button")).map((b) => b.textContent);
expect(labels.some((l) => l.includes("analysis mode"))).to.equal(false);
it("offers only restore or discard, with no generic notice or dismiss button", async () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }]],
active: 0,
baseMoveCount: 9,
};
const { container, emitted } = render(AnalysisPanel, { props: { active: true, pendingRestore } });
const buttons = Array.from(container.querySelectorAll("button"));
expect(buttons.map((button) => button.textContent.trim())).to.deep.equal(["Restore anyway", "Discard"]);
expect(container.querySelector(".analysis-restore").textContent).to.contain("1 move");
expect(container.querySelector(".analysis-strip, [role='alert']")).to.equal(null);
await fireEvent.click(buttons[0]);
await fireEvent.click(buttons[1]);
expect(emitted().restore).to.have.length(1);
expect(emitted()["discard-restore"]).to.have.length(1);
});
describe("staleness notice and pending-restore prompt (§3.5)", () => {
it("shows a dismissible notice even when analysis mode is not active, and emits dismiss-notice", async () => {
const { container, emitted } = render(AnalysisPanel, {
props: { active: false, notice: "Opponents moved since this line was saved." },
});
expect(container.querySelector(".analysis-strip").textContent).to.contain("Opponents moved");
await fireEvent.click(container.querySelector(".analysis-strip__banner-x"));
expect(emitted()["dismiss-notice"]).to.have.length(1);
});
it("prompts to restore or discard a stored line, and emits both answers", async () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }]],
active: 0,
baseMoveCount: 9,
};
const { container, emitted } = render(AnalysisPanel, { props: { active: true, pendingRestore } });
const buttons = Array.from(container.querySelectorAll("button"));
const restore = buttons.find((b) => b.textContent.includes("Restore anyway"));
const discard = buttons.find((b) => b.textContent.includes("Discard"));
expect(container.querySelector(".analysis-strip").textContent).to.contain("1 move");
await fireEvent.click(restore);
await fireEvent.click(discard);
expect(emitted().restore).to.have.length(1);
expect(emitted()["discard-restore"]).to.have.length(1);
});
// §13: Restore/Discard answers for every stored line at once, so quoting only the open line's
// length would understate what Discard is about to throw away.
it("counts every line and every move when more than one was stored", () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }], [{ kind: "move", move: "terrans up gaia." }], []],
active: 1,
baseMoveCount: 9,
};
const { container } = render(AnalysisPanel, { props: { active: true, pendingRestore } });
const text = container.querySelector(".analysis-strip").textContent;
expect(text).to.contain("3 saved plans");
expect(text).to.contain("2 moves in total");
});
it("does not show the restore prompt while analysis mode is inactive", () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }]],
active: 0,
baseMoveCount: 9,
};
const { container } = render(AnalysisPanel, { props: { active: false, pendingRestore } });
expect(container.querySelector(".analysis-strip__banner--confirm")).to.equal(null);
});
// Restore/Discard answers for every stored line at once, so quoting only the open line's length
// would understate what Discard is about to throw away.
it("counts every line and every move when more than one was stored", () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }], [{ kind: "move", move: "terrans up gaia." }], []],
active: 1,
baseMoveCount: 9,
};
const { container } = render(AnalysisPanel, { props: { active: true, pendingRestore } });
const text = container.querySelector(".analysis-restore").textContent;
expect(text).to.contain("3 saved plans");
expect(text).to.contain("2 moves in total");
});
it("no longer carries round 0's faction picker - that moved into Commands.vue's action area", () => {
const { container } = render(AnalysisPanel, { props: { active: true, notice: "something happened" } });
expect(container.querySelector(".analysis-strip__seed")).to.equal(null);
expect(container.querySelector("select")).to.equal(null);
it("renders nothing while analysis mode is inactive, even with a pending recovery", () => {
const pendingRestore = {
lines: [[{ kind: "move", move: "terrans up nav." }]],
active: 0,
baseMoveCount: 9,
};
const { container } = render(AnalysisPanel, { props: { active: false, pendingRestore } });
expect(container.querySelector(".analysis-restore, .analysis-strip, button")).to.equal(null);
});
});

View file

@ -1,16 +1,9 @@
<template>
<!-- Planning notices and recovery after a rollback. -->
<div v-if="notice || pendingRestore" class="analysis-strip">
<div v-if="notice" class="analysis-strip__banner">
<span class="flex-grow-1">{{ notice }}</span>
<button type="button" class="analysis-strip__banner-x" @click="$emit('dismiss-notice')">✕</button>
</div>
<div v-if="active && pendingRestore" class="analysis-strip__banner analysis-strip__banner--confirm">
<span class="flex-grow-1"> {{ pendingRestoreLabel }} from a different board position. </span>
<b-button size="sm" variant="outline-secondary" class="mr-1" @click="$emit('restore')">Restore anyway</b-button>
<b-button size="sm" variant="outline-secondary" @click="$emit('discard-restore')">Discard</b-button>
</div>
<!-- Inline recovery controls beside the plan list, only for a rollback or divergent history. -->
<div v-if="active && pendingRestore" class="analysis-restore">
<span class="flex-grow-1"> {{ pendingRestoreLabel }} from a different board position. </span>
<b-button size="sm" variant="outline-secondary" class="mr-1" @click="$emit('restore')">Restore anyway</b-button>
<b-button size="sm" variant="outline-secondary" @click="$emit('discard-restore')">Discard</b-button>
</div>
</template>
@ -23,7 +16,6 @@ export default Vue.extend({
name: "AnalysisPanel",
props: {
active: { type: Boolean, default: false },
notice: { type: String, default: null },
pendingRestore: { type: Object as () => AnalysisLineSet | null, default: null },
},
computed: {
@ -46,36 +38,14 @@ export default Vue.extend({
</script>
<style lang="scss" scoped>
.analysis-strip {
margin-bottom: 0.5rem;
font-size: 0.8rem;
}
.analysis-strip__banner {
.analysis-restore {
display: flex;
align-items: center;
gap: 0.4rem;
line-height: 1.3;
border: 1px solid var(--ui-border);
border-radius: 0.45rem;
padding: 0.4rem 0.5rem;
background: var(--ui-surface);
color: var(--ui-text);
margin-bottom: 0.4rem;
}
.analysis-strip__banner--confirm {
flex-wrap: wrap;
}
.analysis-strip__banner-x {
border: 0;
background: transparent;
color: var(--ui-text-muted);
font-size: 0.75rem;
line-height: 1;
padding: 0.15rem 0.25rem;
cursor: pointer;
flex: 0 0 auto;
gap: 0.4rem;
margin-bottom: 0.5rem;
font-size: 0.8rem;
line-height: 1.3;
color: var(--ui-text);
}
</style>

View file

@ -869,6 +869,109 @@ describe("Commands", () => {
expect(container.querySelectorAll("#analysis-commit-confirm").length).to.be.at.most(1);
});
it("keeps the complete move list and resources visible while inspecting, with direct step navigation", async () => {
const store = makeStore();
store.commit("receiveData", createLostFleetRoundMoveEngine());
const wrapper = mount(Commands, {
store,
propsData: {
currentMove: "",
actionsEnabled: false,
analysisMode: true,
analysisMoveCount: 1,
analysisAppliedCount: 4,
analysisEditingIndex: 0,
analysisInspectingMove: true,
analysisPlayed: [{ move: "played" }],
analysisEntries: [
{ kind: "move", move: "a" },
{ kind: "adjust", charge: 1 },
{ kind: "move", move: "b" },
{ kind: "move", move: "c" },
{ kind: "move", move: "blocked" },
],
},
});
expect(wrapper.findAll(".analysis-moves__row")).to.have.length(5);
expect(wrapper.find(".analysis-replace__title").text()).to.equal("After move 2");
expect(wrapper.find(".sticky-resource-bar-row--inspect").exists()).to.equal(true);
expect(wrapper.findComponent({ name: "StickyResourceBar" }).props("player")).to.equal(store.state.data.players[0]);
expect(wrapper.text()).not.to.contain("This preview has no action available");
expect(wrapper.find('[aria-label="Previous planned move"]').attributes("disabled")).to.equal("disabled");
await wrapper.find('[aria-label="Next planned move"]').trigger("click");
expect(wrapper.emitted("analysis-inspect-move")).to.deep.equal([[2]]);
await wrapper.setProps({ analysisEditingIndex: 3 });
expect(wrapper.find('[aria-label="Next planned move"]').attributes("disabled")).to.equal("disabled");
await wrapper.find('[aria-label="Previous planned move"]').trigger("click");
expect(wrapper.emitted("analysis-inspect-move")).to.deep.equal([[2], [2]]);
await wrapper.findAll(".analysis-moves__move").at(0).trigger("click");
expect(wrapper.emitted("analysis-inspect-move")).to.deep.equal([[2], [2], [0]]);
const edit = wrapper
.findAll(".analysis-replace__actions button")
.wrappers.find((b) => b.text() === "Edit this move");
await edit.trigger("click");
expect(wrapper.emitted("analysis-edit-move")).to.deep.equal([[3]]);
const end = wrapper.findAll(".analysis-replace__actions button").wrappers.find((b) => b.text() === "Return to end");
await end.trigger("click");
expect(wrapper.emitted("analysis-cancel-edit")).to.have.length(1);
wrapper.destroy();
});
it("keeps saved-plan recovery beside the plan instead of in a top-of-board alert", async () => {
const store = makeStore();
store.commit("receiveData", createLostFleetRoundMoveEngine());
const wrapper = mount(Commands, {
store,
propsData: {
currentMove: "",
analysisMode: true,
analysisPendingRestore: {
lines: [[{ kind: "move", move: "terrans up nav." }]],
active: 0,
baseMoveCount: 15,
},
},
});
const recovery = wrapper.findComponent({ name: "AnalysisPanel" });
expect(recovery.exists()).to.equal(true);
await recovery.findAll("button").at(0).trigger("click");
await recovery.findAll("button").at(1).trigger("click");
expect(wrapper.emitted("analysis-restore")).to.have.length(1);
expect(wrapper.emitted("analysis-discard-restore")).to.have.length(1);
expect(wrapper.find(".analysis-strip__banner").exists()).to.equal(false);
await wrapper.setProps({ analysisPendingRestore: null });
expect(wrapper.findComponent({ name: "AnalysisPanel" }).exists()).to.equal(false);
wrapper.destroy();
});
it("keeps the list during editing but protects a partial replacement from a navigation click", async () => {
const store = makeStore();
store.commit("receiveData", createLostFleetRoundMoveEngine());
const wrapper = mount(Commands, {
store,
propsData: {
currentMove: "",
analysisMode: true,
analysisAppliedCount: 2,
analysisEditingIndex: 0,
analysisEntries: [
{ kind: "move", move: "a" },
{ kind: "move", move: "b" },
],
},
});
expect(wrapper.findAll(".analysis-moves__row")).to.have.length(2);
expect(wrapper.find(".analysis-replace__title").text()).to.equal("Editing move 1");
await wrapper.findAll(".analysis-moves__edit").at(1).trigger("click");
expect(wrapper.emitted("analysis-edit-move")).to.deep.equal([[1]]);
await wrapper.setProps({ analysisNavigationDisabled: true });
await wrapper.findAll(".analysis-moves__edit").at(0).trigger("click");
await wrapper.findAll(".analysis-moves__move").at(0).trigger("click");
expect(wrapper.emitted("analysis-edit-move")).to.have.length(1);
expect(wrapper.emitted("analysis-inspect-move")).to.equal(undefined);
wrapper.destroy();
});
it("opens a row prefix without submitting, and the header restores the full proposal", async () => {
const store = makeStore();
store.commit("receiveData", createLostFleetRoundMoveEngine());

View file

@ -18,7 +18,6 @@
@close="$emit('analysis-close-line', $event)"
/>
<div
v-if="!analysisEditActive"
id="move-title"
class="d-flex align-items-center"
:class="{ 'hide-on-mobile-sticky': showStickyMobileBar, 'move-title--analysis': analysisMode }"
@ -52,11 +51,11 @@
panel - also renders for players who aren't on turn. Two copies would also register the
same modal id twice. -->
<AnalysisHeaderControls
v-if="analysisMode && !analysisEditActive"
:move-count="analysisMoveCount"
v-if="analysisMode"
:move-count="analysisDisplayedMoveCount"
:move-summary="analysisMoveSummary"
:premove-plan="premovePlan"
:can-edit="analysisCanEdit"
:can-edit="analysisCanEdit && !analysisEditActive"
@undo="$emit('analysis-undo')"
@reset="$emit('analysis-reset')"
:status="analysisStatus"
@ -67,8 +66,15 @@
/>
<span class="game-chat-button-host game-chat-button-host--desktop"></span>
</div>
<AnalysisPanel
v-if="analysisMode && analysisPendingRestore"
:active="analysisMode"
:pending-restore="analysisPendingRestore"
@restore="$emit('analysis-restore')"
@discard-restore="$emit('analysis-discard-restore')"
/>
<AnalysisMoves
v-if="analysisMode && (analysisEntries.length || analysisPlayed.length) && !analysisEditActive"
v-if="analysisMode && (analysisEntries.length || analysisPlayed.length)"
:entries="analysisEntries"
:played="analysisPlayed"
:blocked-reason="analysisBlockedReason"
@ -76,8 +82,13 @@
:applied-count="analysisAppliedCount"
:committable-moves="analysisCommittableMoves"
@commit="requestAnalysisCommit($event)"
:can-append="!engine.ended"
:disabled="analysisEditingIndex < 0 && !!currentMove"
:can-append="analysisCanAppend && !engine.ended"
:disabled="analysisNavigationDisabled || !!currentMove"
:mutations-disabled="analysisEditActive"
:active-index="analysisEditingIndex"
:inspecting="analysisInspectingMove"
:inserting="analysisInsertingMove"
@inspect="$emit('analysis-inspect-move', $event)"
@edit="$emit('analysis-edit-move', $event)"
@insert="$emit('analysis-insert-move', $event)"
@remove="$emit('analysis-remove-entry', $event)"
@ -166,11 +177,11 @@
(showStickyMobileBar excludes all three), so they could never show here. See
SetupStatus.vue. -->
<AnalysisHeaderControls
v-if="analysisMode && !analysisEditActive"
:move-count="analysisMoveCount"
v-if="analysisMode"
:move-count="analysisDisplayedMoveCount"
:move-summary="analysisMoveSummary"
:premove-plan="premovePlan"
:can-edit="analysisCanEdit"
:can-edit="analysisCanEdit && !analysisEditActive"
@undo="$emit('analysis-undo')"
@reset="$emit('analysis-reset')"
:status="analysisStatus"
@ -196,18 +207,53 @@
</div>
<div v-if="analysisEditActive" class="analysis-replace" role="status">
<div class="analysis-replace__original">
<strong class="analysis-replace__title"
<strong v-if="analysisInspectingMove" class="analysis-replace__title">{{
`After move ${analysisEditingMoveNumber}`
}}</strong>
<strong v-else class="analysis-replace__title"
>{{ analysisInsertingMove ? "Adding" : "Editing" }} move {{ analysisEditingMoveNumber }}</strong
>
<span v-if="analysisEditingMove"
<span v-if="analysisInspectingMove">{{ analysisEditingMove }}</span>
<span v-else-if="analysisEditingMove"
><span class="analysis-replace__label">{{ analysisInsertingMove ? "Before:" : "Original:" }}</span>
{{ analysisEditingMove }}</span
>
<span v-else class="analysis-replace__label">At the end of the plan</span>
</div>
<div class="analysis-replace__actions">
<template v-if="analysisInspectingMove">
<button
type="button"
class="btn btn-sm btn-outline-secondary"
aria-label="Previous planned move"
title="Previous planned move"
:disabled="analysisPreviousMove < 0"
@click="$emit('analysis-inspect-move', analysisPreviousMove)"
@keydown.stop
>
<span aria-hidden="true">←</span>
</button>
<button
type="button"
class="btn btn-sm btn-outline-secondary"
aria-label="Next planned move"
title="Next planned move"
:disabled="analysisNextMove < 0"
@click="$emit('analysis-inspect-move', analysisNextMove)"
@keydown.stop
>
<span aria-hidden="true">→</span>
</button>
<button
type="button"
class="btn btn-sm btn-outline-secondary"
@click="$emit('analysis-edit-move', analysisEditingIndex)"
>
Edit this move
</button>
</template>
<button
v-if="currentMove"
v-if="currentMove && !analysisInspectingMove"
type="button"
class="btn btn-sm btn-outline-secondary"
@click="$emit('analysis-restart-edit')"
@ -215,12 +261,12 @@
Restart
</button>
<button type="button" class="btn btn-sm btn-outline-secondary" @click="$emit('analysis-cancel-edit')">
Cancel
{{ analysisInspectingMove ? "Return to end" : "Cancel" }}
</button>
</div>
</div>
<ChargeWait v-if="autoChargeEnabled && !analysisMode && !currentMove" @command="$emit('command', $event)" />
<template v-if="actionsEnabled">
<template v-if="actionsEnabled && !analysisInspectingMove">
<div v-if="init" class="d-flex flex-wrap align-content-stretch">
<MoveButton
v-for="i in [2, 3, 4]"
@ -358,15 +404,18 @@
</div>
<b-btn variant="primary" class="silent-bid-submit" @click="submitSilentBid">Submit bids</b-btn>
</div>
<!-- Placed last (below the action buttons, at the very bottom of the sticky bar) - see the
.sticky-resource-bar-row CSS for the divider separating it from the buttons above and the
extra bottom clearance keeping it clear of the screen's rounded bottom corners. -->
<StickyResourceBar v-if="showResourceBar" :player="myPlayer" class="sticky-resource-bar-row" />
</template>
<p v-else-if="analysisMode" class="small text-muted mt-2 mb-0" role="status">
<p v-else-if="analysisMode && !analysisInspectingMove" class="small text-muted mt-2 mb-0" role="status">
This preview has no action available. You can switch plans, undo a move, clear the plan or return to the live
game.
</p>
<!-- Inspection is read-only, but its resource totals must stay visible on every screen size. -->
<StickyResourceBar
v-if="showResourceBar && (actionsEnabled || analysisInspectingMove)"
:player="myPlayer"
class="sticky-resource-bar-row"
:class="{ 'sticky-resource-bar-row--inspect': analysisInspectingMove }"
/>
</div>
<!-- reserves the sticky bar's actual rendered height (tracked live via ResizeObserver, capped
by the bar's own max-height/overflow) so it never permanently covers page content it has
@ -430,6 +479,7 @@ import { factionColor } from "../graphics/utils";
import type {
AnalysisCommitPlan,
AnalysisEntry,
AnalysisLineSet,
AnalysisLineSummary,
AnalysisPlayedMove,
AnalysisStatus,
@ -453,6 +503,7 @@ import AnalysisHeaderControls from "./AnalysisHeaderControls.vue";
import AnalysisLineTabs from "./AnalysisLineTabs.vue";
import AnalysisModeInfo from "./AnalysisModeInfo.vue";
import AnalysisMoves from "./AnalysisMoves.vue";
import AnalysisPanel from "./AnalysisPanel.vue";
import AutoChargeControl from "./AutoChargeControl.vue";
import ChargeWait from "./ChargeWait.vue";
import FactionInfoCard from "./FactionInfoCard.vue";
@ -482,6 +533,12 @@ export type EmitCommandParams = { disappear?: boolean; times?: number; warnings?
currentMove(this: Commands) {
this.mobileActionsCollapsed = false;
},
analysisEditingIndex(this: Commands, index: number) {
if (index >= 0) this.mobileActionsCollapsed = false;
},
analysisInspectingMove(this: Commands, inspecting: boolean) {
if (inspecting) this.mobileActionsCollapsed = false;
},
availableCommands(this: Commands, val, previous) {
if (hasConcurrentCharges(this.engine) && previous) {
const choices = (commands: AvailableCommand[]) =>
@ -542,6 +599,7 @@ export type EmitCommandParams = { disappear?: boolean; times?: number; warnings?
AnalysisCommitConfirm,
AnalysisModeInfo,
AnalysisMoves,
AnalysisPanel,
},
})
export default class Commands extends Vue implements CommandController {
@ -654,10 +712,47 @@ export default class Commands extends Vue implements CommandController {
@Prop({ default: false })
analysisInsertingMove: boolean;
@Prop({ default: false })
analysisInspectingMove: boolean;
@Prop({ default: false })
analysisNavigationDisabled: boolean;
@Prop({ default: null })
analysisPlayerIndex: number | null;
@Prop({ default: true })
analysisCanAppend: boolean;
@Prop({ default: null })
analysisPendingRestore: AnalysisLineSet | null;
get analysisPreviousMove(): number {
return this.analysisEntries.reduce(
(previous, entry, index) =>
entry.kind === "move" && index < this.analysisEditingIndex && index < this.analysisAppliedCount
? index
: previous,
-1
);
}
get analysisNextMove(): number {
return this.analysisEntries.findIndex(
(entry, index) => entry.kind === "move" && index > this.analysisEditingIndex && index < this.analysisAppliedCount
);
}
get analysisDisplayedMoveCount(): number {
return this.analysisEditActive
? this.analysisEntries.slice(0, this.analysisAppliedCount).filter((entry) => entry.kind === "move").length
: this.analysisMoveCount;
}
get analysisMoveSummary(): string {
const remaining = this.analysisEntries.filter((entry) => entry.kind === "move").length;
if (this.analysisPlayed.length) return `${this.analysisPlayed.length} played · ${remaining} left`;
return this.analysisBlockedReason ? `${this.analysisMoveCount}/${remaining} simulated` : "";
return this.analysisBlockedReason ? `${this.analysisDisplayedMoveCount}/${remaining} simulated` : "";
}
get analysisEditActive(): boolean {
@ -914,7 +1009,10 @@ export default class Commands extends Vue implements CommandController {
* lookup used elsewhere (e.g. FactionWheel.vue, BoardAction.vue) - falls back to the active
* player in self-contained/hot-seat mode, where there's no separate logged-in seat. */
get myPlayer(): Player | null {
const index = this.$store.state.player?.index ?? this.engine.currentPlayer;
const index =
this.analysisMode && this.analysisPlayerIndex !== null
? this.analysisPlayerIndex
: (this.$store.state.player?.index ?? this.engine.currentPlayer);
return index == null ? null : this.engine.players[index];
}
@ -1656,6 +1754,10 @@ $mobile-sticky-actions-max-height: 40vh;
border-top: 1px solid var(--ui-border);
}
#move-buttons .sticky-resource-bar-row--inspect {
display: flex !important;
}
// Keep the planning heading separate from the game controls below it.
#move-title.move-title--analysis {
background: $planning-background;
@ -1957,6 +2059,7 @@ $mobile-sticky-actions-max-height: 40vh;
}
.analysis-replace__actions {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-left: auto;
}

View file

@ -1707,6 +1707,351 @@ describe("Game", () => {
});
});
describe("inspecting simulated moves on the board", () => {
it("jumps directly to positions AFTER each move while keeping the full list, costs and saved plan", async () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
const firstBoard = JSON.stringify(vm.engine);
const firstStatus = JSON.stringify(vm.analysisStatus);
vm.chargeAnalysisPower();
vm.applyAnalysisMove("terrans up gaia.");
const secondBoard = JSON.stringify(vm.engine);
const secondStatus = JSON.stringify(vm.analysisStatus);
vm.applyAnalysisMove("terrans up sci.");
const endBoard = JSON.stringify(vm.engine);
const lines = vm.analysisLines;
const played = vm.analysisPlayed;
const costs = vm.analysisMoveCosts;
const summaries = vm.analysisLineSummaries;
const saved = JSON.stringify(window.localStorage);
const dispatched = spyDispatch(vm);
const write = vi.spyOn(Storage.prototype, "setItem");
await Vue.nextTick();
try {
// The charge row occupies entry 1, but move 2 still inspects original entry 2.
const moves = () => vm.$el.querySelectorAll(".analysis-moves__move");
await fireEvent.click(moves()[0]);
expect(vm.analysisEdit).to.deep.equal({ index: 0, appliedCount: 4, mode: "inspect" });
expect(vm.analysisAppliedCount).to.equal(1);
expect(JSON.stringify(vm.engine)).to.equal(firstBoard);
expect(JSON.stringify(vm.analysisStatus)).to.equal(firstStatus);
expect(vm.engine.players[0].data.knowledge).to.equal(8);
expect(vm.canPlay).to.equal(false);
expect(moves()).to.have.length(3);
expect(vm.$el.querySelectorAll(".analysis-moves__changes")).to.have.length(3);
expect(vm.$el.querySelector('[aria-current="step"]').textContent).to.contain("terrans up nav.");
await fireEvent.click(moves()[1]);
expect(vm.analysisEdit).to.deep.equal({ index: 2, appliedCount: 4, mode: "inspect" });
expect(vm.analysisAppliedCount).to.equal(3);
expect(JSON.stringify(vm.engine)).to.equal(secondBoard);
expect(JSON.stringify(vm.analysisStatus)).to.equal(secondStatus);
expect(vm.engine.players[0].data.knowledge).to.equal(4);
expect(vm.$el.querySelector('[aria-current="step"]').textContent).to.contain("terrans up gaia.");
await fireEvent.click(moves()[2]);
expect(vm.analysisEdit.index).to.equal(3);
expect(JSON.stringify(vm.engine)).to.equal(endBoard);
await fireEvent.click(moves()[0]);
expect(JSON.stringify(vm.engine)).to.equal(firstBoard);
expect(vm.analysisLines).to.equal(lines);
expect(vm.analysisPlayed).to.equal(played);
expect(vm.analysisMoveCosts).to.equal(costs);
expect(vm.analysisLineSummaries).to.equal(summaries);
expect(JSON.stringify(window.localStorage)).to.equal(saved);
expect(write.mock.calls).to.have.length(0);
expect(
dispatched.filter((action) => ["move", "analysisMove", "submitPlan"].includes(action.type))
).to.have.length(0);
vm.cancelAnalysisMoveEdit();
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisAppliedCount).to.equal(4);
expect(vm.canPlay).to.equal(true);
expect(JSON.stringify(vm.engine)).to.equal(endBoard);
expect(JSON.stringify(window.localStorage)).to.equal(saved);
expect(write.mock.calls).to.have.length(0);
} finally {
write.mockRestore();
vm.$destroy();
}
});
it("clears transient selection and rejects game inputs, commits and accidental edit restarts while inspecting", () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.chargeAnalysisPower();
vm.applyAnalysisMove("terrans up gaia.");
vm.$store.state.context.activeButton = { name: "stale" };
vm.$store.state.context.highlighted.hexes = ["-1x2"];
vm.$store.commit("setAutoClick", [[true]]);
vm.inspectAnalysisMove(0);
expect(vm.$store.state.context.activeButton).to.equal(null);
expect(vm.$store.state.context.highlighted.hexes).to.equal(null);
expect(vm.autoClick).to.deep.equal([]);
const board = JSON.stringify(vm.engine);
const saved = JSON.stringify(window.localStorage);
const entries = vm.analysisEntries;
const dispatched = spyDispatch(vm);
vm.applyAnalysisMove("terrans up sci.");
vm.applyAnalysisMove("");
vm.handleCommand("terrans up sci");
vm.handleCommand("init 2 ignored");
vm.addMove("terrans up sci.");
vm.chargeAnalysisPower();
vm.undoAnalysisCharge();
vm.seedAnalysisFaction(Faction.Itars);
vm.removeAnalysisEntry(0);
vm.commitAnalysisLine();
vm.commitAnalysisLine(1);
vm.restartAnalysisMoveEdit();
expect(vm.analysisEdit.mode).to.equal("inspect");
expect(vm.analysisPendingCharge).to.equal(0);
expect(vm.currentMove).to.equal("");
expect(vm.analysisCommittableMoves).to.deep.equal([]);
expect(vm.analysisEntries).to.equal(entries);
expect(JSON.stringify(vm.engine)).to.equal(board);
expect(JSON.stringify(window.localStorage)).to.equal(saved);
expect(dispatched).to.have.length(0);
vm.$destroy();
});
it("opens the pencil BEFORE the viewed move and replaces only that move, retaining its tail and undo history", async () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
for (const field of ["nav", "gaia", "eco"]) vm.applyAnalysisMove(`terrans up ${field}.`);
const original = JSON.parse(JSON.stringify(vm.analysisEntries));
vm.inspectAnalysisMove(1);
expect(vm.engine.players[0].data.knowledge).to.equal(4);
await Vue.nextTick();
await fireEvent.click(vm.$el.querySelectorAll(".analysis-moves__edit")[1]);
expect(vm.analysisEdit).to.deep.equal({ index: 1, appliedCount: 3, mode: "replace" });
expect(vm.engine.players[0].data.knowledge).to.equal(8);
expect(vm.canPlay).to.equal(true);
// An untouched edit can switch directly back to inspection, or to another pencil.
vm.inspectAnalysisMove(2);
expect(vm.analysisEdit.index).to.equal(2);
vm.startAnalysisMoveEdit(1);
vm.applyAnalysisMove("terrans up sci.");
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisEntries).to.deep.equal([original[0], { kind: "move", move: "terrans up sci." }, original[2]]);
vm.inspectAnalysisMove(0);
vm.cancelAnalysisMoveEdit();
vm.undoLastAnalysisEntry();
expect(vm.analysisEntries).to.deep.equal(original);
vm.$destroy();
});
it("does not discard a half-composed replacement or pending charge when switching to another step", () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.applyAnalysisMove("terrans up gaia.");
vm.startAnalysisMoveEdit(0);
vm.applyAnalysisMove("terrans spend 1o for 1c");
const draft = JSON.stringify(vm.engine);
vm.inspectAnalysisMove(1);
vm.startAnalysisMoveEdit(1);
vm.insertAnalysisMove(1);
expect(vm.analysisEdit).to.deep.equal({ index: 0, appliedCount: 2, mode: "replace" });
expect(JSON.stringify(vm.engine)).to.equal(draft);
expect(vm.currentMove).to.contain("spend 1o");
vm.restartAnalysisMoveEdit();
expect(vm.currentMove).to.equal("");
vm.chargeAnalysisPower();
vm.inspectAnalysisMove(1);
vm.startAnalysisMoveEdit(1);
expect(vm.analysisEdit.index).to.equal(0);
expect(vm.analysisPendingCharge).to.equal(1);
vm.restartAnalysisMoveEdit();
expect(vm.analysisPendingCharge).to.equal(0);
vm.inspectAnalysisMove(1);
expect(vm.analysisEdit).to.deep.equal({ index: 1, appliedCount: 2, mode: "inspect" });
vm.cancelAnalysisMoveEdit();
vm.applyAnalysisMove("terrans spend 1o for 1c");
vm.inspectAnalysisMove(0);
expect(vm.analysisEdit).to.equal(null);
expect(vm.currentMove).to.contain("spend 1o");
vm.$destroy();
});
it("rejects invalid indices, adjustments and blocked suffixes without hiding the full plan's blocked reason", async () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
for (const field of ["nav", "gaia", "eco"]) vm.applyAnalysisMove(`terrans up ${field}.`);
vm.startAnalysisMoveEdit(0);
vm.applyAnalysisMove("terrans spend 1k for 1c. up nav.");
const reason = vm.analysisBlockedReason;
expect(reason).not.to.equal("");
expect(vm.analysisAppliedCount).to.equal(2);
const before = JSON.stringify(vm.engine);
for (const index of [-1, 0.5, NaN, Infinity, 2, 3]) vm.inspectAnalysisMove(index);
expect(vm.analysisEdit).to.equal(null);
expect(JSON.stringify(vm.engine)).to.equal(before);
vm.inspectAnalysisMove(0);
vm.inspectAnalysisMove(2);
expect(vm.analysisEdit).to.deep.equal({ index: 0, appliedCount: 2, mode: "inspect" });
expect(vm.analysisBlockedReason).to.equal(reason);
await Vue.nextTick();
expect(vm.$el.querySelector(".analysis-moves__reason").textContent).to.contain(reason);
expect(vm.$el.querySelectorAll(".analysis-moves__move")[2].disabled).to.equal(true);
vm.cancelAnalysisMoveEdit();
vm.resetAnalysisLine();
vm.chargeAnalysisPower();
vm.applyAnalysisMove("terrans up nav.");
vm.inspectAnalysisMove(0);
expect(vm.analysisEdit).to.equal(null);
vm.inspectAnalysisMove(1);
expect(vm.analysisEdit.index).to.equal(1);
vm.$destroy();
});
it("undo returns to the full end position without editing the plan, through either undo entry point", () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.applyAnalysisMove("terrans up gaia.");
const board = JSON.stringify(vm.engine);
const saved = JSON.stringify(window.localStorage);
const dispatched = spyDispatch(vm);
for (const undo of ["undoLastAnalysisEntry", "undoMove"]) {
vm.inspectAnalysisMove(0);
vm[undo]();
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisEntries).to.have.length(2);
expect(JSON.stringify(vm.engine)).to.equal(board);
expect(JSON.stringify(window.localStorage)).to.equal(saved);
}
expect(dispatched).to.have.length(0);
vm.$destroy();
});
it("retains inspection on identical refresh, but reanchors the full plan on real progress without a top alert", async () => {
const vm = mountAsSeat(1, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("nevlas up nav.");
vm.applyAnalysisMove("nevlas up gaia.");
const entries = JSON.parse(JSON.stringify(vm.analysisEntries));
vm.inspectAnalysisMove(0);
const board = JSON.stringify(vm.engine);
await vm.$store.dispatch("externalData", JSON.parse(JSON.stringify(vm.analysisBackup)));
expect(vm.analysisEdit).to.deep.equal({ index: 0, appliedCount: 2, mode: "inspect" });
expect(JSON.stringify(vm.engine)).to.equal(board);
const arrived = bgsMove(JSON.parse(JSON.stringify(vm.analysisBackup)), "terrans up nav.", 0);
await vm.$store.dispatch("externalData", arrived);
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisEntries).to.deep.equal(entries);
expect(vm.analysisAppliedCount).to.equal(2);
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
vm.inspectAnalysisMove(0);
const own = bgsMove(JSON.parse(JSON.stringify(vm.analysisBackup)), "nevlas up nav.", 1);
await vm.$store.dispatch("externalData", own);
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisEntries).to.deep.equal(entries.slice(1));
expect(vm.analysisPlayed[0]).to.have.length(1);
expect(vm.analysisAppliedCount).to.equal(1);
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
vm.$destroy();
});
for (const uiMode of ["graphical", "table"]) {
it(`keeps hotseat final-pass resources and disables end insertion while inspecting an earlier step (${uiMode})`, async () => {
const engine = researchGame();
engine.round = 6;
engine.clearAvailableCommands();
engine.generateAvailableCommands();
const vm = mountAsSeat(undefined, engine);
vm.$store.commit("preferences", { uiMode });
expect(vm.myLockedSeat).to.equal(undefined);
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.applyAnalysisMove("terrans pass");
const endedBoard = JSON.stringify(vm.engine);
expect(vm.engine.ended).to.equal(true);
expect(vm.analysisCanAppend).to.equal(false);
vm.inspectAnalysisMove(1);
expect(vm.analysisEdit).to.deep.equal({ index: 1, appliedCount: 2, mode: "inspect" });
expect(JSON.stringify(vm.engine)).to.equal(endedBoard);
await Vue.nextTick();
const resourceBar = vm.$el.querySelector(".sticky-resource-bar");
expect(resourceBar, "the final-pass resource readout remains visible without a locked seat").not.to.equal(
null
);
expect(resourceBar.__vue__.player).to.equal(vm.engine.players[vm.analysisSeat]);
const addAtEnd = () => vm.$el.querySelector('[aria-label="Add move at end"]');
expect(addAtEnd().disabled).to.equal(true);
await fireEvent.click(vm.$el.querySelectorAll(".analysis-moves__move")[0]);
expect(vm.engine.ended).to.equal(false);
expect(vm.analysisEdit.index).to.equal(0);
expect(vm.analysisCanAppend).to.equal(false);
expect(addAtEnd().disabled, "the full plan ends the game even though this prefix does not").to.equal(true);
vm.startAnalysisMoveEdit(1);
await Vue.nextTick();
expect(vm.analysisEdit.mode).to.equal("replace");
expect(vm.analysisCanAppend).to.equal(false);
expect(addAtEnd().disabled).to.equal(true);
vm.cancelAnalysisMoveEdit();
expect(JSON.stringify(vm.engine)).to.equal(endedBoard);
vm.undoLastAnalysisEntry();
await Vue.nextTick();
expect(vm.analysisCanAppend).to.equal(true);
expect(addAtEnd().disabled).to.equal(false);
vm.$destroy();
});
}
it("abandons the temporary view on a real rollback while retaining the complete saved draft", async () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.applyAnalysisMove("terrans up gaia.");
const saved = JSON.stringify(window.localStorage);
vm.inspectAnalysisMove(0);
const rolledBack = new Engine(SETUP_MOVES.slice(0, -1));
await vm.$store.dispatch("externalData", JSON.parse(JSON.stringify(rolledBack)));
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisMode).to.equal(false);
expect(vm.currentMove).to.equal("");
expect(vm.engine.moveHistory).to.deep.equal(rolledBack.moveHistory);
expect(JSON.stringify(window.localStorage)).to.equal(saved);
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
vm.$destroy();
});
it("clears inspection on variation changes, reset, exit and reload without ever persisting the cursor", () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("terrans up nav.");
vm.applyAnalysisMove("terrans up gaia.");
vm.addAnalysisLine();
vm.inspectAnalysisMove(0);
vm.selectAnalysisLine(0);
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisAppliedCount).to.equal(2);
vm.inspectAnalysisMove(0);
vm.exitAnalysisMode();
vm.enterAnalysisMode();
expect(vm.analysisEdit).to.equal(null);
expect(vm.analysisAppliedCount).to.equal(2);
vm.inspectAnalysisMove(0);
vm.$destroy();
const reopened = mountAsSeat(0, researchGame());
reopened.enterAnalysisMode();
expect(reopened.analysisEdit).to.equal(null);
expect(reopened.analysisAppliedCount).to.equal(2);
expect(reopened.analysisEntries).to.have.length(2);
reopened.inspectAnalysisMove(0);
reopened.resetAnalysisLine();
expect(reopened.analysisEdit).to.equal(null);
expect(reopened.analysisEntries).to.have.length(0);
expect(reopened.analysisLines[1]).to.have.length(2);
reopened.$destroy();
});
});
describe("editing simulated moves on the board", () => {
it("shows each move's spending and gains after simulated charges and edits", async () => {
const vm = mountAsSeat(0, researchGame());
@ -1948,7 +2293,7 @@ describe("Game", () => {
vm.$destroy();
});
it("cancels the replacement on a real board change without appending its partial draft", () => {
it("cancels the replacement on a real board change without appending its partial draft", async () => {
const vm = mountAsSeat(1, researchGame());
vm.enterAnalysisMode();
vm.applyAnalysisMove("nevlas up nav.");
@ -1961,7 +2306,8 @@ describe("Game", () => {
expect(vm.analysisEdit).to.equal(null);
expect(vm.currentMove).to.equal("");
expect(vm.analysisEntries).to.deep.equal(entries);
expect(vm.analysisNotice).to.contain("original plan was kept");
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
vm.$destroy();
});
});
@ -2077,7 +2423,7 @@ describe("Game", () => {
vm.$el.remove();
vm.$destroy();
});
it("restores a stored line silently, with no notice, when nothing changed since it was saved", () => {
it("restores a stored line without a top alert when nothing changed since it was saved", async () => {
const first = mountAsSeat(0);
first.enterAnalysisMode();
first.applyAnalysisMove("terrans up nav.");
@ -2088,7 +2434,8 @@ describe("Game", () => {
second.enterAnalysisMode();
expect(second.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
expect(second.analysisNotice).to.equal(null);
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
expect(second.analysisPendingRestore).to.equal(null);
second.$el.remove();
@ -2115,9 +2462,8 @@ describe("Game", () => {
expect(second.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
expect(second.analysisPendingRestore).to.equal(null);
expect(second.analysisNotice).to.equal(null);
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip")).to.equal(null);
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
second.$el.remove();
second.$destroy();
@ -2170,7 +2516,7 @@ describe("Game", () => {
}
});
it("stays open through a refetch that carries no new move, even when the origin auto-played opponents", () => {
it("stays open through a refetch that carries no new move, even when the origin auto-played opponents", async () => {
// The other half of the same root cause as the re-anchor gate: the no-op-refetch guard read
// `analysisOrigin.moveHistory`, which settleAnalysisClone/advancePastOwnPass have already
// grown past the real history. A plain refetch then looked like a new move and force-closed
@ -2185,13 +2531,14 @@ describe("Game", () => {
vm.$store.dispatch("externalData", JSON.parse(JSON.stringify(vm.analysisBackup)));
expect(vm.analysisMode).to.equal(true);
expect(vm.analysisNotice).to.equal(null);
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
expect(vm.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
vm.$el.remove();
vm.$destroy();
});
it("discardPendingAnalysisLine clears the prompt and starts fresh instead of restoring", () => {
it("the inline Discard control clears rollback recovery and starts fresh", async () => {
const first = mountAsSeat(0, new Engine([...SETUP_MOVES, "terrans build m 5A2."]));
first.enterAnalysisMode();
first.applyAnalysisMove("terrans up nav.");
@ -2204,8 +2551,16 @@ describe("Game", () => {
second.enterAnalysisMode();
expect(second.analysisPendingRestore).to.not.equal(null);
second.discardPendingAnalysisLine();
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
const prompt = second.$el.querySelector("#move .analysis-restore");
expect(prompt, "rollback recovery is available beside the plan controls").not.to.equal(null);
const discard = Array.from(prompt.querySelectorAll("button")).find(
(button: HTMLButtonElement) => button.textContent.trim() === "Discard"
);
await fireEvent.click(discard as HTMLElement);
expect(second.$el.querySelector(".analysis-restore")).to.equal(null);
expect(second.analysisPendingRestore).to.equal(null);
expect(second.analysisEntries).to.deep.equal([]);
// Discard is now what actually deletes it - the prompt no longer wipes storage up front, so
@ -2216,7 +2571,7 @@ describe("Game", () => {
second.$destroy();
});
it("keeps a stored plan when the live game advances several rounds", () => {
it("keeps a stored plan when the live game advances several rounds", async () => {
const first = mountAsSeat(0);
first.enterAnalysisMode();
first.applyAnalysisMove("terrans up nav.");
@ -2232,7 +2587,8 @@ describe("Game", () => {
expect(second.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
expect(second.analysisPendingRestore).to.equal(null);
expect(second.analysisNotice).to.equal(null);
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
second.$el.remove();
second.$destroy();
@ -2254,17 +2610,6 @@ describe("Game", () => {
vm.$destroy();
});
it("dismissAnalysisNotice clears a shown notice", () => {
const vm = mountAsSeat(0);
vm.analysisNotice = "something happened";
vm.dismissAnalysisNotice();
expect(vm.analysisNotice).to.equal(null);
vm.$el.remove();
vm.$destroy();
});
it("silently trims a matching manual move without closing planning, and persists the remainder", async () => {
const vm = mountAsSeat(0, researchGame());
vm.enterAnalysisMode();
@ -2274,9 +2619,8 @@ describe("Game", () => {
vm.$store.dispatch("externalData", arrived);
expect(vm.analysisMode).to.equal(true);
expect(vm.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up gaia." }]);
expect(vm.analysisNotice).to.equal(null);
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip")).to.equal(null);
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
vm.$el.remove();
vm.$destroy();
const second = mountAsSeat(0, Engine.fromData(JSON.parse(JSON.stringify(arrived))));
@ -2302,9 +2646,8 @@ describe("Game", () => {
expect(vm.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
// Re-anchored onto the new history, so the stored line is not stale next time either.
expect(vm.analysisBaseMoveCount).to.equal(baseBefore + 1);
expect(vm.analysisNotice).to.equal(null);
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip")).to.equal(null);
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
// Exiting now restores the NEW real board, not the one from before the opponent moved.
vm.exitAnalysisMode();
expect(vm.engine.moveHistory.length).to.equal(arrived.moveHistory.length);
@ -2313,7 +2656,7 @@ describe("Game", () => {
vm.$destroy();
});
it("truncates and says so when an opponent's move genuinely does invalidate part of the line", () => {
it("retains blocked plan rows without a top alert when an opponent invalidates a move", async () => {
// Seat 1 (nevlas) analyses taking a board action while seat 0 is on turn; seat 0 then takes
// that very action for real. Board actions are single-use, so the line really is dead.
const position = new Engine(SETUP_MOVES);
@ -2332,9 +2675,13 @@ describe("Game", () => {
vm.$store.dispatch("externalData", JSON.parse(JSON.stringify(real)));
expect(vm.analysisMode).to.equal(true); // still in the sandbox - just with less line
expect(vm.analysisMode).to.equal(true);
expect(vm.analysisAppliedEntries).to.deep.equal([]); // nothing of it is on the board
expect(vm.analysisNotice).to.contain("no longer apply");
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
const blocked = vm.$el.querySelector(".analysis-moves__move--blocked");
expect(blocked.textContent).to.contain("nevlas action power3.");
expect(blocked.textContent).to.contain("Needs update");
// ...but the entry itself is NOT deleted: the strip flags the line (applied < moves) and the
// player decides. Silently destroying it was the old behaviour, and it had no undo.
expect(vm.analysisEntries).to.deep.equal([{ kind: "move", move: "nevlas action power3." }]);
@ -2349,7 +2696,7 @@ describe("Game", () => {
vm.$destroy();
});
it("restores the REST of a line the player then played for real, instead of nothing at all", () => {
it("restores the REST of a line the player then played for real, instead of nothing at all", async () => {
// The reported bug: follow your sandbox line at the table, come back, press Restore anyway,
// and get "0 moves restored" - because the replay starts at entry 1, which is exactly the
// move that has just been played and can never be played twice.
@ -2367,7 +2714,8 @@ describe("Game", () => {
expect(second.analysisPendingRestore).to.equal(null);
expect(second.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
expect(second.analysisNotice).to.equal(null);
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
expect(second.analysisPlayed[0]).to.have.length(1);
const recorded = JSON.parse(JSON.stringify(second.analysisPlayed));
second.exitAnalysisMode();
@ -2378,7 +2726,7 @@ describe("Game", () => {
second.$destroy();
});
it("restores a taken-back played prefix as editable moves", () => {
it("the inline Restore control recovers a taken-back played prefix as editable moves", async () => {
const first = mountAsSeat(0);
first.enterAnalysisMode();
first.applyAnalysisMove("terrans up nav.");
@ -2392,7 +2740,16 @@ describe("Game", () => {
const earlier = mountAsSeat(0);
earlier.enterAnalysisMode();
expect(earlier.analysisPendingRestore).not.to.equal(null);
earlier.restoreAnalysisLine();
await earlier.$nextTick();
expect(earlier.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
const prompt = earlier.$el.querySelector("#move .analysis-restore");
expect(prompt, "rollback recovery is available beside the plan controls").not.to.equal(null);
const restore = Array.from(prompt.querySelectorAll("button")).find(
(button: HTMLButtonElement) => button.textContent.trim() === "Restore anyway"
);
await fireEvent.click(restore as HTMLElement);
expect(earlier.$el.querySelector(".analysis-restore")).to.equal(null);
expect(earlier.analysisPendingRestore).to.equal(null);
expect(earlier.analysisPlayed[0]).to.deep.equal([]);
expect(earlier.analysisEntries).to.have.length(1);
expect(earlier.analysisAppliedCount).to.equal(1);
@ -2400,7 +2757,7 @@ describe("Game", () => {
earlier.$destroy();
});
it("leaves a line the player did NOT play alone - nothing is dropped without a real move behind it", () => {
it("leaves a line the player did NOT play alone - nothing is dropped without a real move behind it", async () => {
const first = mountAsSeat(0);
first.enterAnalysisMode();
first.applyAnalysisMove("terrans build m 2A3.");
@ -2413,7 +2770,10 @@ describe("Game", () => {
second.restoreAnalysisLine();
expect(second.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans build m 2A3." }]);
expect(second.analysisNotice).to.contain("no longer apply");
expect(second.analysisAppliedCount).to.equal(0);
await second.$nextTick();
expect(second.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
expect(second.$el.querySelector(".analysis-moves__move--blocked").textContent).to.contain("Needs update");
second.$el.remove();
second.$destroy();
});
@ -2467,7 +2827,7 @@ describe("Game", () => {
vm.$destroy();
});
it("leaves the sandbox open when the same state is refetched (a reconnect, not a move)", () => {
it("leaves the sandbox open when the same state is refetched (a reconnect, not a move)", async () => {
// Minimizing the tab and reopening it dispatches externalData with the SAME real state,
// which used to force-close the sandbox as if somebody had moved.
const vm = mountAsSeat(0);
@ -2477,7 +2837,8 @@ describe("Game", () => {
vm.$store.dispatch("externalData", JSON.parse(JSON.stringify(vm.analysisBackup)));
expect(vm.analysisMode).to.equal(true);
expect(vm.analysisNotice).to.equal(null);
await vm.$nextTick();
expect(vm.$el.querySelector(".analysis-strip, #root > [role='alert']")).to.equal(null);
expect(vm.analysisEntries).to.deep.equal([{ kind: "move", move: "terrans up nav." }]);
vm.$el.remove();
vm.$destroy();

View file

@ -5,20 +5,6 @@
</b-modal>
<Rules id="rules" />
<!-- Show planning and queue details above the board; own-turn simulation starts beside the actions. -->
<div v-if="analysisNotice || analysisPendingRestore" class="row">
<div class="col-12">
<AnalysisPanel
:active="analysisMode"
:notice="analysisNotice"
:pending-restore="analysisPendingRestore"
@dismiss-notice="dismissAnalysisNotice"
@restore="restoreAnalysisLine"
@discard-restore="discardPendingAnalysisLine"
/>
</div>
</div>
<b-modal
id="premove-history"
v-model="premoveHistoryVisible"
@ -70,6 +56,11 @@
:currentMove="currentMove"
:hide-spacer="true"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -94,6 +85,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"
@ -207,6 +201,11 @@
:currentMove="currentMove"
:hide-spacer="true"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -231,6 +230,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"
@ -308,6 +310,11 @@
:hide-spacer="true"
@sticky-bar-height="stickyBarHeight = $event"
:analysis-mode="analysisMode"
:analysis-player-index="analysisSeat"
:analysis-can-append="analysisCanAppend"
:analysis-pending-restore="analysisPendingRestore"
@analysis-restore="restoreAnalysisLine"
@analysis-discard-restore="discardPendingAnalysisLine"
:analysis-offered="analysisOffered && !replayData"
:take-back-offered="takeBackOffered"
@analysis-start="enterAnalysisMode"
@ -332,6 +339,9 @@
:analysis-applied-count="analysisEdit ? analysisEdit.appliedCount : analysisAppliedCount"
:analysis-editing-index="analysisEdit ? analysisEdit.index : -1"
:analysis-inserting-move="!!analysisEdit && analysisEdit.mode === 'insert'"
:analysis-inspecting-move="!!analysisEdit && analysisEdit.mode === 'inspect'"
:analysis-navigation-disabled="!!currentMove || analysisPendingCharge > 0"
@analysis-inspect-move="inspectAnalysisMove"
@analysis-insert-move="insertAnalysisMove"
@analysis-remove-entry="removeAnalysisEntry"
@analysis-edit-move="startAnalysisMoveEdit"
@ -421,7 +431,6 @@ import { isDesktopViewport, watchDesktopViewport } from "../logic/viewport";
import type { SealedBidBackend } from "../store";
import { UiMode } from "../store";
import AdvancedLog from "./AdvancedLog.vue";
import AnalysisPanel from "./AnalysisPanel.vue";
import BoardAction from "./BoardAction.vue";
import Charts from "./Charts.vue";
import Commands from "./Commands.vue";
@ -464,7 +473,6 @@ function continuesHistory(shown: string[], next: string[]): boolean {
@Component<Game>({
components: {
AdvancedLog,
AnalysisPanel,
BoardAction,
Commands,
PlayerInfo,
@ -529,8 +537,8 @@ export default class Game extends Vue {
analysisBlockedReason = "";
premoveHistoryVisible = false;
analysisActiveLine = 0;
// The saved line stays intact while the board temporarily shows a prefix for replacement.
analysisEdit: { index: number; appliedCount: number; mode: "replace" | "insert" } | null = null;
// The saved line stays intact while the board shows a prefix for inspection or editing.
analysisEdit: { index: number; appliedCount: number; mode: "replace" | "insert" | "inspect" } | null = null;
// Undo the most recent insertion, replacement or deletion without losing its original suffix.
analysisUndo: AnalysisEntry[] | null = null;
// How many of the OPEN line's entries actually replayed onto the current origin - `analysisEntries`
@ -544,6 +552,8 @@ export default class Game extends Vue {
// `applied` is short of its `moves` (AnalysisLineTabs.vue's `~`), the dead tail gets another chance
// on every re-anchor, and it is dropped only when the player themselves edits the line.
analysisAppliedCount = 0;
// Whether the full replayed plan can continue, independent of a temporary inspected/edited prefix.
analysisCanAppend = true;
// Spending and gains for each replayed move, excluding assumed-charge and faction entries.
analysisMoveCosts: MoveCost[] = [];
// Charge 1 presses made while a turn is half-composed (see `chargeAnalysisPower`). They are applied
@ -572,7 +582,6 @@ export default class Game extends Vue {
analysisSealedBidBackendBackup: SealedBidBackend | null = null;
// Ordinary real moves reconcile automatically. A saved plan from a divergent history is
// held for explicit recovery without overwriting storage while the prompt is unanswered.
analysisNotice: string | null = null;
analysisPendingRestore: AnalysisLineSet | null = null;
// The sandbox rolled the clone into a later round than the real game is in, because this seat had
// already passed (`advancePastOwnPass`). Nothing in such a line is committable - the real game has
@ -645,19 +654,17 @@ export default class Game extends Vue {
this.analysisBackup = JSON.parse(JSON.stringify(payload));
return;
}
const wasEditing = !!this.analysisEdit;
if (wasEditing) {
if (this.analysisEdit) {
this.analysisEdit = null;
this.currentMove = "";
this.analysisPendingCharge = 0;
this.$store.commit("clearContext");
}
// An opponent's turn is not, by itself, a reason to throw the player out of the sandbox -
// see `reanchorAnalysisLine`. It re-bases the line onto the new real state in place and
// takes over the whole handler when it can, so nothing below (including the handleData at
// the end) runs and the takeover simply carries on.
if (this.reanchorAnalysisLine(payload)) {
if (wasEditing)
this.analysisNotice = "The board changed. Your original plan was kept; select the move again to edit it.";
return;
}
this.analysisMode = false;
@ -669,7 +676,6 @@ export default class Game extends Vue {
this.analysisPendingRestore = null;
this.analysisPendingCharge = 0;
this.analysisRealHistory = [];
this.analysisNotice = "The position changed. Your draft is saved; open Planning to review it.";
this.$store.commit("setSealedBidBackend", this.analysisSealedBidBackendBackup);
this.analysisSealedBidBackendBackup = null;
this.$store.commit("setAnalysisMode", false);
@ -956,7 +962,7 @@ export default class Game extends Vue {
}
get canPlay() {
if (this.interactionDisabled) return false;
if (this.interactionDisabled || this.analysisEdit?.mode === "inspect") return false;
if (this.ended) {
return false;
}
@ -1141,7 +1147,6 @@ export default class Game extends Vue {
}
if (this.analysisEntries.length) {
if (this.analysisLines.length >= MAX_ANALYSIS_LINES) {
this.analysisNotice = "Close a plan before opening your queued moves.";
return;
}
this.addAnalysisLine();
@ -1328,7 +1333,6 @@ export default class Game extends Vue {
this.$store.commit("setAnalysisMode", true);
this.analysisMode = true;
this.analysisEdit = null;
this.analysisNotice = null;
this.analysisPendingRestore = null;
this.analysisPendingCharge = 0;
this.analysisSummaryCache = new Map();
@ -1399,13 +1403,9 @@ export default class Game extends Vue {
const entries = this.analysisEntries;
const draft = ownMove ? "" : this.currentMove;
const pendingCharge = ownMove ? 0 : this.analysisPendingCharge;
const applied = this.setAnalysisEntries(entries, { prune: false });
this.setAnalysisEntries(entries, { prune: false });
this.analysisPendingCharge = pendingCharge;
if (draft) this.applyAnalysisMove(draft);
this.analysisNotice =
applied < entries.length
? "The board changed. Some planned moves no longer apply; they are kept for you to edit."
: null;
return true;
}
@ -1418,7 +1418,6 @@ export default class Game extends Vue {
fresh();
return;
}
const sameBase = stored.baseMoveCount === this.analysisBaseMoveCount;
if (
stored.baseMoveCount > this.analysisBaseMoveCount ||
(stored.baseMove !== undefined && this.analysisRealHistory[stored.baseMoveCount - 1] !== stored.baseMove)
@ -1428,7 +1427,6 @@ export default class Game extends Vue {
return;
}
const newMoves = this.analysisRealHistory.slice(stored.baseMoveCount);
let played = 0;
const histories: AnalysisPlayedMove[][] = [];
const lines = stored.lines.map((entries, index) => {
const result = dropPlayedAnalysisPrefix(
@ -1440,15 +1438,9 @@ export default class Game extends Vue {
stored.played?.[index]
);
histories.push([...(stored.played?.[index] ?? []), ...result.played]);
played = Math.max(played, result.dropped);
return result.entries;
});
const active = lines[normalizeAnalysisLineSet(stored).active] ?? [];
const applied = this.setAnalysisLineSet({ ...stored, lines, played: histories }, { prune: false });
this.analysisNotice =
(!sameBase || played > 0) && applied < active.length
? "The board changed. Some planned moves no longer apply; they are kept for you to edit."
: null;
this.setAnalysisLineSet({ ...stored, lines, played: histories }, { prune: false });
}
/** A divergent history cannot prove which moves were played. Restore without deleting any. */
@ -1476,10 +1468,6 @@ export default class Game extends Vue {
this.persistAnalysisLines();
}
dismissAnalysisNotice() {
this.analysisNotice = null;
}
/** Decision #2 - discards the board preview but keeps the line (already persisted as each entry
* committed); re-entering restores it. */
exitAnalysisMode() {
@ -1504,6 +1492,7 @@ export default class Game extends Vue {
this.analysisBlockedReason = "";
this.analysisActiveLine = 0;
this.analysisAppliedCount = 0;
this.analysisCanAppend = true;
this.analysisMoveCosts = [];
this.analysisPendingCharge = 0;
this.analysisRealHistory = [];
@ -1517,7 +1506,7 @@ export default class Game extends Vue {
// Partial turns are always replayed from their stable base.
applyAnalysisMove(move: string) {
if (!this.analysisComposeBase) {
if (!this.analysisComposeBase || this.analysisEdit?.mode === "inspect") {
return;
}
const copy = markAnalysisSeat(
@ -1585,7 +1574,7 @@ export default class Game extends Vue {
* me Itars instead" means (and how the picker is labelled once one is applied).
*/
seedAnalysisFaction(faction: Faction) {
if (!this.analysisMode || !factionSeedAvailable(this.engine)) {
if (!this.analysisMode || this.analysisEdit?.mode === "inspect" || !factionSeedAvailable(this.engine)) {
return;
}
let lineup: Faction[];
@ -1630,7 +1619,7 @@ export default class Game extends Vue {
* path commits it straight to the line - which is what it always did, and still the common case.
*/
chargeAnalysisPower() {
if (!this.analysisMode) {
if (!this.analysisMode || this.analysisEdit?.mode === "inspect") {
return;
}
this.analysisPendingCharge += 1;
@ -1685,13 +1674,34 @@ export default class Game extends Vue {
}
}
/** Rewind only the displayed board. Persistence and the other variations keep the full plan. */
/** Inspect AFTER a completed move, keeping the full list, costs and saved plan untouched. */
inspectAnalysisMove(index: number) {
if (!this.analysisMode || !this.analysisOrigin || !Number.isInteger(index) || index < 0) return;
const appliedCount = this.analysisEdit?.appliedCount ?? this.analysisAppliedCount;
if (index >= appliedCount || this.analysisEntries[index]?.kind !== "move") return;
// A selection may be changed freely until a replacement/insertion has actually been composed.
if (this.currentMove || this.analysisPendingCharge) return;
const { engine, applied } = replayAnalysisLine(
this.analysisOrigin,
this.analysisEntries.slice(0, index + 1),
this.analysisSeat
);
if (applied !== index + 1) return;
this.analysisEdit = { index, appliedCount, mode: "inspect" };
this.analysisAppliedCount = applied;
this.analysisComposeBase = JSON.parse(JSON.stringify(engine));
this.analysisComposeAssumedPower = assumedPowerOf(engine, this.analysisSeat);
this.$store.commit("clearContext");
this.handleData(engine);
}
/** Rewind BEFORE the selected move for explicit editing; the full saved plan stays intact. */
startAnalysisMoveEdit(index: number, insert = false) {
if (!this.analysisMode || !Number.isInteger(index) || index < 0 || index > this.analysisEntries.length) return;
if (!insert && this.analysisEntries[index]?.kind !== "move") return;
if (insert && this.analysisEntries[index]?.kind === "faction") return;
if (!this.analysisEdit && (this.currentMove || this.analysisPendingCharge)) return;
const { engine, applied, blockedReason } = replayAnalysisLine(
if (this.currentMove || this.analysisPendingCharge) return;
const { engine, applied } = replayAnalysisLine(
this.analysisOrigin,
this.analysisEntries.slice(0, index),
this.analysisSeat
@ -1703,19 +1713,24 @@ export default class Game extends Vue {
mode: insert ? "insert" : "replace",
};
this.analysisAppliedCount = applied;
this.analysisBlockedReason = blockedReason ?? "";
this.analysisPendingCharge = 0;
this.analysisComposeBase = JSON.parse(JSON.stringify(engine));
this.analysisComposeAssumedPower = assumedPowerOf(engine, this.analysisSeat);
this.$store.commit("clearContext");
this.handleData(engine);
}
restartAnalysisMoveEdit() {
if (this.analysisEdit) this.startAnalysisMoveEdit(this.analysisEdit.index, this.analysisEdit.mode === "insert");
if (!this.analysisEdit || this.analysisEdit.mode === "inspect") return;
this.currentMove = "";
this.analysisPendingCharge = 0;
this.startAnalysisMoveEdit(this.analysisEdit.index, this.analysisEdit.mode === "insert");
}
cancelAnalysisMoveEdit() {
if (this.analysisEdit) this.setAnalysisEntries(this.analysisEntries, { prune: false, history: "preserve" });
if (!this.analysisEdit) return;
this.$store.commit("clearContext");
this.setAnalysisEntries(this.analysisEntries, { prune: false, persist: false, history: "preserve" });
}
insertAnalysisMove(index: number) {
@ -1740,7 +1755,8 @@ export default class Game extends Vue {
const entries = this.analysisEntries;
if (!this.analysisMode) return;
if (this.analysisEdit) {
this.restartAnalysisMoveEdit();
if (this.analysisEdit.mode === "inspect") this.cancelAnalysisMoveEdit();
else this.restartAnalysisMoveEdit();
return;
}
if (this.currentMove || this.analysisPendingCharge) {
@ -1797,7 +1813,7 @@ export default class Game extends Vue {
* is deleted now - the tail is kept, `analysisAppliedCount` records where the board stops, the
* strip flags the line, and the tail gets another chance every time the origin moves on.
*
* Returns `applied` so `resolveAnalysisStaleness`/`restoreAnalysisLine` can say what came back. */
* Returns the number of entries replayed onto the board. */
private setAnalysisEntries(
entries: AnalysisEntry[],
options: { prune?: boolean; persist?: boolean; history?: "record" | "preserve" } = {}
@ -1814,6 +1830,7 @@ export default class Game extends Vue {
);
const kept = options.prune === false ? entries : entries.slice(0, applied);
this.analysisAppliedCount = applied;
this.analysisCanAppend = !engine.ended;
this.analysisBlockedReason = blockedReason ?? "";
this.analysisMoveCosts = costs;
// A pending mid-turn charge belongs to the turn that was being composed; replacing the line
@ -1977,6 +1994,7 @@ export default class Game extends Vue {
}
handleCommand(command: string, warnings?: BuildWarning[]) {
if (this.analysisEdit?.mode === "inspect") return;
if (command.startsWith(Command.Init) || this.engine.round <= 0) {
this.addMove(command);
return;
@ -1998,6 +2016,10 @@ export default class Game extends Vue {
}
undoMove() {
if (this.analysisEdit?.mode === "inspect") {
this.cancelAnalysisMoveEdit();
return;
}
console.log("undo");
const back = new ExecuteBack();
@ -2027,6 +2049,7 @@ export default class Game extends Vue {
}
addMove(command: string) {
if (this.analysisEdit?.mode === "inspect") return;
this.$store.commit("clearContext");
const type = this.analysisMode ? "analysisMove" : "move";
this.$store.dispatch(type, command);

View file

@ -50,9 +50,11 @@ describe("premove history", () => {
});
expect(view.find(".analysis-moves__past").text()).to.include("✓ Played");
expect(view.find(".analysis-moves__past button").exists()).to.equal(false);
expect(view.find(".analysis-moves__move").attributes("aria-label")).to.equal("Edit move 2: nevlas up gaia.");
expect(view.find(".analysis-moves__edit").attributes("aria-label")).to.equal("Edit move 2: nevlas up gaia.");
expect(view.text()).to.include("Not enough knowledge").and.include("Not simulated");
await view.find(".analysis-moves__move").trigger("click");
expect(view.emitted("inspect")).to.equal(undefined);
await view.find(".analysis-moves__edit").trigger("click");
expect(view.emitted("edit")).to.deep.equal([[0]]);
view.destroy();
});

View file

@ -4141,5 +4141,13 @@
"New plan": "Ny plan",
"✓ Income resolved": "✓ Indkomst afviklet",
"Program up to move {p0}": "Programmér til og med træk {p0}",
"Kept for later": "Gemt til senere"
"Kept for later": "Gemt til senere",
"View after move {p0}: {p1}": "Vis efter træk {p0}: {p1}",
"View position after this move": "Vis stillingen efter dette træk",
"Viewing": "Visning",
"After move {p0}": "Efter træk {p0}",
"Previous planned move": "Forrige planlagte træk",
"Next planned move": "Næste planlagte træk",
"Edit this move": "Rediger dette træk",
"Return to end": "Tilbage til slutningen"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Neuer Plan",
"✓ Income resolved": "✓ Einkommen abgehandelt",
"Program up to move {p0}": "Bis zu Zug {p0} programmieren",
"Kept for later": "Für später gespeichert"
"Kept for later": "Für später gespeichert",
"View after move {p0}: {p1}": "Nach Zug {p0} ansehen: {p1}",
"View position after this move": "Spielstand nach diesem Zug ansehen",
"Viewing": "Ansicht",
"After move {p0}": "Nach Zug {p0}",
"Previous planned move": "Vorheriger geplanter Zug",
"Next planned move": "Nächster geplanter Zug",
"Edit this move": "Diesen Zug bearbeiten",
"Return to end": "Zum Ende zurückkehren"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Νέο σχέδιο",
"✓ Income resolved": "✓ Το εισόδημα διευθετήθηκε",
"Program up to move {p0}": "Προγραμματισμός έως την κίνηση {p0}",
"Kept for later": "Αποθηκευμένες για αργότερα"
"Kept for later": "Αποθηκευμένες για αργότερα",
"View after move {p0}: {p1}": "Προβολή μετά την κίνηση {p0}: {p1}",
"View position after this move": "Προβολή της θέσης μετά από αυτή την κίνηση",
"Viewing": "Προβολή",
"After move {p0}": "Μετά την κίνηση {p0}",
"Previous planned move": "Προηγούμενη προγραμματισμένη κίνηση",
"Next planned move": "Επόμενη προγραμματισμένη κίνηση",
"Edit this move": "Επεξεργασία αυτής της κίνησης",
"Return to end": "Επιστροφή στο τέλος"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "New plan",
"✓ Income resolved": "✓ Income resolved",
"Program up to move {p0}": "Program up to move {p0}",
"Kept for later": "Kept for later"
"Kept for later": "Kept for later",
"View after move {p0}: {p1}": "View after move {p0}: {p1}",
"View position after this move": "View position after this move",
"Viewing": "Viewing",
"After move {p0}": "After move {p0}",
"Previous planned move": "Previous planned move",
"Next planned move": "Next planned move",
"Edit this move": "Edit this move",
"Return to end": "Return to end"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "برنامهٔ جدید",
"✓ Income resolved": "✓ درآمد دریافت شد",
"Program up to move {p0}": "برنامه‌ریزی تا حرکت {p0}",
"Kept for later": "نگه‌داشته‌شده برای بعد"
"Kept for later": "نگه‌داشته‌شده برای بعد",
"View after move {p0}: {p1}": "مشاهده پس از حرکت {p0}: {p1}",
"View position after this move": "مشاهدهٔ وضعیت پس از این حرکت",
"Viewing": "در حال مشاهده",
"After move {p0}": "پس از حرکت {p0}",
"Previous planned move": "حرکت برنامه‌ریزی‌شدهٔ قبلی",
"Next planned move": "حرکت برنامه‌ریزی‌شدهٔ بعدی",
"Edit this move": "ویرایش این حرکت",
"Return to end": "بازگشت به پایان"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Nouveau plan",
"✓ Income resolved": "✓ Revenus résolus",
"Program up to move {p0}": "Programmer jusqu’au coup {p0}",
"Kept for later": "Conservés pour plus tard"
"Kept for later": "Conservés pour plus tard",
"View after move {p0}: {p1}": "Voir après le coup {p0} : {p1}",
"View position after this move": "Voir la position après ce coup",
"Viewing": "Consultation",
"After move {p0}": "Après le coup {p0}",
"Previous planned move": "Coup planifié précédent",
"Next planned move": "Coup planifié suivant",
"Edit this move": "Modifier ce coup",
"Return to end": "Revenir à la fin"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "नई योजना",
"✓ Income resolved": "✓ आय प्राप्त हो गई",
"Program up to move {p0}": "चाल {p0} तक प्रोग्राम करें",
"Kept for later": "बाद के लिए सुरक्षित"
"Kept for later": "बाद के लिए सुरक्षित",
"View after move {p0}: {p1}": "चाल {p0} के बाद देखें: {p1}",
"View position after this move": "इस चाल के बाद की स्थिति देखें",
"Viewing": "अवलोकन",
"After move {p0}": "चाल {p0} के बाद",
"Previous planned move": "पिछली नियोजित चाल",
"Next planned move": "अगली नियोजित चाल",
"Edit this move": "इस चाल को संपादित करें",
"Return to end": "अंत पर लौटें"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Nuovo piano",
"✓ Income resolved": "✓ Reddito risolto",
"Program up to move {p0}": "Programma fino alla mossa {p0}",
"Kept for later": "Conservate per dopo"
"Kept for later": "Conservate per dopo",
"View after move {p0}: {p1}": "Visualizza dopo la mossa {p0}: {p1}",
"View position after this move": "Visualizza la posizione dopo questa mossa",
"Viewing": "Visualizzazione",
"After move {p0}": "Dopo la mossa {p0}",
"Previous planned move": "Mossa pianificata precedente",
"Next planned move": "Mossa pianificata successiva",
"Edit this move": "Modifica questa mossa",
"Return to end": "Torna alla fine"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "새 계획",
"✓ Income resolved": "✓ 수입 처리 완료",
"Program up to move {p0}": "{p0}번째 수까지 예약",
"Kept for later": "나중을 위해 보관됨"
"Kept for later": "나중을 위해 보관됨",
"View after move {p0}: {p1}": "{p0}번째 수 이후 보기: {p1}",
"View position after this move": "이 수 이후의 상태 보기",
"Viewing": "보는 중",
"After move {p0}": "{p0}번째 수 이후",
"Previous planned move": "이전 계획된 수",
"Next planned move": "다음 계획된 수",
"Edit this move": "이 수 수정",
"Return to end": "끝으로 돌아가기"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Nieuw plan",
"✓ Income resolved": "✓ Inkomsten afgehandeld",
"Program up to move {p0}": "Programmeer tot en met zet {p0}",
"Kept for later": "Bewaard voor later"
"Kept for later": "Bewaard voor later",
"View after move {p0}: {p1}": "Bekijk na zet {p0}: {p1}",
"View position after this move": "Bekijk de positie na deze zet",
"Viewing": "Weergave",
"After move {p0}": "Na zet {p0}",
"Previous planned move": "Vorige geplande zet",
"Next planned move": "Volgende geplande zet",
"Edit this move": "Deze zet bewerken",
"Return to end": "Terug naar het einde"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Nowy plan",
"✓ Income resolved": "✓ Dochód rozliczony",
"Program up to move {p0}": "Zaprogramuj do ruchu {p0}",
"Kept for later": "Zachowane na później"
"Kept for later": "Zachowane na później",
"View after move {p0}: {p1}": "Zobacz po ruchu {p0}: {p1}",
"View position after this move": "Zobacz pozycję po tym ruchu",
"Viewing": "Podgląd",
"After move {p0}": "Po ruchu {p0}",
"Previous planned move": "Poprzedni zaplanowany ruch",
"Next planned move": "Następny zaplanowany ruch",
"Edit this move": "Edytuj ten ruch",
"Return to end": "Wróć na koniec"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Novo plano",
"✓ Income resolved": "✓ Renda resolvida",
"Program up to move {p0}": "Programar até a jogada {p0}",
"Kept for later": "Guardados para depois"
"Kept for later": "Guardados para depois",
"View after move {p0}: {p1}": "Ver após a jogada {p0}: {p1}",
"View position after this move": "Ver a posição após esta jogada",
"Viewing": "Visualização",
"After move {p0}": "Após a jogada {p0}",
"Previous planned move": "Jogada planejada anterior",
"Next planned move": "Próxima jogada planejada",
"Edit this move": "Editar esta jogada",
"Return to end": "Voltar ao final"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Plan nou",
"✓ Income resolved": "✓ Venit rezolvat",
"Program up to move {p0}": "Programează până la mutarea {p0}",
"Kept for later": "Păstrate pentru mai târziu"
"Kept for later": "Păstrate pentru mai târziu",
"View after move {p0}: {p1}": "Vezi după mutarea {p0}: {p1}",
"View position after this move": "Vezi poziția după această mutare",
"Viewing": "Vizualizare",
"After move {p0}": "După mutarea {p0}",
"Previous planned move": "Mutarea planificată anterioară",
"Next planned move": "Următoarea mutare planificată",
"Edit this move": "Editează această mutare",
"Return to end": "Revino la final"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Новый план",
"✓ Income resolved": "✓ Доход получен",
"Program up to move {p0}": "Запрограммировать до хода {p0}",
"Kept for later": "Сохранены на потом"
"Kept for later": "Сохранены на потом",
"View after move {p0}: {p1}": "Посмотреть после хода {p0}: {p1}",
"View position after this move": "Посмотреть позицию после этого хода",
"Viewing": "Просмотр",
"After move {p0}": "После хода {p0}",
"Previous planned move": "Предыдущий запланированный ход",
"Next planned move": "Следующий запланированный ход",
"Edit this move": "Изменить этот ход",
"Return to end": "Вернуться в конец"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "Kế hoạch mới",
"✓ Income resolved": "✓ Đã xử lý thu nhập",
"Program up to move {p0}": "Lập trình đến nước đi {p0}",
"Kept for later": "Giữ lại để dùng sau"
"Kept for later": "Giữ lại để dùng sau",
"View after move {p0}: {p1}": "Xem sau nước đi {p0}: {p1}",
"View position after this move": "Xem trạng thái sau nước đi này",
"Viewing": "Đang xem",
"After move {p0}": "Sau nước đi {p0}",
"Previous planned move": "Nước đi đã lên kế hoạch trước",
"Next planned move": "Nước đi đã lên kế hoạch tiếp theo",
"Edit this move": "Chỉnh sửa nước đi này",
"Return to end": "Trở về cuối"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "新计划",
"✓ Income resolved": "✓ 收入已结算",
"Program up to move {p0}": "编排至第 {p0} 步",
"Kept for later": "保留供以后使用"
"Kept for later": "保留供以后使用",
"View after move {p0}: {p1}": "查看第 {p0} 步之后:{p1}",
"View position after this move": "查看此行动后的局面",
"Viewing": "查看中",
"After move {p0}": "第 {p0} 步之后",
"Previous planned move": "上一个计划行动",
"Next planned move": "下一个计划行动",
"Edit this move": "编辑此行动",
"Return to end": "返回末尾"
}

View file

@ -4141,5 +4141,13 @@
"New plan": "新計畫",
"✓ Income resolved": "✓ 收入已結算",
"Program up to move {p0}": "編排至第 {p0} 步",
"Kept for later": "保留供之後使用"
"Kept for later": "保留供之後使用",
"View after move {p0}: {p1}": "檢視第 {p0} 步之後:{p1}",
"View position after this move": "檢視此行動後的局面",
"Viewing": "檢視中",
"After move {p0}": "第 {p0} 步之後",
"Previous planned move": "上一個計畫行動",
"Next planned move": "下一個計畫行動",
"Edit this move": "編輯此行動",
"Return to end": "返回末尾"
}