From 5e61230a240a75782ed86546ccee578f99be2d95 Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:14:29 -0700 Subject: [PATCH] Fun picker fixes --- stylesheets/components/CompositionTextArea.scss | 2 +- ts/components/CompositionTextArea.tsx | 2 +- ts/components/DraftGifMessageSendModal.tsx | 2 +- ts/components/fun/base/FunImage.tsx | 2 ++ ts/components/fun/data/emojis.ts | 8 ++++++-- ts/state/ducks/composer.ts | 5 ++++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/stylesheets/components/CompositionTextArea.scss b/stylesheets/components/CompositionTextArea.scss index 3e1e4f450..9d277dec2 100644 --- a/stylesheets/components/CompositionTextArea.scss +++ b/stylesheets/components/CompositionTextArea.scss @@ -35,7 +35,7 @@ &__input__scroller { max-height: 300px; - min-height: 300px; + min-height: 100px; padding: 16px; // Need more padding on the right to make room for floating emoji button padding-inline-end: 36px; diff --git a/ts/components/CompositionTextArea.tsx b/ts/components/CompositionTextArea.tsx index 7e45fb764..0da7d297b 100644 --- a/ts/components/CompositionTextArea.tsx +++ b/ts/components/CompositionTextArea.tsx @@ -141,7 +141,7 @@ export function CompositionTextArea({ isActive={isActive} isFormattingEnabled={isFormattingEnabled} inputApi={inputApiRef} - large + large={false} moduleClassName="CompositionTextArea__input" onEditorStateChange={handleChange} onPickEmoji={onPickEmoji} diff --git a/ts/components/DraftGifMessageSendModal.tsx b/ts/components/DraftGifMessageSendModal.tsx index ce3c39bf0..450a08586 100644 --- a/ts/components/DraftGifMessageSendModal.tsx +++ b/ts/components/DraftGifMessageSendModal.tsx @@ -84,7 +84,7 @@ export function DraftGifMessageSendModal( state={props.gifDownloadState.loadingState} width={props.gifSelection.width} height={props.gifSelection.height} - maxHeight={200} + maxHeight={256} aria-label={props.gifSelection.title} aria-describedby={descriptionId} /> diff --git a/ts/components/fun/base/FunImage.tsx b/ts/components/fun/base/FunImage.tsx index 6605c5e78..50d5505e9 100644 --- a/ts/components/fun/base/FunImage.tsx +++ b/ts/components/fun/base/FunImage.tsx @@ -39,6 +39,8 @@ const FunImageBase = forwardRef(function FunImageBase( width={props.width} height={props.height} draggable={false} + decoding="async" + loading="lazy" /> ); }); diff --git a/ts/components/fun/data/emojis.ts b/ts/components/fun/data/emojis.ts index 4514502e9..3e5134231 100644 --- a/ts/components/fun/data/emojis.ts +++ b/ts/components/fun/data/emojis.ts @@ -5,6 +5,7 @@ import { sortBy } from 'lodash'; import { useEffect, useMemo, useState } from 'react'; import { z } from 'zod'; import * as log from '../../../logging/log'; +import * as Errors from '../../../types/errors'; import type { LocaleEmojiListType } from '../../../types/emoji'; import type { LocalizerType } from '../../../types/I18N'; import { strictAssert } from '../../../util/assert'; @@ -569,7 +570,7 @@ function createEmojiSearchIndex( const FuseKeys: Array = [ { name: 'shortName', weight: 100 }, - // { name: 'shortNames', weight: 1 }, + { name: 'shortNames', weight: 1 }, { name: 'emoticon', weight: 50 }, { name: 'emoticons', weight: 1 }, ]; @@ -648,7 +649,10 @@ export function useEmojiSearch(i18n: LocalizerType): EmojiSearch { setLocaleIndex(result); } } catch (error) { - log.error(`Failed to get localized emoji list for ${locale}`, error); + log.error( + `Failed to get localized emoji list for ${locale}`, + Errors.toLogFormat(error) + ); } } diff --git a/ts/state/ducks/composer.ts b/ts/state/ducks/composer.ts index 24593cf80..4bfc9e286 100644 --- a/ts/state/ducks/composer.ts +++ b/ts/state/ducks/composer.ts @@ -402,6 +402,7 @@ export function saveDraftRecordingIfNeeded(): ThunkAction< type WithPreSendChecksOptions = Readonly<{ message?: string; voiceNoteAttachment?: InMemoryAttachmentDraftType; + draftAttachments?: ReadonlyArray; }>; async function withPreSendChecks( @@ -425,6 +426,8 @@ async function withPreSendChecks( ]); const { message, voiceNoteAttachment } = options; + const draftAttachments = + options.draftAttachments ?? conversation.attributes.draftAttachments; try { dispatch(setComposerDisabledState(conversationId, true)); @@ -457,7 +460,7 @@ async function withPreSendChecks( if ( !message?.length && - !hasDraftAttachments(conversation.attributes.draftAttachments, { + !hasDraftAttachments(draftAttachments, { includePending: false, }) && !voiceNoteAttachment