Skip to content

Commit

Permalink
getNodeType
Browse files Browse the repository at this point in the history
  • Loading branch information
cdriesler committed Nov 28, 2023
1 parent 11dc000 commit 93e45fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/nodepen-client/components/NodesAppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const NodesAppContainer = ({ document: initialDocument, templates }: NodesAppCon

const payload = { method: 'POST', body }

const response = await fetch('http://localhost:6500/files/gh', payload)
const response = await fetch('http://localhost:4000/files/gh', payload)
const data = await response.json()

setDocument(data)
Expand Down
2 changes: 1 addition & 1 deletion apps/nodepen-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nodepen-viewer-example",
"private": true,
"scripts": {
"dev": "next dev -p 4000",
"dev": "next dev -p 8080",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down
17 changes: 17 additions & 0 deletions packages/nodes/src/utils/templates/getNodeType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as NodePen from '@nodepen/core'

type NodeType = 'generic-node' | 'generic-port' | 'panel'

// TODO: If this library is language-agnostic, it doesn't make sense for "special" components to be
// hard-coded Grasshopper guids. Moot until this supports anything other than grasshopper, but still.

export const getNodeType = (template: NodePen.NodeTemplate): NodeType => {
switch (template.guid) {
case '59e0b89a-e487-49f8-bab8-b5bab16be14c': {
return 'panel'
}
default: {
return 'generic-node'
}
}
}
1 change: 1 addition & 0 deletions packages/nodes/src/utils/templates/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { createInstance } from './createInstance'
export { getIconAsImage } from './getIconAsImage'
export { getNodeType } from './getNodeType'
export { groupTemplatesByCategory } from './groupTemplatesByCategory'

0 comments on commit 93e45fd

Please sign in to comment.