Skip to content

Commit 7434d08

Browse files
authored
Merge pull request #437 from code0-tech/feat/#436
Dashboard folder structure linked to flow service
2 parents 7698177 + 7be11b6 commit 7434d08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+460
-764
lines changed

package-lock.json

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@ariakit/react": "^0.4.17",
2222
"@babel/plugin-proposal-decorators": "^7.28.0",
2323
"@babel/plugin-transform-class-properties": "^7.27.1",
24-
"@code0-tech/sagittarius-graphql-types": "^0.0.0-00f33663039d78ad59e95306730878c687de5c48",
24+
"@code0-tech/sagittarius-graphql-types": "^0.0.0-65144a9920c6a8de3bcf24acdcb8eec4158cef73",
2525
"@dagrejs/dagre": "^1.1.5",
2626
"@mdx-js/react": "^3.1.1",
2727
"@radix-ui/react-checkbox": "^1.3.3",

src/components/d-flow/viewport/DFlowViewport.edges.hook.ts renamed to src/components/d-flow/DFlow.edges.hook.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {useService, useStore} from "../../../utils/contextStore";
2-
import {DFlowReactiveService} from "../DFlow.service";
1+
import {useService, useStore} from "../../utils/contextStore";
2+
import {DFlowReactiveService} from "./DFlow.service";
33
import {Edge} from "@xyflow/react";
4-
import {NodeFunctionView} from "../DFlow.view";
5-
import {DFlowFunctionReactiveService} from "../function/DFlowFunction.service";
6-
import {DFlowDataTypeReactiveService} from "../data-type/DFlowDataType.service";
4+
import {NodeFunctionView} from "./DFlow.view";
5+
import {DFlowFunctionReactiveService} from "./function/DFlowFunction.service";
6+
import {DFlowDataTypeReactiveService} from "./data-type/DFlowDataType.service";
77
import React from "react";
88
import {DataTypeIdentifier, DataTypeVariant, Scalars} from "@code0-tech/sagittarius-graphql-types";
99

@@ -19,7 +19,7 @@ export const FLOW_EDGE_RAINBOW: string[] = [
1919
'#fff170', // 7 – Gelb
2020
];
2121

