Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tinker

Manav Rathi97bdc9362a47
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 49985f404a..1cd1bf5661 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -503,6 +503,7 @@ const PhotoFrame = ({
return (
<Container>
+ {process.env.NEXT_PUBLIC_ENTE_WIP_PS5 && <FileViewer />}
<AutoSizer>
{({ height, width }) => (
<PhotoList
@@ -518,7 +519,6 @@ const PhotoFrame = ({
/>
)}
</AutoSizer>
- {process.env.NEXT_PUBLIC_ENTE_WIP_PS5 && <FileViewer />}
<PhotoViewer
isOpen={open}
items={displayFiles}
diff --git a/web/packages/new/photos/components/FileViewer5.tsx b/web/packages/new/photos/components/FileViewer5.tsx
index ad2a3c4ef1..81c0c87c5d 100644
--- a/web/packages/new/photos/components/FileViewer5.tsx
+++ b/web/packages/new/photos/components/FileViewer5.tsx
@@ -1,3 +1,6 @@
+/* eslint-disable */
+// @ts-nocheck
+
// TODO(PS): WIP gallery using upstream photoswipe
//
// Needs (not committed yet):
@@ -10,18 +13,52 @@ if (process.env.NEXT_PUBLIC_ENTE_WIP_PS5) {
throw new Error("Whoa");
}
-import { Button } from "@mui/material";
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+import { Button, styled } from "@mui/material";
+import { useEffect } from "react";
import PhotoSwipeLightBox from "./ps5/dist/photoswipe-lightbox.esm.js";
+import PhotoSwipe from "./ps5/dist/photoswipe.esm.js";
const FileViewer: React.FC = () => {
console.log(PhotoSwipeLightBox);
+ useEffect(() => {
+ const lightbox = new PhotoSwipeLightBox({
+ gallery: "#test-gallery",
+ mainClass: "our-extra-pswp-main-class",
+ pswpModule: PhotoSwipe,
+ });
+ lightbox.init();
+
+ return () => {
+ lightbox.destroy();
+ };
+ }, []);
return (
- <div>
- Hello<Button>Test</Button>
- </div>
+ <Container>
+ <Button>Test</Button>
+ <div id="test-gallery">
+ <a
+ href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-2500.jpg"
+ data-pswp-width="1669"
+ data-pswp-height="2500"
+ target="_blank"
+ >
+ <img
+ src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-200.jpg"
+ alt=""
+ />
+ </a>
+ </div>
+ </Container>
);
};
+const Container = styled("div")`
+ border: 1px solid red;
+
+ #test-gallery {
+ border: 1px solid red;
+ min-height: 10px;
+ }
+`;
+
export default FileViewer;