Skip to content

Commit 209f8d5

Browse files
committed
updated router style to not use hash routing
1 parent 9351a1b commit 209f8d5

File tree

6 files changed

+197
-11
lines changed

6 files changed

+197
-11
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"devDependencies": {
2020
"@eslint/js": "^9.36.0",
21+
"@rollup/plugin-commonjs": "^29.0.0",
2122
"@types/node": "^24.6.0",
2223
"@types/react": "^19.1.16",
2324
"@types/react-dom": "^19.1.9",
@@ -37,5 +38,8 @@
3738
"overrides": {
3839
"vite": "npm:rolldown-vite@7.1.14"
3940
},
40-
"packageManager": "yarn@4.10.3"
41+
"packageManager": "yarn@4.10.3",
42+
"resolutions": {
43+
"@sigmacomputing/plugin": "portal:/Users/ryan.kahn/sigma/plugin"
44+
}
4145
}

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { HashRouter as Router, Routes, Route } from "react-router-dom";
1+
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
22
import Clock from "./plugins/clock";
33
import ForEach from "./plugins/foreach";
44
import OnLoad from "./plugins/onLoad";
5+
import DebugUrlParameter from "./plugins/debug-url-parameter";
56
import Landing from "./pages/Landing";
67

78
function App() {
89
return (
9-
<Router>
10+
<Router basename="/ryans-sigmacomputing-plugins">
1011
<Routes>
1112
<Route path="/" element={<Landing />} />
1213
<Route path="/clock" element={<Clock />} />
1314
<Route path="/foreach" element={<ForEach />} />
1415
<Route path="/onload" element={<OnLoad />} />
16+
<Route path="/debug-url-parameter" element={<DebugUrlParameter />} />
1517
</Routes>
1618
</Router>
1719
);
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import {
2+
useConfig,
3+
useEditorPanelConfig,
4+
useVariable,
5+
useUrlParameter,
6+
} from "@sigmacomputing/plugin";
7+
8+
import {
9+
pluginContainerStyles,
10+
pluginHeaderStyles,
11+
pluginTitleStyles,
12+
pluginContentStyles,
13+
pluginStatusItemStyles,
14+
pluginLabelStyles,
15+
pluginValueStyles,
16+
} from "../styles/pluginStyles";
17+
18+
interface ForEachConfig_t {
19+
testVariable: string;
20+
urlParamToRead: string;
21+
effect1: string;
22+
trigger1: string;
23+
}
24+
25+
function ForEach() {
26+
useEditorPanelConfig([
27+
{
28+
type: "variable",
29+
name: "testVariable",
30+
label: "Test Variable",
31+
allowedTypes: ["number", "text"],
32+
},
33+
{
34+
type: "variable",
35+
name: "urlParamToRead",
36+
label: "URL Param to Read",
37+
allowedTypes: ["text"],
38+
},
39+
{ type: "action-effect", name: "effect1", label: "Action Effect 1" },
40+
{ type: "action-trigger", name: "trigger1", label: "Action Trigger 1" },
41+
]);
42+
43+
const config: ForEachConfig_t = useConfig() as ForEachConfig_t;
44+
45+
// Extract the variables from config panel
46+
const [testVariableValue] = useVariable(config.testVariable);
47+
const [urlParamToReadValue] = useVariable(config.urlParamToRead);
48+
const [urlParameter, setUrlParameter] = useUrlParameter(urlParamToReadValue?.defaultValue?.value ?? '');
49+
50+
return (
51+
<div style={pluginContainerStyles}>
52+
<div style={pluginHeaderStyles}>
53+
<h2 style={pluginTitleStyles}>Debug Plugin</h2>
54+
</div>
55+
<div style={pluginContentStyles}>
56+
<div style={pluginStatusItemStyles}>
57+
<span style={pluginLabelStyles}>Config:</span>
58+
<pre
59+
style={{
60+
...pluginValueStyles,
61+
}}
62+
>
63+
{JSON.stringify(config, undefined, 2)}
64+
</pre>
65+
</div>
66+
<div style={pluginStatusItemStyles}>
67+
<span style={pluginLabelStyles}>URL Param to Read:</span>
68+
<pre
69+
style={{
70+
...pluginValueStyles,
71+
}}
72+
>
73+
{JSON.stringify(urlParamToReadValue, undefined, 2)}
74+
</pre>
75+
</div>
76+
<div style={pluginStatusItemStyles}>
77+
<span style={pluginLabelStyles}>URL Param Value:</span>
78+
<pre
79+
style={{
80+
...pluginValueStyles,
81+
}}
82+
>
83+
{JSON.stringify(urlParameter, undefined, 2)}
84+
<button onClick={() => setUrlParameter('test')}>Set URL Param to 'test'</button>
85+
</pre>
86+
</div>
87+
<div style={pluginStatusItemStyles}>
88+
<span style={pluginLabelStyles}>Test Variable:</span>
89+
<pre
90+
style={{
91+
...pluginValueStyles,
92+
}}
93+
>
94+
{JSON.stringify(testVariableValue, undefined, 2)}
95+
</pre>
96+
</div>
97+
</div>
98+
</div>
99+
);
100+
}
101+
102+
export default ForEach;

src/styles/pluginStyles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const pluginContainerStyles = {
77
background: colors.bgGradient,
88
color: colors.textPrimary,
99
fontFamily: typography.fontFamily,
10+
overflow: 'auto',
1011
};
1112

1213
export const pluginHeaderStyles = {

vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react";
3+
import commonjs from "@rollup/plugin-commonjs";
34

45
// https://vite.dev/config/
56
export default defineConfig({
@@ -9,6 +10,14 @@ export default defineConfig({
910
plugins: [["babel-plugin-react-compiler"]],
1011
},
1112
}),
13+
// Explicitly handle CommonJS conversion for the plugin
14+
commonjs({
15+
include: ["**/node_modules/@sigmacomputing/plugin/**", "**/plugin/dist/**"],
16+
transformMixedEsModules: true,
17+
}),
1218
],
1319
base: "/ryans-sigmacomputing-plugins/",
20+
resolve: {
21+
preserveSymlinks: true,
22+
},
1423
});

