Chat view: glowing-pill composer, themed bubbles, no copy buttons
Browse files- Merge input + send into one rounded "pill" with an italic serif placeholder
and a ➤ icon send button; both glow in the active Shard's color.
- Theme the chat bubbles (serif, translucent dark bot bubbles, accent-tinted
user bubbles).
- Remove all share/copy/copy-all controls (Chatbot buttons=[] + CSS safety net).
- Fix latent theming bug: chat_view was missing elem_id="chat-view", so --accent
was undefined and accent styling silently fell back. Add the id, make the
per-Shard skin win with !important (Gradio injects css= after it), and use
color-mix() for accent alpha (the var(--x)NN hex-alpha shorthand is invalid).
The whole conversation panel now tints to each Shard.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -350,7 +350,9 @@ def _build_skin(shard):
|
|
| 350 |
chat panel by setting --accent CSS variables on #chat-view."""
|
| 351 |
return f"""
|
| 352 |
<style>
|
| 353 |
-
|
|
|
|
|
|
|
| 354 |
</style>
|
| 355 |
<div class="shard-banner" style="--c:{shard['color']};--c2:{shard['accent']};">
|
| 356 |
<div class="shard-name">{shard['name']}</div>
|
|
@@ -599,16 +601,66 @@ CSS = """
|
|
| 599 |
|
| 600 |
#orrery-wrap { display:flex; align-items:center; justify-content:center;
|
| 601 |
min-height:460px; overflow:visible; padding:14px 0; }
|
| 602 |
-
#shard-chat {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 603 |
#send-btn {
|
| 604 |
-
|
| 605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 606 |
}
|
| 607 |
-
#
|
| 608 |
-
|
| 609 |
-
|
| 610 |
}
|
| 611 |
-
#user-box textarea::placeholder { color:#8a85ad !important; }
|
| 612 |
#travel-btn {
|
| 613 |
flex:0 0 auto !important; width:fit-content !important; min-width:0 !important;
|
| 614 |
background:#140f24cc !important; border:1px solid var(--accent)66 !important;
|
|
@@ -672,7 +724,7 @@ with gr.Blocks(title="Cosmere Codex") as demo:
|
|
| 672 |
gr.HTML(build_cosmos_scene())
|
| 673 |
|
| 674 |
# -------------------------- CONVERSATION VIEW --------------------------- #
|
| 675 |
-
with gr.Column(visible=False) as chat_view:
|
| 676 |
with gr.Row():
|
| 677 |
travel_btn = gr.Button("✦ Travel to another system", elem_id="travel-btn", scale=1)
|
| 678 |
shard_skin = gr.HTML()
|
|
@@ -684,16 +736,18 @@ with gr.Blocks(title="Cosmere Codex") as demo:
|
|
| 684 |
elem_id="shard-chat",
|
| 685 |
height=460,
|
| 686 |
show_label=False,
|
|
|
|
| 687 |
)
|
| 688 |
-
with gr.Row():
|
| 689 |
user_box = gr.Textbox(
|
| 690 |
elem_id="user-box",
|
| 691 |
placeholder="Speak to the voice…",
|
| 692 |
show_label=False,
|
|
|
|
| 693 |
scale=5,
|
| 694 |
autofocus=True,
|
| 695 |
)
|
| 696 |
-
send_btn = gr.Button("
|
| 697 |
|
| 698 |
gr.HTML(
|
| 699 |
"""
|
|
|
|
| 350 |
chat panel by setting --accent CSS variables on #chat-view."""
|
| 351 |
return f"""
|
| 352 |
<style>
|
| 353 |
+
/* !important so this wins over the default in the css= block, which Gradio
|
| 354 |
+
injects later in the DOM (equal specificity would otherwise lose). */
|
| 355 |
+
#chat-view {{ --accent: {shard['color']} !important; --accent2: {shard['accent']} !important; }}
|
| 356 |
</style>
|
| 357 |
<div class="shard-banner" style="--c:{shard['color']};--c2:{shard['accent']};">
|
| 358 |
<div class="shard-name">{shard['name']}</div>
|
|
|
|
| 601 |
|
| 602 |
#orrery-wrap { display:flex; align-items:center; justify-content:center;
|
| 603 |
min-height:460px; overflow:visible; padding:14px 0; }
|
| 604 |
+
#shard-chat {
|
| 605 |
+
border:1px solid color-mix(in srgb, var(--accent) 28%, transparent) !important;
|
| 606 |
+
box-shadow:0 0 26px color-mix(in srgb, var(--accent) 14%, transparent) !important;
|
| 607 |
+
background:rgba(10,9,24,0.55) !important;
|
| 608 |
+
font-family:'Georgia','Times New Roman',serif;
|
| 609 |
+
}
|
| 610 |
+
/* strip Gradio's per-message + toolbar copy / share / copy-all buttons */
|
| 611 |
+
#shard-chat .icon-button-wrapper,
|
| 612 |
+
#shard-chat .message-buttons,
|
| 613 |
+
#shard-chat button[title*="opy" i],
|
| 614 |
+
#shard-chat button[title*="hare" i] { display:none !important; }
|
| 615 |
+
|
| 616 |
+
/* themed chat bubbles */
|
| 617 |
+
#shard-chat .message, #shard-chat .bot, #shard-chat .user {
|
| 618 |
+
font-family:'Georgia',serif !important; color:#ece9f7 !important;
|
| 619 |
+
border-radius:14px !important;
|
| 620 |
+
}
|
| 621 |
+
#shard-chat .bot, #shard-chat .message.bot {
|
| 622 |
+
background:rgba(20,18,42,0.85) !important;
|
| 623 |
+
border:1px solid color-mix(in srgb, var(--accent) 22%, transparent) !important;
|
| 624 |
+
}
|
| 625 |
+
#shard-chat .user, #shard-chat .message.user {
|
| 626 |
+
background:color-mix(in srgb, var(--accent) 16%, rgba(20,18,42,0.85)) !important;
|
| 627 |
+
border:1px solid color-mix(in srgb, var(--accent) 32%, transparent) !important;
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
/* unified "glowing pill" composer (text field + send icon as one bar) */
|
| 631 |
+
#composer {
|
| 632 |
+
display:flex !important; align-items:center; gap:6px; flex-wrap:nowrap !important;
|
| 633 |
+
margin-top:10px; padding:5px 6px 5px 18px;
|
| 634 |
+
background:rgba(12,11,26,0.72);
|
| 635 |
+
border:1px solid color-mix(in srgb, var(--accent) 38%, transparent);
|
| 636 |
+
border-radius:999px;
|
| 637 |
+
box-shadow:0 0 18px color-mix(in srgb, var(--accent) 16%, transparent);
|
| 638 |
+
transition:box-shadow .3s ease, border-color .3s ease;
|
| 639 |
+
}
|
| 640 |
+
#composer:focus-within {
|
| 641 |
+
border-color:var(--accent);
|
| 642 |
+
box-shadow:0 0 28px color-mix(in srgb, var(--accent) 38%, transparent);
|
| 643 |
+
}
|
| 644 |
+
#composer #user-box { flex:1 1 auto !important; min-width:0 !important; }
|
| 645 |
+
#composer #user-box textarea {
|
| 646 |
+
background:transparent !important; border:none !important; box-shadow:none !important;
|
| 647 |
+
color:#f1eef9 !important; font-family:'Georgia',serif; font-size:1rem;
|
| 648 |
+
padding:6px 4px !important; resize:none;
|
| 649 |
+
}
|
| 650 |
+
#user-box textarea::placeholder { color:#9a95bd !important; font-style:italic; }
|
| 651 |
#send-btn {
|
| 652 |
+
flex:0 0 auto !important; width:42px !important; min-width:42px !important;
|
| 653 |
+
height:42px !important; padding:0 !important; border-radius:50% !important;
|
| 654 |
+
background:linear-gradient(145deg,var(--accent),var(--accent2)) !important;
|
| 655 |
+
color:#11111a !important; border:none !important;
|
| 656 |
+
font-size:1.05rem; line-height:1; display:flex; align-items:center; justify-content:center;
|
| 657 |
+
box-shadow:0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
|
| 658 |
+
transition:transform .2s ease, box-shadow .2s ease;
|
| 659 |
}
|
| 660 |
+
#send-btn:hover {
|
| 661 |
+
transform:scale(1.08);
|
| 662 |
+
box-shadow:0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
|
| 663 |
}
|
|
|
|
| 664 |
#travel-btn {
|
| 665 |
flex:0 0 auto !important; width:fit-content !important; min-width:0 !important;
|
| 666 |
background:#140f24cc !important; border:1px solid var(--accent)66 !important;
|
|
|
|
| 724 |
gr.HTML(build_cosmos_scene())
|
| 725 |
|
| 726 |
# -------------------------- CONVERSATION VIEW --------------------------- #
|
| 727 |
+
with gr.Column(visible=False, elem_id="chat-view") as chat_view:
|
| 728 |
with gr.Row():
|
| 729 |
travel_btn = gr.Button("✦ Travel to another system", elem_id="travel-btn", scale=1)
|
| 730 |
shard_skin = gr.HTML()
|
|
|
|
| 736 |
elem_id="shard-chat",
|
| 737 |
height=460,
|
| 738 |
show_label=False,
|
| 739 |
+
buttons=[], # no share / copy / copy-all controls
|
| 740 |
)
|
| 741 |
+
with gr.Row(elem_id="composer"):
|
| 742 |
user_box = gr.Textbox(
|
| 743 |
elem_id="user-box",
|
| 744 |
placeholder="Speak to the voice…",
|
| 745 |
show_label=False,
|
| 746 |
+
container=False,
|
| 747 |
scale=5,
|
| 748 |
autofocus=True,
|
| 749 |
)
|
| 750 |
+
send_btn = gr.Button("➤", elem_id="send-btn", scale=0, min_width=48)
|
| 751 |
|
| 752 |
gr.HTML(
|
| 753 |
"""
|