Skip to content

Commit 1897cf6

Browse files
committed
mobile: simplify logging components for new reusable endpoint
1 parent 708daf2 commit 1897cf6

File tree

8 files changed

+471
-287
lines changed

8 files changed

+471
-287
lines changed

apps/mobile/src/app/(home)/log.tsx

Lines changed: 91 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import {
1414
Virus,
1515
} from "phosphor-react-native";
1616

17+
import { TrackableLogStep } from "~/components/app/trackableLogStep";
1718
import { Text } from "~/components/ui/text";
18-
import { FoodDrinkStep } from "./logSteps/fooddrink";
19-
import { BloodStep, BodyStep, SymptomsStep } from "./logSteps/medical";
20-
import { ActivitiesStep, EnergyStep, SleepStep } from "./logSteps/physical";
21-
import { CyclesStep, MindStep, SupplementsStep } from "./logSteps/prevention";
2219

2320
// Button component for consistent styling and behavior
2421
function LogButton({
@@ -43,26 +40,26 @@ function LogButton({
4340
}
4441

4542
// Variant for the wider buttons
46-
function WideLogButton({
47-
icon,
48-
label,
49-
onPress,
50-
}: {
51-
icon: React.ReactNode;
52-
label: string;
53-
onPress: () => void;
54-
}) {
55-
return (
56-
<Pressable
57-
className="bg-sand-3 flex h-14 w-[48%] flex-row items-center justify-center gap-2 rounded-md"
58-
onPress={onPress}
59-
android_ripple={{ color: "rgba(0, 0, 0, 0.1)" }}
60-
>
61-
{icon}
62-
<Text className="text-sm">{label}</Text>
63-
</Pressable>
64-
);
65-
}
43+
// function WideLogButton({
44+
// icon,
45+
// label,
46+
// onPress,
47+
// }: {
48+
// icon: React.ReactNode;
49+
// label: string;
50+
// onPress: () => void;
51+
// }) {
52+
// return (
53+
// <Pressable
54+
// className="bg-sand-3 flex h-14 w-[48%] flex-row items-center justify-center gap-2 rounded-md"
55+
// onPress={onPress}
56+
// android_ripple={{ color: "rgba(0, 0, 0, 0.1)" }}
57+
// >
58+
// {icon}
59+
// <Text className="text-sm">{label}</Text>
60+
// </Pressable>
61+
// );
62+
// }
6663

6764
// Define step types for our state management
6865
type StepType =
@@ -89,25 +86,85 @@ export default function Logger() {
8986
const renderStep = () => {
9087
switch (currentStep) {
9188
case "food":
92-
return <FoodDrinkStep onBack={handleBack} />;
89+
return (
90+
<TrackableLogStep
91+
onBack={handleBack}
92+
trackableParentType="consumption"
93+
trackableSubType="consumption.parent.food"
94+
/>
95+
);
9396
case "activities":
94-
return <ActivitiesStep onBack={handleBack} />;
97+
return (
98+
<TrackableLogStep
99+
onBack={handleBack}
100+
trackableParentType="activity"
101+
trackableSubType="custom.generic"
102+
/>
103+
);
95104
case "energy":
96-
return <EnergyStep onBack={handleBack} />;
105+
return (
106+
<TrackableLogStep
107+
onBack={handleBack}
108+
trackableParentType="energy"
109+
trackableSubType="energy.calories.net"
110+
/>
111+
);
97112
case "sleep":
98-
return <SleepStep onBack={handleBack} />;
113+
return (
114+
<TrackableLogStep
115+
onBack={handleBack}
116+
trackableParentType="sleep"
117+
trackableSubType="custom.generic"
118+
/>
119+
);
99120
case "supplements":
100-
return <SupplementsStep onBack={handleBack} />;
121+
return (
122+
<TrackableLogStep
123+
onBack={handleBack}
124+
trackableParentType="supplement"
125+
trackableSubType="supplement.generic"
126+
/>
127+
);
101128
case "cycles":
102-
return <CyclesStep onBack={handleBack} />;
129+
return (
130+
<TrackableLogStep
131+
onBack={handleBack}
132+
trackableParentType="body"
133+
trackableSubType="body.generic"
134+
/>
135+
);
103136
case "mind":
104-
return <MindStep onBack={handleBack} />;
137+
return (
138+
<TrackableLogStep
139+
onBack={handleBack}
140+
trackableParentType="mind"
141+
trackableSubType="custom.generic"
142+
/>
143+
);
105144
case "symptoms":
106-
return <SymptomsStep onBack={handleBack} />;
145+
return (
146+
<TrackableLogStep
147+
onBack={handleBack}
148+
trackableParentType="symptom"
149+
trackableSubType="symptom.generic"
150+
/>
151+
);
107152
case "blood":
108-
return <BloodStep onBack={handleBack} />;
153+
return (
154+
<TrackableLogStep
155+
onBack={handleBack}
156+
trackableParentType="blood"
157+
trackableSubType="blood.generic"
158+
/>
159+
);
109160
case "body":
110-
return <BodyStep onBack={handleBack} />;
161+
return (
162+
<TrackableLogStep
163+
onBack={handleBack}
164+
trackableParentType="body"
165+
trackableSubType="body.generic"
166+
/>
167+
);
111168
default:
112169
return null;
113170
}

apps/mobile/src/app/(home)/logSteps/fooddrink.tsx

Lines changed: 0 additions & 166 deletions
This file was deleted.

apps/mobile/src/app/(home)/logSteps/medical.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

apps/mobile/src/app/(home)/logSteps/physical.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)