An ATproto social media client -- with an independent Appview.
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move MAX_GRAPHEME_LENGTH to constants.ts (#735)

authored by

Ben Harris and committed by
GitHub
7458b6f6 02392257

+14 -8
+2
src/lib/constants.ts
··· 4 4 export const MAX_DISPLAY_NAME = 64 5 5 export const MAX_DESCRIPTION = 256 6 6 7 + export const MAX_GRAPHEME_LENGTH = 300 8 + 7 9 // Recommended is 100 per: https://www.w3.org/WAI/GL/WCAG20/tests/test3.html 8 10 // but increasing limit per user feedback 9 11 export const MAX_ALT_TEXT = 1000
+2 -3
src/view/com/composer/Composer.tsx
··· 37 37 import {isDesktopWeb, isAndroid} from 'platform/detection' 38 38 import {GalleryModel} from 'state/models/media/gallery' 39 39 import {Gallery} from './photos/Gallery' 40 - 41 - const MAX_GRAPHEME_LENGTH = 300 40 + import {MAX_GRAPHEME_LENGTH} from 'lib/constants' 42 41 43 42 type Props = ComposerOpts & { 44 43 onClose: () => void ··· 310 309 onError={setError} 311 310 accessible={true} 312 311 accessibilityLabel="Write post" 313 - accessibilityHint="Compose posts up to 300 characters in length" 312 + accessibilityHint={`Compose posts up to ${MAX_GRAPHEME_LENGTH} characters in length`} 314 313 /> 315 314 </View> 316 315
+10 -5
src/view/com/composer/char-progress/CharProgress.tsx
··· 7 7 import ProgressPie from 'react-native-progress/Pie' 8 8 import {s} from 'lib/styles' 9 9 import {usePalette} from 'lib/hooks/usePalette' 10 + import {MAX_GRAPHEME_LENGTH} from 'lib/constants' 10 11 11 - const MAX_LENGTH = 300 12 - const DANGER_LENGTH = MAX_LENGTH 12 + const DANGER_LENGTH = MAX_GRAPHEME_LENGTH 13 13 14 14 export function CharProgress({count}: {count: number}) { 15 15 const pal = usePalette('default') ··· 17 17 const circleColor = count > DANGER_LENGTH ? '#e60000' : pal.colors.link 18 18 return ( 19 19 <> 20 - <Text style={[s.mr10, {color: textColor}]}>{MAX_LENGTH - count}</Text> 20 + <Text style={[s.mr10, {color: textColor}]}> 21 + {MAX_GRAPHEME_LENGTH - count} 22 + </Text> 21 23 <View> 22 24 {count > DANGER_LENGTH ? ( 23 25 <ProgressPie ··· 25 27 borderWidth={4} 26 28 borderColor={circleColor} 27 29 color={circleColor} 28 - progress={Math.min((count - MAX_LENGTH) / MAX_LENGTH, 1)} 30 + progress={Math.min( 31 + (count - MAX_GRAPHEME_LENGTH) / MAX_GRAPHEME_LENGTH, 32 + 1, 33 + )} 29 34 /> 30 35 ) : ( 31 36 <ProgressCircle ··· 33 38 borderWidth={1} 34 39 borderColor={pal.colors.border} 35 40 color={circleColor} 36 - progress={count / MAX_LENGTH} 41 + progress={count / MAX_GRAPHEME_LENGTH} 37 42 /> 38 43 )} 39 44 </View>