-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Drew Hess <src@drewhess.com>
- Loading branch information
Showing
16 changed files
with
301 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { NodeChange, ReactFlowProvider, useReactFlow } from "reactflow"; | ||
import { Level, TypeOrKind } from "@/primer-api"; | ||
import { TreeReactFlowOne } from "@/components"; | ||
import { defaultTreeReactFlowProps } from "../TreeReactFlow"; | ||
|
||
export type SelectionInfoProps = { | ||
typeOrKind: TypeOrKind | undefined; | ||
level: Level; | ||
}; | ||
|
||
const TypeOrKindTree = (p: { typeOrKind: TypeOrKind; level: Level }) => { | ||
const padding = 1.0; | ||
const { fitView } = useReactFlow(); | ||
const onNodesChange = (_: NodeChange[]) => { | ||
fitView({ padding }); | ||
}; | ||
|
||
return ( | ||
<TreeReactFlowOne | ||
{...defaultTreeReactFlowProps} | ||
tree={p.typeOrKind.contents} | ||
level={p.level} | ||
zoomBarProps={{ padding }} | ||
onNodesChange={onNodesChange} | ||
fitViewOptions={{ padding }} | ||
/> | ||
); | ||
}; | ||
|
||
export const SelectionInfo = ({ | ||
typeOrKind, | ||
level, | ||
}: SelectionInfoProps): JSX.Element => { | ||
return ( | ||
<div className="flex h-full flex-col overflow-auto"> | ||
{typeOrKind && ( | ||
<> | ||
<div className="grow"> | ||
<ReactFlowProvider> | ||
<TypeOrKindTree typeOrKind={typeOrKind} level={level} /> | ||
</ReactFlowProvider> | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default SelectionInfo; |
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
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
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,11 @@ | ||
/** | ||
* Generated by orval v6.16.0 🍺 | ||
* Do not edit manually. | ||
* Primer backend API | ||
* A backend service implementing a pedagogic functional programming language. | ||
* OpenAPI spec version: 0.7 | ||
*/ | ||
import type { TypeOrKindOneOf } from './typeOrKindOneOf'; | ||
import type { TypeOrKindOneOfThree } from './typeOrKindOneOfThree'; | ||
|
||
export type TypeOrKind = TypeOrKindOneOf | TypeOrKindOneOfThree; |
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,14 @@ | ||
/** | ||
* Generated by orval v6.16.0 🍺 | ||
* Do not edit manually. | ||
* Primer backend API | ||
* A backend service implementing a pedagogic functional programming language. | ||
* OpenAPI spec version: 0.7 | ||
*/ | ||
import type { Tree } from './tree'; | ||
import type { TypeOrKindOneOfTag } from './typeOrKindOneOfTag'; | ||
|
||
export type TypeOrKindOneOf = { | ||
contents: Tree; | ||
tag: TypeOrKindOneOfTag; | ||
}; |
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,15 @@ | ||
/** | ||
* Generated by orval v6.16.0 🍺 | ||
* Do not edit manually. | ||
* Primer backend API | ||
* A backend service implementing a pedagogic functional programming language. | ||
* OpenAPI spec version: 0.7 | ||
*/ | ||
|
||
export type TypeOrKindOneOfTag = typeof TypeOrKindOneOfTag[keyof typeof TypeOrKindOneOfTag]; | ||
|
||
|
||
// eslint-disable-next-line @typescript-eslint/no-redeclare | ||
export const TypeOrKindOneOfTag = { | ||
Type: 'Type', | ||
} as const; |
Oops, something went wrong.