Skip to content

Commit

Permalink
[front/components] - refactor: adjust ConnectorPermissionsModal layou…
Browse files Browse the repository at this point in the history
…t using SheetContainer

 - Wrap options and content tree in new SheetContainer component for improved structure
 - Simplify button and header layout within modal for enhanced visual coherence
 - Remove redundant div elements to streamline modal markup
  • Loading branch information
JulesBelveze committed Jan 6, 2025
1 parent d5ace41 commit 2d67c44
Showing 1 changed file with 55 additions and 53 deletions.
108 changes: 55 additions & 53 deletions front/components/ConnectorPermissionsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NotificationType, SheetTitle } from "@dust-tt/sparkle";
import { NotificationType, SheetContainer, SheetTitle } from "@dust-tt/sparkle";
import { SheetHeader } from "@dust-tt/sparkle";
import {
Avatar,
Expand Down Expand Up @@ -761,10 +761,7 @@ export function ConnectorPermissionsModal({
<SheetTitle>
Manage {getDisplayNameForDataSource(dataSource)} connection
</SheetTitle>
</SheetHeader>

<div className="mx-auto mt-4 flex w-full max-w-4xl grow flex-col gap-4 px-4">
<div className="flex flex-row justify-end gap-2">
<div className="flex flex-row justify-end gap-2 py-1">
{(isOAuthProvider(connector.type) ||
connector.type === "snowflake") && (
<Button
Expand All @@ -791,58 +788,63 @@ export function ConnectorPermissionsModal({
/>
)}
</div>
{OptionsComponent && plan && (
<>
<div className="p-1 text-xl font-bold">
Connector options
</div>
<div className="p-1">
<div className="border-y">
<OptionsComponent
{...{ owner, readOnly, isAdmin, dataSource, plan }}
/>
</div>
</div>
</>
)}
</SheetHeader>

<div className="p-1 text-xl font-bold">
{CONNECTOR_CONFIGURATIONS[connector.type].selectLabel}
</div>
<SheetContainer>
<div className="flex w-full flex-col gap-4">
{OptionsComponent && plan && (
<>
<div className="p-1 text-xl font-bold">
Connector options
</div>
<div className="p-1">
<div className="border-y">
<OptionsComponent
{...{ owner, readOnly, isAdmin, dataSource, plan }}
/>
</div>
</div>
</>
)}

<ContentNodeTree
isSearchEnabled={
CONNECTOR_CONFIGURATIONS[connector.type].isSearchEnabled
}
isRoundedBackground={true}
useResourcesHook={useResourcesHook}
selectedNodes={
canUpdatePermissions ? selectedNodes : undefined
}
setSelectedNodes={
canUpdatePermissions && !isResourcesLoading
? setSelectedNodes
: undefined
}
showExpand={
CONNECTOR_CONFIGURATIONS[connector.type]?.isNested
}
/>

<div className="flex justify-end gap-2 border-t pt-4">
<Button
label="Cancel"
variant="outline"
onClick={() => closeModal(false)}
/>
<Button
label={saving ? "Saving..." : "Save"}
variant="primary"
disabled={isUnchanged || saving}
onClick={save}
<div className="p-1 text-xl font-bold">
{CONNECTOR_CONFIGURATIONS[connector.type].selectLabel}
</div>

<ContentNodeTree
isSearchEnabled={
CONNECTOR_CONFIGURATIONS[connector.type].isSearchEnabled
}
isRoundedBackground={true}
useResourcesHook={useResourcesHook}
selectedNodes={
canUpdatePermissions ? selectedNodes : undefined
}
setSelectedNodes={
canUpdatePermissions && !isResourcesLoading
? setSelectedNodes
: undefined
}
showExpand={
CONNECTOR_CONFIGURATIONS[connector.type]?.isNested
}
/>

<div className="flex justify-end gap-2 border-t pt-4">
<Button
label="Cancel"
variant="outline"
onClick={() => closeModal(false)}
/>
<Button
label={saving ? "Saving..." : "Save"}
variant="primary"
disabled={isUnchanged || saving}
onClick={save}
/>
</div>
</div>
</div>
</SheetContainer>
</>
)}
</SheetContent>
Expand Down

0 comments on commit 2d67c44

Please sign in to comment.