This commit is contained in:
2026-07-27 16:42:04 +02:00
parent 45a7704ea6
commit 018b751723
23 changed files with 2327 additions and 635 deletions

View File

@@ -7,33 +7,116 @@ import Svg, { Circle } from 'react-native-svg';
import { useApp } from '../../context/AppContext';
import { useColors } from '../../constants/Colors';
import { useSafeAnalytics } from '../../services/analytics';
import { PreAuthOnboardingService, PreAuthAnswers } from '../../services/preAuthOnboardingService';
import { Language } from '../../types';
const getCopy = (language: Language) => {
if (language === 'de') {
return {
status: 'Dein Pflegeplan wird personalisiert…',
steps: ['Antworten werden analysiert', 'Pflegeplan wird erstellt', 'Scan-Credits werden vorbereitet', 'Plan wird finalisiert'],
testimonial: '„GreenLens hat meine Geigenfeige gerettet. Die täglichen Routinen sind unglaublich präzise."',
author: 'Elena R.',
rating: '4,8 APP-STORE-BEWERTUNG',
status: 'Dein Plan wird zusammengestellt…',
// Schritte beschreiben den Nutzen fuer den Nutzer, nicht unsere Prozesse.
steps: [
'Deine Antworten werden ausgewertet',
'Mögliche Ursachen für dein Symptom werden gewichtet',
'Prüfschritte für deine Lichtsituation werden ausgewählt',
'Dein 7-Tage-Plan steht',
],
summaryTitle: 'Dein Plan basiert auf',
noAnswers: 'Deinen Angaben aus dem Gespräch',
situations: {
acute: 'Akutes Problem',
slow: 'Langsame Veränderung',
prevention: 'Vorbeugung',
} as Record<string, string>,
symptoms: {
yellow: 'Gelbe Blätter',
brown_tips: 'Braune Spitzen',
drooping: 'Hängende Blätter',
spots: 'Flecken oder Belag',
pests: 'Schädlinge',
other: 'Anderes Symptom',
} as Record<string, string>,
lights: {
bright_indirect: 'Helles, indirektes Licht',
low_light: 'Wenig Licht',
direct_sunlight: 'Direkte Sonne',
} as Record<string, string>,
experiences: {
beginner: 'Einsteigerin',
intermediate: 'Etwas Erfahrung',
advanced: 'Erfahren',
} as Record<string, string>,
};
}
if (language === 'es') {
return {
status: 'Personalizando tu plan de cuidados…',
steps: ['Analizando tus respuestas', 'Creando tu plan de cuidados', 'Preparando tus créditos de escaneo', 'Finalizando tu plan'],
testimonial: '"GreenLens salvó mi ficus lyrata. Las rutinas diarias son increíblemente precisas."',
author: 'Elena R.',
rating: '4.8 VALORACIÓN EN APP STORE',
status: 'Preparando tu plan…',
steps: [
'Analizando tus respuestas',
'Ponderando las causas posibles de tu síntoma',
'Eligiendo pasos de revisión para tu luz',
'Tu plan de 7 días está listo',
],
summaryTitle: 'Tu plan se basa en',
noAnswers: 'Lo que nos contaste en el chat',
situations: {
acute: 'Problema agudo',
slow: 'Cambio lento',
prevention: 'Prevención',
} as Record<string, string>,
symptoms: {
yellow: 'Hojas amarillas',
brown_tips: 'Puntas marrones',
drooping: 'Hojas caídas',
spots: 'Manchas o residuo',
pests: 'Plagas',
other: 'Otro síntoma',
} as Record<string, string>,
lights: {
bright_indirect: 'Luz brillante indirecta',
low_light: 'Poca luz',
direct_sunlight: 'Sol directo',
} as Record<string, string>,
experiences: {
beginner: 'Principiante',
intermediate: 'Algo de experiencia',
advanced: 'Con experiencia',
} as Record<string, string>,
};
}
return {
status: 'Personalizing your care plan…',
steps: ['Analyzing your answers', 'Building your care plan', 'Preparing your scan credits', 'Finalizing your plan'],
testimonial: '"GreenLens completely saved my Fiddle Leaf Fig. The daily routines feel incredibly precise."',
author: 'Elena R.',
rating: '4.8 APP STORE RATING',
status: 'Putting your plan together…',
steps: [
'Reviewing your answers',
'Weighing possible causes for your symptom',
'Picking checks for your light situation',
'Your 7-day plan is ready',
],
summaryTitle: 'Your plan is based on',
noAnswers: 'What you told us in the chat',
situations: {
acute: 'Acute problem',
slow: 'Slow change',
prevention: 'Prevention',
} as Record<string, string>,
symptoms: {
yellow: 'Yellow leaves',
brown_tips: 'Brown tips',
drooping: 'Drooping leaves',
spots: 'Spots or residue',
pests: 'Pests',
other: 'Other symptom',
} as Record<string, string>,
lights: {
bright_indirect: 'Bright, indirect light',
low_light: 'Low light',
direct_sunlight: 'Direct sun',
} as Record<string, string>,
experiences: {
beginner: 'Beginner',
intermediate: 'Some experience',
advanced: 'Experienced',
} as Record<string, string>,
};
};
@@ -52,8 +135,22 @@ export default function OnboardingPersonalizingScreen() {
const copy = getCopy(language);
const progress = useRef(new Animated.Value(0)).current;
const [percent, setPercent] = useState(0);
const [answers, setAnswers] = useState<PreAuthAnswers>({});
const navigated = useRef(false);
// Die eigenen Angaben zurueckspiegeln beweist "es geht um MEINE Pflanze"
// (Belief 4) durch Demonstration statt durch Behauptung.
useEffect(() => {
void PreAuthOnboardingService.getAnswers().then(setAnswers);
}, []);
const summaryChips = [
answers.situation ? copy.situations[answers.situation] : null,
answers.symptom ? copy.symptoms[answers.symptom] : null,
answers.lightLevel ? copy.lights[answers.lightLevel] : null,
answers.experienceLevel ? copy.experiences[answers.experienceLevel] : null,
].filter((chip): chip is string => Boolean(chip));
const strokeDashoffset = progress.interpolate({
inputRange: [0, 100],
outputRange: [RING_CIRCUMFERENCE, 0],
@@ -129,17 +226,18 @@ export default function OnboardingPersonalizingScreen() {
})}
</View>
<View style={[styles.testimonialCard, { backgroundColor: colors.surface }]}>
<View style={styles.testimonialHeader}>
<Text style={[styles.testimonialAuthor, { color: colors.text }]}>{copy.author}</Text>
<View style={styles.starsRow}>
{[0, 1, 2, 3, 4].map((i) => <Ionicons key={i} name="star" size={13} color="#f5c04e" />)}
</View>
<Text style={[styles.summaryTitle, { color: colors.textMuted }]}>{copy.summaryTitle}</Text>
<View style={styles.summaryChips}>
{summaryChips.length > 0 ? (
summaryChips.map((chip) => (
<View key={chip} style={[styles.summaryChip, { backgroundColor: colors.primarySoft }]}>
<Text style={[styles.summaryChipText, { color: colors.primaryDark }]}>{chip}</Text>
</View>
))
) : (
<Text style={[styles.testimonialText, { color: colors.textSecondary }]}>{copy.noAnswers}</Text>
)}
</View>
<Text style={[styles.testimonialText, { color: colors.textSecondary }]}>{copy.testimonial}</Text>
</View>
<View style={[styles.ratingBadge, { borderColor: colors.primary }]}>
<Ionicons name="ribbon-outline" size={16} color={colors.primary} />
<Text style={[styles.ratingText, { color: colors.primary }]}>{copy.rating}</Text>
</View>
</SafeAreaView>
);
@@ -156,10 +254,9 @@ const styles = StyleSheet.create({
checkRow: { flexDirection: 'row', alignItems: 'center', gap: 12 },
checkLabel: { fontSize: 16.5, fontWeight: '700' },
testimonialCard: { alignSelf: 'stretch', borderRadius: 18, padding: 16, marginBottom: 14 },
testimonialHeader: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 6 },
testimonialAuthor: { fontSize: 14.5, fontWeight: '800' },
starsRow: { flexDirection: 'row', gap: 2 },
testimonialText: { fontSize: 14, lineHeight: 20, fontStyle: 'italic' },
ratingBadge: { flexDirection: 'row', alignItems: 'center', gap: 7, borderWidth: 1.5, borderRadius: 999, paddingHorizontal: 16, paddingVertical: 9 },
ratingText: { fontSize: 12.5, fontWeight: '900', letterSpacing: 0.6 },
testimonialText: { fontSize: 14, lineHeight: 20 },
summaryTitle: { fontSize: 10.5, fontWeight: '900', letterSpacing: 0.9, textTransform: 'uppercase', marginBottom: 10 },
summaryChips: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },
summaryChip: { borderRadius: 999, paddingHorizontal: 12, paddingVertical: 7 },
summaryChipText: { fontSize: 12.5, fontWeight: '700' },
});