last changes
This commit is contained in:
parent
7a5ace403e
commit
899b50ded4
16 changed files with 53 additions and 89 deletions
|
|
@ -5,7 +5,7 @@ import { SafeAreaView } from 'react-native-safe-area-context';
|
|||
import { AutoDecimalInput, CustomColorPicker, NavigationButton, TypeSelectorSwitch } from "../../../components";
|
||||
import { addCategory } from "../../../services/database";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { CategoryType } from "../../../services/database";
|
||||
import { CategoryType } from "../../../types/dbItems";
|
||||
|
||||
export default function Page() {
|
||||
const {colors} = useTheme();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import useFetch from "../../../hooks/useFetch";
|
|||
import { deleteCategory, deleteExpense, updateCategory } from "../../../services/database";
|
||||
import { useTheme } from "../../contexts/ThemeContext";
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { CategoryType } from "../../../types/dbItems";
|
||||
|
||||
const addCategory = () => {
|
||||
const {colors} = useTheme();
|
||||
|
|
@ -13,7 +14,7 @@ const addCategory = () => {
|
|||
|
||||
const [categoryName, setCategoryName] = useState(category_name.toString());
|
||||
const [categoryColor, setCategoryColor] = useState(category_color.toString());
|
||||
const [selectedType, setSelectedType] = useState(category_type.toString());
|
||||
const [selectedType, setSelectedType] = useState<CategoryType>(category_type === "expense" ? CategoryType.EXPENSE : CategoryType.SAVING);
|
||||
const [amount, setAmount] = useState(Number.parseFloat(category_amount.toString()));
|
||||
|
||||
const {data} = useFetch({sql: "SELECT * FROM expense WHERE category_guid = ?", args: [category_guid.toString()]});
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ export default function Page() {
|
|||
})
|
||||
}, [data, searchString, selectedPage]);
|
||||
|
||||
console.log(selectedPage)
|
||||
return (
|
||||
<SafeAreaView style={[styles.safeAreaViewStyle, {backgroundColor: containerColor}]}>
|
||||
<View style={{flex: 1, marginHorizontal: 10}}>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,39 @@
|
|||
import React from 'react';
|
||||
import { SafeAreaView } from 'react-native';
|
||||
|
||||
import { Graph } from '../../../components';
|
||||
import BudgetOverview from '../../../components/stats/BudgetOverview';
|
||||
import BudgetRemaining from '../../../components/stats/BudgetRemaining';
|
||||
import BudgetRemaining from '../../../components/stats/SavingsOverview';
|
||||
import SavingsOverview from '../../../components/stats/SavingsOverview';
|
||||
import Widget from '../../../components/stats/Widget';
|
||||
import FinancialAdvice from '../../../components/stats/FinancialAdvice';
|
||||
import BudgetTotal from '../../../components/stats/BudgetTotal';
|
||||
import { ScrollView } from 'react-native-gesture-handler';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import DebugMenu from '../../../services/DebugMenu';
|
||||
|
||||
export default function Page() {
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{flex: 1}}>
|
||||
<Widget title="Budget Overview"/>
|
||||
<Graph/>
|
||||
<BudgetRemaining/>
|
||||
<Widget>
|
||||
<BudgetOverview/>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<SavingsOverview/>
|
||||
</Widget>
|
||||
<SafeAreaView style={{flex:1}}>
|
||||
<ScrollView>
|
||||
{/* <DebugMenu/> */}
|
||||
<Widget title="Budget Overview"/>
|
||||
<Graph/>
|
||||
<Widget>
|
||||
<BudgetOverview/>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<SavingsOverview/>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<BudgetTotal/>
|
||||
</Widget>
|
||||
{/* <Widget title='"Financial" Tips' backgroundColor='orange'>
|
||||
<FinancialAdvice/>
|
||||
</Widget> */}
|
||||
|
||||
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
import React from 'react';
|
||||
import { StyleSheet, View, ScrollView } from 'react-native';
|
||||
import BudgetTotal from '../../../components/stats/BudgetTotal';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import Widget from '../../../components/stats/Widget';
|
||||
import DebugMenu from '../../../services/DebugMenu';
|
||||
import SavingsOverview from '../../../components/stats/SavingsOverview';
|
||||
import FinancialAdvice from '../../../components/stats/FinancialAdvice';
|
||||
import BudgetOverview from '../../../components/stats/BudgetOverview';
|
||||
|
||||
export default function Page() {
|
||||
const { colors } = useTheme();
|
||||
|
||||
// Mock data #TODO Database einbinden
|
||||
// what to do when amount too small?
|
||||
|
||||
const spent = 120.75;
|
||||
const budget = 696.96;
|
||||
|
||||
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: colors.backgroundColor,
|
||||
marginTop: 50,
|
||||
alignItems: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<ScrollView>
|
||||
<DebugMenu />
|
||||
<Widget title='"Financial" Tips' backgroundColor='orange'>
|
||||
<FinancialAdvice/>
|
||||
</Widget>
|
||||
<Widget title="Budget Overview" />
|
||||
<Widget>
|
||||
<BudgetTotal/>
|
||||
</Widget>
|
||||
<Widget title='Your Expenses so far' image={require('../../../assets/images/8b14el.jpg')}/>
|
||||
<Widget>
|
||||
<BudgetOverview/>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<SavingsOverview/>
|
||||
</Widget>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
@ -54,9 +54,7 @@ export default function AddItem() {
|
|||
|
||||
useEffect(()=>{
|
||||
if(searchParams.category !== undefined){
|
||||
console.log(searchParams.category)
|
||||
executeQuery({sql: "SELECT * FROM category WHERE guid = ?", args: [searchParams.category]}).then((result) =>{
|
||||
console.log("then")
|
||||
if("rows" in result[0]){
|
||||
const category = result[0]["rows"][0];
|
||||
setSelectedCategory({name: category["name"], color: category["color"], guid: category["guid"]})
|
||||
|
|
|
|||
Reference in a new issue