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

View file

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

View file

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