gitdataai/src/index.css
ZhenYi 00a5369fe1
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions
feat(frontend): Discord layout + AI Studio theme + Room Settings
Frontend:
- Add Discord-style 3-column layout (server icons / channel sidebar / chat)
- AI Studio design system: new CSS token palette (--room-* vars)
- Replace all hardcoded Discord colors with CSS variable tokens
- Add RoomSettingsPanel (name, visibility, AI model management)
- Settings + Member list panels mutually exclusive (don't overlap)
- AI models shown at top of member list with green accent
- Fix TS errors: TipTap SuggestionOptions, unused imports, StarterKit options
- Remove MentionInput, MentionPopover, old room components (废弃代码清理)

Backend:
- RoomAiResponse returns model_name from agents.model JOIN
- room_ai_list and room_ai_upsert fetch model name for each config
- AiConfigData ws-protocol interface updated with model_name

Note: RoomSettingsPanel UI still uses shadcn defaults (未完全迁移到AI Studio)
2026-04-18 16:59:36 +08:00

830 lines
20 KiB
CSS

@import "tailwindcss";
@import "tw-animate-css";
@import "@fontsource-variable/geist";
@custom-variant dark (&:is(.dark *));
@theme inline {
--font-heading: var(--font-sans);
--font-sans: 'Geist Variable', sans-serif;
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--color-foreground: var(--foreground);
--color-background: var(--background);
--radius-sm: calc(var(--radius) * 0.6);
--radius-md: calc(var(--radius) * 0.8);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) * 1.4);
--radius-2xl: calc(var(--radius) * 1.8);
--radius-3xl: calc(var(--radius) * 2.2);
--radius-4xl: calc(var(--radius) * 2.6);
/* ── Discord layout tokens ─────────────────────────────────────────────── */
--color-discord-bg: var(--room-bg);
--color-discord-sidebar: var(--room-sidebar);
--color-discord-channel-hover: var(--room-channel-hover);
--color-discord-channel-active: var(--room-channel-active);
--color-discord-mention-badge: var(--room-mention-badge);
--color-discord-blurple: var(--room-accent);
--color-discord-blurple-hover: var(--room-accent-hover);
--color-discord-green: var(--room-online);
--color-discord-red: oklch(0.63 0.21 25);
--color-discord-yellow: oklch(0.75 0.17 80);
--color-discord-online: var(--room-online);
--color-discord-offline: var(--room-offline);
--color-discord-idle: var(--room-away);
--color-discord-mention-text: var(--room-mention-text);
--color-discord-text: var(--room-text);
--color-discord-text-secondary: var(--room-text-secondary);
--color-discord-text-muted: var(--room-text-muted);
--color-discord-text-subtle: var(--room-text-subtle);
--color-discord-border: var(--room-border);
--color-discord-hover: var(--room-hover);
--color-discord-placeholder: var(--room-text-muted);
}
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.488 0.243 264.376);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.488 0.243 264.376);
--chart-1: oklch(0.87 0 0);
--chart-2: oklch(0.556 0 0);
--chart-3: oklch(0.439 0 0);
--chart-4: oklch(0.371 0 0);
--chart-5: oklch(0.269 0 0);
--radius: 0.5rem;
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.488 0.243 264.376);
/* AI Studio room palette — light */
--room-bg: oklch(0.995 0 0);
--room-sidebar: oklch(0.99 0 0);
--room-channel-hover: oklch(0.97 0 0);
--room-channel-active: oklch(0.55 0.18 253 / 8%);
--room-mention-badge: oklch(0.55 0.18 253);
--room-accent: oklch(0.55 0.18 253);
--room-accent-hover: oklch(0.52 0.19 253);
--room-online: oklch(0.63 0.19 158);
--room-offline: oklch(0.62 0 0 / 35%);
--room-away: oklch(0.75 0.17 80);
--room-text: oklch(0.145 0 0);
--room-text-secondary: oklch(0.25 0 0);
--room-text-muted: oklch(0.50 0 0);
--room-text-subtle: oklch(0.68 0 0);
--room-border: oklch(0.91 0 0);
--room-hover: oklch(0.97 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.18 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.18 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.488 0.243 264.376);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.22 0 0);
--muted-foreground: oklch(0.65 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 8%);
--input: oklch(1 0 0 / 10%);
--ring: oklch(0.488 0.243 264.376);
--chart-1: oklch(0.87 0 0);
--chart-2: oklch(0.556 0 0);
--chart-3: oklch(0.439 0 0);
--chart-4: oklch(0.371 0 0);
--chart-5: oklch(0.269 0 0);
--sidebar: oklch(0.13 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.22 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 8%);
--sidebar-ring: oklch(0.488 0.243 264.376);
/* Discord dark theme */
--discord-bg: oklch(0.145 0 0);
--discord-sidebar: oklch(0.13 0 0);
--discord-channel-hover: oklch(0.2 0 0);
/* AI Studio room palette — dark */
--room-bg: oklch(0.11 0 0);
--room-sidebar: oklch(0.10 0 0);
--room-channel-hover: oklch(0.16 0 0);
--room-channel-active: oklch(0.58 0.18 253 / 12%);
--room-mention-badge: oklch(0.58 0.18 253);
--room-accent: oklch(0.58 0.18 253);
--room-accent-hover: oklch(0.65 0.20 253);
--room-online: oklch(0.65 0.17 158);
--room-offline: oklch(0.50 0 0 / 35%);
--room-away: oklch(0.72 0.16 80);
--room-text: oklch(0.985 0 0);
--room-text-secondary: oklch(0.985 0 0 / 80%);
--room-text-muted: oklch(0.985 0 0 / 58%);
--room-text-subtle: oklch(0.985 0 0 / 40%);
--room-border: oklch(0 0 0 / 18%);
--room-hover: oklch(0.16 0 0);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
html {
@apply font-sans;
}
}
/* Placeholder support for contenteditable MentionInput */
[contenteditable][data-placeholder]:empty::before {
content: attr(data-placeholder);
color: var(--muted-foreground);
pointer-events: none;
}
/* ── Discord layout ──────────────────────────────────────────────────────── */
.discord-layout {
display: flex;
height: 100%;
width: 100%;
overflow: hidden;
background: var(--room-bg);
color: var(--foreground);
}
/* Server sidebar (left icon strip) */
.discord-server-sidebar {
display: flex;
flex-direction: column;
width: 72px;
background: var(--room-sidebar);
padding: 12px 0;
gap: 6px;
align-items: center;
border-right: 1px solid var(--room-border);
flex-shrink: 0;
overflow-y: auto;
overflow-x: hidden;
}
.discord-server-icon {
position: relative;
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: var(--room-channel-hover);
color: var(--foreground);
transition: border-radius 200ms ease, background 200ms ease;
font-weight: 700;
font-size: 14px;
text-transform: uppercase;
letter-spacing: 0;
user-select: none;
}
.discord-server-icon:hover {
border-radius: 16px;
background: var(--room-accent);
color: var(--primary-foreground);
}
.discord-server-icon.active {
border-radius: 16px;
background: var(--room-accent);
color: var(--primary-foreground);
}
.discord-server-icon .home-icon {
width: 28px;
height: 28px;
}
/* Channel sidebar */
.discord-channel-sidebar {
display: flex;
flex-direction: column;
width: 260px;
background: var(--room-sidebar);
border-right: 1px solid var(--room-border);
flex-shrink: 0;
overflow: hidden;
}
.discord-channel-header {
display: flex;
align-items: center;
height: 48px;
padding: 0 16px;
border-bottom: 1px solid var(--room-border);
box-shadow: 0 1px 0 var(--room-border);
flex-shrink: 0;
}
.discord-channel-header-title {
font-weight: 600;
font-size: 15px;
color: var(--foreground);
flex: 1;
}
.discord-channel-list {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 8px 8px 8px 0;
}
.discord-channel-list::-webkit-scrollbar {
width: 4px;
}
.discord-channel-list::-webkit-scrollbar-track {
background: transparent;
}
.discord-channel-list::-webkit-scrollbar-thumb {
background: var(--room-border);
border-radius: 4px;
}
.discord-channel-category {
margin-bottom: 4px;
}
.discord-channel-category-header {
display: flex;
align-items: center;
gap: 4px;
padding: 4px 8px;
cursor: pointer;
user-select: none;
border-radius: 4px;
margin-bottom: 2px;
color: var(--room-text-muted);
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
transition: color 150ms;
}
.discord-channel-category-header:hover {
color: var(--foreground);
}
.discord-channel-category-header svg {
transition: transform 150ms;
}
.discord-channel-category-header.collapsed svg {
transform: rotate(-90deg);
}
.discord-channel-item {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 8px;
border-radius: 4px;
cursor: pointer;
color: var(--room-text-muted);
font-size: 15px;
font-weight: 400;
transition: background 100ms, color 100ms;
user-select: none;
position: relative;
}
.discord-channel-item:hover {
background: var(--room-hover);
color: var(--room-text);
}
.discord-channel-item.active {
background: var(--room-channel-active);
color: var(--foreground);
}
.discord-channel-item.active::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 70%;
background: var(--room-accent);
border-radius: 0 2px 2px 0;
}
.discord-channel-hash {
opacity: 0.7;
font-size: 18px;
line-height: 1;
flex-shrink: 0;
}
.discord-channel-name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.discord-mention-badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 9px;
background: var(--room-mention-badge);
color: var(--primary-foreground);
font-size: 11px;
font-weight: 700;
line-height: 1;
}
.discord-add-channel-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
color: var(--room-text-subtle);
font-size: 14px;
transition: color 150ms;
margin-left: 16px;
background: none;
border: none;
text-align: left;
width: 100%;
}
.discord-add-channel-btn:hover {
color: var(--room-text);
}
/* Member list sidebar */
.discord-member-sidebar {
display: flex;
flex-direction: column;
width: 220px;
background: var(--room-sidebar);
border-left: 1px solid var(--room-border);
flex-shrink: 0;
overflow: hidden;
}
.discord-member-header {
display: flex;
align-items: center;
height: 48px;
padding: 0 16px;
border-bottom: 1px solid var(--room-border);
flex-shrink: 0;
}
.discord-member-section-title {
display: flex;
align-items: center;
gap: 4px;
padding: 16px 12px 4px;
color: var(--room-text-subtle);
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.discord-member-item {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
color: var(--room-text-secondary);
font-size: 14px;
transition: background 100ms;
user-select: none;
}
.discord-member-item:hover {
background: var(--room-hover);
}
.discord-member-avatar-wrap {
position: relative;
flex-shrink: 0;
}
.discord-member-status-dot {
position: absolute;
bottom: 0;
right: 0;
width: 11px;
height: 11px;
border-radius: 50%;
border: 2px solid var(--room-sidebar);
}
.discord-member-status-dot.online {
background: var(--room-online);
}
.discord-member-status-dot.offline {
background: var(--room-offline);
}
.discord-member-status-dot.idle {
background: var(--room-away);
}
/* ── Discord message bubbles ─────────────────────────────────────────────── */
.discord-message-list {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 0 16px 8px;
}
.discord-message-list::-webkit-scrollbar {
width: 8px;
}
.discord-message-list::-webkit-scrollbar-track {
background: transparent;
}
.discord-message-list::-webkit-scrollbar-thumb {
background: var(--room-border);
border-radius: 4px;
border: 2px solid transparent;
background-clip: padding-box;
}
.discord-message-group {
display: flex;
flex-direction: column;
}
.discord-message-row {
display: flex;
align-items: flex-start;
gap: 16px;
padding: 1px 0;
min-height: 26px;
border-radius: 4px;
position: relative;
}
.discord-message-row:hover .discord-message-actions {
opacity: 1;
}
.discord-message-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
flex-shrink: 0;
overflow: hidden;
margin-top: -2px;
}
.discord-message-body {
flex: 1;
min-width: 0;
}
.discord-message-avatar-spacer {
width: 40px;
flex-shrink: 0;
}
.discord-message-header {
display: flex;
align-items: baseline;
gap: 8px;
margin-bottom: 2px;
}
.discord-message-author {
font-size: 15px;
font-weight: 600;
color: var(--foreground);
line-height: 1.2;
cursor: pointer;
}
.discord-message-author:hover {
text-decoration: underline;
}
.discord-message-time {
font-size: 11px;
color: var(--room-text-subtle);
line-height: 1.2;
}
.discord-message-content {
font-size: 15px;
line-height: 1.4;
color: var(--room-text);
word-break: break-word;
white-space: pre-wrap;
}
.discord-message-content .mention {
background: oklch(0.488 0.243 264.376 / 25%);
color: var(--room-mention-text);
padding: 0 4px;
border-radius: 3px;
font-weight: 500;
}
.discord-message-actions {
position: absolute;
top: -14px;
right: 16px;
display: flex;
align-items: center;
gap: 2px;
background: var(--card);
border: 1px solid var(--border);
border-radius: 4px;
padding: 2px;
opacity: 0;
transition: opacity 150ms;
box-shadow: 0 1px 4px var(--room-border);
}
.discord-msg-action-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border-radius: 4px;
cursor: pointer;
color: var(--room-text-muted);
transition: background 100ms, color 100ms;
background: none;
border: none;
}
.discord-msg-action-btn:hover {
background: var(--room-hover);
color: var(--room-text);
}
.discord-date-divider {
display: flex;
align-items: center;
gap: 16px;
margin: 16px 0 8px;
padding: 0 60px;
}
.discord-date-divider::before,
.discord-date-divider::after {
content: '';
flex: 1;
height: 1px;
background: var(--room-border);
}
.discord-date-divider-label {
font-size: 12px;
font-weight: 600;
color: var(--room-text-subtle);
white-space: nowrap;
}
/* Typing indicator */
.discord-typing-indicator {
display: flex;
align-items: center;
gap: 8px;
padding: 0 16px 4px;
font-size: 12px;
color: var(--room-text-subtle);
}
.discord-typing-dots {
display: flex;
gap: 3px;
}
.discord-typing-dots span {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--room-text-subtle);
animation: typing-bounce 1.2s infinite ease-in-out;
}
.discord-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.discord-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
0%, 60%, 100% { transform: translateY(0); }
30% { transform: translateY(-4px); }
}
/* Status pill in header */
.discord-ws-status {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 12px;
color: var(--room-text-muted);
}
.discord-ws-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.discord-ws-dot.connected { background: var(--room-online); }
.discord-ws-dot.connecting {
background: var(--room-away);
animation: pulse 1.5s infinite;
}
.discord-ws-dot.disconnected { background: oklch(0.63 0.21 25); }
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
/* Chat input area */
.discord-chat-input-area {
display: flex;
flex-direction: column;
padding: 0 16px 24px;
margin-top: 4px;
}
.discord-input-wrapper {
display: flex;
align-items: flex-end;
gap: 4px;
background: var(--room-hover);
border: 1px solid var(--room-border);
border-radius: 8px;
padding: 4px 4px 4px 16px;
transition: background 150ms, border-color 150ms;
}
.discord-input-wrapper:focus-within {
background: var(--room-sidebar);
border-color: var(--room-accent);
}
.discord-input-field {
flex: 1;
background: transparent;
border: none;
outline: none;
color: var(--room-text);
font-size: 14px;
line-height: 1.4;
padding: 8px 0;
resize: none;
max-height: 200px;
overflow-y: auto;
font-family: inherit;
}
.discord-input-field::placeholder {
color: var(--room-text-muted);
}
.discord-input-field::-webkit-scrollbar { width: 0; }
.discord-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 6px;
background: var(--room-accent);
color: var(--primary-foreground);
cursor: pointer;
border: none;
transition: background 150ms;
flex-shrink: 0;
}
.discord-send-btn:hover { background: var(--room-accent-hover); }
.discord-send-btn:disabled { opacity: 0.5; cursor: default; }
/* Reply preview in input */
.discord-reply-preview {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 4px;
padding: 6px 8px;
border-radius: 4px;
background: var(--room-hover);
border-left: 2px solid var(--room-accent);
font-size: 13px;
color: var(--room-text-muted);
}
.discord-reply-preview-author {
font-weight: 600;
color: var(--room-text-secondary);
}
.discord-reply-preview-text {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Streaming message cursor */
.discord-streaming-cursor {
display: inline-block;
width: 2px;
height: 1em;
background: var(--room-accent);
margin-left: 1px;
vertical-align: text-bottom;
animation: cursor-blink 0.8s step-end infinite;
}
@keyframes cursor-blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
/* Role color dot */
.discord-role-dot {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
flex-shrink: 0;
}