yarn.lock

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ __metadata:
469469
languageName: node
470470
linkType: hard
471471

472-
"@jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.5.0":
472+
"@jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.5.0, @jridgewell/sourcemap-codec@npm:^1.5.5":
473473
version: 1.5.5
474474
resolution: "@jridgewell/sourcemap-codec@npm:1.5.5"
475475
checksum: 10c0/f9e538f302b63c0ebc06eecb1dd9918dd4289ed36147a0ddce35d6ea4d7ebbda243cda7b2213b6a5e1d8087a298d5cf630fb2bd39329cdecb82017023f6081a0
@@ -681,15 +681,50 @@ __metadata:
681681
languageName: node
682682
linkType: hard
683683

684-
"@sigmacomputing/plugin@npm:^1.0.10":
685-
version: 1.0.10
686-
resolution: "@sigmacomputing/plugin@npm:1.0.10"
684+
"@rollup/plugin-commonjs@npm:^29.0.0":
685+
version: 29.0.0
686+
resolution: "@rollup/plugin-commonjs@npm:29.0.0"
687+
dependencies:
688+
"@rollup/pluginutils": "npm:^5.0.1"
689+
commondir: "npm:^1.0.1"
690+
estree-walker: "npm:^2.0.2"
691+
fdir: "npm:^6.2.0"
692+
is-reference: "npm:1.2.1"
693+
magic-string: "npm:^0.30.3"
694+
picomatch: "npm:^4.0.2"
695+
peerDependencies:
696+
rollup: ^2.68.0||^3.0.0||^4.0.0
697+
peerDependenciesMeta:
698+
rollup:
699+
optional: true
700+
checksum: 10c0/e19f99aace255e625c3f92169108d444e522eb1119e26ec3af2e2744ec1d81d765ba1140e59afc9881a8640e0fcfe25a3b927d3c6877b850d57d6acddc1c5223
701+
languageName: node
702+
linkType: hard
703+
704+
"@rollup/pluginutils@npm:^5.0.1":
705+
version: 5.3.0
706+
resolution: "@rollup/pluginutils@npm:5.3.0"
707+
dependencies:
708+
"@types/estree": "npm:^1.0.0"
709+
estree-walker: "npm:^2.0.2"
710+
picomatch: "npm:^4.0.2"
711+
peerDependencies:
712+
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
713+
peerDependenciesMeta:
714+
rollup:
715+
optional: true
716+
checksum: 10c0/001834bf62d7cf5bac424d2617c113f7f7d3b2bf3c1778cbcccb72cdc957b68989f8e7747c782c2b911f1dde8257f56f8ac1e779e29e74e638e3f1e2cac2bcd0
717+
languageName: node
718+
linkType: hard
719+
720+
"@sigmacomputing/plugin@portal:/Users/ryan.kahn/sigma/plugin::locator=simons-sigmacomputing-plugins%40workspace%3A.":
721+
version: 0.0.0-use.local
722+
resolution: "@sigmacomputing/plugin@portal:/Users/ryan.kahn/sigma/plugin::locator=simons-sigmacomputing-plugins%40workspace%3A."
687723
peerDependencies:
688724
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
689725
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
690-
checksum: 10c0/2972ca50bf87e007253cec016e4dafcd425f8f5787c545bc17938d16916ab615fdb221d4f9b7495875f540749b7aa7eff52cac2df0570aa403509b47d9bfccb5
691726
languageName: node
692-
linkType: hard
727+
linkType: soft
693728

