Turn off the accepted rules and fix the design tokens, alt text, and last type errors. [skip build]
This commit is contained in:
@@ -188,9 +188,10 @@ export function RenderMessageContent({
|
||||
const customRendererEarly = pluginRegistry.getRenderer('message');
|
||||
if (customRendererEarly) {
|
||||
try {
|
||||
const contentEarly = getContent();
|
||||
const messageDataEarly = {
|
||||
msgtype: msgType,
|
||||
...getContent(),
|
||||
...(typeof contentEarly === 'object' && contentEarly !== null ? contentEarly : {}),
|
||||
};
|
||||
const customContentEarly = customRendererEarly(messageDataEarly, () => null);
|
||||
if (customContentEarly) {
|
||||
@@ -367,9 +368,10 @@ export function RenderMessageContent({
|
||||
console.log('[RenderMessageContent] customRenderer function:', typeof customRenderer);
|
||||
if (customRenderer) {
|
||||
try {
|
||||
const content = getContent();
|
||||
const messageData = {
|
||||
msgtype: msgType,
|
||||
...getContent(),
|
||||
...(typeof content === 'object' && content !== null ? content : {}),
|
||||
};
|
||||
console.log('[RenderMessageContent] Calling customRenderer with msgtype:', msgType);
|
||||
console.log('[RenderMessageContent] messageData:', messageData);
|
||||
|
||||
@@ -55,7 +55,7 @@ export function RouteTransition({ children }: RouteTransitionProps) {
|
||||
const location = useLocation();
|
||||
const [displayLocation, setDisplayLocation] = useState(location);
|
||||
const [transitionStage, setTransitionStage] = useState<'entering' | 'exiting' | 'idle'>('idle');
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout>>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname !== displayLocation.pathname) {
|
||||
|
||||
@@ -15,12 +15,12 @@ export interface AuthenticatedMediaProps extends Omit<ImgHTMLAttributes<HTMLImag
|
||||
* and renders them as blob URLs.
|
||||
*/
|
||||
export const AuthenticatedMedia = forwardRef<HTMLImageElement, AuthenticatedMediaProps>(
|
||||
({ src, useAuthentication: useAuthOverride, ...props }, ref) => {
|
||||
({ src, alt, useAuthentication: useAuthOverride, ...props }, ref) => {
|
||||
const useAuthFromServer = useMediaAuthentication();
|
||||
const useAuthentication = useAuthOverride ?? useAuthFromServer;
|
||||
const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication);
|
||||
|
||||
return <img ref={ref} {...props} src={authenticatedSrc} />;
|
||||
return <img ref={ref} alt={alt} {...props} src={authenticatedSrc} />;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -33,11 +33,11 @@ AuthenticatedMedia.displayName = 'AuthenticatedMedia';
|
||||
export type AuthenticatedImgProps = ImgHTMLAttributes<HTMLImageElement>;
|
||||
|
||||
export const AuthenticatedImg = forwardRef<HTMLImageElement, AuthenticatedImgProps>(
|
||||
({ src, ...props }, ref) => {
|
||||
({ src, alt, ...props }, ref) => {
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication);
|
||||
|
||||
return <img ref={ref} {...props} src={authenticatedSrc} />;
|
||||
return <img ref={ref} alt={alt} {...props} src={authenticatedSrc} />;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ export function EmojiBoard({
|
||||
const usage = emojiTab ? ImageUsage.Emoticon : ImageUsage.Sticker;
|
||||
|
||||
// Get default emoji - use most used or fallback to slight_smile
|
||||
const defaultPreview = useMemo((): PreviewData => {
|
||||
const defaultPreview = useMemo((): PreviewData | undefined => {
|
||||
if (!emojiTab) return undefined;
|
||||
|
||||
const mostUsedShortcode = getMostUsedEmoji();
|
||||
|
||||
@@ -43,7 +43,6 @@ export const Video = forwardRef<HTMLVideoElement, VideoProps>(
|
||||
|
||||
if (disableControls) {
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/media-has-caption
|
||||
<video
|
||||
className={classNames(css.Video, className)}
|
||||
{...props}
|
||||
@@ -61,7 +60,7 @@ export const Video = forwardRef<HTMLVideoElement, VideoProps>(
|
||||
onMouseEnter={() => setShowControls(true)}
|
||||
onMouseLeave={() => setShowControls(false)}
|
||||
>
|
||||
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
|
||||
{}
|
||||
<video
|
||||
className={classNames(css.Video, className)}
|
||||
{...props}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable jsx-a11y/media-has-caption */
|
||||
import React, { ReactNode, useCallback, useRef, useState } from 'react';
|
||||
import { Badge, Chip, IconButton, ProgressBar, Spinner, Text, toRem } from 'folds';
|
||||
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
*/
|
||||
const fetchAuthenticatedMedia = async (
|
||||
url: string,
|
||||
accessToken: string | null,
|
||||
accessToken: string | undefined,
|
||||
): Promise<string> => {
|
||||
try {
|
||||
let response = await fetch(url, {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { getCurrentAccessToken } from '../../../utils/auth';
|
||||
*/
|
||||
const fetchAuthenticatedMedia = async (
|
||||
url: string,
|
||||
accessToken: string | null,
|
||||
accessToken: string | undefined,
|
||||
): Promise<string> => {
|
||||
try {
|
||||
let response = await fetch(url, {
|
||||
@@ -69,6 +69,8 @@ export function ThumbnailContent({ info, renderImage }: ThumbnailContentProps) {
|
||||
|
||||
const [thumbSrcState, loadThumbSrc] = useAsyncCallback(
|
||||
useCallback(async () => {
|
||||
if (!thumbMxcUrl) return undefined;
|
||||
|
||||
const encInfo = info.thumbnail_file;
|
||||
|
||||
const mediaUrl = mxcUrlToHttp(mx, thumbMxcUrl, useAuthentication) ?? thumbMxcUrl;
|
||||
@@ -77,7 +79,7 @@ export function ThumbnailContent({ info, renderImage }: ThumbnailContentProps) {
|
||||
if (encInfo) {
|
||||
const fileContent = await downloadEncryptedMedia(
|
||||
mediaUrl,
|
||||
(encBuf) => decryptFile(encBuf, thumbInfo.mimetype ?? FALLBACK_MIMETYPE, encInfo),
|
||||
(encBuf) => decryptFile(encBuf, thumbInfo?.mimetype ?? FALLBACK_MIMETYPE, encInfo),
|
||||
accessToken,
|
||||
);
|
||||
return URL.createObjectURL(fileContent);
|
||||
@@ -99,5 +101,7 @@ export function ThumbnailContent({ info, renderImage }: ThumbnailContentProps) {
|
||||
}
|
||||
}, [hasValidThumbnail, loadThumbSrc]);
|
||||
|
||||
return thumbSrcState.status === AsyncStatus.Success ? renderImage(thumbSrcState.data) : null;
|
||||
return thumbSrcState.status === AsyncStatus.Success && thumbSrcState.data
|
||||
? renderImage(thumbSrcState.data)
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
MatrixClient,
|
||||
RoomEvent,
|
||||
ClientEvent,
|
||||
EventType,
|
||||
MatrixEvent,
|
||||
Room,
|
||||
IPushRules,
|
||||
@@ -24,7 +25,6 @@ import { roomToParentsAtom } from '../../state/room/roomToParents';
|
||||
import { mDirectAtom } from '../../state/mDirectList';
|
||||
import { getDirectRoomPath, getHomeRoomPath, getSpaceRoomPath } from '../../pages/pathUtils';
|
||||
import { RoomNotificationMode } from '../../hooks/useRoomsNotificationPreferences';
|
||||
import { AccountDataEvent } from '../../../types/matrix/accountData';
|
||||
import { getNotificationMode, NotificationMode } from '../../hooks/useNotificationMode';
|
||||
import { useSyncState } from '../../hooks/useSyncState';
|
||||
import { useBackRoute } from '../../hooks/useBackRoute';
|
||||
@@ -107,10 +107,10 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
}
|
||||
|
||||
// We can't use hooks here, so we'll fetch the data directly
|
||||
const userId = mx.getUserId();
|
||||
const userId = mx.getUserId() ?? undefined;
|
||||
|
||||
// Get push rules for keywords
|
||||
const pushRulesEvt = mx.getAccountData(AccountDataEvent.PushRules);
|
||||
const pushRulesEvt = mx.getAccountData(EventType.PushRules);
|
||||
const pushRules = pushRulesEvt?.getContent<IPushRules>() ?? { global: {} };
|
||||
const content = pushRules.global.content ?? [];
|
||||
const keywordPatterns = content
|
||||
@@ -600,7 +600,6 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
const path = [...parentChain, roomName];
|
||||
|
||||
return path.join(' > ');
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [mx, roomId, roomToParents, mDirects, updateCounter]);
|
||||
|
||||
// Get total unread count
|
||||
@@ -608,7 +607,6 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
if (!mx) return 0;
|
||||
const unreadInfos = getUnreadInfos(mx);
|
||||
return unreadInfos.reduce((sum, info) => sum + info.total, 0);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [mx, updateCounter]);
|
||||
|
||||
// Build title parts
|
||||
|
||||
@@ -43,7 +43,6 @@ function PreviewVideo({ fileItem }: PreviewVideoProps) {
|
||||
const fileUrl = useObjectURL(originalFile);
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/media-has-caption
|
||||
<video
|
||||
style={{
|
||||
objectFit: 'contain',
|
||||
|
||||
Reference in New Issue
Block a user