22-
export const useFlowViewportEdges = (flowId: string): Edge[] => {
22+
export const useFlowEdges = (flowId: string): Edge[] => {
2323
const flowService = useService(DFlowReactiveService);
2424
const functionService = useService(DFlowFunctionReactiveService);
2525
const dataTypeService = useService(DFlowDataTypeReactiveService);

src/components/d-flow/viewport/DFlowViewport.nodes.hook.ts renamed to src/components/d-flow/DFlow.nodes.hook.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {useService} from "../../../utils/contextStore";
2-
import {DFlowReactiveService} from "../DFlow.service";
3-
import {NodeFunctionView} from "../DFlow.view";
1+
import {useService} from "../../utils/contextStore";
2+
import {DFlowReactiveService} from "./DFlow.service";
3+
import {NodeFunctionView} from "./DFlow.view";
44
import {Node} from "@xyflow/react";
5-
import {DFlowFunctionReactiveService} from "../function/DFlowFunction.service";
6-
import {DFlowDataTypeReactiveService} from "../data-type/DFlowDataType.service";
5+
import {DFlowFunctionReactiveService} from "./function/DFlowFunction.service";
6+
import {DFlowDataTypeReactiveService} from "./data-type/DFlowDataType.service";
77
import {DataTypeIdentifier, DataTypeVariant, Scalars} from "@code0-tech/sagittarius-graphql-types";
88

99
const packageNodes = new Map<string, string>([
@@ -90,7 +90,7 @@ const bestMatchValue = (map: Map<string, string>, input: string): string => {
9090
return bestKey !== null ? map.get(bestKey)! : "";
9191
};
9292

93-
export const useFlowViewportNodes = (flowId: string): Node[] => {
93+
export const useFlowNodes = (flowId: string): Node[] => {
9494
const flowService = useService(DFlowReactiveService);
9595
const functionService = useService(DFlowFunctionReactiveService);
9696
const dataTypeService = useService(DFlowDataTypeReactiveService);

src/components/d-flow/DFlow.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import React from "react";
1313
import {mergeCode0Props} from "../../utils/utils";
1414
import '@xyflow/react/dist/style.css';
1515
import "./DFlow.style.scss"
16-
import {DFlowViewportDefaultCard} from "./viewport/cards/DFlowViewportDefaultCard";
17-
import {DFlowViewportGroupCard} from "./viewport/cards/DFlowViewportGroupCard";
18-
import {DFlowViewportSuggestionCard} from "./viewport/cards/DFlowViewportSuggestionCard";
19-
import {DFlowViewportTriggerCard} from "./viewport/cards/DFlowViewportTriggerCard";
20-
import {DFlowViewportEdge} from "./viewport/DFlowViewportEdge";
16+
import {DFlowFunctionDefaultCard} from "./function/DFlowFunctionDefaultCard";
17+
import {DFlowFunctionGroupCard} from "./function/DFlowFunctionGroupCard";
18+
import {DFlowFunctionSuggestionCard} from "./function/DFlowFunctionSuggestionCard";
19+
import {DFlowFunctionTriggerCard} from "./function/DFlowFunctionTriggerCard";
20+
import {DFlowEdge} from "./DFlowEdge";
2121

2222
/**
2323
* Dynamically layouts a tree of nodes and their parameter nodes for a flow-based editor.
@@ -523,15 +523,15 @@ const InternalDFlow: React.FC<DFlowProps> = (props) => {
523523
}, [updateNodeInternals])
524524

525525
const nodeTypes = {
526-
default: DFlowViewportDefaultCard,
527-
group: DFlowViewportGroupCard,
528-
suggestion: DFlowViewportSuggestionCard,
529-
trigger: DFlowViewportTriggerCard,
526+
default: DFlowFunctionDefaultCard,
527+
group: DFlowFunctionGroupCard,
528+
suggestion: DFlowFunctionSuggestionCard,
529+
trigger: DFlowFunctionTriggerCard,
530530
...props.nodeTypes
531531
}
532532

533533
const edgeTypes = {
534-
default: DFlowViewportEdge,
534+
default: DFlowEdge,
535535
...props.edgeTypes
536536
}
537537

src/components/d-flow/DFlow.view.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export class FlowView {
3838
/** Time when this Flow was last updated */
3939
private readonly _updatedAt?: Maybe<Scalars['Time']['output']>;
4040

41+
private _name?: Maybe<Scalars['String']['output']>;
42+
4143
constructor(flow: Flow) {
4244

4345
this._createdAt = flow.createdAt
@@ -49,6 +51,7 @@ export class FlowView {
4951
this._startingNodeId = flow.startingNodeId
5052
this._type = flow.type
5153
this._updatedAt = flow.updatedAt
54+
this._name = flow.name
5255

5356
}
5457

@@ -88,6 +91,10 @@ export class FlowView {
8891
return this._updatedAt;
8992
}
9093

94+
get name(): Maybe<Scalars["String"]["output"]> | undefined {
95+
return this._name;
96+
}
97+
9198
set inputType(value: Maybe<DataType>) {
9299
this._inputType = value;
93100
}
@@ -96,6 +103,10 @@ export class FlowView {
96103
this._startingNodeId = value;
97104
}
98105

106+
set name(value: Maybe<Scalars["String"]["output"]>) {
107+
this._name = value;
108+
}
109+
99110
addNode(node: NodeFunctionView): void {
100111
if (!this._nodes) {
101112
this._nodes = [];

src/components/d-flow/viewport/DFlowViewportControls.tsx renamed to src/components/d-flow/DFlowControls.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from "react";
22
import {Panel, useReactFlow, useViewport} from "@xyflow/react";
3-
import ButtonGroup from "../../button-group/ButtonGroup";
4-
import Button from "../../button/Button";
3+
import ButtonGroup from "../button-group/ButtonGroup";
4+
import Button from "../button/Button";
55
import {IconFocusCentered, IconMinus, IconPlus} from "@tabler/icons-react";
6-
import Badge from "../../badge/Badge";
7-
import Flex from "../../flex/Flex";
8-
import {DFlowViewportMiniMap} from "./DFlowViewportMiniMap";
6+
import Badge from "../badge/Badge";
7+
import Flex from "../flex/Flex";
8+
import {DFlowMiniMap} from "./DFlowMiniMap";
99

10-
export const DFlowViewportControls: React.FC = () => {
10+
export const DFlowControls: React.FC = () => {
1111

1212
const viewport = useViewport();
1313
const reactFlow = useReactFlow();

src/components/d-flow/viewport/DFlowViewportEdge.tsx renamed to src/components/d-flow/DFlowEdge.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import {Code0Component} from "../../../utils/types";
1+
import {Code0Component} from "../../utils/types";
22
import {BaseEdge, Edge, EdgeLabelRenderer, EdgeProps, getSmoothStepPath, Position} from "@xyflow/react";
33
import React, {memo} from "react";
4-
import Badge from "../../badge/Badge";
4+
import Badge from "../badge/Badge";
55

6-
export interface DFlowViewportEdgeDataProps extends Code0Component<HTMLDivElement> {
6+
export interface DFlowEdgeDataProps extends Code0Component<HTMLDivElement> {
77
//some data we will use
88
color?: string
99
isParameter?: boolean
1010
isSuggestion?: boolean
1111
}
1212

1313
// @ts-ignore
14-
export type DFlowViewportEdgeProps = EdgeProps<Edge<DFlowViewportEdgeDataProps>>
14+
export type DFlowEdgeProps = EdgeProps<Edge<DFlowEdgeDataProps>>
1515

16-
export const DFlowViewportEdge: React.FC<DFlowViewportEdgeProps> = memo((props) => {
16+
export const DFlowEdge: React.FC<DFlowEdgeProps> = memo((props) => {
1717

1818
const {sourceX, sourceY, targetX, targetY, id, data, ...rest} = props
1919

src/components/d-flow/viewport/DFlowViewportMiniMap.style.scss renamed to src/components/d-flow/DFlowMiniMap.style.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@use "../../../styles/helpers";
2-
@use "../../../styles/box";
3-
@use "../../../styles/variables";
1+
@use "../../styles/helpers";
2+
@use "../../styles/box";
3+
@use "../../styles/variables";
44

55
.d-flow-viewport-mini-map {
66

src/components/d-flow/viewport/DFlowViewportMiniMap.tsx renamed to src/components/d-flow/DFlowMiniMap.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from "react";
22
import {MiniMap, useNodes} from "@xyflow/react";
3-
import {FLOW_EDGE_RAINBOW} from "./DFlowViewport.edges.hook";
4-
import "./DFlowViewportMiniMap.style.scss"
3+
import {FLOW_EDGE_RAINBOW} from "./DFlow.edges.hook";
4+
import "./DFlowMiniMap.style.scss"
55

6-
export const DFlowViewportMiniMap: React.FC = (props) => {
6+
export const DFlowMiniMap: React.FC = (props) => {
77

88
const nodes = useNodes();
99

0 commit comments

Comments
 (0)