694729
"@tybys/wasm-util@npm:^0.10.1":
695730
version: 0.10.1
@@ -741,7 +776,7 @@ __metadata:
741776
languageName: node
742777
linkType: hard
743778

744-
"@types/estree@npm:^1.0.6":
779+
"@types/estree@npm:*, @types/estree@npm:^1.0.0, @types/estree@npm:^1.0.6":
745780
version: 1.0.8
746781
resolution: "@types/estree@npm:1.0.8"
747782
checksum: 10c0/39d34d1afaa338ab9763f37ad6066e3f349444f9052b9676a7cc0252ef9485a41c6d81c9c4e0d26e9077993354edf25efc853f3224dd4b447175ef62bdcc86a5
@@ -1165,6 +1200,13 @@ __metadata:
11651200
languageName: node
11661201
linkType: hard
11671202

1203+
"commondir@npm:^1.0.1":
1204+
version: 1.0.1
1205+
resolution: "commondir@npm:1.0.1"
1206+
checksum: 10c0/33a124960e471c25ee19280c9ce31ccc19574b566dc514fe4f4ca4c34fa8b0b57cf437671f5de380e11353ea9426213fca17687dd2ef03134fea2dbc53809fd6
1207+
languageName: node
1208+
linkType: hard
1209+
11681210
"compare-versions@npm:^6.1.1":
11691211
version: 6.1.1
11701212
resolution: "compare-versions@npm:6.1.1"
@@ -1476,6 +1518,13 @@ __metadata:
14761518
languageName: node
14771519
linkType: hard
14781520

1521+
"estree-walker@npm:^2.0.2":
1522+
version: 2.0.2
1523+
resolution: "estree-walker@npm:2.0.2"
1524+
checksum: 10c0/53a6c54e2019b8c914dc395890153ffdc2322781acf4bd7d1a32d7aedc1710807bdcd866ac133903d5629ec601fbb50abe8c2e5553c7f5a0afdd9b6af6c945af
1525+
languageName: node
1526+
linkType: hard
1527+
14791528
"esutils@npm:^2.0.2":
14801529
version: 2.0.3
14811530
resolution: "esutils@npm:2.0.3"
@@ -1533,7 +1582,7 @@ __metadata:
15331582
languageName: node
15341583
linkType: hard
15351584

1536-
"fdir@npm:^6.5.0":
1585+
"fdir@npm:^6.2.0, fdir@npm:^6.5.0":
15371586
version: 6.5.0
15381587
resolution: "fdir@npm:6.5.0"
15391588
peerDependencies:
@@ -1822,6 +1871,15 @@ __metadata:
18221871
languageName: node
18231872
linkType: hard
18241873

1874+
"is-reference@npm:1.2.1":
1875+
version: 1.2.1
1876+
resolution: "is-reference@npm:1.2.1"
1877+
dependencies:
1878+
"@types/estree": "npm:*"
1879+
checksum: 10c0/7dc819fc8de7790264a0a5d531164f9f5b9ef5aa1cd05f35322d14db39c8a2ec78fd5d4bf57f9789f3ddd2b3abeea7728432b759636157a42db12a9e8c3b549b
1880+
languageName: node
1881+
linkType: hard
1882+
18251883
"isexe@npm:^2.0.0":
18261884
version: 2.0.0
18271885
resolution: "isexe@npm:2.0.0"
@@ -2077,6 +2135,15 @@ __metadata:
20772135
languageName: node
20782136
linkType: hard
20792137

2138+
"magic-string@npm:^0.30.3":
2139+
version: 0.30.21
2140+
resolution: "magic-string@npm:0.30.21"
2141+
dependencies:
2142+
"@jridgewell/sourcemap-codec": "npm:^1.5.5"
2143+
checksum: 10c0/299378e38f9a270069fc62358522ddfb44e94244baa0d6a8980ab2a9b2490a1d03b236b447eee309e17eb3bddfa482c61259d47960eb018a904f0ded52780c4a
2144+
languageName: node
2145+
linkType: hard
2146+
20802147
"make-fetch-happen@npm:^14.0.3":
20812148
version: 14.0.3
20822149
resolution: "make-fetch-happen@npm:14.0.3"
@@ -2639,6 +2706,7 @@ __metadata:
26392706
resolution: "simons-sigmacomputing-plugins@workspace:."
26402707
dependencies:
26412708
"@eslint/js": "npm:^9.36.0"
2709+
"@rollup/plugin-commonjs": "npm:^29.0.0"
26422710
"@sigmacomputing/plugin": "npm:^1.0.10"
26432711
"@types/node": "npm:^24.6.0"
26442712
"@types/react": "npm:^19.1.16"

0 commit comments

Comments
 (0)