Merge pull request #754 from ente-io/rename

Rename custom components from PhotoSwipe to PhotoViewer
This commit is contained in:
Neeraj Gupta 2022-10-28 15:03:04 +05:30 committed by GitHub
commit bce60813fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 18 additions and 15 deletions

View file

@ -6,7 +6,7 @@ import { styled } from '@mui/material';
import DownloadManager from 'services/downloadManager';
import constants from 'utils/strings/constants';
import AutoSizer from 'react-virtualized-auto-sizer';
import PhotoSwipe from 'components/PhotoSwipe';
import PhotoViewer from 'components/PhotoViewer';
import {
ALL_SECTION,
ARCHIVE_SECTION,
@ -586,7 +586,7 @@ const PhotoFrame = ({
/>
)}
</AutoSizer>
<PhotoSwipe
<PhotoViewer
isOpen={open}
items={filteredData}
currentIndex={currentIndex}

View file

@ -9,7 +9,6 @@ import {
import { EnteFile } from 'types/file';
import constants from 'utils/strings/constants';
import exifr from 'exifr';
import events from './events';
import { downloadFile } from 'utils/file';
import { prettyPrintExif } from 'utils/exif';
import { livePhotoBtnHTML } from 'components/LivePhotoBtn';
@ -21,7 +20,10 @@ import { playVideo, pauseVideo } from 'utils/photoFrame';
import { PublicCollectionGalleryContext } from 'utils/publicCollectionGallery';
import { AppContext } from 'pages/_app';
import { FileInfo } from './InfoDialog';
import { defaultLivePhotoDefaultOptions } from 'constants/photoswipe';
import {
defaultLivePhotoDefaultOptions,
photoSwipeV4Events,
} from 'constants/photoViewer';
import { LivePhotoBtn } from './styledComponents/LivePhotoBtn';
import DownloadIcon from '@mui/icons-material/Download';
import InfoIcon from '@mui/icons-material/InfoOutlined';
@ -49,7 +51,7 @@ interface Iprops {
isSourceLoaded: boolean;
}
function PhotoSwipe(props: Iprops) {
function PhotoViewer(props: Iprops) {
const pswpElement = useRef<HTMLDivElement>();
const [photoSwipe, setPhotoSwipe] =
useState<Photoswipe<Photoswipe.Options>>();
@ -203,7 +205,7 @@ function PhotoSwipe(props: Iprops) {
items,
options
);
events.forEach((event) => {
photoSwipeV4Events.forEach((event) => {
const callback = props[event];
if (callback || event === 'destroy') {
photoSwipe.listen(event, function (...args) {
@ -486,4 +488,4 @@ function PhotoSwipe(props: Iprops) {
);
}
export default PhotoSwipe;
export default PhotoViewer;

View file

@ -1,4 +1,12 @@
export default [
export const defaultLivePhotoDefaultOptions = {
click: () => {},
hide: () => {},
show: () => {},
loading: false,
visible: false,
};
export const photoSwipeV4Events = [
'beforeChange',
'afterChange',
'imageLoadComplete',

View file

@ -1,7 +0,0 @@
export const defaultLivePhotoDefaultOptions = {
click: () => {},
hide: () => {},
show: () => {},
loading: false,
visible: false,
};