Files
Momento/memento-mobile/components/BottomSheet.tsx
Antigravity 96e7902f01
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m22s
CI / Deploy production (on server) (push) Has been skipped
feat: publication IA (magazine/brief/essay) + fixes critique
Publication IA:
- 4 templates (magazine, brief, essay, simple) avec CSS riche
- Rewrite IA (article/exercises/tutorial/reference/mixed)
- Modération avec timeout 12s + fallback safe
- Quotas publish_enhance par tier (basic=2, pro=15, business=100)
- Détection contenu stale (hash)
- Migration DB publishedContent/publishedTemplate/publishedSourceHash

Fixes:
- cheerio v1.2: Element -> AnyNode (domhandler), decodeEntities cast
- _isShared ajouté au type Note (champ virtuel serveur)
- callout colors PDF export: extraction fonction pure testable
- admin/published: guard note.userId null
- Cmd+S fonctionne en mode dialog (pas seulement fullPage)

i18n:
- 23 clés publish* traduites dans les 15 locales
- Extension Web Clipper: 13 locales mise à jour

Tests:
- callout-colors.test.ts (6 tests)
- note-visible-in-view.test.ts (5 tests)
- entitlements.test.ts + byok-entitlements.test.ts: mock usageLog + unstubAllEnvs
- 199/199 tests passent

Tracker: user-stories.md sync avec sprint-status.yaml
2026-06-28 07:32:57 +00:00

81 lines
2.8 KiB
TypeScript

/**
* BottomSheet — modal bas d'écran respectant le design Memento
* Usage:
* <BottomSheet visible={v} onClose={() => setV(false)} title="Titre">
* ...children
* </BottomSheet>
*/
import { useEffect, useRef } from 'react'
import {
View, Text, Modal, TouchableOpacity, Animated,
Pressable, StyleSheet,
} from 'react-native'
import { X } from 'lucide-react-native'
import { C } from '@/lib/theme'
interface Props {
visible: boolean
onClose: () => void
title?: string
children: React.ReactNode
}
export function BottomSheet({ visible, onClose, title, children }: Props) {
const translateY = useRef(new Animated.Value(400)).current
const opacity = useRef(new Animated.Value(0)).current
useEffect(() => {
if (visible) {
Animated.parallel([
Animated.spring(translateY, { toValue: 0, useNativeDriver: true, damping: 20, stiffness: 200 }),
Animated.timing(opacity, { toValue: 1, duration: 200, useNativeDriver: true }),
]).start()
} else {
Animated.parallel([
Animated.timing(translateY, { toValue: 400, duration: 220, useNativeDriver: true }),
Animated.timing(opacity, { toValue: 0, duration: 200, useNativeDriver: true }),
]).start()
}
}, [visible])
return (
<Modal visible={visible} transparent animationType="none" onRequestClose={onClose}>
<Animated.View style={[s.overlay, { opacity }]}>
<Pressable style={StyleSheet.absoluteFill} onPress={onClose} />
<Animated.View style={[s.sheet, { transform: [{ translateY }] }]}>
{/* Handle bar */}
<View style={s.handle} />
{title && (
<View style={s.titleRow}>
<Text style={s.title}>{title}</Text>
<TouchableOpacity onPress={onClose} style={s.closeBtn} hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}>
<X size={18} color={C.concrete} />
</TouchableOpacity>
</View>
)}
{children}
</Animated.View>
</Animated.View>
</Modal>
)
}
const s = StyleSheet.create({
overlay: { flex: 1, backgroundColor: 'rgba(26,26,24,0.5)', justifyContent: 'flex-end' },
sheet: {
backgroundColor: C.paper,
borderTopLeftRadius: 24,
borderTopRightRadius: 24,
paddingBottom: 32,
shadowColor: '#000',
shadowOffset: { width: 0, height: -4 },
shadowOpacity: 0.12,
shadowRadius: 16,
elevation: 16,
},
handle: { width: 36, height: 4, backgroundColor: C.border, borderRadius: 2, alignSelf: 'center', marginTop: 12, marginBottom: 4 },
titleRow: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 20, paddingVertical: 14, borderBottomWidth: 1, borderBottomColor: C.border },
title: { flex: 1, fontSize: 15, fontWeight: '700', color: C.ink },
closeBtn: { padding: 2 },
})