From 1fb25a73bbf39e537972ffbed3d3c9f8359d00ea Mon Sep 17 00:00:00 2001 From: George Thomas Date: Mon, 3 Jul 2023 11:36:40 +0100 Subject: [PATCH 1/2] fix: Comment typo Signed-off-by: George Thomas --- src/components/TreeReactFlow/Flavor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TreeReactFlow/Flavor.ts b/src/components/TreeReactFlow/Flavor.ts index 163e1be9..2d05ecd2 100644 --- a/src/components/TreeReactFlow/Flavor.ts +++ b/src/components/TreeReactFlow/Flavor.ts @@ -531,7 +531,7 @@ export const boxFlavorBackground = (flavor: NodeFlavorBoxBody): string => { }; /** What sort of node does this flavor correspond to? - * Note that the backend could in principal tell us this independently of flavors, + * Note that the backend could in principle tell us this independently of flavors, * since it comes down to whether the node ultimately comes from an `Expr`, `Type` or `Kind`. */ export const isTypeLevel = (flavor: NodeFlavor): "term" | "type" | "kind" => { From 651cc886865d36b6fe6aaff8381c80d0af8e0f46 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Mon, 3 Jul 2023 11:39:04 +0100 Subject: [PATCH 2/2] chore: Use "sort" for referring to term/type/kind Signed-off-by: George Thomas --- src/components/TreeReactFlow/Flavor.ts | 16 +++++++--------- src/components/TreeReactFlow/index.tsx | 10 +++++----- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/TreeReactFlow/Flavor.ts b/src/components/TreeReactFlow/Flavor.ts index 2d05ecd2..4e8e1717 100644 --- a/src/components/TreeReactFlow/Flavor.ts +++ b/src/components/TreeReactFlow/Flavor.ts @@ -17,7 +17,7 @@ export const commonHoverClasses = "hover:ring hover:ring-4 hover:ring-offset-4"; export const flavorClasses = (flavor: NodeFlavor): string => classNames( - typeOrTermClasses(isTypeLevel(flavor)), + sortClasses(flavorSort(flavor)), (() => { switch (flavor) { case "Hole": @@ -209,7 +209,7 @@ export const flavorContentClasses = ( flavor: NodeFlavorTextBody | NodeFlavorPrimBody | NodeFlavorNoBody ): string => classNames( - typeOrTermContentClasses(isTypeLevel(flavor)), + sortContentClasses(flavorSort(flavor)), (() => { switch (flavor) { case "Hole": @@ -534,7 +534,7 @@ export const boxFlavorBackground = (flavor: NodeFlavorBoxBody): string => { * Note that the backend could in principle tell us this independently of flavors, * since it comes down to whether the node ultimately comes from an `Expr`, `Type` or `Kind`. */ -export const isTypeLevel = (flavor: NodeFlavor): "term" | "type" | "kind" => { +export const flavorSort = (flavor: NodeFlavor): "term" | "type" | "kind" => { switch (flavor) { case "Con": case "Lam": @@ -574,8 +574,8 @@ export const isTypeLevel = (flavor: NodeFlavor): "term" | "type" | "kind" => { } }; -export const typeOrTermClasses = (x: "term" | "type" | "kind"): string => { - switch (x) { +export const sortClasses = (s: "term" | "type" | "kind"): string => { + switch (s) { case "term": return "rounded-3xl"; case "type": @@ -585,10 +585,8 @@ export const typeOrTermClasses = (x: "term" | "type" | "kind"): string => { } }; -export const typeOrTermContentClasses = ( - x: "term" | "type" | "kind" -): string => { - switch (x) { +export const sortContentClasses = (s: "term" | "type" | "kind"): string => { + switch (s) { case "term": return ""; case "type": diff --git a/src/components/TreeReactFlow/index.tsx b/src/components/TreeReactFlow/index.tsx index 1337d3ac..244e2701 100644 --- a/src/components/TreeReactFlow/index.tsx +++ b/src/components/TreeReactFlow/index.tsx @@ -61,7 +61,7 @@ import { flavorLabel, flavorLabelClasses, noBodyFlavorContents, - typeOrTermClasses, + sortClasses, } from "./Flavor"; import { ZoomBar, ZoomBarProps } from "./ZoomBar"; import { WasmLayoutType } from "@zxch3n/tidy/wasm_dist"; @@ -274,7 +274,7 @@ const nodeTypes = {