Skip to content

Commit 31a78f4

Browse files
committed
[front/components] - refactor: adjust ConnectorPermissionsModal layout 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
1 parent f4d4cee commit 31a78f4

File tree

1 file changed

+55
-53
lines changed

1 file changed

+55
-53
lines changed

front/components/ConnectorPermissionsModal.tsx

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NotificationType, SheetTitle } from "@dust-tt/sparkle";
1+
import { NotificationType, SheetContainer, SheetTitle } from "@dust-tt/sparkle";
22
import { SheetHeader } from "@dust-tt/sparkle";
33
import {
44
Avatar,
@@ -761,10 +761,7 @@ export function ConnectorPermissionsModal({
761761
<SheetTitle>
762762
Manage {getDisplayNameForDataSource(dataSource)} connection
763763
</SheetTitle>
764-
</SheetHeader>
765-
766-
<div className="mx-auto mt-4 flex w-full max-w-4xl grow flex-col gap-4 px-4">
767-
<div className="flex flex-row justify-end gap-2">
764+
<div className="flex flex-row justify-end gap-2 py-1">
768765
{(isOAuthProvider(connector.type) ||
769766
connector.type === "snowflake") && (
770767
<Button
@@ -791,58 +788,63 @@ export function ConnectorPermissionsModal({
791788
/>
792789
)}
793790
</div>
794-
{OptionsComponent && plan && (
795-
<>
796-
<div className="p-1 text-xl font-bold">
797-
Connector options
798-
</div>
799-
<div className="p-1">
800-
<div className="border-y">
801-
<OptionsComponent
802-
{...{ owner, readOnly, isAdmin, dataSource, plan }}
803-
/>
804-
</div>
805-
</div>
806-
</>
807-
)}
791+
</SheetHeader>
808792

809-
<div className="p-1 text-xl font-bold">
810-
{CONNECTOR_CONFIGURATIONS[connector.type].selectLabel}
811-
</div>
793+
<SheetContainer>
794+
<div className="flex w-full flex-col gap-4">
795+
{OptionsComponent && plan && (
796+
<>
797+
<div className="p-1 text-xl font-bold">
798+
Connector options
799+
</div>
800+
<div className="p-1">
801+
<div className="border-y">
802+
<OptionsComponent
803+
{...{ owner, readOnly, isAdmin, dataSource, plan }}
804+
/>
805+
</div>
806+
</div>
807+
</>
808+
)}
812809

813-
<ContentNodeTree
814-
isSearchEnabled={
815-
CONNECTOR_CONFIGURATIONS[connector.type].isSearchEnabled
816-
}
817-
isRoundedBackground={true}
818-
useResourcesHook={useResourcesHook}
819-
selectedNodes={
820-
canUpdatePermissions ? selectedNodes : undefined
821-
}
822-
setSelectedNodes={
823-
canUpdatePermissions && !isResourcesLoading
824-
? setSelectedNodes
825-
: undefined
826-
}
827-
showExpand={
828-
CONNECTOR_CONFIGURATIONS[connector.type]?.isNested
829-
}
830-
/>
831-
832-
<div className="flex justify-end gap-2 border-t pt-4">
833-
<Button
834-
label="Cancel"
835-
variant="outline"
836-
onClick={() => closeModal(false)}
837-
/>
838-
<Button
839-
label={saving ? "Saving..." : "Save"}
840-
variant="primary"
841-
disabled={isUnchanged || saving}
842-
onClick={save}
810+
<div className="p-1 text-xl font-bold">
811+
{CONNECTOR_CONFIGURATIONS[connector.type].selectLabel}
812+
</div>
813+
814+
<ContentNodeTree
815+
isSearchEnabled={
816+
CONNECTOR_CONFIGURATIONS[connector.type].isSearchEnabled
817+
}
818+
isRoundedBackground={true}
819+
useResourcesHook={useResourcesHook}
820+
selectedNodes={
821+
canUpdatePermissions ? selectedNodes : undefined
822+
}
823+
setSelectedNodes={
824+
canUpdatePermissions && !isResourcesLoading
825+
? setSelectedNodes
826+
: undefined
827+
}
828+
showExpand={
829+
CONNECTOR_CONFIGURATIONS[connector.type]?.isNested
830+
}
843831
/>
832+
833+
<div className="flex justify-end gap-2 border-t pt-4">
834+
<Button
835+
label="Cancel"
836+
variant="outline"
837+
onClick={() => closeModal(false)}
838+
/>
839+
<Button
840+
label={saving ? "Saving..." : "Save"}
841+
variant="primary"
842+
disabled={isUnchanged || saving}
843+
onClick={save}
844+
/>
845+
</div>
844846
</div>
845-
</div>
847+
</SheetContainer>
846848
</>
847849
)}
848850
</SheetContent>

0 commit comments

Comments
 (0)