Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afd5fdd
commit e3252f5
Showing
10 changed files
with
90 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
fix: quote image gallery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/meteor/client/components/ImageGallery/ImageGalleryError.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { css } from '@rocket.chat/css-in-js'; | ||
import { IconButton, ModalBackdrop } from '@rocket.chat/fuselage'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
|
||
import GenericError from '../GenericError/GenericError'; | ||
|
||
const closeButtonStyle = css` | ||
position: absolute; | ||
z-index: 10; | ||
top: 10px; | ||
right: 10px; | ||
`; | ||
|
||
export const ImageGalleryError = ({ onClose }: { onClose: () => void }) => { | ||
const t = useTranslation(); | ||
|
||
return createPortal( | ||
<ModalBackdrop display='flex' justifyContent='center' color='pure-white'> | ||
<GenericError buttonAction={onClose} buttonTitle={t('Close')} /> | ||
<IconButton icon='cross' aria-label='Close gallery' className={closeButtonStyle} onClick={onClose} /> | ||
</ModalBackdrop>, | ||
document.body, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
apps/meteor/client/components/ImageGallery/hooks/useImageGallery.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export { default } from './ImageGallery'; | ||
export * from './ImageGallery'; | ||
export * from './ImageGalleryError'; | ||
export * from './ImageGalleryLoading'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
apps/meteor/client/views/room/ImageGallery/ImageGalleryData.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useContext, useMemo } from 'react'; | ||
|
||
import { ImageGallery, ImageGalleryError, ImageGalleryLoading } from '../../../components/ImageGallery'; | ||
import { ImageGalleryContext } from '../../../contexts/ImageGalleryContext'; | ||
import { useRecordList } from '../../../hooks/lists/useRecordList'; | ||
import { useRoom } from '../contexts/RoomContext'; | ||
import { useImagesList } from './hooks/useImagesList'; | ||
|
||
const ImageGalleryData = () => { | ||
const { _id: rid } = useRoom(); | ||
|
||
const { imageId, onClose } = useContext(ImageGalleryContext); | ||
|
||
const { filesList, loadMoreItems } = useImagesList(useMemo(() => ({ roomId: rid, startingFromId: imageId }), [imageId, rid])); | ||
const { phase, items: images, error } = useRecordList(filesList); | ||
|
||
if (error) { | ||
return <ImageGalleryError onClose={onClose} />; | ||
} | ||
|
||
if (phase === 'loading') { | ||
return <ImageGalleryLoading onClose={onClose} />; | ||
} | ||
|
||
return <ImageGallery images={images} loadMore={() => loadMoreItems(images.length - 1)} onClose={onClose} />; | ||
}; | ||
|
||
export default ImageGalleryData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters