Skip to content

Commit e8f2745

Browse files
committed
Refactor NewAgentSheet and VariableTable components for improved UI and cleanup
- Simplified body style resets in NewAgentSheet when the sheet closes, removing unnecessary timeout logic. - Enhanced VariableTable by commenting out error toast for better error handling and cleaning up JSX for consistency. - Updated className attributes for better readability and structure in VariableTable.
1 parent aa0f2b5 commit e8f2745

File tree

3 files changed

+20
-45
lines changed

3 files changed

+20
-45
lines changed

webapp/src/components/agents/NewAgentSheet.tsx

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -517,29 +517,10 @@ export const AgentSheet = ({
517517
setAllowDelegation(false);
518518
setVerbose(false);
519519

520-
// Force reset pointer events and cursor with delay
521-
setTimeout(() => {
522-
// Force reset pointer events if they're blocked
523-
if (document.body.style.pointerEvents === 'none') {
524-
document.body.style.pointerEvents = 'auto';
525-
}
526-
527-
// Force reset overflow if it's hidden
528-
if (document.body.style.overflow === 'hidden') {
529-
document.body.style.overflow = 'visible';
530-
}
531-
532-
// Additional cleanup for cursor
533-
document.body.style.cursor = 'auto';
534-
535-
// Force cleanup of any remaining overlays
536-
const overlays = document.querySelectorAll('[data-radix-dialog-overlay]');
537-
overlays.forEach(overlay => {
538-
if (overlay instanceof HTMLElement) {
539-
overlay.style.pointerEvents = 'none';
540-
}
541-
});
542-
}, 100);
520+
// Reset body styles when sheet closes
521+
document.body.style.pointerEvents = 'auto';
522+
document.body.style.overflow = 'visible';
523+
document.body.style.cursor = 'auto';
543524
}
544525
}}>
545526
{modal}
@@ -563,10 +544,9 @@ export const AgentSheet = ({
563544

564545
<SheetContent
565546
size='md'
566-
className='text-foreground overflow-y-auto'
547+
className='text-foreground overflow-y-auto max-h-screen'
567548
style={{
568-
pointerEvents: 'auto',
569-
overflow: 'visible'
549+
pointerEvents: 'auto'
570550
}}
571551
onPointerDownOutside={() => {
572552
document.body.style.pointerEvents = 'auto';
@@ -774,6 +754,9 @@ export const AgentSheet = ({
774754
</div>
775755

776756
<div className='grid w-full items-center gap-1.5'>
757+
<Label className='text-gray-900 font-medium' htmlFor='model'>
758+
Model
759+
</Label>
777760
<DropdownMenu>
778761
<DropdownMenuTrigger className='bg-background border border-gray-300 flex items-center justify-between bg-gray-50 px-4 py-2 rounded-lg'>
779762
<div className='flex items-center gap-2'>

webapp/src/components/variables/VariableTable.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function VariableTable({
4040
},
4141
() => {},
4242
err => {
43-
toast.error(err);
43+
// toast.error(err);
4444
},
4545
router
4646
);
@@ -89,33 +89,28 @@ export default function VariableTable({
8989
<tr>
9090
<th
9191
scope='col'
92-
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'
93-
>
92+
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'>
9493
Name
9594
</th>
9695
<th
9796
scope='col'
98-
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'
99-
>
97+
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'>
10098
Default Value
10199
</th>
102100
<th
103101
scope='col'
104-
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'
105-
>
102+
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'>
106103
Created By
107104
</th>
108105
<th
109106
scope='col'
110-
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'
111-
>
107+
className='px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'>
112108
Created On
113109
</th>
114110

115111
<th
116112
scope='col'
117-
className='px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'
118-
>
113+
className='px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-50'>
119114
Actions
120115
</th>
121116
</tr>
@@ -130,12 +125,10 @@ export default function VariableTable({
130125
deletingMap[variable._id]
131126
? 'bg-red-400'
132127
: 'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-500 dark:text-gray-50'
133-
)}
134-
>
128+
)}>
135129
<td
136130
className='px-6 py-4 whitespace-nowrap'
137-
onClick={() => router.push(`/${resourceSlug}/variable/${variable._id}/edit`)}
138-
>
131+
onClick={() => router.push(`/${resourceSlug}/variable/${variable._id}/edit`)}>
139132
<div className='text-sm text-gray-900 dark:text-white'>{variable.name}</div>
140133
</td>
141134
<td className='px-6 py-4 whitespace-nowrap'>
@@ -159,8 +152,7 @@ export default function VariableTable({
159152
setDeletingVariable(variable);
160153
setOpen(true);
161154
}}
162-
className='text-red-500 hover:text-red-700'
163-
>
155+
className='text-red-500 hover:text-red-700'>
164156
<TrashIcon className='h-5 w-5' aria-hidden='true' />
165157
</button>
166158
</td>

webapp/src/pages/[resourceSlug]/variables.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ export default function Variables(props) {
5353

5454
<VariableTable variables={filteredVariables} fetchVariables={fetchVariables} />
5555

56-
{variables.length === 0 && (
56+
{/* {variables.length === 0 && (
5757
<NewButtonSection
5858
link={`/${resourceSlug}/variable/add`}
5959
emptyMessage={'No variables'}
6060
message={'Get started by adding variables.'}
6161
buttonIcon={<PlusIcon className='-ml-0.5 mr-1.5 h-5 w-5' aria-hidden='true' />}
6262
buttonMessage={'Add Variable'}
6363
/>
64-
)}
64+
)} */}
6565
<CreateVariableModal
6666
open={createVariableOpen}
6767
setOpen={setCreateVariableOpen}

0 commit comments

Comments
 (0)