Skip to content

Commit

Permalink
Link to the live reconstruction tool for 3x3x3 solves without solutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jan 22, 2024
1 parent eded79e commit c9cb2e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/timer.cubing.net/resources/vendor/twizzle-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
9 changes: 3 additions & 6 deletions src/timer.cubing.net/ui/results-table.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
}
Expand All @@ -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)`);
Expand Down

0 comments on commit c9cb2e5

Please sign in to comment.