Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix draft post fade timing

Anand Baburajane8e618ab704c
diff --git a/web/apps/space/src/components/SpaceFileViewer.tsx b/web/apps/space/src/components/SpaceFileViewer.tsx
index 1190946559..f04e73a5f4 100644
--- a/web/apps/space/src/components/SpaceFileViewer.tsx
+++ b/web/apps/space/src/components/SpaceFileViewer.tsx
@@ -158,6 +158,7 @@ interface SpaceFileViewerProps {
isDraftPostPreviewPending?: boolean;
onClose: () => void;
onDeletePost?: () => Promise<void> | void;
+ onDraftPostExitAnimationStart?: () => void;
onDraftPostExitStart?: () => void;
onDraftPostPublished?: () => void;
onAddFriendForPostAction?: (intent: SpaceInviteIntent) => void;
@@ -360,6 +361,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
isDraftPostPreviewPending = false,
onClose,
onDeletePost,
+ onDraftPostExitAnimationStart,
onDraftPostExitStart,
onDraftPostPublished,
onAddFriendForPostAction,
@@ -741,7 +743,10 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
setQueuedDraftPost(undefined);
setDraftPostExitPhase("waiting-for-keyboard");
onDraftPostExitStart?.();
- dismissCaptionKeyboard(() => setDraftPostExitPhase("animating"));
+ dismissCaptionKeyboard(() => {
+ setDraftPostExitPhase("animating");
+ onDraftPostExitAnimationStart?.();
+ });
void publishPromise.catch((error: unknown) => {
log.error("Failed to publish space post", error);
});
@@ -750,6 +755,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
isDeleteExit,
isDraftPostExit,
dismissCaptionKeyboard,
+ onDraftPostExitAnimationStart,
onDraftPostExitStart,
onPublishDraftPost,
],
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index a4aa7f82e1..7a91899d79 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -1518,6 +1518,8 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
}) => {
const [selectedViewer, setSelectedViewer] =
useState<SelectedHomeViewer | null>(null);
+ const [isDraftPostExitAnimating, setIsDraftPostExitAnimating] =
+ useState(false);
const [isDraftPostExiting, setIsDraftPostExiting] = useState(false);
const [isInviteSharing, setIsInviteSharing] = useState(false);
const [isPostPhotoOpening, setIsPostPhotoOpening] = useState(false);
@@ -1619,6 +1621,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
};
const closeSelectedPhoto = () => {
activeLocalPostObjectUrlRef.current = null;
+ setIsDraftPostExitAnimating(false);
setIsDraftPostExiting(false);
setSelectedViewer(null);
revokeLocalPostObjectUrls();
@@ -1980,7 +1983,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
}}
>
{selectedViewer && (
- <SpaceViewerFeedBackdrop exiting={isDraftPostExiting} />
+ <SpaceViewerFeedBackdrop exiting={isDraftPostExitAnimating} />
)}
<Box
sx={{
@@ -2462,6 +2465,9 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
}
: undefined
}
+ onDraftPostExitAnimationStart={() => {
+ setIsDraftPostExitAnimating(true);
+ }}
onDraftPostExitStart={() => {
setIsDraftPostExiting(true);
}}
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 87c1a7a85c..717d1715f9 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -522,6 +522,8 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
}) => {
const [selectedPost, setSelectedPost] =
useState<SelectedProfilePost | null>(null);
+ const [isDraftPostExitAnimating, setIsDraftPostExitAnimating] =
+ useState(false);
const [isDraftPostExiting, setIsDraftPostExiting] = useState(false);
const [isPostPhotoOpening, setIsPostPhotoOpening] = useState(false);
const [deletedPostIDs, setDeletedPostIDs] = useState<Set<string>>(
@@ -669,6 +671,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
};
const closeSelectedPost = () => {
activeLocalPostObjectUrlRef.current = null;
+ setIsDraftPostExitAnimating(false);
setIsDraftPostExiting(false);
setSelectedPost(null);
revokeLocalPostObjectUrls();
@@ -1006,7 +1009,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
}}
>
{selectedPost && (
- <SpaceViewerFeedBackdrop exiting={isDraftPostExiting} />
+ <SpaceViewerFeedBackdrop exiting={isDraftPostExitAnimating} />
)}
<Box
sx={{
@@ -1982,6 +1985,9 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
? onAddFriendForPostAction
: undefined
}
+ onDraftPostExitAnimationStart={() => {
+ setIsDraftPostExitAnimating(true);
+ }}
onDraftPostExitStart={() => setIsDraftPostExiting(true)}
onDeletePost={
isOwnerProfile ? deleteSelectedPost : undefined