Use base-ui's transition-status pattern (data-starting-style / data-ending-style) for Dialog, DropdownMenu, Select, Tooltip and Popover so open/close animate consistently at 150ms ease-out without flicker. Wrap dialog popups in a centered flex container so the scale animation no longer fights with translate-based positioning, and switch PendingChangesBar to a real Popover so it actually animates closed. Convert ScheduledTaskEditorDialog from raw Radix to the shared Dialog wrapper, give ScheduledTasksDialog a stable min-height to prevent layout shift mid-animation, and reset NewWorktreeDialog form state on open instead of close so fields don't empty during the close transition. Drop tooltip delay from 700ms to 300ms globally and remove all per-component overrides except the model/variant/agent selectors in the chat input (600ms).
69 lines
2.2 KiB
TypeScript
69 lines
2.2 KiB
TypeScript
import React from 'react';
|
|
import { Dialog } from '@base-ui/react/dialog';
|
|
import { cn } from '@/lib/utils';
|
|
import { useI18n } from '@/lib/i18n';
|
|
import { SettingsView } from './SettingsView';
|
|
|
|
interface SettingsWindowProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
}
|
|
|
|
/**
|
|
* Settings rendered as a centered window with blurred backdrop.
|
|
* Used for desktop and web (non-mobile) environments.
|
|
*/
|
|
export const SettingsWindow: React.FC<SettingsWindowProps> = ({ open, onOpenChange }) => {
|
|
const { t } = useI18n();
|
|
const descriptionId = React.useId();
|
|
|
|
const hasOpenFloatingMenu = React.useCallback(() => {
|
|
if (typeof document === 'undefined') {
|
|
return false;
|
|
}
|
|
|
|
return Boolean(
|
|
document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]')
|
|
);
|
|
}, []);
|
|
|
|
return (
|
|
<Dialog.Root
|
|
open={open}
|
|
onOpenChange={(next) => {
|
|
if (!next && hasOpenFloatingMenu()) return;
|
|
onOpenChange(next);
|
|
}}
|
|
>
|
|
<Dialog.Portal>
|
|
<Dialog.Backdrop
|
|
className={cn(
|
|
'fixed inset-0 z-50 bg-black/50 dark:bg-black/75',
|
|
'transition-opacity duration-150 ease-out',
|
|
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0',
|
|
)}
|
|
/>
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center pointer-events-none">
|
|
<Dialog.Popup
|
|
aria-describedby={descriptionId}
|
|
className={cn(
|
|
'relative pointer-events-auto',
|
|
'w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]',
|
|
'rounded-xl border shadow-none overflow-hidden origin-center',
|
|
'bg-background',
|
|
'transition-all duration-150 ease-out',
|
|
'data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]',
|
|
'data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]',
|
|
)}
|
|
>
|
|
<Dialog.Description id={descriptionId} className="sr-only">
|
|
{t('settings.window.description')}
|
|
</Dialog.Description>
|
|
<SettingsView onClose={() => onOpenChange(false)} isWindowed />
|
|
</Dialog.Popup>
|
|
</div>
|
|
</Dialog.Portal>
|
|
</Dialog.Root>
|
|
);
|
|
};
|