Skip to content

armgit / ente

Public Imported from GitHub
0

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

live 1

Manav Rathi03df527fb7c5
diff --git a/web/apps/photos/src/styles/global.css b/web/apps/photos/src/styles/global.css
index 174067991a..0ce1b1639d 100644
--- a/web/apps/photos/src/styles/global.css
+++ b/web/apps/photos/src/styles/global.css
@@ -182,7 +182,12 @@ body {
display: initial;
}
-/* Scale the built in controls to better fit our requirements */
+/* Transfrom the built in controls to better fit our requirements */
+
+.pswp-ente .pswp__counter {
+ margin-inline-end: 6px;
+}
+
.pswp-ente .pswp__button--zoom .pswp__icn {
transform: scale(0.85);
}
diff --git a/web/packages/gallery/components/viewer/icons.tsx b/web/packages/gallery/components/viewer/icons.tsx
index bd5bc062f4..773fd62f02 100644
--- a/web/packages/gallery/components/viewer/icons.tsx
+++ b/web/packages/gallery/components/viewer/icons.tsx
@@ -20,6 +20,10 @@
const paths = {
// "@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" transform="translate(7, 5.7) scale(0.85)"',
+ // "@mui/icons-material/AlbumOutlined"
+ live: '<path d="M12 2C6.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 8m0-12.5c-2.49 0-4.5 2.01-4.5 4.5s2.01 4.5 4.5 4.5 4.5-2.01 4.5-4.5-2.01-4.5-4.5-4.5m0 5.5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1" transform="translate(2, 7) scale(0.7)"',
+ // "@mui/icons-material/VolumeUp"
+ vol: '<path d="M3 9v6h4l5 5V4L7 9zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77" transform="translate(-2, 7) scale(0.7)"',
// "@mui/icons-material/FavoriteBorderRounded"
favorite:
'<path d="M19.66 3.99c-2.64-1.8-5.9-.96-7.66 1.1-1.76-2.06-5.02-2.91-7.66-1.1-1.4.96-2.28 2.58-2.34 4.29-.14 3.88 3.3 6.99 8.55 11.76l.1.09c.76.69 1.93.69 2.69-.01l.11-.1c5.25-4.76 8.68-7.87 8.55-11.75-.06-1.7-.94-3.32-2.34-4.28M12.1 18.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05" transform="translate(0, 5.5) scale(0.95)"',
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 941f884893..f7c68527a9 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -326,9 +326,9 @@ export class FileViewerPhotoSwipe {
if (fv && !fv.classList.contains("pswp")) {
return true;
}
- return false;
// TODO(PS): Remove me
- // return true;
+ // return false;
+ return true;
};
// Provide data about slides to PhotoSwipe via callbacks
@@ -557,25 +557,27 @@ export class FileViewerPhotoSwipe {
// https://photoswipe.com/adding-ui-elements/#uiregisterelement-api
//
// The "order" prop is used to position items. Some landmarks:
- // - counter: 5
+ // - counter: 3 (default is 5)
+ // - zoom: 4 (default is 10).
// - preloader: 7
- // - zoom: 10
// - close: 20
pswp.on("uiRegister", () => {
// Move the zoom button to the left so that it is in the same place
// as the other items like preloader or the error indicator that
- // come and go as files get loaded.
+ // come and go as files get loaded. Also modify the default orders
+ // so that there is more space for the error / live indicators.
//
// We cannot use the PhotoSwipe "uiElement" filter to modify the
// order since that only allows us to edit the DOM element, not the
// underlying UI element data.
- pswp.ui.uiElementsData.find((e) => e.name == "zoom").order = 6;
+ pswp.ui.uiElementsData.find((e) => e.name == "counter").order = 3;
+ pswp.ui.uiElementsData.find((e) => e.name == "zoom").order = 4;
// Register our custom elements...
pswp.ui.registerElement({
name: "error",
- order: 6,
+ order: 5,
html: createPSRegisterElementIconHTML("error"),
onInit: (errorElement, pswp) => {
pswp.on("change", () => {
@@ -589,6 +591,48 @@ export class FileViewerPhotoSwipe {
},
});
+ pswp.ui.registerElement({
+ name: "live",
+ // TODO(PS):
+ title: pt("Toggle live"),
+ // Safe to use the same order, since this will only be shown if
+ // there are no errors.
+ order: 5,
+ isButton: true,
+ html: createPSRegisterElementIconHTML("live"),
+ onInit: (buttonElement) => {
+ // buttonElement.setAttribute("id", moreButtonID);
+ // buttonElement.setAttribute("aria-haspopup", "true");
+ },
+ onClick: (e) => {
+ // const buttonElement = e.target;
+ // See also: `resetMoreMenuButtonOnMenuClose`.
+ // buttonElement.setAttribute("aria-controls", moreMenuID);
+ // buttonElement.setAttribute("aria-expanded", true);
+ // onMore(buttonElement);
+ },
+ });
+
+ pswp.ui.registerElement({
+ name: "vol",
+ // TODO(PS):
+ title: pt("Toggle audio"),
+ order: 6,
+ isButton: true,
+ html: createPSRegisterElementIconHTML("vol"),
+ onInit: (buttonElement) => {
+ // buttonElement.setAttribute("id", moreButtonID);
+ // buttonElement.setAttribute("aria-haspopup", "true");
+ },
+ onClick: (e) => {
+ // const buttonElement = e.target;
+ // See also: `resetMoreMenuButtonOnMenuClose`.
+ // buttonElement.setAttribute("aria-controls", moreMenuID);
+ // buttonElement.setAttribute("aria-expanded", true);
+ // onMore(buttonElement);
+ },
+ });
+
if (haveUser) {
const showFavoriteIf = (
buttonElement: HTMLButtonElement,
@@ -744,7 +788,7 @@ export class FileViewerPhotoSwipe {
const handleToggleUIControls = () => {
toggleUIControls();
lastActivityDate = new Date();
- }
+ };
// Some actions routed via the delegate