mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-05 02:18:57 +00:00
fix(ui): constrain bounded code editor scroll viewports
This commit is contained in:
@@ -234,8 +234,8 @@ export function ProviderEditor({
|
|||||||
<span className="ml-3 text-muted-foreground">Loading settings...</span>
|
<span className="ml-3 text-muted-foreground">Loading settings...</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden">
|
<div className="min-h-0 flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden">
|
||||||
<div className="flex flex-col overflow-hidden bg-muted/5">
|
<div className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-muted/5">
|
||||||
<Tabs defaultValue="config" className="h-full flex flex-col">
|
<Tabs defaultValue="config" className="h-full flex flex-col">
|
||||||
<div className="px-4 pt-4 shrink-0">
|
<div className="px-4 pt-4 shrink-0">
|
||||||
<TabsList className="w-full">
|
<TabsList className="w-full">
|
||||||
@@ -303,7 +303,7 @@ export function ProviderEditor({
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col overflow-hidden">
|
<div className="flex min-h-0 min-w-0 flex-col overflow-hidden">
|
||||||
<div className="px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]">
|
<div className="px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]">
|
||||||
<Code2 className="w-4 h-4 text-muted-foreground" />
|
<Code2 className="w-4 h-4 text-muted-foreground" />
|
||||||
<span className="text-sm font-medium text-muted-foreground">
|
<span className="text-sm font-medium text-muted-foreground">
|
||||||
|
|||||||
@@ -226,8 +226,8 @@ export function ProfileEditor({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden">
|
<div className="min-h-0 flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden">
|
||||||
<div className="flex flex-col overflow-hidden bg-muted/5 min-w-0">
|
<div className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-muted/5">
|
||||||
<FriendlyUISection
|
<FriendlyUISection
|
||||||
profileName={profileName}
|
profileName={profileName}
|
||||||
target={resolvedTarget}
|
target={resolvedTarget}
|
||||||
@@ -242,7 +242,7 @@ export function ProfileEditor({
|
|||||||
onAddEnvVar={addNewEnvVar}
|
onAddEnvVar={addNewEnvVar}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col overflow-hidden">
|
<div className="flex min-h-0 min-w-0 flex-col overflow-hidden">
|
||||||
<div className="px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]">
|
<div className="px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]">
|
||||||
<Code2 className="w-4 h-4 text-muted-foreground" />
|
<Code2 className="w-4 h-4 text-muted-foreground" />
|
||||||
<span className="text-sm font-medium text-muted-foreground">
|
<span className="text-sm font-medium text-muted-foreground">
|
||||||
|
|||||||
@@ -156,12 +156,16 @@ export function CodeEditor({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex min-h-0 flex-col', className)}>
|
<div
|
||||||
|
className={cn('flex min-h-0 flex-col', isFillParent && 'h-full', className)}
|
||||||
|
style={isFillParent ? { height: minHeight === 'auto' ? undefined : minHeight } : undefined}
|
||||||
|
>
|
||||||
{/* Editor container */}
|
{/* Editor container */}
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'relative rounded-md border overflow-hidden',
|
'relative rounded-md border overflow-hidden',
|
||||||
'bg-muted/30',
|
'bg-muted/30',
|
||||||
|
isFillParent && 'flex min-h-0 flex-1 flex-col',
|
||||||
isFocused && 'ring-2 ring-ring ring-offset-2 ring-offset-background',
|
isFocused && 'ring-2 ring-ring ring-offset-2 ring-offset-background',
|
||||||
readonly && 'opacity-70 cursor-not-allowed',
|
readonly && 'opacity-70 cursor-not-allowed',
|
||||||
!validation.valid && 'border-destructive'
|
!validation.valid && 'border-destructive'
|
||||||
@@ -169,8 +173,7 @@ export function CodeEditor({
|
|||||||
data-slot="code-editor-surface"
|
data-slot="code-editor-surface"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={cn(isFillParent && 'min-h-0 overflow-auto')}
|
className={cn(isFillParent && 'scrollbar-editor min-h-0 flex-1 overflow-auto')}
|
||||||
style={isFillParent ? { height: minHeight === 'auto' ? '100%' : minHeight } : undefined}
|
|
||||||
data-slot={isFillParent ? 'code-editor-viewport' : undefined}
|
data-slot={isFillParent ? 'code-editor-viewport' : undefined}
|
||||||
>
|
>
|
||||||
<Editor
|
<Editor
|
||||||
|
|||||||
@@ -342,3 +342,35 @@
|
|||||||
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
|
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
|
||||||
background: var(--muted-foreground);
|
background: var(--muted-foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor {
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: var(--border) transparent;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--border);
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 9999px;
|
||||||
|
background-clip: content-box;
|
||||||
|
min-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: var(--muted-foreground);
|
||||||
|
background-clip: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-editor::-webkit-scrollbar-corner {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ export function ApiPage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-1 flex flex-col min-w-0 overflow-hidden">
|
<div className="flex min-h-0 flex-1 flex-col min-w-0 overflow-hidden">
|
||||||
{selectedProfileData ? (
|
{selectedProfileData ? (
|
||||||
<>
|
<>
|
||||||
<div className="px-4 py-2 border-b bg-background flex items-center justify-end gap-2">
|
<div className="px-4 py-2 border-b bg-background flex items-center justify-end gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user