This commit is contained in:
Ayaz Hafiz 2023-07-16 22:57:21 -05:00
parent 87bb6c8437
commit 7d3e7ffdfb
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 21 additions and 570 deletions

View file

@ -25,9 +25,9 @@ export default function FileInput({ setResult }: FileInputProps) {
return;
}
const file = files[0];
const buf = await file.arrayBuffer();
const buf = await file.text();
try {
const events: AllEvents = JSON.parse(new TextDecoder().decode(buf));
const events: AllEvents = JSON.parse(buf);
setResult({ kind: "ok", events });
} catch (e) {
setResult({ kind: "err", error: "Invalid checkmate file." });
@ -36,18 +36,13 @@ export default function FileInput({ setResult }: FileInputProps) {
}
return (
<div>
<label htmlFor="small-file-input" className="sr-only">
Choose file
</label>
<input
type="file"
name="small-file-input"
id="small-file-input"
onChange={(e) => setFile(e)}
className="block w-full border border-gray-200 shadow-sm rounded-md text-sm
file:bg-roc-purple-bg file:border-0 file:mr-4 file:py-2 file:px-4"
></input>
</div>
<input
type="file"
name="small-file-input"
id="small-file-input"
onChange={(e) => setFile(e)}
className="block w-full border border-gray-200 shadow-sm rounded-md text-sm
file:bg-roc-purple-bg file:border-0 file:mr-4 file:py-2 file:px-4 cursor-pointer"
></input>
);
}

View file

@ -14,7 +14,7 @@ export default function Ui({ events }: UiProps): JSX.Element {
const engine = new Engine(events);
return (
<div className="font-mono mt-4">
<div className="font-mono mt-4 text-lg">
<EventList engine={engine} root events={events}></EventList>
</div>
);
@ -31,7 +31,7 @@ const UNFOCUSED = "opacity-40";
function EventList({ engine, events, root }: EventListProps): JSX.Element {
return (
<ul className={clsx(MT, root ? "ml-2" : "ml-[1.5em]", "relative")}>
<ul className={clsx(MT, root ? "ml-2" : "ml-[1.5em]")}>
{events.map((event, i) => (
<li key={i} className={MT}>
<OneEvent engine={engine} event={event} />
@ -60,7 +60,7 @@ function OneEvent({ event, engine }: OneEventProps): JSX.Element {
const DROPDOWN_CLOSED = "▶";
const DROPDOWN_OPEN = "▼";
const UN_UNKNOWN = "";
const UN_UNKNOWN = "💭";
const UN_SUCCESS = "✅";
const UN_FAILURE = "❌";
@ -121,7 +121,13 @@ function Unification({ engine, event }: UnificationProps): JSX.Element {
);
return (
<div>
<div
className={clsx(
"relative",
"before:content-[''] before:border-l before:border-slate-400",
"before:absolute before:w-0 before:h-[calc(100%-2rem)] before:top-[1.5rem] before:left-[0.3rem]"
)}
>
<div>{headlineBefore}</div>
<EventList engine={engine} events={subevents} />
{headlineAfter}