feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from 'react-native'
|
||||
import { useIsFocused } from '@react-navigation/native'
|
||||
import { useI18n, type TranslationKey } from '@d3ro/i18n'
|
||||
import { ACTION_BUTTON_MAX_WIDTH_DP, useResponsiveLayout } from '@d3ro/ui-native'
|
||||
import type {
|
||||
DictationTemplateField,
|
||||
DocumentTemplateType,
|
||||
|
|
@ -136,6 +137,7 @@ export default function TemplatesScreen({
|
|||
const { t } = useI18n()
|
||||
const { user } = useAuth()
|
||||
const { palette } = useMobilePreferences()
|
||||
const { gridColumns, wideContentMaxWidth } = useResponsiveLayout()
|
||||
const styles = useMemo(() => createStyles(palette), [palette])
|
||||
const generation = useRef(0)
|
||||
const realtimeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
|
|
@ -335,7 +337,11 @@ export default function TemplatesScreen({
|
|||
const busy = busyId === item.id
|
||||
return (
|
||||
<ThemeCard
|
||||
style={[styles.card, selected && styles.cardSelected]}
|
||||
style={[
|
||||
styles.card,
|
||||
gridColumns > 1 && styles.cardGridItem,
|
||||
selected && styles.cardSelected,
|
||||
]}
|
||||
testID={`template-${item.id}`}
|
||||
>
|
||||
<View style={styles.cardHeader}>
|
||||
|
|
@ -390,7 +396,7 @@ export default function TemplatesScreen({
|
|||
</View>
|
||||
</ThemeCard>
|
||||
)
|
||||
}, [busyId, choose, confirmDelete, selections, styles, t])
|
||||
}, [busyId, choose, confirmDelete, gridColumns, selections, styles, t])
|
||||
|
||||
const empty = loading ? (
|
||||
<View style={styles.center} testID="templates-loading">
|
||||
|
|
@ -426,7 +432,7 @@ export default function TemplatesScreen({
|
|||
<ThemeText variant="small" color="muted">{t('mobile.templates.realtimeWaiting')}</ThemeText>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.controls}>
|
||||
<View style={[styles.controls, { maxWidth: wideContentMaxWidth }]}>
|
||||
<View style={styles.tabs} accessibilityRole="tablist">
|
||||
{(['dictation', 'meeting_document'] as const).map((value) => {
|
||||
const active = value === kind
|
||||
|
|
@ -463,10 +469,15 @@ export default function TemplatesScreen({
|
|||
</View>
|
||||
)}
|
||||
<FlatList
|
||||
key={`templates-cols-${gridColumns}`}
|
||||
data={templates}
|
||||
numColumns={gridColumns}
|
||||
columnWrapperStyle={gridColumns > 1 ? styles.columnRow : undefined}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={renderTemplate}
|
||||
contentContainerStyle={templates.length === 0 ? styles.emptyList : styles.list}
|
||||
contentContainerStyle={templates.length === 0
|
||||
? [styles.emptyList, { maxWidth: wideContentMaxWidth }]
|
||||
: [styles.list, { maxWidth: wideContentMaxWidth }]}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
refreshControl={(
|
||||
<RefreshControl
|
||||
|
|
@ -678,24 +689,26 @@ function createStyles(palette: Palette): ReturnType<typeof StyleSheet.create> {
|
|||
},
|
||||
headerText: { flex: 1, gap: 4 },
|
||||
banner: { paddingHorizontal: 20, paddingVertical: 8, backgroundColor: palette.accent.dim },
|
||||
controls: { padding: 16, gap: 10, borderBottomWidth: 1, borderBottomColor: palette.border.subtle },
|
||||
controls: { padding: 16, width: '100%', alignSelf: 'center', gap: 10, borderBottomWidth: 1, borderBottomColor: palette.border.subtle },
|
||||
tabs: { flexDirection: 'row', gap: 8 },
|
||||
tab: { flex: 1, minHeight: 48, alignItems: 'center', justifyContent: 'center', borderRadius: 9, borderWidth: 1, borderColor: palette.border.default },
|
||||
tabActive: { backgroundColor: palette.accent.main, borderColor: palette.accent.main },
|
||||
input: { minHeight: 48, borderWidth: 1, borderColor: palette.border.default, borderRadius: 10, backgroundColor: palette.bg.inset, color: palette.text.primary, paddingHorizontal: 12, fontSize: 14 },
|
||||
inlineError: { padding: 12, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10, borderBottomWidth: 1, borderBottomColor: palette.tag.red },
|
||||
list: { padding: 16, gap: 12, paddingBottom: 36 },
|
||||
emptyList: { flexGrow: 1 },
|
||||
inlineError: { padding: 12, width: '100%', alignSelf: 'center', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10, borderBottomWidth: 1, borderBottomColor: palette.tag.red },
|
||||
list: { padding: 16, gap: 12, paddingBottom: 36, width: '100%', alignSelf: 'center' },
|
||||
columnRow: { gap: 12 },
|
||||
emptyList: { flexGrow: 1, width: '100%', alignSelf: 'center' },
|
||||
center: { flex: 1, minHeight: 260, alignItems: 'center', justifyContent: 'center', gap: 14, padding: 32 },
|
||||
centerText: { textAlign: 'center' },
|
||||
card: { gap: 12 },
|
||||
cardGridItem: { flex: 1 },
|
||||
cardSelected: { borderColor: palette.accent.main, borderWidth: 1 },
|
||||
cardHeader: { flexDirection: 'row', alignItems: 'flex-start', gap: 10 },
|
||||
cardTitle: { flex: 1, gap: 5 },
|
||||
titleRow: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 8 },
|
||||
badge: { paddingHorizontal: 8, paddingVertical: 3, borderRadius: 999, backgroundColor: palette.accent.dim },
|
||||
actions: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
||||
flexButton: { flex: 1 },
|
||||
flexButton: { flex: 1, maxWidth: ACTION_BUTTON_MAX_WIDTH_DP },
|
||||
modalBackdrop: { flex: 1, justifyContent: 'center', padding: 16, backgroundColor: palette.scrim },
|
||||
modalList: { width: '100%', maxWidth: 680, maxHeight: '94%', alignSelf: 'center', borderRadius: 14, backgroundColor: palette.bg.card },
|
||||
modalCard: { padding: 18, gap: 14 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue