import type { AppRouter } from "@thorium/.server/init/router"; import { rotateCharacters } from "@thorium/cards/LongRangeComm/shared"; import type { inferProcedureInput } from "@thorium/utils/live-query/.server/types"; export function RotationDecoder({ rotation, updateMessageDecoding, }: { rotation: number; updateMessageDecoding: ( decoding: Extract< inferProcedureInput["decoding"], { type: "rotation" } >, ) => Promise; }) { return (
{rotateCharacters.split("").map((l) => ( {l} ))}
{(rotateCharacters.slice(rotation) + rotateCharacters.slice(0, rotation)) .split("") .map((l) => ( {l} ))}
updateMessageDecoding({ type: "rotation", rotation: rotateCharacters.length - Number(event.currentTarget.value), }) } />
); }