feat: add Giphy support with embed component and power levels state management
This commit is contained in:
@@ -25,7 +25,7 @@ import {
|
||||
VideoContent,
|
||||
VideoFrameThumbnail,
|
||||
} from './message';
|
||||
import { UrlPreviewCard, UrlPreviewHolder, YouTubeEmbed, isYouTubeUrl, TikTokEmbed, isTikTokUrl } from './url-preview';
|
||||
import { UrlPreviewCard, UrlPreviewHolder, YouTubeEmbed, isYouTubeUrl, TikTokEmbed, isTikTokUrl, GiphyEmbed, isGiphyUrl } from './url-preview';
|
||||
import { Image, MediaControl, Video } from './media';
|
||||
import { ImageViewer } from './image-viewer';
|
||||
import { PdfViewer } from './Pdf-viewer';
|
||||
@@ -71,7 +71,8 @@ export function RenderMessageContent({
|
||||
// Separate special URLs from generic ones
|
||||
const youtubeUrls = filteredUrls.filter(isYouTubeUrl);
|
||||
const tiktokUrls = filteredUrls.filter(isTikTokUrl);
|
||||
const otherUrls = filteredUrls.filter((url) => !isYouTubeUrl(url) && !isTikTokUrl(url));
|
||||
const giphyUrls = filteredUrls.filter(isGiphyUrl);
|
||||
const otherUrls = filteredUrls.filter((url) => !isYouTubeUrl(url) && !isTikTokUrl(url) && !isGiphyUrl(url));
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -83,6 +84,10 @@ export function RenderMessageContent({
|
||||
{tiktokUrls.map((url) => (
|
||||
<TikTokEmbed key={url} url={url} />
|
||||
))}
|
||||
{/* Render Giphy embeds */}
|
||||
{giphyUrls.map((url) => (
|
||||
<GiphyEmbed key={url} url={url} />
|
||||
))}
|
||||
{/* Render standard URL previews for other links */}
|
||||
{otherUrls.length > 0 && (
|
||||
<UrlPreviewHolder>
|
||||
@@ -247,6 +252,7 @@ export function RenderMessageContent({
|
||||
mimeType={mimeType}
|
||||
url={url}
|
||||
encInfo={encInfo}
|
||||
autoPlay={mediaAutoLoad}
|
||||
{...props}
|
||||
renderThumbnail={
|
||||
mediaAutoLoad
|
||||
|
||||
Reference in New Issue
Block a user