Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
610 changes: 211 additions & 399 deletions frontend/app/(tabs)/History.tsx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { useAuth } from "@/context/authContext";
import { useRouter } from "expo-router";
import { ActivityIndicator, View } from "react-native";
import { BACKEND_PORT } from "@env";
import { TamaguiProvider, Theme } from 'tamagui';
import tamaguiConfig from '../tamagui.config';
import { TamaguiProvider, Theme } from "tamagui";
import tamaguiConfig from "../tamagui.config";

SplashScreen.preventAutoHideAsync();

Expand Down
104 changes: 60 additions & 44 deletions frontend/app/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,74 +1,89 @@
import React from 'react';
import { ScrollView } from 'react-native';
import { Screen } from '../components/primitives/Screen';
import { AppText } from '../components/primitives/AppText';
import { AppButton } from '../components/primitives/AppButton';
import { StatCard } from '../components/primitives/StatCard';
import { DonutCard } from '../components/primitives/DonutCard';
import { QuickActionCard } from '../components/primitives/QuickActionCard';
import { SegmentedControl } from '../components/primitives/SegmentedControl';
import { YStack, XStack, Circle } from 'tamagui';
import { Ionicons } from '@expo/vector-icons';
import React from "react";
import { ScrollView } from "react-native";
import { Screen } from "../components/primitives/Screen";
import { AppText } from "../components/primitives/AppText";
import { AppButton } from "../components/primitives/AppButton";
import { StatCard } from "../components/primitives/StatCard";
import { DonutCard } from "../components/primitives/DonutCard";
import { QuickActionCard } from "../components/primitives/QuickActionCard";
import { SegmentedControl } from "../components/primitives/SegmentedControl";
import { YStack, XStack, Circle } from "tamagui";
import { Ionicons } from "@expo/vector-icons";

