Skip to content

Commit 9b7b810

Browse files
committed
style(say-server): UI improvements
- Move info button into toolbar (order: Play/Pause, Reset, (i), Fullscreen) - Position info popup below toolbar instead of bottom-right - Remove excessive min-height, add dynamic padding for info popup - Improve tool result message to prevent model repeating text
1 parent cac214f commit 9b7b810

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

examples/say-server/server.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@ def say(
201201
# 2. Provide the resourceUri metadata
202202
# 3. Show the final text in the tool result
203203
# 4. Provide widget UUID for multi-player coordination
204+
autoplay_note = "playing automatically" if autoPlay else "ready to play on click"
204205
return [types.TextContent(
205206
type="text",
206-
text=f"Displayed a TTS widget with voice '{voice}'. Click to play/pause, use toolbar to restart or fullscreen.",
207+
text=f"The text is now displayed in a TTS widget and {autoplay_note} (voice: {voice}). The user can see and hear it - do not repeat the text.",
207208
_meta={"widgetUUID": widget_uuid},
208209
)]
209210

@@ -692,7 +693,8 @@ def generate_sync():
692693
}
693694
* { box-sizing: border-box; margin: 0; padding: 0; }
694695
body { font-family: var(--font-sans); }
695-
.container { padding: 16px; min-height: 100px; position: relative; outline: none; }
696+
.container { padding: 16px; position: relative; outline: none; }
697+
.container.showingInfo { padding-bottom: 140px; } /* Space for info popup */
696698
.textWrapper { position: relative; }
697699
.textDisplay {
698700
font-size: 16px; line-height: 1.6; padding: 8px; border-radius: 6px;
@@ -730,26 +732,10 @@ def generate_sync():
730732
.fullscreenBtn .collapseIcon { display: none; }
731733
.container.fullscreen .fullscreenBtn .expandIcon { display: none; }
732734
.container.fullscreen .fullscreenBtn .collapseIcon { display: block; }
733-
/* Info button - bottom right */
734-
.infoBtn {
735-
position: absolute;
736-
bottom: 8px; right: 8px;
737-
width: 24px; height: 24px;
738-
border: none; border-radius: 50%;
739-
background: rgba(128, 128, 128, 0.4);
740-
color: white; cursor: pointer;
741-
display: flex; align-items: center; justify-content: center;
742-
font-size: 12px; font-weight: bold; font-style: italic; font-family: serif;
743-
opacity: 0.5;
744-
transition: opacity 0.2s, background 0.2s;
745-
z-index: 10;
746-
}
747-
.container:hover .infoBtn { opacity: 0.8; }
748-
.infoBtn:hover { opacity: 1; background: rgba(128, 128, 128, 0.7); }
749-
/* Info popup */
735+
/* Info popup - positioned below toolbar */
750736
.infoPopup {
751737
position: absolute;
752-
bottom: 40px; right: 8px;
738+
top: 44px; right: 8px;
753739
background: rgba(0, 0, 0, 0.9);
754740
color: white;
755741
padding: 12px 16px;
@@ -1344,7 +1330,7 @@ def generate_sync():
13441330
<span className="pending">{pendingText}</span>
13451331
</div>
13461332
</div>
1347-
{/* Toolbar - top right */}
1333+
{/* Toolbar - top right: Play/Pause, Reset, (i), Fullscreen */}
13481334
<div className="toolbar">
13491335
<button className="controlBtn" onClick={togglePlayPause} title="Play/Pause">
13501336
{status === "playing" ? (
@@ -1355,12 +1341,15 @@ def generate_sync():
13551341
<svg viewBox="0 0 24 24" fill="currentColor"><polygon points="5,3 19,12 5,21"/></svg>
13561342
)}
13571343
</button>
1358-
<button className="controlBtn" onClick={restartPlayback} title="Restart">
1344+
<button className="controlBtn" onClick={restartPlayback} title="Reset">
13591345
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
13601346
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>
13611347
<path d="M3 3v5h5"/>
13621348
</svg>
13631349
</button>
1350+
<button className="controlBtn infoBtn" onClick={() => setShowInfo(!showInfo)} title="Attribution info">
1351+
<span style={{fontStyle: "italic", fontFamily: "serif", fontWeight: "bold"}}>i</span>
1352+
</button>
13641353
<button className={`controlBtn fullscreenBtn` + (fullscreenAvailable ? ` available` : ``)} onClick={toggleFullscreen} title="Toggle fullscreen">
13651354
<svg className="expandIcon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
13661355
<path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/>
@@ -1370,8 +1359,6 @@ def generate_sync():
13701359
</svg>
13711360
</button>
13721361
</div>
1373-
{/* Info button - bottom right */}
1374-
<button className="infoBtn" onClick={() => setShowInfo(!showInfo)} title="Attribution info">i</button>
13751362
{showInfo && (
13761363
<div className="infoPopup">
13771364
<h4>Powered by Pocket TTS</h4>

0 commit comments

Comments
 (0)