Skip to content

Commit d6d392a

Browse files
committed
Co-authored-by: ChristinaRaether <ChristinaRaether@users.noreply.github.com>
1 parent a75fc24 commit d6d392a

File tree

9 files changed

+4451
-2492
lines changed

9 files changed

+4451
-2492
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"eslint": "^8.54.0",
7373
"glob": "^10.3.10",
7474
"mocha": "^10.2.0",
75+
"postcss-loader": "^7.3.3",
76+
"postcss-preset-env": "^9.3.0",
77+
"tailwindcss": "^3.3.6",
7578
"typescript": "^5.2.2",
7679
"webpack-cli": "^5.1.4"
7780
},

postcss.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const tailwindcss = require('tailwindcss');
2+
module.exports = {
3+
plugins: [
4+
'postcss-preset-env',
5+
tailwindcss
6+
],
7+
};

src/webview/Flow.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useState } from "react";
1+
import React, { useCallback, useEffect } from "react";
22
import ReactFlow, {
33
addEdge,
44
MiniMap,
@@ -7,7 +7,8 @@ import ReactFlow, {
77
useNodesState,
88
useEdgesState
99
} from "reactflow";
10-
import "reactflow/dist/style.css"
10+
11+
import "reactflow/dist/style.css";
1112

1213
import FlowBuilder from './flowBuilder.js';
1314

@@ -33,9 +34,9 @@ const OverviewFlow = () => {
3334
case 'parsed-data': {
3435
const results = new FlowBuilder(msg.value);
3536
results.build(msg.settings)
36-
console.log('results: ', results);
37-
console.log('results.initialNodes: ', results.initialNodes);
38-
console.log('results.initialEdges: ', results.initialEdges);
37+
// console.log('results: ', results);
38+
// console.log('results.initialNodes: ', results.initialNodes);
39+
// console.log('results.initialEdges: ', results.initialEdges);
3940
setNodes(results.initialNodes);
4041
setEdges(results.initialEdges);
4142
break;

src/webview/flowBuilder.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import React from 'react';
2+
// import CustomNode from '../styles/CustomNode';
23
// will create a build func and then call the helper funcs to return an object
34
// make a new instance of this class in flow, call the build method, and pass this as state
5+
// const nodeTypes = {
6+
// custom: CustomNode,
7+
// };
8+
49
class FlowBuilder {
510
constructor(data) {
611
this.parsedData = [data];
@@ -19,31 +24,26 @@ class FlowBuilder {
1924
id: (++this.id).toString(),
2025
data: {
2126
label: (
22-
<div key={this.id}>
23-
<ul>
24-
<li>{item.fileName}</li>
25-
<li>Client Component: {item.isClientComponent.toString()}</li>
26-
</ul>
27+
<div className={`-mx-2.5 -my-2.5 py-2 px-9 shadow-lg rounded-md border-2 border-gray-500 ${(item.isClientComponent) ? 'bg-orange-300' : 'bg-blue-300'}`}>
28+
<div className="flex justify-center place-items-center" key={this.id}>
29+
<div className="text-base font-medium">{item.fileName}</div>
30+
</div>
2731
</div>
2832
)
2933
},
30-
type: item.depth === 0 ? 'input' : '',
34+
// type: item.depth === 0 ? 'input' : '',
35+
type: 'default',
3136
position: { x: 0, y: 0 },
3237
style: {
33-
backgroundColor: "var(--vscode-dropdown-background)",
34-
borderRadius: "15px",
35-
width: '265px',
36-
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
3738
border: 'none',
38-
padding: '10px 10px 3px 10px'
39-
},
39+
borderRadius: "6px"
40+
}
4041
};
4142
this.initialNodes.push(node);
4243
if (item.children) {
4344
this.buildNodesArray(item.children);
4445
}
4546
});
46-
// console.log('initialNodes', this.initialNodes);
4747
};
4848

4949
buildEdgesArray(parsedData, parentID) {
@@ -65,7 +65,6 @@ class FlowBuilder {
6565
this.buildEdgesArray(item.children, nodeID);
6666
}
6767
});
68-
// console.log('initialEdges', this.initialEdges);
6968
}
7069

7170
build(settings) {

src/webview/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import { createRoot } from "react-dom/client";
3+
import './style.css';
34

45
import App from "./App.jsx";
56

src/webview/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
15
html,
26
body,
37
#root,

tailwind.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
content: ['./build/bundle.js'],
3+
theme: {
4+
extend: {},
5+
},
6+
variants: {
7+
extend: {},
8+
},
9+
plugins: [],
10+
important: true,
11+
}

webpack.config.cjs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const path = require('path')
22

3-
43
module.exports = {
5-
entry: './src/webview/index.jsx',
4+
entry: './src/webview/index.jsx',
65
output: {
76
filename: 'bundle.js',
87
path: path.resolve(__dirname, './build'),
@@ -12,20 +11,20 @@ entry: './src/webview/index.jsx',
1211
},
1312
module: {
1413
rules: [
15-
{
16-
test: /\.jsx?/,
17-
exclude: /node_modules/,
18-
use: {
19-
loader: "babel-loader",
20-
options: {
21-
presets: ['@babel/preset-env', '@babel/preset-react']
22-
}
23-
}
24-
},
25-
{
26-
test: /\.(scss|css)$/,
27-
use: ["style-loader", "css-loader"],
28-
},
14+
{
15+
test: /\.jsx?/,
16+
exclude: /node_modules/,
17+
use: {
18+
loader: "babel-loader",
19+
options: {
20+
presets: ['@babel/preset-env', '@babel/preset-react']
21+
}
22+
}
23+
},
24+
{
25+
test: /\.(css|scss)$/,
26+
use: ["style-loader", "css-loader", "postcss-loader"],
27+
},
2928
]
3029
},
3130
mode: "development"

0 commit comments

Comments
 (0)