Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix composer char progress layout #5620

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/view/com/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,16 @@ export const ComposePost = ({
)}
<View
style={[
a.flex_row,
a.py_xs,
{paddingLeft: 7, paddingRight: 16},
a.align_center,
a.border_t,
t.atoms.bg,
t.atoms.border_contrast_medium,
styles.bottomBar,
a.justify_between,
]}>
<View style={[a.flex_row, a.align_center]}>
{videoState.status !== 'idle' && videoState.status !== 'done' ? (
<VideoUploadToolbar state={videoState} />
) : (
Expand All @@ -885,7 +891,10 @@ export const ComposePost = ({
disabled={!canSelectImages || images?.length > 0}
setError={setError}
/>
<OpenCameraBtn disabled={!canSelectImages} onAdd={onImageAdd} />
<OpenCameraBtn
disabled={!canSelectImages}
onAdd={onImageAdd}
/>
<SelectGifBtn
onClose={focusTextInput}
onSelectGif={onSelectGif}
Expand All @@ -906,9 +915,11 @@ export const ComposePost = ({
) : null}
</ToolbarWrapper>
)}
<View style={a.flex_1} />
</View>
<View style={[a.flex_row, a.align_center, a.justify_between]}>
<SelectLangBtn />
<CharProgress count={graphemeLength} />
<CharProgress count={graphemeLength} style={{width: 65}} />
</View>
</View>
</View>
<Prompt.Basic
Expand Down Expand Up @@ -1128,15 +1139,6 @@ const styles = StyleSheet.create({
marginHorizontal: 10,
marginBottom: 4,
},
bottomBar: {
flexDirection: 'row',
paddingVertical: 4,
// should be 8 but due to visual alignment we have to fudge it
paddingLeft: 7,
paddingRight: 16,
alignItems: 'center',
borderTopWidth: StyleSheet.hairlineWidth,
},
})

function ErrorBanner({
Expand Down
9 changes: 4 additions & 5 deletions src/view/com/composer/char-progress/CharProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ProgressPie from 'react-native-progress/Pie'

import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
import {usePalette} from '#/lib/hooks/usePalette'
import {s} from '#/lib/styles'
import {atoms as a} from '#/alf'
import {Text} from '../../util/text/Text'

export function CharProgress({
Expand All @@ -28,11 +28,11 @@ export function CharProgress({
const textColor = count > maxLength ? '#e60000' : pal.colors.text
const circleColor = count > maxLength ? '#e60000' : pal.colors.link
return (
<View style={style}>
<Text style={[s.mr10, s.tabularNum, {color: textColor}, textStyle]}>
<View
style={[a.flex_row, a.align_center, a.justify_between, a.gap_sm, style]}>
<Text style={[{color: textColor}, a.flex_grow, a.text_right, textStyle]}>
{maxLength - count}
</Text>
<View>
{count > maxLength ? (
<ProgressPie
size={size ?? 30}
Expand All @@ -51,6 +51,5 @@ export function CharProgress({
/>
)}
</View>
</View>
)
}
Loading