Changeset View
Changeset View
Standalone View
Standalone View
web/modals/threads/gallery/thread-settings-media-gallery.react.js
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | const fetchData = async () => { | ||||
}); | }); | ||||
setMediaInfos(result.media); | setMediaInfos(result.media); | ||||
}; | }; | ||||
fetchData(); | fetchData(); | ||||
}, [callFetchThreadMedia, threadID, limit]); | }, [callFetchThreadMedia, threadID, limit]); | ||||
const onClick = React.useCallback( | const onClick = React.useCallback( | ||||
(media: Media) => { | (media: Media) => { | ||||
// This branching is needed for Flow. | const thumbHash = media.thumbnailThumbHash ?? media.thumbHash; | ||||
let mediaInfo; | let mediaInfo = { | ||||
thumbHash, | |||||
dimensions: media.dimensions, | |||||
}; | |||||
if (media.type === 'photo' || media.type === 'video') { | if (media.type === 'photo' || media.type === 'video') { | ||||
const { uri, thumbnailURI } = media; | |||||
mediaInfo = { | mediaInfo = { | ||||
...mediaInfo, | |||||
type: media.type, | type: media.type, | ||||
uri: media.uri, | uri, | ||||
thumbnailURI, | |||||
}; | }; | ||||
} else { | } else { | ||||
const { | |||||
holder, | |||||
encryptionKey, | |||||
thumbnailHolder, | |||||
thumbnailEncryptionKey, | |||||
} = media; | |||||
mediaInfo = { | mediaInfo = { | ||||
...mediaInfo, | |||||
type: media.type, | type: media.type, | ||||
holder: media.holder, | holder, | ||||
encryptionKey: media.encryptionKey, | encryptionKey, | ||||
thumbnailHolder, | |||||
thumbnailEncryptionKey, | |||||
}; | }; | ||||
} | } | ||||
pushModal(<MultimediaModal media={mediaInfo} />); | pushModal(<MultimediaModal media={mediaInfo} />); | ||||
}, | }, | ||||
[pushModal], | [pushModal], | ||||
); | ); | ||||
const filteredMediaInfos = React.useMemo(() => { | const filteredMediaInfos = React.useMemo(() => { | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |