fix: 优化暗黑主题下相关背景色

This commit is contained in:
sophie committed 2026-05-26 14:40:09 +08:00
1 parent bacff38ef7
commit 041c2d033f
4 files changed
+59 -45

No files matched your search

+36 -30
View File
@@ -773,6 +773,10 @@ const handleRegister = async () => {
};
const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs' | 'history'>('applications');
const workspaceSidebarNavActive =
'bg-brand-50 text-brand-700 shadow-sm dark:bg-brand-500/15 dark:text-brand-300 dark:shadow-none dark:ring-1 dark:ring-inset dark:ring-brand-500/25';
const workspaceSidebarNavInactive =
'text-slate-600 hover:bg-slate-50 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800/80 dark:hover:text-slate-200';
const isProfileLoading = ref(false);
const isProfileSaving = ref(false);
const isProfileEditing = ref(false);
@@ -1553,15 +1557,15 @@ onMounted(async () => {
</header>
<div class="grid min-h-screen gap-0 lg:grid-cols-[232px_minmax(0,1fr)]">
<aside v-if="!isMobile" class="lg:sticky lg:top-0 lg:h-screen">
<div class="flex h-full flex-col border-r border-slate-200 bg-white px-5 py-6 shadow-sm">
<div class="border-b border-slate-100 pb-6">
<div class="flex h-full flex-col border-r border-slate-200 bg-white px-5 py-6 shadow-sm dark:border-slate-800 dark:bg-slate-900">
<div class="border-b border-slate-100 pb-6 dark:border-slate-800">
<div class="flex items-center gap-3">
<div class="flex h-12 w-12 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-white shadow-lg shadow-brand-500/25">
<Bot class="h-6 w-6" />
</div>
<div class="min-w-0">
<div class="text-2xl font-extrabold tracking-tight text-[#14213d]">{{ $t('workspace.brandTitle') }}</div>
<div class="truncate text-xs font-medium text-slate-400">
<div class="text-2xl font-extrabold tracking-tight text-[#14213d] dark:text-slate-100">{{ $t('workspace.brandTitle') }}</div>
<div class="truncate text-xs font-medium text-slate-400 dark:text-slate-500">
{{ currentUser?.username }} / {{ currentUser?.role }}
</div>
</div>
@@ -1573,7 +1577,7 @@ onMounted(async () => {
<button
@click="navigateToProfile"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'profile' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'profile' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<User class="h-4 w-4" />
<span>{{ $t('workspace.nav.profile') }}</span>
@@ -1581,7 +1585,8 @@ onMounted(async () => {
<button
v-if="currentUser?.role === 'admin'"
@click="openAdminPanel"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="workspaceSidebarNavInactive"
>
<Settings class="h-4 w-4" />
<span>{{ $t('workspace.nav.admin') }}</span>
@@ -1589,7 +1594,7 @@ onMounted(async () => {
<button
@click="navigateToApplications"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'applications' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'applications' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<LayoutGrid class="h-4 w-4" />
<span>{{ $t('workspace.nav.applications') }}</span>
@@ -1597,7 +1602,7 @@ onMounted(async () => {
<button
@click="navigateToKnowledgeBase"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'knowledge_base' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'knowledge_base' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<FileText class="h-4 w-4" />
<span>{{ $t('workspace.nav.knowledgeBase') }}</span>
@@ -1605,7 +1610,7 @@ onMounted(async () => {
<button
@click="navigateToScheduleRuns"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'schedule_runs' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'schedule_runs' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Clock class="h-4 w-4" />
<span>{{ $t('workspace.nav.scheduleRuns') }}</span>
@@ -1613,7 +1618,7 @@ onMounted(async () => {
<button
@click="openGeneralFeedback"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'feedback' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'feedback' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Edit class="h-4 w-4" />
<span>{{ $t('workspace.nav.feedback') }}</span>
@@ -1621,7 +1626,7 @@ onMounted(async () => {
<button
@click="navigateToUpdates"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="activeSidebarItem === 'updates' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
:class="activeSidebarItem === 'updates' ? workspaceSidebarNavActive : workspaceSidebarNavInactive"
>
<Megaphone class="h-4 w-4" />
<span>{{ $t('workspace.nav.updates') }}</span>
@@ -1629,18 +1634,19 @@ onMounted(async () => {
</div>
</div>
<div class="border-t border-slate-100 pt-6">
<div class="border-t border-slate-100 pt-6 dark:border-slate-800">
<div class="space-y-2">
<button
@click="navigateToGeneralChat"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
:class="workspaceSidebarNavInactive"
>
<Bot class="h-4 w-4" />
<span>{{ $t('workspace.nav.backToChat') }}</span>
</button>
<button
@click="handleLogout"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300"
>
<LogOut class="h-4 w-4" />
<span>{{ $t('workspace.nav.logout') }}</span>
@@ -1650,7 +1656,7 @@ onMounted(async () => {
</div>
</aside>
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 dark:bg-slate-950 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
<template v-if="activeSidebarItem === 'history'">
<div class="space-y-3">
<div v-if="isLoadingHistories" class="flex justify-center py-20">
@@ -2002,18 +2008,18 @@ onMounted(async () => {
<div class="flex justify-between items-center mb-6">
<h2 class="text-lg md:text-xl font-semibold text-[#1b2b49] dark:text-slate-100 flex items-center gap-2.5 cursor-pointer select-none" @click="toggleSectionCollapse(section)">
<div class="p-2 rounded-lg" :class="{
'bg-emerald-50 text-emerald-600': section.id === 'announcements',
'bg-yellow-50 text-yellow-600': section.id === 'favorites',
'bg-brand-50 text-brand-600': section.id === 'quick_questions',
'bg-purple-50 text-purple-600': section.id === 'embedded',
'bg-slate-100 text-slate-600': section.id === 'all_agents'
'bg-emerald-50 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-400': section.id === 'announcements',
'bg-yellow-50 text-yellow-600 dark:bg-yellow-500/15 dark:text-yellow-400': section.id === 'favorites',
'bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300': section.id === 'quick_questions',
'bg-purple-50 text-purple-600 dark:bg-purple-500/15 dark:text-purple-400': section.id === 'embedded',
'bg-slate-100 text-slate-600 dark:bg-slate-700/80 dark:text-slate-300': section.id === 'all_agents'
}">
<component :is="section.id === 'announcements' ? Megaphone : (section.id === 'favorites' ? Star : (section.id === 'embedded' ? Bot : LayoutGrid))" class="w-5 h-5" />
</div>
{{ $t(getSectionTitleKey(section.id)) }}
<component :is="section.collapsed ? ChevronDown : ChevronUp" class="w-4 h-4 text-slate-400" />
</h2>
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50 dark:text-brand-300 dark:hover:bg-brand-500/15">
<Plus class="w-4 h-4" /> {{ $t('workspace.quickQuestions.add') }}
</button>
</div>
@@ -2030,21 +2036,21 @@ onMounted(async () => {
@click="openAnnouncement(ann)"
>
<div class="flex items-start justify-between gap-3 mb-2">
<h4 class="font-bold text-slate-900 line-clamp-2 group-hover:text-emerald-700 transition-colors">{{ ann.title }}</h4>
<span class="text-[10px] font-semibold text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-full whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
<h4 class="font-bold text-slate-900 dark:text-slate-100 line-clamp-2 group-hover:text-emerald-700 dark:group-hover:text-emerald-400 transition-colors">{{ ann.title }}</h4>
<span class="text-[10px] font-semibold text-emerald-700 bg-emerald-50 dark:text-emerald-300 dark:bg-emerald-500/15 px-2 py-0.5 rounded-full whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
</div>
<p class="text-sm text-slate-600 line-clamp-3">{{ ann.content }}</p>
<p class="text-sm text-slate-600 dark:text-slate-400 line-clamp-3">{{ ann.content }}</p>
</div>
</div>
</div>
<!-- Content: Favorites -->
<div v-if="section.id === 'favorites'">
<div v-if="favoriteAgents.length === 0" class="text-slate-400 text-sm italic py-4 bg-slate-50 rounded-xl text-center border border-dashed border-slate-200">{{ $t('workspace.noFavorites') }}</div>
<div v-if="favoriteAgents.length === 0" class="text-slate-400 text-sm italic py-4 bg-slate-50 rounded-xl text-center border border-dashed border-slate-200 dark:bg-slate-800/50 dark:border-slate-700">{{ $t('workspace.noFavorites') }}</div>
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 sm:gap-6">
<div v-for="agent in favoriteAgents" :key="agent.id" @click="navigateToChat(agent.id)"
class="card p-4 sm:p-5 cursor-pointer relative group/card hover:-translate-y-1 hover:shadow-lg hover:border-brand-200 bg-gradient-to-br from-white to-slate-50/50">
<div class="w-8 h-8 sm:w-12 sm:h-12 bg-brand-100 rounded-xl flex items-center justify-center text-brand-600 mb-3 sm:mb-4 shadow-sm group-hover/card:scale-110 transition-transform duration-300">
class="card p-4 sm:p-5 cursor-pointer relative group/card hover:-translate-y-1 hover:shadow-lg hover:border-brand-200 dark:hover:border-brand-600 bg-gradient-to-br from-white to-slate-50/50 dark:from-slate-800 dark:to-slate-800/90">
<div class="w-8 h-8 sm:w-12 sm:h-12 bg-brand-100 dark:bg-brand-500/15 rounded-xl flex items-center justify-center text-brand-600 dark:text-brand-300 mb-3 sm:mb-4 shadow-sm dark:shadow-none group-hover/card:scale-110 transition-transform duration-300">
<img v-if="agent.icon_url" :src="agent.icon_url" class="w-5 h-5 sm:w-7 sm:h-7" />
<Bot v-else class="w-5 h-5 sm:w-7 sm:h-7" />
</div>
@@ -2120,7 +2126,7 @@ onMounted(async () => {
<div v-for="agent in embeddedAgents" :key="agent.id" class="border border-slate-200 dark:border-slate-700 rounded-2xl overflow-hidden bg-white dark:bg-slate-900 shadow-sm hover:shadow-md transition-shadow h-[500px] flex flex-col">
<div class="bg-slate-50 dark:bg-slate-800 px-4 py-3 text-sm font-bold text-slate-700 dark:text-slate-200 flex justify-between items-center border-b border-slate-100 dark:border-slate-700">
<span>{{ agent.name }}</span>
<a :href="`/chat/${agent.id}`" target="_blank" class="text-brand-600 hover:text-brand-700 hover:bg-brand-50 p-1.5 rounded-lg transition-colors"><ExternalLink class="w-4 h-4"/></a>
<a :href="`/chat/${agent.id}`" target="_blank" class="text-brand-600 hover:text-brand-700 hover:bg-brand-50 dark:text-brand-300 dark:hover:bg-brand-500/15 p-1.5 rounded-lg transition-colors"><ExternalLink class="w-4 h-4"/></a>
</div>
<iframe v-if="agent.iframe_url" :src="agent.iframe_url" class="w-full flex-1 border-none bg-white dark:bg-slate-900"></iframe>
<div v-else class="flex items-center justify-center flex-1 text-slate-400 bg-slate-50/50">{{ $t('workspace.embedded.noUrl') }}</div>
@@ -2136,9 +2142,9 @@ onMounted(async () => {
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 sm:gap-6">
<div v-for="agent in otherAgents" :key="agent.id"
@click="navigateToChat(agent.id)"
class="card card-mobile-compact cursor-pointer relative group/card hover:-translate-y-1 hover:border-brand-200">
class="card card-mobile-compact cursor-pointer relative group/card hover:-translate-y-1 hover:border-brand-200 dark:hover:border-brand-600">
<div class="flex items-start justify-between mb-2 sm:mb-4">
<div class="w-8 h-8 sm:w-10 sm:h-10 bg-slate-50 rounded-xl flex items-center justify-center text-slate-500 group-hover/card:bg-brand-50 group-hover/card:text-brand-600 transition-colors">
<div class="w-8 h-8 sm:w-10 sm:h-10 bg-slate-50 dark:bg-slate-700/80 rounded-xl flex items-center justify-center text-slate-500 dark:text-slate-300 group-hover/card:bg-brand-50 group-hover/card:text-brand-600 dark:group-hover/card:bg-brand-500/15 dark:group-hover/card:text-brand-300 transition-colors">
<img v-if="agent.icon_url" :src="agent.icon_url" class="w-4 h-4 sm:w-6 sm:h-6" />
<Bot v-else class="w-4 h-4 sm:w-6 sm:h-6" />
</div>