-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5717 from roc-lang/checkmate-ui-improvements
Checkmate UI improvements
- Loading branch information
Showing
13 changed files
with
697 additions
and
188 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
crates/compiler/checkmate/www/src/components/Common/EpochCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import clsx from "clsx"; | ||
import { EventEpoch } from "../../engine/engine"; | ||
import { HashLink } from "react-router-hash-link"; | ||
|
||
export enum EpochCellView { | ||
Events, | ||
Graph, | ||
} | ||
|
||
function invert(cell: EpochCellView): EpochCellView { | ||
if (cell === EpochCellView.Events) { | ||
return EpochCellView.Graph; | ||
} | ||
return EpochCellView.Events; | ||
} | ||
|
||
function asStr(cell: EpochCellView): string { | ||
switch (cell) { | ||
case EpochCellView.Events: | ||
return "events"; | ||
case EpochCellView.Graph: | ||
return "graph"; | ||
} | ||
} | ||
|
||
interface EpochCellProps { | ||
view: EpochCellView; | ||
epoch: EventEpoch; | ||
className?: string; | ||
} | ||
|
||
const EPOCH_STYLES_ARRAY = [ | ||
"text-slate-900", | ||
"font-mono", | ||
"bg-slate-200", | ||
"p-1", | ||
"py-0", | ||
"rounded-sm", | ||
"ring-1", | ||
"ring-slate-500", | ||
"text-sm", | ||
]; | ||
|
||
export const EPOCH_STYLES = clsx(...EPOCH_STYLES_ARRAY); | ||
|
||
export default function EpochCell({ epoch, className, view }: EpochCellProps) { | ||
const invertedView = invert(view); | ||
|
||
return ( | ||
<HashLink smooth to={`#${asStr(invertedView)}-${epoch}`}> | ||
<div | ||
id={`${asStr(view)}-${epoch}`} | ||
className={clsx(EPOCH_STYLES, className)} | ||
> | ||
{view === EpochCellView.Graph ? "Epoch " : ""} | ||
{epoch} | ||
</div> | ||
</HashLink> | ||
); | ||
} |
8 changes: 4 additions & 4 deletions
8
crates/compiler/checkmate/www/src/components/EventItem/Variable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
crates/compiler/checkmate/www/src/components/EventItem/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import type { Engine } from "../../engine/engine"; | ||
import type { Engine, EventEpoch } from "../../engine/engine"; | ||
import type { Variable } from "../../schema"; | ||
|
||
export interface CommonProps { | ||
currentEpoch: EventEpoch; | ||
engine: Engine; | ||
toggleVariableVis: (variable: Variable) => void; | ||
} |
Oops, something went wrong.