Skip to content

armgit / ente

Public Imported from GitHub
0

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

Alt

Manav Rathia70d2b9c05bf
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index 44d32a86c9..3592e8a6e3 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -82,6 +82,7 @@ export type FileListWithViewerProps = {
| "isInHiddenSection"
| "fileCollectionIDs"
| "allCollectionsNameByID"
+ | "onVisualFeedback"
| "onSelectCollection"
| "onSelectPerson"
> &
@@ -117,6 +118,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
onMarkTempDeleted,
onSetOpenFileViewer,
onSyncWithRemote,
+ onVisualFeedback,
onSelectCollection,
onSelectPerson,
}) => {
@@ -227,6 +229,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
allCollectionsNameByID,
pendingVisibilityUpdates,
unsyncedVisibilityUpdates,
+ onVisualFeedback,
onFileVisibilityUpdate,
onSelectCollection,
onSelectPerson,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 75d458d3db..e569f6b285 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -520,6 +520,19 @@ const Page: React.FC = () => {
[showMiniDialog, logout],
);
+ // [Note: Visual feedback to acknowledge user actions]
+ //
+ // In some infrequent cases, we want to acknowledge some user action (e.g.
+ // pressing a keyboard shortcut which doesn't have an immediate on-screen
+ // impact). In these cases, we tickle the loading bar at the top to
+ // acknowledge that their action.
+ //
+ // TODO: Move to the new "GalleryContext"?
+ const handleVisualFeedback = useCallback(() => {
+ showLoadingBar();
+ setTimeout(hideLoadingBar, 0);
+ }, [showLoadingBar, hideLoadingBar]);
+
const handleSyncWithRemote = useCallback(
async (force = false, silent = false) => {
if (!navigator.onLine) return;
@@ -1125,6 +1138,7 @@ const Page: React.FC = () => {
onMarkTempDeleted={handleMarkTempDeleted}
onSetOpenFileViewer={setIsFileViewerOpen}
onSyncWithRemote={handleSyncWithRemote}
+ onVisualFeedback={handleVisualFeedback}
onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}
/>
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index bb887c5977..5a5873f210 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -372,6 +372,12 @@ export default function PublicCollectionGallery() {
// TODO: See gallery
const syncWithRemote = handleSyncWithRemote;
+ // See: [Note: Visual feedback to acknowledge user actions]
+ const handleVisualFeedback = useCallback(() => {
+ showLoadingBar();
+ setTimeout(hideLoadingBar, 0);
+ }, [showLoadingBar, hideLoadingBar]);
+
const verifyLinkPassword: SingleInputFormProps["callback"] = async (
password,
setFieldError,
@@ -522,6 +528,7 @@ export default function PublicCollectionGallery() {
setFilesDownloadProgressAttributesCreator
}
onSyncWithRemote={handleSyncWithRemote}
+ onVisualFeedback={handleVisualFeedback}
/>
{blockingLoad && <TranslucentLoadingOverlay />}
<Upload
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index c3ec05f482..19f3cec490 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -225,6 +225,13 @@ export type FileViewerProps = ModalVisibilityProps & {
* not defined, then this prop is not used.
*/
onTriggerSyncWithRemote?: () => void;
+ /**
+ * Called when the user performs an action which does not otherwise have any
+ * immediate visual impact, to acknowledge it.
+ *
+ * See: [Note: Visual feedback to acknowledge user actions]
+ */
+ onVisualFeedback: () => void;
/**
* Called when the favorite status of given {@link file} should be toggled
* from its current value.
@@ -291,6 +298,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
fileCollectionIDs,
allCollectionsNameByID,
onTriggerSyncWithRemote,
+ onVisualFeedback,
onToggleFavorite,
onDownload,
onDelete,