flowfi-network/components/sandbox/presets.ts

63 lines
3.3 KiB
TypeScript

import type { Node, Edge } from '@xyflow/react'
export interface FlowPreset {
name: string
nodes: Node[]
edges: Edge[]
}
export const extractivePreset: FlowPreset = {
name: 'Extractive',
nodes: [
{ id: 's1', type: 'source', position: { x: 50, y: 50 }, data: { label: 'Labor', flowRate: 5 } },
{ id: 's2', type: 'source', position: { x: 50, y: 180 }, data: { label: 'Nature', flowRate: 8 } },
{ id: 's3', type: 'source', position: { x: 50, y: 310 }, data: { label: 'Creativity', flowRate: 4 } },
{ id: 'p1', type: 'pipe', position: { x: 300, y: 160 }, data: { label: 'Finance' } },
{ id: 'k1', type: 'sink', position: { x: 550, y: 80 }, data: { label: 'Shareholders', fillLevel: 85 } },
{ id: 'k2', type: 'sink', position: { x: 550, y: 230 }, data: { label: 'Executives', fillLevel: 70 } },
{ id: 'k3', type: 'sink', position: { x: 550, y: 370 }, data: { label: 'Public Good', fillLevel: 10 } },
],
edges: [
{ id: 'e1', source: 's1', target: 'p1', type: 'animatedPipe', data: { flowRate: 5 } },
{ id: 'e2', source: 's2', target: 'p1', type: 'animatedPipe', data: { flowRate: 8 } },
{ id: 'e3', source: 's3', target: 'p1', type: 'animatedPipe', data: { flowRate: 4 } },
{ id: 'e4', source: 'p1', target: 'k1', type: 'animatedPipe', data: { flowRate: 8 } },
{ id: 'e5', source: 'p1', target: 'k2', type: 'animatedPipe', data: { flowRate: 6 } },
{ id: 'e6', source: 'p1', target: 'k3', type: 'animatedPipe', data: { flowRate: 1 } },
],
}
export const regenerativePreset: FlowPreset = {
name: 'Regenerative',
nodes: [
{ id: 's1', type: 'source', position: { x: 50, y: 100 }, data: { label: 'Commons', flowRate: 6 } },
{ id: 's2', type: 'source', position: { x: 50, y: 280 }, data: { label: 'Ecology', flowRate: 5 } },
{ id: 'p1', type: 'pipe', position: { x: 280, y: 60 }, data: { label: 'Community' } },
{ id: 'p2', type: 'pipe', position: { x: 280, y: 200 }, data: { label: 'Care' } },
{ id: 'p3', type: 'pipe', position: { x: 280, y: 340 }, data: { label: 'Knowledge' } },
{ id: 'k1', type: 'sink', position: { x: 520, y: 100 }, data: { label: 'Stewardship', fillLevel: 60 } },
{ id: 'k2', type: 'sink', position: { x: 520, y: 280 }, data: { label: 'Regeneration', fillLevel: 55 } },
],
edges: [
{ id: 'e1', source: 's1', target: 'p1', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e2', source: 's1', target: 'p2', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e3', source: 's2', target: 'p2', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e4', source: 's2', target: 'p3', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e5', source: 'p1', target: 'k1', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e6', source: 'p2', target: 'k1', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e7', source: 'p2', target: 'k2', type: 'animatedPipe', data: { flowRate: 3 } },
{ id: 'e8', source: 'p3', target: 'k2', type: 'animatedPipe', data: { flowRate: 3 } },
],
}
export const blankPreset: FlowPreset = {
name: 'Blank',
nodes: [
{ id: 's1', type: 'source', position: { x: 100, y: 200 }, data: { label: 'Source', flowRate: 5 } },
{ id: 'k1', type: 'sink', position: { x: 500, y: 200 }, data: { label: 'Sink', fillLevel: 0 } },
],
edges: [],
}
export const presets = [regenerativePreset, extractivePreset, blankPreset]