Skip to content

Commit

Permalink
2.2 build 2, allow multiple price feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Wrege committed Jul 12, 2024
1 parent 317449f commit 496d609
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 276 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"assetBundlePatterns": ["**/*"],
"ios": {
"buildNumber": "1",
"buildNumber": "2",
"supportsTablet": false,
"jsEngine": "jsc",
"bundleIdentifier": "app.ladefuchs.Ladefuchs",
Expand Down
55 changes: 11 additions & 44 deletions components/detail/feedbackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,30 @@
import React from "react";
import { SafeAreaView, Text, TouchableOpacity, StyleSheet } from "react-native";
import { useNavigation } from "@react-navigation/native";
import { Tariff } from "../../../types/tariff";
import { TariffCondition } from "../../../types/conditions";
import { SafeAreaView, Text, TouchableOpacity } from "react-native";
import { ScaledSheet } from "react-native-size-matters";
import { colors } from "../../theme";

interface FeedbackButtonProps {
link: string | null | undefined;
tariff: Tariff | null | undefined;
tariffCondition: TariffCondition | null;
operatorName: string; // Füge den Operatornamen hinzu
operatorImageUrl: string; // Füge die OperatorImageUrl hinzu
onPress: () => void;
}

export function FeedbackButton({
link,
tariff,
tariffCondition,
operatorName,
operatorImageUrl,
}: FeedbackButtonProps): JSX.Element {
const navigation = useNavigation();

if (!link) {
return <></>;
}

const onPress = () => {
navigation.navigate("Feedback", {
tariff,
tariffCondition,
operatorName,
operatorImageUrl,
});
};

export function FeedbackButton({ onPress }: FeedbackButtonProps): JSX.Element {
return (
<SafeAreaView style={{ marginTop: 10, marginHorizontal: 0 }}>
<TouchableOpacity
activeOpacity={0.8}
style={styles.button}
onPress={onPress}
>
<Text style={[styles.headerText, styles.underlinedText]}>
<TouchableOpacity activeOpacity={0.8} onPress={onPress}>
<Text style={[styles.underlinedText]}>
{"Preise falsch? Dann sag dem Fuchs Bescheid!"}
</Text>
</TouchableOpacity>
</SafeAreaView>
);
}

const styles = StyleSheet.create({
button: {
// Add your button styles here
},
const styles = ScaledSheet.create({
underlinedText: {
textDecorationLine: "underline",
color: "grey",
color: colors.ladefuchsGrayTextColor,
fontFamily: "Bitter",
fontSize: 15,
lineHeight: 20,
fontSize: "15@s",
lineHeight: "20@s",
},
});
19 changes: 15 additions & 4 deletions components/detail/priceBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import { scale } from "react-native-size-matters";
export function PriceBox({
chargeMode,
price,
rounded = false,
}: {
chargeMode: ChargeMode;
price: number | null | undefined;
rounded?: boolean;
}) {
const { formatNumber } = useFormatNumber();
const plugSize = 25;
Expand All @@ -31,7 +33,12 @@ export function PriceBox({
</Text>
{plug}
</View>
<View style={styles.priceContainer}>
<View
style={[
styles.priceContainer,
rounded && styles.roundedContainer,
]}
>
<Text style={styles.priceText}>
{formatNumber(price) ?? "—"}
</Text>
Expand All @@ -44,19 +51,23 @@ const styles = StyleSheet.create({
priceText: {
textAlign: "center",
fontWeight: "500",
fontSize: scale(40),
fontSize: scale(38),
},
priceContainer: {
backgroundColor: colors.ladefuchsLightGrayBackground,
paddingHorizontal: scale(12),
paddingVertical: scale(12),
paddingHorizontal: scale(11),
paddingVertical: scale(11),
},
priceHeaderText: {
fontSize: scale(24),
fontWeight: "700",
textAlign: "center",
marginRight: scale(4),
},
roundedContainer: {
borderBottomLeftRadius: scale(12),
borderBottomRightRadius: scale(12),
},
priceHeaderContainer: {
display: "flex",
borderTopLeftRadius: scale(12),
Expand Down
22 changes: 17 additions & 5 deletions screens/detailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useShallow } from "zustand/react/shallow";
import { ScrollView } from "react-native-gesture-handler";
import { ScaledSheet } from "react-native-size-matters";
import { FeedbackButton } from "../components/detail/feedbackButton";
import { useNavigation } from "@react-navigation/native";

function findTariffCondition({
tariffConditions,
Expand All @@ -30,6 +31,8 @@ function findTariffCondition({
}

export function DetailScreen({ route }: { route: any }): JSX.Element {
const navigation = useNavigation();

const [operators, operatorId, tariffConditions] = useAppStore(
useShallow((state) => [
state.operators,
Expand Down Expand Up @@ -89,11 +92,20 @@ export function DetailScreen({ route }: { route: any }): JSX.Element {
<MonthlyFee fee={tariff.monthlyFee} />
<Notes notes={tariff.note} />
<FeedbackButton
link={tariff.affiliateLinkUrl}
tariff={tariff}
tariffCondition={dcTariffCondition || acTariffCondition} // Übergebe die relevante Bedingung
operatorName={operator!.name} // Füge den Operatornamen hinzu
operatorImageUrl={operator!.imageUrl} // Füge die OperatorImageUrl hinzu
onPress={() => {
// @ts-ignore
navigation.navigate("Feedback", {
tariff,
acTariffCondition,
dcTariffCondition,
operator,
});
}}
// link={tariff.affiliateLinkUrl}
// tariff={tariff}
// tariffCondition={dcTariffCondition || acTariffCondition} // Übergebe die relevante Bedingung
// operatorName={operator!.name} // Füge den Operatornamen hinzu
// operatorImageUrl={operator!.imageUrl} // Füge die OperatorImageUrl hinzu
/>
</View>
</ScrollView>
Expand Down
Loading

0 comments on commit 496d609

Please sign in to comment.