From 1dd047fb8533b4f0a165667de357c91dbca72ac6 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 21 May 2026 15:02:01 +0300 Subject: [PATCH] fix up other charprogress usage locations --- eslint-suppressions.json | 2 +- src/components/Dialog/index.tsx | 11 +++-- src/components/Dialog/index.web.tsx | 14 +++++-- .../moderation/ReportDialog/index.tsx | 41 +++++++++++-------- src/screens/Takendown.tsx | 8 +--- .../composer/char-progress/CharProgress.tsx | 22 ++++++++++ 6 files changed, 66 insertions(+), 32 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 20427ab32b..b32051fe0b 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -36,7 +36,7 @@ }, "src/components/Dialog/index.web.tsx": { "@typescript-eslint/no-explicit-any": { - "count": 4 + "count": 2 } }, "src/components/DraggableList/index.web.tsx": { diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index af724a4ab2..8b1450cdf8 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -15,7 +15,6 @@ import { Pressable, ScrollView, type StyleProp, - TextInput, View, type ViewStyle, } from 'react-native' @@ -42,7 +41,7 @@ import { type DialogInnerProps, type DialogOuterProps, } from '#/components/Dialog/types' -import {createInput} from '#/components/forms/TextField' +import {Input} from '#/components/forms/TextField' import {useOnKeyboard} from '#/components/hooks/useOnKeyboard' import {IS_ANDROID, IS_IOS, IS_LIQUID_GLASS} from '#/env' import {BottomSheet, BottomSheetSnapPoint} from '../../../modules/bottom-sheet' @@ -51,13 +50,17 @@ import { type BottomSheetStateChangeEvent, } from '../../../modules/bottom-sheet/src/BottomSheet.types' import {type BottomSheetNativeComponent} from '../../../modules/bottom-sheet/src/BottomSheetNativeComponent' - export {useDialogContext, useDialogControl} from '#/components/Dialog/context' export * from '#/components/Dialog/shared' export * from '#/components/Dialog/types' export * from '#/components/Dialog/utils' -export const Input = createInput(TextInput) +export { + /** + * @deprecated use `TextField.Input` from `#/components/forms/TextField` instead + */ + Input, +} export function Outer({ children, diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index 9666e9a7a4..27fc5bd11c 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -32,6 +32,7 @@ import { type DialogInnerProps, type DialogOuterProps, } from '#/components/Dialog/types' +import {Input} from '#/components/forms/TextField' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' import {Portal} from '#/components/Portal' @@ -39,13 +40,20 @@ export {useDialogContext, useDialogControl} from '#/components/Dialog/context' export * from '#/components/Dialog/shared' export * from '#/components/Dialog/types' export * from '#/components/Dialog/utils' -export {Input} from '#/components/forms/TextField' + +export { + /** + * @deprecated use `TextField.Input` from `#/components/forms/TextField` instead + */ + Input, +} // 100 minus 10vh of paddingVertical export const WEB_DIALOG_HEIGHT = '80vh' -const stopPropagation = (e: any) => e.stopPropagation() -const preventDefault = (e: any) => e.preventDefault() +const stopPropagation = (e: {stopPropagation: () => void}) => + e.stopPropagation() +const preventDefault = (e: {preventDefault: () => void}) => e.preventDefault() export function Outer({ children, diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx index 678fd8886a..adcfe332d8 100644 --- a/src/components/moderation/ReportDialog/index.tsx +++ b/src/components/moderation/ReportDialog/index.tsx @@ -24,6 +24,7 @@ import * as Admonition from '#/components/Admonition' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {useGlobalDialogsControlContext} from '#/components/dialogs/Context' +import * as TextField from '#/components/forms/TextField' import {useDelayedLoading} from '#/components/hooks/useDelayedLoading' import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Retry} from '#/components/icons/ArrowRotate' import { @@ -540,30 +541,34 @@ function Inner(props: ReportDialogProps) { {state.detailsOpen && ( - { - dispatch({type: 'setDetails', details}) - }} - label={_(msg`Additional details (limit 300 characters)`)} - style={{paddingRight: 60}} - numberOfLines={4} - /> + + { + dispatch({type: 'setDetails', details}) + }} + label={_( + msg`Additional details (limit 300 characters)`, + )} + style={{paddingRight: 50}} + numberOfLines={4} + /> + + - + )} diff --git a/src/screens/Takendown.tsx b/src/screens/Takendown.tsx index 551f3ba27b..8f27ac0d52 100644 --- a/src/screens/Takendown.tsx +++ b/src/screens/Takendown.tsx @@ -177,14 +177,10 @@ export function Takendown() { max ? '#e60000' : t.atoms.text.color const circleColor = count > max ? '#e60000' : t.palette.primary_500 + + // + if (IS_WEB && count > max) { + return ( + + + {max - count} + + + ) + } + return ( {max - count < 100 && (