Address lints

This commit is contained in:
niki committed 2026-06-29 17:50:42 +03:00
1 parent ab23f571e6
commit 9dd1d0df22
6 files changed
+31 -28

No files matched your search

@@ -57,11 +57,14 @@ import {
EmojiGroup,
EmojiBoardLayout,
} from './components';
import { EmojiBoardTab, EmojiType, GifData } from './types';
import { GitDiffIcon } from '@phosphor-icons/react';
import type { GifData } from './types';
import { EmojiBoardTab, EmojiType } from './types';
import { useClientConfig } from '$hooks/useClientConfig';
import { useFavoriteGifs } from '$hooks/useFavoriteGifs';
/* oxlint-disable typescript/no-explicit-any */
// TODO: type klipy api properly
const RECENT_GROUP_ID = 'recent_group';
const SEARCH_GROUP_ID = 'search_group';
@@ -596,7 +599,7 @@ export function EmojiBoard({
setLoading(false);
}
},
[parseKlipyResult]
[parseKlipyResult, klipyApiKey]
);
return { gifs, loading, error, searchGifs };
@@ -844,7 +847,7 @@ export function EmojiBoard({
<GifStatus
loading={gifsLoading}
error={gifsError}
isEmpty={groups.flatMap((v) => v.items.map((i) => 'gif')).length === 0}
isEmpty={groups.flatMap((v) => v.items.map(() => 'gif')).length === 0}
/>
)}
</EmojiGroupHolder>
@@ -3,14 +3,15 @@ import type { MatrixClient } from '$types/matrix-sdk';
import type { PackImageReader } from '$plugins/custom-emoji';
import type { IEmoji } from '$plugins/emoji';
import { mxcUrlToHttp } from '$utils/matrix';
import { EmojiItemInfo, EmojiType, GifData } from '$components/emoji-board/types';
import { CSSProperties, ReactNode, useEffect, useState } from 'react';
import type { EmojiItemInfo, GifData } from '$components/emoji-board/types';
import { EmojiType } from '$components/emoji-board/types';
import type { CSSProperties, ReactNode } from 'react';
import { useEffect, useState } from 'react';
import * as css from './styles.css';
import { useFavoriteGifs } from '$hooks/useFavoriteGifs';
import { Star, menuIcon } from '$components/icons/phosphor';
import { MATRIX_SABLE_UNSTABLE_FAVORITE_GIFS } from '$unstable/prefixes';
import { useMatrixClient } from '$hooks/useMatrixClient';
import classNames from 'classnames';
const ANIMATED_MIME_TYPES = new Set(['image/gif', 'image/apng']);
@@ -48,8 +48,6 @@ import {
MATRIX_SABLE_UNSTABLE_FAVORITE_GIFS,
MATRIX_UNSTABLE_BLUR_HASH_PROPERTY_NAME,
} from '../../../../unstable/prefixes';
import { useAccountData } from '$hooks/useAccountData';
import { AccountDataEvents, IContent } from 'matrix-js-sdk';
import { useFavoriteGifs } from '$hooks/useFavoriteGifs';
function thumbnailDimsForMaxEdge(
+18 -17
View File
@@ -64,7 +64,8 @@ import {
BlockType,
} from '$components/editor';
import { plainToEditorInput } from '$components/editor/input';
import { EmojiBoard, EmojiBoardTab, GifData } from '$components/emoji-board';
import type { GifData } from '$components/emoji-board';
import { EmojiBoard, EmojiBoardTab } from '$components/emoji-board';
import { UseStateProvider } from '$components/UseStateProvider';
import type { TUploadContent } from '$utils/matrix';
import { encryptFile, getImageInfo, mxcUrlToHttp, toggleReaction } from '$utils/matrix';
@@ -273,6 +274,22 @@ interface RoomInputProps {
onEditLastMessage?: () => void;
}
function toBase64Url(value: string): string {
const bytes = new TextEncoder().encode(value);
let binary = '';
for (const byte of bytes) {
binary += String.fromCodePoint(byte);
}
return btoa(binary).replaceAll('+', '-').replaceAll('/', '_').replaceAll(/=+$/g, '');
}
function toMatrixID(fname: string, urlPrefix: string): string {
const base64 = toBase64Url(fname);
return urlPrefix + base64;
}
export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
({ editor, fileDropContainerRef, roomId, room, threadRootId, onEditLastMessage }, ref) => {
// When in thread mode, isolate drafts by thread root ID so thread replies
@@ -1308,22 +1325,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
};
const handleGifSelect = async (gif: GifData) => {
function toBase64Url(value: string): string {
const bytes = new TextEncoder().encode(value);
let binary = '';
for (const byte of bytes) {
binary += String.fromCodePoint(byte);
}
return btoa(binary).replaceAll('+', '-').replaceAll('/', '_').replaceAll(/=+$/g, '');
}
function toMatrixID(fname: string, prefix: string): string {
const base64 = toBase64Url(fname);
return prefix + base64;
}
let url = gif.url.startsWith('mxc://')
? gif.url
: `mxc://${clientConfig.gifs?.proxyUrl ?? ''}/${toMatrixID(gif.url.slice('https://static.klipy.com/ii/'.length), 'klipy_')}`;
+1 -1
View File
@@ -1,4 +1,4 @@
import { AccountDataEvents } from 'matrix-js-sdk';
import type { AccountDataEvents } from 'matrix-js-sdk';
import { MATRIX_SABLE_UNSTABLE_FAVORITE_GIFS } from '../../unstable/prefixes';
import { useAccountData } from './useAccountData';
+1 -1
View File
@@ -6,7 +6,7 @@ import type { MemberPowerTag } from '$types/matrix/room';
import type { RoomAbbreviationsContent } from '$utils/abbreviations';
import type { PronounSet } from '$utils/pronouns';
import type * as prefix from '$unstable/prefixes';
import { GifData } from '$components/emoji-board';
import type { GifData } from '$components/emoji-board';
type PowerLevelTagsEventContent = Record<number, MemberPowerTag>;