export default function DemoScreen() {
return (
<Screen>
<ScrollView contentContainerStyle={{ padding: 20 }}>
<YStack space="$6" paddingBottom="$10">

{/* Header */}
<XStack justifyContent="space-between" alignItems="center" marginTop="$4">
<XStack
justifyContent="space-between"
alignItems="center"
marginTop="$4"
>
<Circle size={44} backgroundColor="$white" elevation={1}>
<Ionicons name="notifications-outline" size={20} color="#1C252E" />
<Ionicons
name="notifications-outline"
size={20}
color="#1C252E"
/>
</Circle>
<Circle size={44} backgroundColor="$primary">
<AppText color="white" fontWeight="bold">JD</AppText>
<AppText color="white" fontWeight="bold">
JD
</AppText>
</Circle>
</XStack>

<YStack space="$1">
<AppText variant="title" fontSize="$8">Welcome Back,</AppText>
<AppText variant="subtitle" color="$textMuted">Jordan 👋</AppText>
<AppText variant="title" fontSize="$8">
Welcome Back,
</AppText>
<AppText variant="subtitle" color="$textMuted">
Jordan 👋
</AppText>
</YStack>

{/* Stats Row */}
<XStack space="$3">
<StatCard
title="Daily Spending"
value="$42.50"
subtitle="Under budget"
backgroundColor="$surfaceTintBlue"
icon={<Ionicons name="trending-up" size={16} color="#395773" />}
<StatCard
title="Daily Spending"
value="$42.50"
subtitle="Under budget"
backgroundColor="$surfaceTintBlue"
icon={<Ionicons name="trending-up" size={16} color="#395773" />}
/>
<StatCard
title="Goals"
value="3 of 5"
subtitle="On track"
backgroundColor="$surfaceTintBlue"
icon={<Ionicons name="disc-outline" size={16} color="#395773" />}
<StatCard
title="Goals"
value="3 of 5"
subtitle="On track"
backgroundColor="$surfaceTintBlue"
icon={<Ionicons name="disc-outline" size={16} color="#395773" />}
/>
</XStack>

{/* Weekly Spending */}
<DonutCard title="Weekly Spending" centerMetric="68%" />

{/* Quick Actions */}
<YStack space="$4">
<AppText variant="title" fontSize="$6">Quick Actions</AppText>
<AppText variant="title" fontSize="$6">
Quick Actions
</AppText>
<XStack space="$3">
<QuickActionCard
label="Save More"
icon={<AppText fontSize="$5">💰</AppText>}
backgroundColor="$surfaceTintYellow"
<QuickActionCard
label="Save More"
icon={<AppText fontSize="$5">💰</AppText>}
backgroundColor="$surfaceTintYellow"
/>
<QuickActionCard
label="Track Bills"
icon={<AppText fontSize="$5">📄</AppText>}
backgroundColor="$surfaceTintGreen"
<QuickActionCard
label="Track Bills"
icon={<AppText fontSize="$5">📄</AppText>}
backgroundColor="$surfaceTintGreen"
/>
<QuickActionCard
label="Set Goals"
icon={<AppText fontSize="$5">🎯</AppText>}
<QuickActionCard
label="Set Goals"
icon={<AppText fontSize="$5">🎯</AppText>}
backgroundColor="$surfaceTintGreen" // using green as fallback for the third from design
/>
</XStack>
Expand All @@ -83,10 +98,11 @@ export default function DemoScreen() {

{/* Segmented Control Demo */}
<YStack space="$4" marginTop="$6">
<AppText variant="title" fontSize="$6">Segmented Control Example</AppText>
<AppText variant="title" fontSize="$6">
Segmented Control Example
</AppText>
<SegmentedControl defaultValue="1W" />
</YStack>

</YStack>
</ScrollView>
</Screen>
Expand Down
8 changes: 0 additions & 8 deletions frontend/components/NewTransaction/NewTransactionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,11 @@ export default function NewTransactionButton(props: any) {
style={styles.picker}
>
<Picker.Item label="Select Category" value="" />
{/* <<<<<<< HEAD
<Picker.Item label="Food" value="6" />
<Picker.Item label="Shopping" value="7" />
<Picker.Item label="Transportation" value="8" />
<Picker.Item label="Subsciptions" value="9" />
<Picker.Item label="Other" value="10" />
======= */}
<Picker.Item label="Food" value="Food" />
<Picker.Item label="Shopping" value="Shopping" />
<Picker.Item label="Transportation" value="Transportation" />
<Picker.Item label="Subscriptions" value="Subscriptions" />
<Picker.Item label="Other" value="Other" />
{/* >>>>>>> main */}
</Picker>

<TextInput
Expand Down
114 changes: 16 additions & 98 deletions frontend/components/TransactionHistory/FullTransactionHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import {
View,
StyleSheet,
Text,
ScrollView,
TouchableOpacity,
Alert,
} from "react-native";
import TransactionRow from "./TransactionRow";
import { useState, useEffect } from "react";
import { BACKEND_PORT } from "@env";
import NewTransactionRow from "./NewTransactionRow";
import { useState, useEffect } from "react";
import { YStack } from "tamagui";
import { Alert, Text, StyleSheet } from "react-native";
import { useAuth } from "@/context/authContext";

export default function FullTransactionHistory(props: any) {
Expand Down Expand Up @@ -40,94 +34,18 @@ export default function FullTransactionHistory(props: any) {
}
};

const groupedByDate = transactions.reduce((acc: any, transaction: any) => {
const dateKey = transaction.date.slice(0, 10);
if (!acc[dateKey]) acc[dateKey] = [];
acc[dateKey].push(transaction);
return acc;
}, {});

return (
<View style={styles.HistoryContainer}>
<Text style={styles.title}>Transactions</Text>
<ScrollView>
<View style={styles.recentTranactions}>
{Object.entries(groupedByDate).map(([date, trans]: any) => (
<View style={styles.row} key={date}>
<Text style={styles.dates}>{date}</Text>
{trans.map((transaction: any, index: number) => (
<View key={transaction.id}>
<View style={styles.transactionContainer}>
<View style={{ flex: 1 }}>
<TransactionRow
name={transaction.item_name}
amount={transaction.amount}
icon={transaction.category_name}
/>
</View>
<TouchableOpacity
onPress={() => handleDelete(transaction.id)}
>
<Text style={styles.deleteButton}>✕</Text>
</TouchableOpacity>
</View>
{index < trans.length - 1 && (
<View style={styles.separator} />
)}
</View>
))}
</View>
))}
</View>
</ScrollView>
</View>
<YStack gap="$4">
{transactions.map((transaction: any) => (
<NewTransactionRow
name={transaction.item_name}
amount={transaction.amount}
category={transaction.category_name}
date={transaction.date}
deleteCallback={() => handleDelete(transaction.id)}
key={transaction.id}
/>
))}
</YStack>
);
}

const styles = StyleSheet.create({
HistoryContainer: {
backgroundColor: "#E6E6E6",
width: "100%",
flex: 1,
borderRadius: 15,
padding: 15,
gap: 5,
shadowRadius: 12,
shadowOpacity: 0.4,
},
title: {
fontSize: 20,
fontWeight: "500",
},
recentTranactions: {
flexDirection: "column",
gap: 20,
},
row: {
flexDirection: "column",
},
dates: {
fontSize: 18,
fontWeight: "500",
opacity: 0.4,
},
transactionContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
width: "100%",
},
deleteButton: {
fontSize: 18,
color: "red",
paddingHorizontal: 10,
fontWeight: "bold",
},
separator: {
width: "100%",
height: 2,
backgroundColor: "black",
opacity: 0.2,
borderRadius: 2,
},
});
Loading
Loading