Skip to content

armgit / ente

Public Imported from GitHub
0

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

err 2

Manav Rathi89881975f20a
diff --git a/web/packages/gallery/components/viewer/icons.tsx b/web/packages/gallery/components/viewer/icons.tsx
index ef4fadd8e1..8b6ef33b5f 100644
--- a/web/packages/gallery/components/viewer/icons.tsx
+++ b/web/packages/gallery/components/viewer/icons.tsx
@@ -10,7 +10,7 @@
*
*
* import { renderToString } from "react-dom/server";
- * import InfoOutlinedIcon from ;
+ * import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
*
* console.log(renderToString(<InfoOutlinedIcon />));
*/
@@ -18,6 +18,8 @@
const paths = {
// "@mui/icons-material/InfoOutlined"
info: '<path d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"',
+ // "@mui/icons-material/ErrorOutline"
+ error: '<path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"',
};
/**
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index f843139b44..18b2734b5c 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -271,6 +271,44 @@ export class FileViewerPhotoSwipe {
// - zoom: 10
// - close: 20
pswp.on("uiRegister", () => {
+ pswp.ui.registerElement({
+ name: "error",
+ title: t("error"),
+ order: 6,
+ html: createPSRegisterElementIconHTML("error"),
+ onInit: (errorElement, pswp) => {
+ let isVisible = false;
+
+ const toggleIndicatorClass = (className, add) => {
+ errorElement.classList.toggle(
+ // Reuse preloading hide / show mechanism.
+ "pswp__preloader--" + className,
+ add,
+ );
+ };
+
+ const setIndicatorVisibility = (visible) => {
+ if (isVisible !== visible) {
+ isVisible = visible;
+ toggleIndicatorClass("active", visible);
+ }
+ };
+
+ const updateErrorIndicatorVisibility = () => {
+ console.log(
+ "updateErrorIndicatorVisibility",
+ pswp.currSlide.content,
+ );
+ if (pswp.currSlide.content.data.failureReason) {
+ setIndicatorVisibility(true);
+ } else {
+ setIndicatorVisibility(false);
+ }
+ };
+
+ pswp.on("change", updateErrorIndicatorVisibility);
+ },
+ });
pswp.ui.registerElement({
name: "info",
title: t("info"),