Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use right

Manav Rathi13ed68c79e18
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 414d96d092..6e81c7d905 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -20,6 +20,7 @@ import { LoadingButton } from "ente-base/components/mui/LoadingButton";
import {
NestedSidebarDrawer,
SidebarDrawer,
+ TitledNestedSidebarDrawer,
} from "ente-base/components/mui/SidebarDrawer";
import {
RowButton,
@@ -485,6 +486,8 @@ const AddParticipant: React.FC<AddParticipantProps> = ({
onRootClose();
};
+ const title = type == "VIEWER" ? t("add_viewers") : t("add_collaborators");
+
const collectionShare: AddParticipantFormProps["callback"] = async ({
email,
emails,
@@ -524,34 +527,20 @@ const AddParticipant: React.FC<AddParticipantProps> = ({
};
return (
- <NestedSidebarDrawer
+ <TitledNestedSidebarDrawer
anchor="right"
{...{ open, onClose }}
onRootClose={handleRootClose}
+ title={title}
+ caption={collection.name}
>
- <Stack sx={{ gap: "4px", py: "12px" }}>
- <Titlebar
- {...{ onClose }}
- onRootClose={handleRootClose}
- title={
- type == "VIEWER"
- ? t("add_viewers")
- : t("add_collaborators")
- }
- caption={collection.name}
- />
- <AddParticipantForm
- onClose={onClose}
- callback={collectionShare}
- optionsList={nonSharedEmails}
- buttonText={
- type == "VIEWER"
- ? t("add_viewers")
- : t("add_collaborators")
- }
- />
- </Stack>
- </NestedSidebarDrawer>
+ <AddParticipantForm
+ onClose={onClose}
+ callback={collectionShare}
+ optionsList={nonSharedEmails}
+ buttonText={title}
+ />
+ </TitledNestedSidebarDrawer>
);
};
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 8760920d86..5baa666d45 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -215,10 +215,12 @@ export const SidebarDrawerTitlebarClose: React.FC<
*/
export const TitledNestedSidebarDrawer: React.FC<
React.PropsWithChildren<
- NestedSidebarDrawerVisibilityProps & SidebarDrawerTitlebarProps
+ NestedSidebarDrawerVisibilityProps &
+ Pick<DrawerProps, "anchor"> &
+ SidebarDrawerTitlebarProps
>
-> = ({ open, onClose, onRootClose, children, ...rest }) => (
- <NestedSidebarDrawer {...{ open, onClose, onRootClose }}>
+> = ({ open, onClose, onRootClose, anchor, children, ...rest }) => (
+ <NestedSidebarDrawer {...{ open, onClose, onRootClose, anchor }}>
<Stack sx={{ gap: "4px", py: "12px" }}>
<SidebarDrawerTitlebar {...{ onClose, onRootClose }} {...rest} />
{children}