mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-02 10:33:00 +08:00
* fix(shell): hide prompt options on desktop * fix(chat): group continuous same-tool runs more consistently Consecutive tool calls (Edit, Read, Grep, etc.) grouped inconsistently: - The group threshold was 3, so a run of only 2 calls stayed ungrouped while a run of 3 collapsed — making two back-to-back edits look different from three. - A run was broken by any interleaved message, including ones that render nothing (reasoning hidden when showThinking is off). Providers like Codex interleave hidden reasoning between tool calls, so visually continuous edits intermittently failed to group. Lower TOOL_GROUP_THRESHOLD to 2 and skip non-rendered messages when extending a run, so any 2+ consecutive same-tool calls collapse reliably. ChatMessagesPane now passes showThinking into groupConsecutiveTools. * fix(chat): stabilize message scroll controls * fix: update command menu positioning * fix(chat): refine load all overlay behavior * fix(chat): hide load all prompt after final page * fix(chat): remove auto scroll quick setting * fix(chat): unify messages and composer into centered column Constrain both ChatMessagesPane content and ChatComposer to the same max-w-3xl centered column. Previously only the composer had a max-width, causing messages to fill the full width while the input stayed narrow, making them visually misaligned with large empty gutters on either side. * style(ui): rework light/dark theme to make it visually consistent Rework the color system around warm neutrals and route hardcoded surfaces through theme tokens for consistency. - Theme tokens (index.css, ThemeContext): warm cream light mode and neutral charcoal dark mode, replacing the pure-white/blue-tinted palette; update PWA theme-color meta - Code blocks: soft grey background in light mode via oneLight/oneDark, and drop the Tailwind Typography <pre> shell that framed the highlighter in a dark box - Dropdowns/panels: convert CommandMenu, Quick Settings, and the JSON response block from hardcoded gray/slate to popover/muted/border tokens - Git panel: Publish button purple -> primary blue - Composer: drop top padding so the input sits flush with the thread * fix: use app theme for code editor * style(chat): unify composer toolbar heights and declutter slash-command modal - Composer: give the permission-mode and token-usage buttons a fixed h-8 so every bottom-toolbar control shares one height - CommandResultModal: replace the blue gradient header (gradient fill, glow blobs, blue eyebrow + icon chip) with a clean neutral header on popover/muted tokens * fix(chat): header ellipsis, Codex logo on light theme, portal copy menu - MainContentTitle: truncate the session title with an ellipsis instead of horizontal-scrolling it - MessageComponent: use text-foreground for the provider logo chip so the currentColor Codex/OpenAI mark is visible on the light theme - MessageCopyControl: render the copy-format dropdown in a portal so it escapes the chat message's `contain: paint` clip box; anchor it to the trigger, flip above near the viewport bottom, close on scroll/resize * style(mcp): remove purple accents and portal the server form modal - Replace the purple provider-button colors, heading icon, and form submit button with the primary token (no purple in the MCP UI) - Portal the add/edit MCP server modal to document.body so its fixed overlay covers the full viewport, fixing the white band at the top caused by the Settings dialog's transformed tab content becoming the containing block * style(ui): use Merriweather serif for chat text and Encode Sans for the rest of the UI * fix: align activity indicator with composer input width Wrap ActivityIndicator in the same mx-auto max-w-3xl container as the text input so the "Analyzing…" label and Stop button stay within the input's boundaries instead of spanning the full window width. * style: improve thinking and stop button placements * style(auth): modernize login, setup, and onboarding screens * fix(chat): correct invalid dark-mode hover on AskUserQuestion options * fix: remove unnecessary auto expand tools * fix: resolve coderabbit comments * fix(chat): widen chat layout and sidebar titles * fix(branding): update CloudCLI wordmark styling --------- Co-authored-by: Simos Mikelatos <simosmik@gmail.com>
242 lines
9.3 KiB
TypeScript
242 lines
9.3 KiB
TypeScript
import { useEffect, useMemo, useState } from 'react';
|
|
import { X } from 'lucide-react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import ProviderLoginModal from '../../provider-auth/view/ProviderLoginModal';
|
|
import { Button } from '../../../shared/view/ui';
|
|
import SettingsSidebar from '../view/SettingsSidebar';
|
|
import AgentsSettingsTab from '../view/tabs/agents-settings/AgentsSettingsTab';
|
|
import AppearanceSettingsTab from '../view/tabs/AppearanceSettingsTab';
|
|
import CredentialsSettingsTab from '../view/tabs/api-settings/CredentialsSettingsTab';
|
|
import VoiceSettingsTab from '../view/tabs/VoiceSettingsTab';
|
|
import GitSettingsTab from '../view/tabs/git-settings/GitSettingsTab';
|
|
import BrowserUseSettingsTab from '../view/tabs/browser-use-settings/BrowserUseSettingsTab';
|
|
import NotificationsSettingsTab from '../view/tabs/NotificationsSettingsTab';
|
|
import TasksSettingsTab from '../view/tabs/tasks-settings/TasksSettingsTab';
|
|
import PluginSettingsTab from '../../plugins/view/PluginSettingsTab';
|
|
import AboutTab from '../view/tabs/AboutTab';
|
|
import { useSettingsController } from '../hooks/useSettingsController';
|
|
import { useWebPush } from '../../../hooks/useWebPush';
|
|
import type { SettingsProps } from '../types/types';
|
|
|
|
type DesktopNotificationsState = {
|
|
enabled: boolean;
|
|
supported: boolean;
|
|
connectedCount?: number;
|
|
targetCount?: number;
|
|
lastError?: string | null;
|
|
};
|
|
|
|
function Settings({ isOpen, onClose, projects = [], initialTab = 'agents' }: SettingsProps) {
|
|
const { t } = useTranslation('settings');
|
|
const desktopNotificationsBridge = useMemo(() => (
|
|
typeof window === 'undefined'
|
|
? null
|
|
: ((window as any).cloudcliDesktopNotifications || null)
|
|
), []);
|
|
const [desktopNotificationsState, setDesktopNotificationsState] = useState<DesktopNotificationsState | null>(null);
|
|
const {
|
|
activeTab,
|
|
setActiveTab,
|
|
saveStatus,
|
|
projectSortOrder,
|
|
setProjectSortOrder,
|
|
codeEditorSettings,
|
|
updateCodeEditorSetting,
|
|
claudePermissions,
|
|
setClaudePermissions,
|
|
notificationPreferences,
|
|
setNotificationPreferences,
|
|
cursorPermissions,
|
|
setCursorPermissions,
|
|
codexPermissionMode,
|
|
setCodexPermissionMode,
|
|
providerAuthStatus,
|
|
geminiPermissionMode,
|
|
setGeminiPermissionMode,
|
|
openLoginForProvider,
|
|
showLoginModal,
|
|
setShowLoginModal,
|
|
loginProvider,
|
|
handleLoginComplete,
|
|
} = useSettingsController({
|
|
isOpen,
|
|
initialTab
|
|
});
|
|
|
|
const {
|
|
permission: pushPermission,
|
|
isSubscribed: isPushSubscribed,
|
|
isLoading: isPushLoading,
|
|
subscribe: pushSubscribe,
|
|
unsubscribe: pushUnsubscribe,
|
|
} = useWebPush();
|
|
|
|
const handleEnablePush = async () => {
|
|
await pushSubscribe();
|
|
// Server sets webPush: true in preferences on subscribe; sync local state
|
|
setNotificationPreferences({
|
|
...notificationPreferences,
|
|
channels: { ...notificationPreferences.channels, webPush: true },
|
|
});
|
|
};
|
|
|
|
const handleDisablePush = async () => {
|
|
await pushUnsubscribe();
|
|
// Server sets webPush: false in preferences on unsubscribe; sync local state
|
|
setNotificationPreferences({
|
|
...notificationPreferences,
|
|
channels: { ...notificationPreferences.channels, webPush: false },
|
|
});
|
|
};
|
|
|
|
useEffect(() => {
|
|
if (!desktopNotificationsBridge) return undefined;
|
|
let mounted = true;
|
|
desktopNotificationsBridge.getState().then((state: any) => {
|
|
if (mounted) {
|
|
setDesktopNotificationsState(state?.desktopNotifications || null);
|
|
}
|
|
}).catch(() => {});
|
|
const unsubscribe = desktopNotificationsBridge.onStateUpdated?.((state: any) => {
|
|
if (mounted) {
|
|
setDesktopNotificationsState(state?.desktopNotifications || null);
|
|
}
|
|
});
|
|
return () => {
|
|
mounted = false;
|
|
unsubscribe?.();
|
|
};
|
|
}, [desktopNotificationsBridge]);
|
|
|
|
const handleEnableDesktopNotifications = async () => {
|
|
if (!desktopNotificationsBridge) return;
|
|
const state = await desktopNotificationsBridge.update({ enabled: true });
|
|
setDesktopNotificationsState(state?.desktopNotifications || null);
|
|
setNotificationPreferences({
|
|
...notificationPreferences,
|
|
channels: { ...notificationPreferences.channels, desktop: true },
|
|
});
|
|
};
|
|
|
|
const handleDisableDesktopNotifications = async () => {
|
|
if (!desktopNotificationsBridge) return;
|
|
const state = await desktopNotificationsBridge.update({ enabled: false });
|
|
setDesktopNotificationsState(state?.desktopNotifications || null);
|
|
setNotificationPreferences({
|
|
...notificationPreferences,
|
|
channels: { ...notificationPreferences.channels, desktop: false },
|
|
});
|
|
};
|
|
|
|
if (!isOpen) {
|
|
return null;
|
|
}
|
|
|
|
const isAuthenticated = Boolean(loginProvider && providerAuthStatus[loginProvider].authenticated);
|
|
|
|
return (
|
|
<div className="modal-backdrop fixed inset-0 z-[9999] flex items-center justify-center bg-background/80 backdrop-blur-sm md:p-4">
|
|
<div className="flex h-full w-full flex-col overflow-hidden border border-border bg-background shadow-2xl md:h-[90vh] md:max-w-4xl md:rounded-xl">
|
|
{/* Header */}
|
|
<div className="flex flex-shrink-0 items-center justify-between border-b border-border px-4 py-3 md:px-5">
|
|
<h2 className="text-base font-semibold text-foreground">{t('title')}</h2>
|
|
<div className="flex items-center gap-2">
|
|
{saveStatus === 'success' && (
|
|
<span className="animate-in fade-in text-xs text-muted-foreground">{t('saveStatus.success')}</span>
|
|
)}
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={onClose}
|
|
className="h-10 w-10 touch-manipulation p-0 text-muted-foreground hover:text-foreground active:bg-accent/50"
|
|
>
|
|
<X className="h-5 w-5" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Body: sidebar + content */}
|
|
<div className="flex min-h-0 min-w-0 flex-1 flex-col md:flex-row">
|
|
<SettingsSidebar activeTab={activeTab} onChange={setActiveTab} />
|
|
|
|
{/* Content */}
|
|
<main className="min-w-0 flex-1 overflow-y-auto overflow-x-hidden">
|
|
<div key={activeTab} className="settings-content-enter min-w-0 space-y-6 overflow-x-hidden p-4 pb-safe-area-inset-bottom md:space-y-8 md:p-6">
|
|
{activeTab === 'appearance' && (
|
|
<AppearanceSettingsTab
|
|
projectSortOrder={projectSortOrder}
|
|
onProjectSortOrderChange={setProjectSortOrder}
|
|
codeEditorSettings={codeEditorSettings}
|
|
onCodeEditorWordWrapChange={(value) => updateCodeEditorSetting('wordWrap', value)}
|
|
onCodeEditorShowMinimapChange={(value) => updateCodeEditorSetting('showMinimap', value)}
|
|
onCodeEditorLineNumbersChange={(value) => updateCodeEditorSetting('lineNumbers', value)}
|
|
onCodeEditorFontSizeChange={(value) => updateCodeEditorSetting('fontSize', value)}
|
|
/>
|
|
)}
|
|
|
|
{activeTab === 'git' && <GitSettingsTab />}
|
|
|
|
{activeTab === 'agents' && (
|
|
<AgentsSettingsTab
|
|
providerAuthStatus={providerAuthStatus}
|
|
onProviderLogin={openLoginForProvider}
|
|
claudePermissions={claudePermissions}
|
|
onClaudePermissionsChange={setClaudePermissions}
|
|
cursorPermissions={cursorPermissions}
|
|
onCursorPermissionsChange={setCursorPermissions}
|
|
codexPermissionMode={codexPermissionMode}
|
|
onCodexPermissionModeChange={setCodexPermissionMode}
|
|
geminiPermissionMode={geminiPermissionMode}
|
|
onGeminiPermissionModeChange={setGeminiPermissionMode}
|
|
projects={projects}
|
|
/>
|
|
)}
|
|
|
|
{activeTab === 'tasks' && <TasksSettingsTab />}
|
|
|
|
{activeTab === 'browser' && <BrowserUseSettingsTab />}
|
|
|
|
{activeTab === 'notifications' && (
|
|
<NotificationsSettingsTab
|
|
notificationPreferences={notificationPreferences}
|
|
onNotificationPreferencesChange={setNotificationPreferences}
|
|
pushPermission={pushPermission}
|
|
isPushSubscribed={isPushSubscribed}
|
|
isPushLoading={isPushLoading}
|
|
onEnablePush={handleEnablePush}
|
|
onDisablePush={handleDisablePush}
|
|
isDesktop={Boolean(desktopNotificationsBridge)}
|
|
desktopNotifications={desktopNotificationsState}
|
|
onEnableDesktopNotifications={handleEnableDesktopNotifications}
|
|
onDisableDesktopNotifications={handleDisableDesktopNotifications}
|
|
/>
|
|
)}
|
|
|
|
{activeTab === 'api' && <CredentialsSettingsTab />}
|
|
|
|
{activeTab === 'voice' && <VoiceSettingsTab />}
|
|
|
|
{activeTab === 'plugins' && <PluginSettingsTab />}
|
|
|
|
{activeTab === 'about' && <AboutTab />}
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<ProviderLoginModal
|
|
key={loginProvider || 'claude'}
|
|
isOpen={showLoginModal}
|
|
onClose={() => setShowLoginModal(false)}
|
|
provider={loginProvider || 'claude'}
|
|
onComplete={handleLoginComplete}
|
|
isAuthenticated={isAuthenticated}
|
|
/>
|
|
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default Settings;
|