Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Styles

Manav Rathia144d39a4732
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 000cf2d037..db71630501 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -49,10 +49,8 @@ import { resumeExportsIfNeeded } from "services/export";
import { photosLogout } from "services/logout";
import "photoswipe/dist/photoswipe.css";
-// TODO(PS): Note, auto hide only works with the new CSS.
-// import "../../../../packages/gallery/components/viewer/ps5/dist/photoswipe.css";
-
import "styles/global.css";
+import "styles/photoswipe.css";
const App: React.FC<AppProps> = ({ Component, pageProps }) => {
useSetupLogs();
diff --git a/web/apps/photos/src/styles/global.css b/web/apps/photos/src/styles/global.css
index f87335cd30..1d8a983599 100644
--- a/web/apps/photos/src/styles/global.css
+++ b/web/apps/photos/src/styles/global.css
@@ -12,273 +12,3 @@ body {
flex-direction: column;
height: 100%;
}
-
-.pswp__button--custom {
- width: 48px;
- height: 48px;
- background: none !important;
- background-image: none !important;
- color: white;
-}
-
-.pswp__item video {
- width: 100%;
- height: 100%;
-}
-
-.pswp-item-container {
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- object-fit: contain;
-}
-
-/* Need this in CSS instead of as an inline style to increase specificity. */
-.pswp__top-bar.pswp__top-bar {
- top: var(--ente-pswp-top-bar-top, 0px);
-}
-
-/* Shift the top bar by --ente-pswp-top-bar-top, and add a before pseudo element
- with the same color to fill in the custom app title bar.
-
- See: [Note: Customize the desktop title bar] */
-.pswp__top-bar::before {
- content: "";
- position: absolute;
- top: calc(-1 * var(--ente-pswp-top-bar-top, 0px));
- left: 0;
- height: var(--ente-pswp-top-bar-top, 0px);
- width: 100%;
- background-color: rgba(0 0 0 / 0.3);
-}
-
-.pswp-item-container > * {
- position: absolute;
- transition: opacity 1s ease;
- max-width: 100%;
- max-height: 100%;
-}
-
-.pswp-item-container > img {
- opacity: 1;
-}
-
-.pswp-item-container > video {
- opacity: 0;
-}
-
-.pswp__img {
- object-fit: contain;
- /* For reasons I don't understand, Chrome shows black grid lines on images
- when we zoom into them, unless we set a background color.
- https://github.com/ente-io/ente/issues/4067
-
- Even after setting the background color, the black lines are visible for
- a split second when an image is zoomed on to for the first time (this can
- be used as a test to see when this workaround is no longer required).
- */
- background-color: black;
-}
-
-.pswp__button--arrow--left,
-.pswp__button--arrow--right {
- color: white;
- background-color: rgba(37 37 37 / 0.65) !important;
- border-radius: 50%;
- width: 56px;
- height: 56px;
-}
-.pswp__button--arrow--left::before,
-.pswp__button--arrow--right::before {
- background: none !important;
-}
-
-.pswp__button--arrow--left {
- margin-left: 20px;
-}
-
-.pswp__button--arrow--right {
- margin-right: 20px;
-}
-
-.pswp-custom-caption-container {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- bottom: 56px;
- background-color: transparent !important;
-}
-
-.pswp__caption--empty {
- display: none;
-}
-
-.pswp-ente {
- /* The default z-index for PhotoSwipe is 10k, way beyond everything else.
- Give it a more moderate value so that MUI elements can be used with it. */
- z-index: calc(var(--mui-zIndex-drawer) - 1);
-}
-
-/* Shift the top bar by a fraction of the desktop title bar, if any. The top bar
- contents already have a decent top padding, so we don't need to shift by the
- entire amount. See also: [Note: Customize the desktop title bar] */
-.pswp-ente .pswp__top-bar {
- top: calc(env(titlebar-area-height, 0px) * 0.4);
-}
-
-/*
- Make the controllable video elements we render as custom PhotoSwipe content
- take up the entire container.
- */
-.pswp-ente video[controls] {
- width: 100%;
- height: 100%;
-}
-
-.pswp-ente .pswp__preloader--active .pswp__icn {
- opacity: 0.4;
-}
-
-/*
- Error indicator on the file viewer.
-
- It is styled similar to the loading indicator provided by PhotoSwipe since it
- is meant to occupy the same space. Only one of these will be shown at the same
- time, so it can also set the auto right margin.
- */
-.pswp-ente .pswp__error {
- position: relative;
- overflow: hidden;
- width: 50px;
- height: 60px;
- /* Unlike the loading indicator, "display" is used to toggle visibility, and
- the opacity is fixed to be similar to that of the counter. */
- display: none;
- opacity: 0.85;
-}
-
-.pswp-ente .pswp__error .pswp__icn {
- /* Use a warning color for the error icon */
- fill: var(--mui-palette-fixed-golden);
-}
-
-.pswp-ente .pswp__error .pswp__icn-shadow {
- /* Reduce the stroke from default (2px) to make it look better with the
- golden icon outline */
- stroke-width: 1px;
-}
-
-/* The ".pswp--ui-visible .pswp__hide-on-close" selector in PhotoSwipe's CSS
- sets the opacity of the arrows to 1, which doesn't match the rest of the
- controls (0.85). */
-.pswp-ente.pswp--ui-visible .pswp__hide-on-close.pswp__button--arrow {
- opacity: 0.85;
-}
-
-.pswp-ente .pswp__error--active {
- display: initial;
-}
-
-/* Transform the built in controls to better fit our requirements */
-
-.pswp-ente .pswp__counter {
- margin-top: 22.5px;
- margin-inline-start: 18px;
- margin-inline-end: 9px;
- line-height: 20px;
-}
-
-.pswp-ente .pswp__button--zoom .pswp__icn {
- top: 16px;
- transform: scale(0.85);
-}
-
-.pswp-ente .pswp__preloader {
- transform: translate(-2px, 2px);
-}
-
-.pswp-ente .pswp__error {
- transform: translate(-2px, 2px);
-}
-
-.pswp-ente .pswp__button--close .pswp__icn {
- transform: translate(-6px, 0) scale(0.925);
-}
-
-.pswp-ente .pswp__button--close {
- margin-right: 2px;
-}
-
-.pswp-ente .pswp__button--arrow--prev .pswp__icn {
- transform: scale(0.8);
-}
-
-.pswp-ente .pswp__button--arrow--next .pswp__icn {
- /* default is a horizontal flip, transform: scale(-1, 1); */
- transform: scale(-0.8, 0.8);
-}
-
-/* Toggleable live photo buttons */
-
-.pswp-ente button.pswp-ente-off .pswp__icn {
- /* PhotoSwipe already uses the CSS opacity, so reduce the color's opacity */
- fill: rgba(255 255 255 / 0.6);
-}
-
-/* Make the controls fit the top bar on mobile sized screens */
-@media (width < 450px) {
- .pswp__button {
- width: 44px;
- }
-
- .pswp-ente .pswp__counter {
- margin-inline-start: 10px;
- margin-inline-end: 0;
- }
-
- .pswp-ente .pswp__button--close {
- margin-right: -2px;
- }
-}
-
-@media (width < 350px) {
- .pswp__button {
- width: 42px;
- }
-
- .pswp-ente .pswp__counter {
- margin-inline-start: 4px;
- }
-
- .pswp-ente .pswp__button--close {
- margin-right: -4px;
- }
-}
-
-/* 4 line caption */
-
-.pswp-ente .pswp__caption {
- position: absolute;
- bottom: 0px;
- right: 0;
- margin: 20px 24px;
- padding: 6px 16px;
- border-radius: 2px;
- /* Same opacity as the other controls. */
- color: rgba(255 255 255 / 0.85);
- background-color: rgba(0 0 0 / 0.2);
- backdrop-filter: blur(10px);
- /* 4 lines max, ellipsis on overflow. */
- word-break: break-word;
- text-align: right;
- max-width: 375px;
- max-height: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 4;
- line-clamp: 4;
-}
diff --git a/web/apps/photos/src/styles/photoswipe.css b/web/apps/photos/src/styles/photoswipe.css
new file mode 100644
index 0000000000..00dc2c051e
--- /dev/null
+++ b/web/apps/photos/src/styles/photoswipe.css
@@ -0,0 +1,167 @@
+.pswp-ente {
+ /* The default z-index for PhotoSwipe is 10k, way beyond everything else.
+ Give it a more moderate value so that MUI elements can be used with it. */
+ z-index: calc(var(--mui-zIndex-drawer) - 1);
+}
+
+/* Shift the top bar by a fraction of the desktop title bar, if any. The top bar
+ contents already have a decent top padding, so we don't need to shift by the
+ entire amount. See also: [Note: Customize the desktop title bar] */
+.pswp-ente .pswp__top-bar {
+ top: calc(env(titlebar-area-height, 0px) * 0.4);
+}
+
+/*
+ Make the controllable video elements we render as custom PhotoSwipe content
+ take up the entire container.
+ */
+.pswp-ente video[controls] {
+ width: 100%;
+ height: 100%;
+}
+
+.pswp-ente .pswp__preloader--active .pswp__icn {
+ opacity: 0.4;
+}
+
+/*
+ Error indicator on the file viewer.
+
+ It is styled similar to the loading indicator provided by PhotoSwipe since it
+ is meant to occupy the same space. Only one of these will be shown at the same
+ time, so it can also set the auto right margin.
+ */
+.pswp-ente .pswp__error {
+ position: relative;
+ overflow: hidden;
+ width: 50px;
+ height: 60px;
+ /* Unlike the loading indicator, "display" is used to toggle visibility, and
+ the opacity is fixed to be similar to that of the counter. */
+ display: none;
+ opacity: 0.85;
+}
+
+.pswp-ente .pswp__error .pswp__icn {
+ /* Use a warning color for the error icon */
+ fill: var(--mui-palette-fixed-golden);
+}
+
+.pswp-ente .pswp__error .pswp__icn-shadow {
+ /* Reduce the stroke from default (2px) to make it look better with the
+ golden icon outline */
+ stroke-width: 1px;
+}
+
+/* The ".pswp--ui-visible .pswp__hide-on-close" selector in PhotoSwipe's CSS
+ sets the opacity of the arrows to 1, which doesn't match the rest of the
+ controls (0.85). */
+.pswp-ente.pswp--ui-visible .pswp__hide-on-close.pswp__button--arrow {
+ opacity: 0.85;
+}
+
+.pswp-ente .pswp__error--active {
+ display: initial;
+}
+
+/* Transform the built in controls to better fit our requirements */
+
+.pswp-ente .pswp__counter {
+ margin-top: 22.5px;
+ margin-inline-start: 18px;
+ margin-inline-end: 9px;
+ line-height: 20px;
+}
+
+.pswp-ente .pswp__button--zoom .pswp__icn {
+ top: 16px;
+ transform: scale(0.85);
+}
+
+.pswp-ente .pswp__preloader {
+ transform: translate(-2px, 2px);
+}
+
+.pswp-ente .pswp__error {
+ transform: translate(-2px, 2px);
+}
+
+.pswp-ente .pswp__button--close .pswp__icn {
+ transform: translate(-6px, 0) scale(0.925);
+}
+
+.pswp-ente .pswp__button--close {
+ margin-right: 2px;
+}
+
+.pswp-ente .pswp__button--arrow--prev .pswp__icn {
+ transform: scale(0.8);
+}
+
+.pswp-ente .pswp__button--arrow--next .pswp__icn {
+ /* default is a horizontal flip, transform: scale(-1, 1); */
+ transform: scale(-0.8, 0.8);
+}
+
+/* Toggleable live photo buttons */
+
+.pswp-ente button.pswp-ente-off .pswp__icn {
+ /* PhotoSwipe already uses the CSS opacity, so reduce the color's opacity */
+ fill: rgba(255 255 255 / 0.6);
+}
+
+/* Make the controls fit the top bar on mobile sized screens */
+@media (width < 450px) {
+ .pswp__button {
+ width: 44px;
+ }
+
+ .pswp-ente .pswp__counter {
+ margin-inline-start: 10px;
+ margin-inline-end: 0;
+ }
+
+ .pswp-ente .pswp__button--close {
+ margin-right: -2px;
+ }
+}
+
+@media (width < 350px) {
+ .pswp__button {
+ width: 42px;
+ }
+
+ .pswp-ente .pswp__counter {
+ margin-inline-start: 4px;
+ }
+
+ .pswp-ente .pswp__button--close {
+ margin-right: -4px;
+ }
+}
+
+/* 4 line caption */
+
+.pswp-ente .pswp__caption {
+ position: absolute;
+ bottom: 0px;
+ right: 0;
+ margin: 20px 24px;
+ padding: 6px 16px;
+ border-radius: 2px;
+ /* Same opacity as the other controls. */
+ color: rgba(255 255 255 / 0.85);
+ background-color: rgba(0 0 0 / 0.2);
+ backdrop-filter: blur(10px);
+ /* 4 lines max, ellipsis on overflow. */
+ word-break: break-word;
+ text-align: right;
+ max-width: 375px;
+ max-height: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 4;
+ line-clamp: 4;
+}
diff --git a/web/packages/gallery/components/viewer/.gitignore b/web/packages/gallery/components/viewer/.gitignore
deleted file mode 100644
index cbf1262ae4..0000000000
--- a/web/packages/gallery/components/viewer/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# TODO(PS): Remove me once PS5 is integrated
-ps5