diff --git a/components/chatflow/chatflow-execution-bar.tsx b/components/chatflow/chatflow-execution-bar.tsx index 6e4d9d06..1e38e57d 100644 --- a/components/chatflow/chatflow-execution-bar.tsx +++ b/components/chatflow/chatflow-execution-bar.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useTheme } from '@lib/hooks/use-theme'; import type { ChatflowNode, ChatflowParallelBranch, @@ -42,7 +41,6 @@ export function ChatflowExecutionBar({ index, delay = 0, }: ChatflowExecutionBarProps) { - const { isDark } = useTheme(); const t = useTranslations('pages.chatflow.executionBar'); const [isVisible, setIsVisible] = useState(false); const [elapsedTime, setElapsedTime] = useState(0); @@ -113,17 +111,14 @@ export function ChatflowExecutionBar({ ); case 'completed': return ( ); case 'failed': @@ -131,19 +126,13 @@ export function ChatflowExecutionBar({ case 'pending': return ( ); default: return ( ); } @@ -247,7 +236,7 @@ export function ChatflowExecutionBar({ // Use new indicator bar style node.isInIteration ? 'iteration-node' : 'loop-node', // Slight background color distinction - isDark ? 'bg-stone-800/20' : 'bg-stone-50/40' + 'bg-stone-50/40 dark:bg-stone-800/20' ) : ''; @@ -257,37 +246,27 @@ export function ChatflowExecutionBar({ case 'running': return cn( combinedBaseStyles, - isDark - ? 'border-stone-600 bg-stone-700/50 shadow-lg shadow-stone-900/30' - : 'border-stone-300 bg-stone-200/50 shadow-lg shadow-stone-200/50' + 'border-stone-300 bg-stone-200/50 shadow-lg shadow-stone-200/50 dark:border-stone-600 dark:bg-stone-700/50 dark:shadow-lg dark:shadow-stone-900/30' ); case 'completed': return cn( combinedBaseStyles, - isDark - ? 'border-stone-500 bg-stone-600/30' - : 'border-stone-300 bg-stone-100' + 'border-stone-300 bg-stone-100 dark:border-stone-500 dark:bg-stone-600/30' ); case 'failed': return cn( combinedBaseStyles, - isDark - ? 'border-red-700/50 bg-red-900/20' - : 'border-red-200 bg-red-50' + 'border-red-200 bg-red-50 dark:border-red-700/50 dark:bg-red-900/20' ); case 'pending': return cn( combinedBaseStyles, - isDark - ? 'border-stone-700/50 bg-stone-800/50' - : 'border-stone-200 bg-stone-50' + 'border-stone-200 bg-stone-50 dark:border-stone-700/50 dark:bg-stone-800/50' ); default: return cn( combinedBaseStyles, - isDark - ? 'border-stone-700/50 bg-stone-800/50' - : 'border-stone-200 bg-stone-50' + 'border-stone-200 bg-stone-50 dark:border-stone-700/50 dark:bg-stone-800/50' ); } }; @@ -324,7 +303,7 @@ export function ChatflowExecutionBar({ {getNodeTitle()} @@ -337,7 +316,7 @@ export function ChatflowExecutionBar({ {(node.currentIteration || 0) + 1}/{node.totalIterations} @@ -347,7 +326,7 @@ export function ChatflowExecutionBar({ {node.completedBranches || 0}/{node.totalBranches} @@ -357,7 +336,7 @@ export function ChatflowExecutionBar({ {node.maxLoops @@ -372,23 +351,15 @@ export function ChatflowExecutionBar({ node.status === 'running' ? cn( // Base style - isDark - ? 'bg-stone-600/40 text-stone-200' - : 'bg-stone-300/60 text-stone-700', + 'bg-stone-300/60 text-stone-700 dark:bg-stone-600/40 dark:text-stone-200', // Subtle pulse effect 'animate-pulse' ) : node.status === 'completed' - ? isDark - ? 'bg-stone-500/40 text-stone-100' - : 'bg-stone-200 text-stone-800' + ? 'bg-stone-200 text-stone-800 dark:bg-stone-500/40 dark:text-stone-100' : node.status === 'failed' - ? isDark - ? 'bg-red-700/30 text-red-200' - : 'bg-red-100 text-red-700' - : isDark - ? 'bg-stone-700/50 text-stone-400' - : 'bg-stone-200/80 text-stone-600' + ? 'bg-red-100 text-red-700 dark:bg-red-700/30 dark:text-red-200' + : 'bg-stone-200/80 text-stone-600 dark:bg-stone-700/50 dark:text-stone-400' )} > {getStatusText()} @@ -404,7 +375,7 @@ export function ChatflowExecutionBar({
{formatTime(elapsedTime)} @@ -435,7 +406,6 @@ export function ChatflowExecutionBar({ current={node.completedBranches || 0} total={node.totalBranches} type="branch" - isDark={isDark} />
)} @@ -443,11 +413,7 @@ export function ChatflowExecutionBar({ {/* Branch list */}
{node.parallelBranches?.map(branch => ( - + ))}
@@ -485,10 +451,9 @@ function CollapsibleContent({ // --- 🎯 New: parallel branch item component --- interface ParallelBranchItemProps { branch: ChatflowParallelBranch; - isDark: boolean; } -function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) { +function ParallelBranchItem({ branch }: ParallelBranchItemProps) { const t = useTranslations('pages.chatflow.executionBar'); const [elapsedTime, setElapsedTime] = useState(0); @@ -531,13 +496,13 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) { className={cn( 'ml-4 flex items-center gap-2 rounded-md border-l-2 px-3 py-2 font-serif', branch.status === 'running' && - cn('border-l-stone-400', isDark ? 'bg-stone-800/20' : 'bg-stone-100'), + cn('border-l-stone-400', 'bg-stone-100 dark:bg-stone-800/20'), branch.status === 'completed' && - cn('border-l-stone-500', isDark ? 'bg-stone-700/20' : 'bg-stone-50'), + cn('border-l-stone-500', 'bg-stone-50 dark:bg-stone-700/20'), branch.status === 'failed' && - cn('border-l-red-500', isDark ? 'bg-red-900/20' : 'bg-red-50'), + cn('border-l-red-500', 'bg-red-50 dark:bg-red-900/20'), branch.status === 'pending' && - cn('border-l-stone-300', isDark ? 'bg-stone-800/20' : 'bg-stone-50') + cn('border-l-stone-300', 'bg-stone-50 dark:bg-stone-800/20') )} >
@@ -550,17 +515,12 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) { {t('branch.label')} {String.fromCharCode(65 + branch.index)} - + {branch.description || t('status.executing_')}
@@ -573,7 +533,7 @@ function ParallelBranchItem({ branch, isDark }: ParallelBranchItemProps) { {formatTime(elapsedTime)} @@ -589,10 +549,9 @@ interface ProgressBarProps { current: number; total: number; type: 'iteration' | 'branch'; - isDark: boolean; } -function ProgressBar({ current, total, type, isDark }: ProgressBarProps) { +function ProgressBar({ current, total, type }: ProgressBarProps) { const t = useTranslations('pages.chatflow.executionBar'); const percentage = total > 0 ? (current / total) * 100 : 0; @@ -602,7 +561,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) { {type === 'iteration' @@ -612,7 +571,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) { {current}/{total} @@ -622,7 +581,7 @@ function ProgressBar({ current, total, type, isDark }: ProgressBarProps) {
diff --git a/components/chatflow/chatflow-input-area.tsx b/components/chatflow/chatflow-input-area.tsx index 459a5fe2..4f32cf81 100644 --- a/components/chatflow/chatflow-input-area.tsx +++ b/components/chatflow/chatflow-input-area.tsx @@ -5,7 +5,6 @@ import { FormField } from '@components/workflow/workflow-input-form/form-field'; import { validateFormData } from '@components/workflow/workflow-input-form/validation'; import { useChatWidth } from '@lib/hooks/use-chat-width'; import { useCurrentApp } from '@lib/hooks/use-current-app'; -import { useThemeColors } from '@lib/hooks/use-theme-colors'; import type { DifyUserInputFormItem } from '@lib/services/dify/types'; import { cn } from '@lib/utils'; import { Loader2, RotateCcw, Send, Workflow } from 'lucide-react'; @@ -44,7 +43,6 @@ export function ChatflowInputArea({ className, onFormConfigChange, }: ChatflowInputAreaProps) { - const { isDark } = useThemeColors(); const { widthClass, paddingClass } = useChatWidth(); const { currentAppInstance } = useCurrentApp(); const t = useTranslations('pages.chatflow'); @@ -308,13 +306,13 @@ export function ChatflowInputArea({

{t('loading.inputConfig')} @@ -340,16 +338,14 @@ export function ChatflowInputArea({ className={cn( 'mx-auto max-w-2xl', 'rounded-2xl shadow-xl backdrop-blur-xl transition-all duration-300', - isDark - ? 'border border-stone-700/60 bg-gradient-to-br from-stone-900/95 to-stone-800/95 shadow-stone-900/40 hover:shadow-stone-900/60' - : 'border border-stone-200/60 bg-gradient-to-br from-white/95 to-stone-50/95 shadow-stone-200/40 hover:shadow-2xl hover:shadow-stone-300/50' + 'border border-stone-200/60 bg-gradient-to-br from-white/95 to-stone-50/95 shadow-stone-200/40 hover:shadow-2xl hover:shadow-stone-300/50 dark:border-stone-700/60 dark:bg-gradient-to-br dark:from-stone-900/95 dark:to-stone-800/95 dark:shadow-stone-900/40 dark:hover:shadow-stone-900/60' )} > {/* --- Form header --- */}

@@ -357,16 +353,11 @@ export function ChatflowInputArea({ className={cn( 'inline-flex h-16 w-16 items-center justify-center rounded-2xl', 'shadow-lg', - isDark - ? 'border border-stone-600/50 bg-gradient-to-br from-stone-800 to-stone-700 shadow-stone-900/50' - : 'border border-stone-300/50 bg-gradient-to-br from-stone-100 to-stone-200 shadow-stone-200/50' + 'border border-stone-300/50 bg-gradient-to-br from-stone-100 to-stone-200 shadow-stone-200/50 dark:border-stone-600/50 dark:bg-gradient-to-br dark:from-stone-800 dark:to-stone-700 dark:shadow-stone-900/50' )} >
@@ -374,7 +365,7 @@ export function ChatflowInputArea({

{currentAppInstance?.display_name || t('form.defaultAppName')} @@ -382,7 +373,7 @@ export function ChatflowInputArea({

{currentAppInstance?.description || @@ -406,7 +397,7 @@ export function ChatflowInputArea({

@@ -459,15 +448,13 @@ export function ChatflowInputArea({
{t('form.additionalInfo')} @@ -475,7 +462,7 @@ export function ChatflowInputArea({
@@ -495,18 +482,14 @@ export function ChatflowInputArea({ key={`${fieldConfig.variable}-${index}`} className={cn( 'group relative rounded-xl p-6 transition-all duration-300', - isDark - ? 'border border-stone-600/60 bg-gradient-to-br from-stone-800/80 to-stone-700/80 hover:border-stone-500 hover:shadow-lg hover:shadow-stone-900/50' - : 'border border-stone-200/60 bg-gradient-to-br from-stone-50/80 to-white/80 hover:border-stone-300 hover:shadow-lg hover:shadow-stone-200/50' + 'border border-stone-200/60 bg-gradient-to-br from-stone-50/80 to-white/80 hover:border-stone-300 hover:shadow-lg hover:shadow-stone-200/50 dark:border-stone-600/60 dark:bg-gradient-to-br dark:from-stone-800/80 dark:to-stone-700/80 dark:hover:border-stone-500 dark:hover:shadow-lg dark:hover:shadow-stone-900/50' )} > {/* Field decoration line */}
@@ -552,7 +535,7 @@ export function ChatflowInputArea({
@@ -571,9 +554,7 @@ export function ChatflowInputArea({ className={cn( 'flex items-center justify-center gap-3 rounded-xl px-6 py-3', 'border-2 font-serif text-sm font-medium backdrop-blur-sm transition-all duration-300', - isDark - ? 'border-stone-600 bg-stone-800/80 text-stone-300' - : 'border-stone-300 bg-white/80 text-stone-700', + 'border-stone-300 bg-white/80 text-stone-700 dark:border-stone-600 dark:bg-stone-800/80 dark:text-stone-300', isProcessing || isWaiting || (!query && @@ -583,9 +564,7 @@ export function ChatflowInputArea({ ? 'cursor-not-allowed opacity-50' : cn( 'transform active:scale-[0.98]', - isDark - ? 'hover:border-stone-500 hover:bg-stone-700 hover:shadow-lg hover:shadow-stone-900/50' - : 'hover:border-stone-400 hover:bg-stone-50 hover:shadow-lg hover:shadow-stone-200/50' + 'hover:border-stone-400 hover:bg-stone-50 hover:shadow-lg hover:shadow-stone-200/50 dark:hover:border-stone-500 dark:hover:bg-stone-700 dark:hover:shadow-lg dark:hover:shadow-stone-900/50' ) )} > @@ -600,16 +579,12 @@ export function ChatflowInputArea({ className={cn( 'flex flex-1 items-center justify-center gap-3 rounded-xl px-8 py-4', 'font-serif text-base font-semibold text-white shadow-lg transition-all duration-300', - isDark - ? 'bg-gradient-to-r from-stone-700 to-stone-600 shadow-stone-900/50' - : 'bg-gradient-to-r from-stone-800 to-stone-700 shadow-stone-800/25', + 'bg-gradient-to-r from-stone-800 to-stone-700 shadow-stone-800/25 dark:bg-gradient-to-r dark:from-stone-700 dark:to-stone-600 dark:shadow-stone-900/50', isProcessing || isWaiting || !canSubmit() ? 'cursor-not-allowed opacity-50' : cn( 'transform hover:scale-[1.02] active:scale-[0.98]', - isDark - ? 'hover:from-stone-600 hover:to-stone-500 hover:shadow-xl hover:shadow-stone-900/60' - : 'hover:from-stone-700 hover:to-stone-600 hover:shadow-xl hover:shadow-stone-800/30' + 'hover:from-stone-700 hover:to-stone-600 hover:shadow-xl hover:shadow-stone-800/30 dark:hover:from-stone-600 dark:hover:to-stone-500 dark:hover:shadow-xl dark:hover:shadow-stone-900/60' ) )} > @@ -632,9 +607,7 @@ export function ChatflowInputArea({
@@ -642,7 +615,7 @@ export function ChatflowInputArea({

{t('form.checkAndCorrectErrors')} diff --git a/components/chatflow/chatflow-node-tracker.tsx b/components/chatflow/chatflow-node-tracker.tsx index d3b72a27..9e3a425d 100644 --- a/components/chatflow/chatflow-node-tracker.tsx +++ b/components/chatflow/chatflow-node-tracker.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useTheme } from '@lib/hooks/use-theme'; import { useChatflowExecutionStore } from '@lib/stores/chatflow-execution-store'; import { cn } from '@lib/utils'; import { Loader2, Workflow } from 'lucide-react'; @@ -30,7 +29,6 @@ export function ChatflowNodeTracker({ isVisible, className, }: ChatflowNodeTrackerProps) { - const { isDark } = useTheme(); const t = useTranslations('pages.chatflow.nodeTracker'); // Get node status from store @@ -114,28 +112,23 @@ export function ChatflowNodeTracker({ 'space-y-3 rounded-lg border p-4', // Limit actual width to avoid conflict with chat content 'max-w-[320px] min-w-[280px]', - isDark - ? 'border-stone-700/50 bg-stone-800/50 backdrop-blur-sm' - : 'border-stone-200 bg-white/80 backdrop-blur-sm' + 'border-stone-200 bg-white/80 backdrop-blur-sm dark:border-stone-700/50 dark:bg-stone-800/50' )} > {/* Title bar */}

{t('title')} @@ -151,23 +144,21 @@ export function ChatflowNodeTracker({
{isExecuting ? ( ) : ( )} @@ -175,7 +166,7 @@ export function ChatflowNodeTracker({
{isExecuting ? t('starting') : t('noRecords')} @@ -183,7 +174,7 @@ export function ChatflowNodeTracker({
{isExecuting ? t('waitingUpdate') : t('showProgress')} @@ -208,9 +199,7 @@ export function ChatflowNodeTracker({
diff --git a/components/file-preview/previews/audio-preview.tsx b/components/file-preview/previews/audio-preview.tsx index 9ed2eff2..39d2a055 100644 --- a/components/file-preview/previews/audio-preview.tsx +++ b/components/file-preview/previews/audio-preview.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useTheme } from '@lib/hooks'; import { cn, formatBytes } from '@lib/utils'; import { DownloadIcon, MusicIcon } from 'lucide-react'; @@ -19,7 +18,6 @@ export const AudioPreview: React.FC = ({ filename, onDownload, }) => { - const { isDark } = useTheme(); const t = useTranslations('filePreview'); const audioRef = useRef(null); const [audioUrl, setAudioUrl] = useState(''); @@ -64,9 +62,7 @@ export const AudioPreview: React.FC = ({ onClick={onDownload} className={cn( 'inline-flex items-center space-x-2 rounded-md px-4 py-2 text-sm font-medium transition-colors', - isDark - ? 'bg-stone-700 text-stone-200 hover:bg-stone-600' - : 'bg-stone-200 text-stone-800 hover:bg-stone-300' + 'bg-stone-200 text-stone-800 hover:bg-stone-300 dark:bg-stone-700 dark:text-stone-200 dark:hover:bg-stone-600' )} > @@ -78,24 +74,19 @@ export const AudioPreview: React.FC = ({
{/* Filename Display */}

@@ -103,10 +94,7 @@ export const AudioPreview: React.FC = ({

{duration > 0 && (

{formatTime(duration)}

@@ -120,10 +108,7 @@ export const AudioPreview: React.FC = ({
{t('loading')} @@ -134,12 +119,7 @@ export const AudioPreview: React.FC = ({ {/* Error State */} {hasError && (
-

+

{t('audio.loadError')}

@@ -165,9 +145,7 @@ export const AudioPreview: React.FC = ({
diff --git a/components/file-preview/previews/image-preview.tsx b/components/file-preview/previews/image-preview.tsx index a4ba2201..aa61a7d7 100644 --- a/components/file-preview/previews/image-preview.tsx +++ b/components/file-preview/previews/image-preview.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useTheme } from '@lib/hooks'; import { cn } from '@lib/utils'; import { DownloadIcon, ImageIcon } from 'lucide-react'; @@ -19,7 +18,6 @@ export const ImagePreview: React.FC = ({ filename, onDownload, }) => { - const { isDark } = useTheme(); const t = useTranslations('filePreview.imagePreview'); const [imageUrl, setImageUrl] = useState(''); const [isLoading, setIsLoading] = useState(true); @@ -51,17 +49,14 @@ export const ImagePreview: React.FC = ({

{t('title')}

@@ -73,10 +68,7 @@ export const ImagePreview: React.FC = ({

{t('title')}

@@ -84,9 +76,7 @@ export const ImagePreview: React.FC = ({ onClick={onDownload} className={cn( 'inline-flex items-center space-x-2 rounded-md px-3 py-1.5 text-sm font-medium transition-colors', - isDark - ? 'bg-stone-700 text-stone-200 hover:bg-stone-600' - : 'bg-stone-200 text-stone-800 hover:bg-stone-300' + 'bg-stone-200 text-stone-800 hover:bg-stone-300 dark:bg-stone-700 dark:text-stone-200 dark:hover:bg-stone-600' )} > @@ -97,16 +87,14 @@ export const ImagePreview: React.FC = ({
{hasError ? (
@@ -115,7 +103,7 @@ export const ImagePreview: React.FC = ({ onClick={onDownload} className={cn( 'text-sm underline hover:no-underline', - isDark ? 'text-stone-300' : 'text-stone-700' + 'text-stone-700 dark:text-stone-300' )} > {t('downloadToView')} @@ -137,9 +125,7 @@ export const ImagePreview: React.FC = ({
diff --git a/components/file-preview/previews/markdown-preview.tsx b/components/file-preview/previews/markdown-preview.tsx index 4e8ed871..eefcc0ad 100644 --- a/components/file-preview/previews/markdown-preview.tsx +++ b/components/file-preview/previews/markdown-preview.tsx @@ -1,6 +1,5 @@ 'use client'; -import { useTheme } from '@lib/hooks'; import { cn } from '@lib/utils'; import { CodeIcon, DownloadIcon, EyeIcon } from 'lucide-react'; @@ -19,7 +18,6 @@ export const MarkdownPreview: React.FC = ({ filename, onDownload, }) => { - const { isDark } = useTheme(); const t = useTranslations('filePreview.markdownPreview'); const [markdown, setMarkdown] = useState(''); const [isLoading, setIsLoading] = useState(true); @@ -43,23 +41,12 @@ export const MarkdownPreview: React.FC = ({ if (isLoading) { return (
+
-
); @@ -95,7 +82,7 @@ export const MarkdownPreview: React.FC = ({