-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgentStudio.html
More file actions
165 lines (151 loc) · 5.88 KB
/
Copy pathAgentStudio.html
File metadata and controls
165 lines (151 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Opaque — Agent Studio · Employee HR Assist</title>
<link rel="stylesheet" href="colors_and_type.css" />
<link rel="stylesheet" href="kit.css?v=22" />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..24,400,0..1,0" />
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js" integrity="sha384-hD6/rw4ppMLGNu3tX5cjIb+uRZ7UkRJ6BPkLpg4hAu/6onKUg4lLsHAs9EBPT82L" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js" integrity="sha384-u6aeetuaXnQ38mYT8rp6sbXaQe3NL9t+IBXmnYxwkUI2Hw4bsp2Wvmx4yRQF1uAm" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@babel/standalone@7.29.0/babel.min.js" integrity="sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y" crossorigin="anonymous"></script>
</head>
<body>
<div id="root"></div>
<style id="tweak-style"></style>
<script>
// Tweaks — persisted defaults. The host rewrites this block on disk when
// the design changes values via postMessage(__edit_mode_set_keys).
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"linkColor": "emerald"
}/*EDITMODE-END*/;
(function () {
const LINK_COLORS = {
emerald: { base: "var(--opq-emerald-400)", hover: "var(--opq-emerald-300)" },
info: { base: "var(--opq-info-500)", hover: "var(--opq-info-400)" },
white: { base: "#ffffff", hover: "var(--opq-ink-200)" },
};
let state = { ...TWEAK_DEFAULTS };
let role = localStorage.getItem("opq-role") || "admin";
let panelEl = null;
function applyStyles() {
const c = LINK_COLORS[state.linkColor] || LINK_COLORS.emerald;
document.getElementById("tweak-style").textContent =
`.opq-table .link { color: ${c.base}; }
.opq-table .link:hover { color: ${c.hover}; }`;
}
function renderPanel() {
if (!panelEl) return;
const opt = (val, label) =>
`<button data-val="${val}" class="tweak-opt${state.linkColor === val ? " active" : ""}">${label}</button>`;
const ropt = (val, label) =>
`<button data-role="${val}" class="tweak-opt${role === val ? " active" : ""}">${label}</button>`;
panelEl.innerHTML = `
<div class="tweak-head">
<span class="material-symbols-outlined" style="font-size:16px;color:var(--opq-emerald-500)">tune</span>
<span>Tweaks</span>
</div>
<div class="tweak-row">
<label>View as role</label>
<div class="tweak-opts">
${ropt("admin", "Admin")}
${ropt("member", "Builder")}
</div>
</div>
<div class="tweak-row">
<label>Link color</label>
<div class="tweak-opts">
${opt("emerald", "Emerald")}
${opt("info", "Info blue")}
${opt("white", "White")}
</div>
</div>
`;
panelEl.querySelectorAll(".tweak-opt[data-val]").forEach(btn => {
btn.addEventListener("click", () => {
state.linkColor = btn.dataset.val;
applyStyles();
renderPanel();
window.parent.postMessage(
{ type: "__edit_mode_set_keys", edits: { linkColor: state.linkColor } },
"*"
);
});
});
panelEl.querySelectorAll(".tweak-opt[data-role]").forEach(btn => {
btn.addEventListener("click", () => {
const r = btn.dataset.role;
if (r === role) return;
try { localStorage.setItem("opq-role", r); } catch (e) {}
location.reload();
});
});
}
function showPanel() {
if (panelEl) { panelEl.style.display = "block"; return; }
panelEl = document.createElement("div");
panelEl.id = "tweaks-panel";
document.body.appendChild(panelEl);
renderPanel();
}
function hidePanel() {
if (panelEl) panelEl.style.display = "none";
}
// Register listener BEFORE announcing availability.
window.addEventListener("message", (e) => {
const t = e.data && e.data.type;
if (t === "__activate_edit_mode") showPanel();
else if (t === "__deactivate_edit_mode") hidePanel();
});
applyStyles();
window.parent.postMessage({ type: "__edit_mode_available" }, "*");
})();
</script>
<style>
#tweaks-panel {
position: fixed; right: 20px; bottom: 20px; z-index: 9999;
background: var(--opq-ink-850); border: 1px solid var(--opq-ink-800);
border-radius: 6px; padding: 12px 14px; min-width: 260px;
box-shadow: 0 8px 24px rgba(0,0,0,0.45);
font-family: var(--font-sans); color: white; font-size: 13px;
}
#tweaks-panel .tweak-head {
display: flex; align-items: center; gap: 8px;
font-size: 12px; font-weight: 500; color: var(--opq-ink-300);
text-transform: uppercase; letter-spacing: 0.04em;
margin-bottom: 10px;
}
#tweaks-panel .tweak-row label {
display: block; font-size: 12px; color: var(--opq-ink-400); margin-bottom: 6px;
}
#tweaks-panel .tweak-opts { display: flex; gap: 4px; }
#tweaks-panel .tweak-opt {
flex: 1; height: 28px; padding: 0 10px;
background: transparent; border: 1px solid var(--opq-ink-800);
border-radius: 4px; color: var(--opq-ink-200);
font-family: inherit; font-size: 12px; cursor: pointer;
}
#tweaks-panel .tweak-opt:hover { background: var(--opq-ink-900); color: white; }
#tweaks-panel .tweak-opt.active {
background: var(--opq-emerald-500); border-color: var(--opq-emerald-500);
color: var(--opq-ink-900); font-weight: 500;
}
</style>
<script type="text/babel" src="Primitives.jsx"></script>
<script type="text/babel" src="Nav.jsx"></script>
<script type="text/babel" src="IntegrationConfig.jsx"></script>
<script type="text/babel" src="AgentStudio.jsx"></script>
<script type="text/babel">
function App() {
return (
<div className="app">
<Nav activeRoute="workflows" onNavigate={() => {}} />
<AgentStudioCanvas />
</div>
);
}
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
</script>
</body>
</html>