Skip to content

Commit 0480b49

Browse files
committed
prettify conversation
1 parent cea2448 commit 0480b49

File tree

1 file changed

+25
-27
lines changed
  • services/static-webserver/client/source/class/osparc/wrapper

1 file changed

+25
-27
lines changed

services/static-webserver/client/source/class/osparc/wrapper/Svg.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,55 +274,53 @@ qx.Class.define("osparc.wrapper.Svg", {
274274
return rect;
275275
},
276276

277-
drawAnnotationConversation: function(draw, x, y, color) {
277+
drawAnnotationConversation: function(draw, x, y) {
278+
const color = qx.theme.manager.Color.getInstance().getTheme().colors["text"];
279+
const bubbleWidth = 150;
280+
const bubbleHeight = 30;
281+
const padding = 6;
282+
278283
// Group to keep all elements together
279284
const bubble = draw.group();
285+
bubble.move(x, y);
280286

281287
// Rounded rectangle as the base
282-
const rect = draw.rect(280, 60)
283-
.radius(15)
288+
const rect = draw.rect(bubbleWidth, bubbleHeight)
289+
.radius(4)
284290
.fill("none")
285291
.stroke({
286-
width: 2,
287292
color,
293+
width: 1.5,
288294
});
289295
bubble.add(rect);
290296

291297
// Icon (simple speech bubble using path or text)
298+
const iconSize = 16;
292299
const icon = draw.text('💬')
293-
.font({ size: 24 })
294-
.move(10, 18);
300+
.font({
301+
size: iconSize
302+
})
303+
.move(padding, (bubbleHeight - iconSize) / 2)
304+
.attr({
305+
cursor: "pointer"
306+
});
295307
bubble.add(icon);
296308

297309
// Title text
310+
const titleFontSize = 12;
311+
const defaultFont = osparc.utils.Utils.getDefaultFont();
298312
const title = draw.text('Hello')
299313
.font({
300-
size: 16,
314+
fill: color,
315+
size: titleFontSize,
316+
family: defaultFont["family"],
301317
anchor: 'start'
302318
})
303-
.move(50, 22);
319+
.move(padding + iconSize + 8, ((bubbleHeight - titleFontSize) / 2) - 3);
304320
bubble.add(title);
305321

306-
// Button (small circle with i or icon)
307-
const button = draw.circle(24)
308-
.fill('#ccc')
309-
.move(250, 18);
310-
const btnText = draw.text('➤')
311-
.font({
312-
size: 14,
313-
anchor: 'middle',
314-
leading: '1'
315-
})
316-
.move(250 + 12 - 7, 18 + 12 - 10); // center text in circle
317-
318-
bubble.add(button);
319-
bubble.add(btnText);
320-
321322
// Add a click event to the button
322-
button.click(function () {
323-
alert('Popup or conversation panel here!');
324-
});
325-
btnText.click(function () {
323+
icon.click(() => {
326324
alert('Popup or conversation panel here!');
327325
});
328326

0 commit comments

Comments
 (0)