Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -51,14 +51,7 @@ export const GiphyEmbed = as<'div', GiphyEmbedProps>(({ url, ...props }, ref) =>
|
||||
|
||||
return (
|
||||
<div className={css.GiphyEmbed} {...props} ref={ref}>
|
||||
<video
|
||||
className={css.GiphyVideo}
|
||||
src={mediaUrl}
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
/>
|
||||
<video className={css.GiphyVideo} src={mediaUrl} autoPlay loop muted playsInline />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -62,7 +62,7 @@ async function fetchTikTokOEmbed(url: string): Promise<{
|
||||
videoId: string | null;
|
||||
} | null> {
|
||||
try {
|
||||
const electron = (window as any).electron;
|
||||
const { electron } = window as any;
|
||||
let data;
|
||||
if (electron?.tiktok?.getOEmbed) {
|
||||
data = await electron.tiktok.getOEmbed(url);
|
||||
|
||||
@@ -22,7 +22,7 @@ const linkStyles = { color: color.Success.Main };
|
||||
* Click handler for external links - uses Tauri shell on desktop/mobile
|
||||
*/
|
||||
const handleExternalLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
||||
const href = e.currentTarget.href;
|
||||
const { href } = e.currentTarget;
|
||||
if (href && (href.startsWith('http://') || href.startsWith('https://'))) {
|
||||
e.preventDefault();
|
||||
openExternalUrl(href);
|
||||
@@ -32,21 +32,21 @@ const handleExternalLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
||||
/**
|
||||
* Preview image component with authentication support
|
||||
*/
|
||||
const AuthenticatedUrlPreviewImg = ({
|
||||
function AuthenticatedUrlPreviewImg({
|
||||
src,
|
||||
useAuthentication,
|
||||
...props
|
||||
}: React.ComponentProps<typeof UrlPreviewImg> & { useAuthentication: boolean }) => {
|
||||
}: React.ComponentProps<typeof UrlPreviewImg> & { useAuthentication: boolean }) {
|
||||
const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication);
|
||||
return <UrlPreviewImg src={authenticatedSrc} {...props} />;
|
||||
};
|
||||
}
|
||||
|
||||
export const UrlPreviewCard = as<'div', { url: string; ts: number }>(
|
||||
({ url, ts, ...props }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const [previewStatus, loadPreview] = useAsyncCallback(
|
||||
useCallback(() => mx.getUrlPreview(url, ts), [url, ts, mx])
|
||||
useCallback(() => mx.getUrlPreview(url, ts), [url, ts, mx]),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -74,8 +74,7 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number }>(
|
||||
// SVGs can't be thumbnailed by Matrix servers, load them directly
|
||||
// Also check og:image:type if available
|
||||
const isSvg =
|
||||
ogImage.toLowerCase().endsWith('.svg') ||
|
||||
prev['og:image:type'] === 'image/svg+xml';
|
||||
ogImage.toLowerCase().endsWith('.svg') || prev['og:image:type'] === 'image/svg+xml';
|
||||
const imgUrl = isSvg
|
||||
? mxcUrlToHttp(mx, ogImage, useAuthentication)
|
||||
: mxcUrlToHttp(mx, ogImage, useAuthentication, 256, 256, 'scale', false);
|
||||
@@ -128,7 +127,7 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number }>(
|
||||
)}
|
||||
</UrlPreview>
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export const UrlPreviewHolder = as<'div'>(({ children, ...props }, ref) => {
|
||||
@@ -156,8 +155,8 @@ export const UrlPreviewHolder = as<'div'>(({ children, ...props }, ref) => {
|
||||
root: scrollRef.current,
|
||||
rootMargin: '10px',
|
||||
}),
|
||||
[]
|
||||
)
|
||||
[],
|
||||
),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -112,7 +112,7 @@ const handleExternalLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
||||
}
|
||||
};
|
||||
|
||||
type PlayerState =
|
||||
type PlayerState =
|
||||
| { status: 'thumbnail' }
|
||||
| { status: 'loading' }
|
||||
| { status: 'playing'; videoUrl: string; title: string }
|
||||
@@ -135,7 +135,7 @@ export const YouTubeEmbed = as<'div', YouTubeEmbedProps>(({ url, ...props }, ref
|
||||
// Fetch video title on mount
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
|
||||
fetchYouTubeTitle(url).then((title) => {
|
||||
if (!cancelled) {
|
||||
setVideoTitle(title);
|
||||
@@ -199,17 +199,13 @@ export const YouTubeEmbed = as<'div', YouTubeEmbedProps>(({ url, ...props }, ref
|
||||
return (
|
||||
<Box shrink="No" className={css.YouTubeEmbed} direction="Column" {...props} ref={ref}>
|
||||
{renderHeader(getHeaderLabel())}
|
||||
<button
|
||||
<button
|
||||
type="button"
|
||||
className={css.YouTubeThumbnailButton}
|
||||
onClick={handlePlay}
|
||||
aria-label="Play video"
|
||||
>
|
||||
<img
|
||||
src={thumbnailUrl}
|
||||
alt="Video thumbnail"
|
||||
className={css.YouTubeThumbnail}
|
||||
/>
|
||||
<img src={thumbnailUrl} alt="Video thumbnail" className={css.YouTubeThumbnail} />
|
||||
<div className={css.YouTubePlayButton}>
|
||||
<Icon size="600" src={Icons.Play} />
|
||||
</div>
|
||||
@@ -223,9 +219,9 @@ export const YouTubeEmbed = as<'div', YouTubeEmbedProps>(({ url, ...props }, ref
|
||||
return (
|
||||
<Box shrink="No" className={css.YouTubeEmbed} direction="Column" {...props} ref={ref}>
|
||||
{renderHeader(getHeaderLabel('- Loading...'))}
|
||||
<Box
|
||||
className={css.YouTubeEmbedIframe}
|
||||
alignItems="Center"
|
||||
<Box
|
||||
className={css.YouTubeEmbedIframe}
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
style={{ background: '#000', display: 'flex' }}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user