diff --git a/src/timer.cubing.net/resources/vendor/twizzle-link.ts b/src/timer.cubing.net/resources/vendor/twizzle-link.ts index b990cd8..70e8b42 100644 --- a/src/timer.cubing.net/resources/vendor/twizzle-link.ts +++ b/src/timer.cubing.net/resources/vendor/twizzle-link.ts @@ -43,3 +43,23 @@ export function twizzleLinkForAttempt(attemptData: AttemptData): string { : undefined, ); } + +// TODO: Include title +export function liveReconstructionLinkForAttempt( + attemptData: AttemptData, +): string { + const url = new URL( + "https://experiments.cubing.net/cubing.js/live-reconstruction/", + ); + url.searchParams.set("setup", attemptData.scramble ?? ""); + return url.toString(); +} + +// TODO: Include title +export function linkForAttempt(attemptData: AttemptData): string { + return attemptData.event && + eventInfo(attemptData.event)?.puzzleID === "3x3x3" && + !attemptData.solution + ? liveReconstructionLinkForAttempt(attemptData) + : twizzleLinkForAttempt(attemptData); +} diff --git a/src/timer.cubing.net/ui/results-table.ts b/src/timer.cubing.net/ui/results-table.ts index bd50411..8733783 100644 --- a/src/timer.cubing.net/ui/results-table.ts +++ b/src/timer.cubing.net/ui/results-table.ts @@ -1,9 +1,6 @@ import { Alg } from "cubing/alg"; import { eventOrder, modifiedEventName } from "../app/events"; -import { - twizzleLink, - twizzleLinkForAttempt, -} from "../resources/vendor/twizzle-link"; +import { linkForAttempt } from "../resources/vendor/twizzle-link"; import { AttemptData, AttemptDataWithIDAndRev } from "../results/AttemptData"; import { Stats } from "../results/Stats"; import { TimerSession } from "../results/TimerSession"; @@ -39,7 +36,7 @@ function scrambleTD( } if (algo) { const scrambleLink = document.createElement("a"); - scrambleLink.href = twizzleLinkForAttempt(attemptData); + scrambleLink.href = linkForAttempt(attemptData); scrambleLink.appendChild(playIcon()); scrambleTD.appendChild(scrambleLink); } @@ -65,7 +62,7 @@ function solutionTD(attemptData: AttemptData): HTMLTableDataCellElement { } if (attemptData.solution) { const scrambleLink = document.createElement("a"); - scrambleLink.href = twizzleLinkForAttempt(attemptData); + scrambleLink.href = linkForAttempt(attemptData); scrambleLink.appendChild(playIcon()); solutionTD.appendChild(scrambleLink); // const node = document.createTextNode(` (${countMoves(attemptData.solution)} ETM)`);