Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to master #30

Merged
merged 54 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0e4bb7d
Feature - add button component
paolojulian Jun 1, 2024
09e2442
style // modify padding for textarea
paolojulian Jun 1, 2024
c8bd52d
style // improve scrolling on add screen
paolojulian Jun 1, 2024
a1f2a88
Feature - add datepicker change month and also refactor some styles
paolojulian Jun 1, 2024
d5d9633
Merge pull request #14 from paolojulian:feat/add-date-picker-navigation
paolojulian Jun 1, 2024
04aecba
style // adjust date picker item styles
paolojulian Jun 1, 2024
ea6621e
refactor // Update ThemedText variant names and styles
paolojulian Jun 1, 2024
16fbb5d
Migrations
ifyouseekei Jun 2, 2024
56f9a6c
Migrations debugging
ifyouseekei Jun 2, 2024
34e47dc
fix migrations
ifyouseekei Jun 2, 2024
95d0b6f
Change dates to integer
ifyouseekei Jun 2, 2024
6c8a996
feat // DROP table before creating
paolojulian Jun 3, 2024
3f056d1
feat // add combobox
paolojulian Jun 3, 2024
f8526dc
style // finalize combobox
paolojulian Jun 3, 2024
812e892
style // adjust spacing between items on bottom bar
paolojulian Jun 3, 2024
5e3d741
feat // initialize expense list
paolojulian Jun 3, 2024
23d39d8
refactor // Update ExpensesScreen UI to include ExpensesListHeader
paolojulian Jun 3, 2024
90a303c
feat: Add ExpensesStatistics component
paolojulian Jun 3, 2024
b0b33ac
feat: Add ExpensesStatistics component
paolojulian Jun 3, 2024
1b6ffce
feat: Add BudgetCard component to ExpensesScreen
paolojulian Jun 3, 2024
1132291
style: Update ExpensesList UI with improved styling and layout
paolojulian Jun 3, 2024
9856279
Merge pull request #15 from paolojulian:feat/expense-list
paolojulian Jun 3, 2024
7e88b12
Create useHooks per table
ifyouseekei Jun 6, 2024
668d907
Fix types
ifyouseekei Jun 6, 2024
722e575
Update namespace
ifyouseekei Jun 6, 2024
8bb62d1
style: Update ExpensesListItem right actions UI with improved styling…
paolojulian Jun 6, 2024
eae1373
Merge pull request #19 from paolojulian:feat/18/add-swipe-gesture-for…
paolojulian Jun 6, 2024
b073aa2
feat: Add budget modal
paolojulian Jun 7, 2024
a81d265
Merge pull request #21 from paolojulian:feat/20/add-update-budget-modal
paolojulian Jun 7, 2024
01d89c7
bump: update packages
paolojulian Jun 7, 2024
b4ab493
feat: install unit tests
paolojulian Jun 7, 2024
685f161
feat: add jest with coverage
paolojulian Jun 7, 2024
48d3165
feat: initialize files and folders for todo page
paolojulian Jun 7, 2024
abd8ef0
feat: add expo-checkbox and initialize todo item and list
paolojulian Jun 7, 2024
e8ceccd
refactor: remove unused codes
paolojulian Jun 7, 2024
0e42891
feat: Add lazy loading for images in TodoHeader component
paolojulian Jun 8, 2024
339e623
refactor: Improve TodoItem component with removal functionality and v…
paolojulian Jun 8, 2024
306def8
Merge pull request #24 from paolojulian:feat/23/initialize-todo-page
paolojulian Jun 8, 2024
932b599
Refactor function to utils
ifyouseekei Jun 9, 2024
340c55e
feat: install yup and formik packages
paolojulian Jun 9, 2024
33377c8
feat: initialize add todo form
paolojulian Jun 10, 2024
ad7b2ac
Update hooks/services/expense/useCreateExpenses.tsx
paolojulian Jun 10, 2024
83e6251
Merge pull request #16 from paolojulian/feature-useX-hooks
paolojulian Jun 10, 2024
1a465c2
feat: Add CheckboxField component for form input
paolojulian Jun 10, 2024
c474127
feat: add auto select add screen item
paolojulian Jun 10, 2024
dc33eca
Merge remote-tracking branch 'origin/dev' into feat/25/initialize-tod…
paolojulian Jun 10, 2024
5a7c4ab
Merge pull request #26 from paolojulian:feat/25/initialize-todo-screen
paolojulian Jun 10, 2024
188ab91
feat: initialize add journal form
paolojulian Jun 10, 2024
6074fa4
Merge pull request #28 from paolojulian:feat/27/initialize-journal-sc…
paolojulian Jun 10, 2024
449da13
fix: eslint errors
paolojulian Jun 10, 2024
760f729
feat: add github checks
paolojulian Jun 10, 2024
91efee4
fix: Remove --watch flag from npm run test-coverage
paolojulian Jun 10, 2024
57f5d53
spec: add unit test for date picker component
paolojulian Jun 10, 2024
219efe4
Merge pull request #29 from paolojulian/test/date-picker
paolojulian Jun 10, 2024
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
EXPO_PUBLIC_DATABASE_VERSION=2
EXPO_PUBLIC_DATABASE_VERSION=1
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.eslintrc.js

babel.config.js

metro.config.js
16 changes: 15 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// https://docs.expo.dev/guides/using-eslint/
module.exports = {
extends: 'expo',
extends: ['expo'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
};
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint code

on: [pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- name: checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Linting code
run: npm run lint
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test code

on: [pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- name: checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Testing code
run: npm run test-coverage
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ yarn-error.*
expo-env.d.ts
# @end expo-cli

.eslintcache
.eslintcache

# Unit test coverages
coverage/
25 changes: 18 additions & 7 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RouteNames } from '@/app/_layout';
import { getDefaultTypeFromTabIndex } from '@/components/add/utils';
import BottomBar from '@/components/navigation/BottomBar/BottomBar';
import { router, Tabs } from 'expo-router';
import React, { ComponentProps } from 'react';
Expand All @@ -7,11 +9,13 @@ import { SafeAreaView } from 'react-native';
export enum TabName {
Home = 'index',
Journal = 'journal',
Add = 'add',
Expense = 'expenses',
Todo = 'todos',
}

/** Don't modify the arrangement of this array since it is used to get the current route from the navigation */
const tabs = [TabName.Home, TabName.Expense, TabName.Todo, TabName.Journal];

export default function TabLayout() {
return (
<Tabs
Expand All @@ -20,19 +24,26 @@ export default function TabLayout() {
}}
tabBar={TabBar}
>
<Tabs.Screen name={TabName.Home}></Tabs.Screen>
<Tabs.Screen name={TabName.Journal}></Tabs.Screen>
<Tabs.Screen name={TabName.Add}></Tabs.Screen>
<Tabs.Screen name={TabName.Expense}></Tabs.Screen>
<Tabs.Screen name={TabName.Todo}></Tabs.Screen>
{tabs.map(tab => (
<Tabs.Screen key={tab} name={tab}></Tabs.Screen>
))}
</Tabs>
);
}

const TabBar: ComponentProps<typeof Tabs>['tabBar'] = props => {
const { navigation } = props;

const handleAddPress = () => router.push('add');
const handleAddPress = () => {
const defaultType = getDefaultTypeFromTabIndex(navigation.getState().index);
router.push({
pathname: RouteNames.Add,
params: {
defaultType: defaultType,
},
});
};

const handleHomePress = () => navigation.navigate(TabName.Home);
const handleTodoPress = () => navigation.navigate(TabName.Todo);
const handleJournalPress = () => navigation.navigate(TabName.Journal);
Expand Down
7 changes: 0 additions & 7 deletions app/(tabs)/add.tsx

This file was deleted.

62 changes: 59 additions & 3 deletions app/(tabs)/expenses.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,66 @@
import Container from '@/components/common/Container';
import ParallaxScrollView, { HEADER_HEIGHT } from '@/components/common/ParallaxScrollView';
import Tabs from '@/components/common/Tabs';
import ThemedText from '@/components/common/ThemedText';
import ThemedView from '@/components/common/ThemedView';
import BudgetCard from '@/components/expenses/BudgetCard';
import BudgetModal from '@/components/expenses/BudgetCard/BudgetModal';
import ExpensesList from '@/components/expenses/ExpensesList';
import ExpensesListHeader from '@/components/expenses/ExpensesList/ExpensesListHeader/ExpensesListHeader';
import ExpensesStatistics from '@/components/expenses/ExpensesStatistics';
import {
EXPENSES_STATISTICS_VARIANTS,
ExpensesStatisticsVariantEnum,
} from '@/components/expenses/ExpensesStatistics/ExpensesStatistics';
import { colors } from '@/constants/Colors';
import ModalProvider, { ModalTypes } from '@/providers/ModalProvider';
import { useState } from 'react';

export default function ExpensesScreen() {
const [selectedDate, setSelectedDate] = useState(new Date());
const [filter, setFilter] = useState<ExpensesStatisticsVariantEnum>(
ExpensesStatisticsVariantEnum.daily,
);

return (
<ThemedView>
<ThemedText variant="heading">Expenses</ThemedText>
</ThemedView>
<ModalProvider
modals={[
{
element: <BudgetModal />,
type: ModalTypes.updateBudgetModal,
},
]}
>
<ParallaxScrollView
headerBackgroundColor={colors.black}
headerContent={<ExpensesListHeader />}
>
<ThemedView
style={{
marginTop: -HEADER_HEIGHT + 24,
gap: 32,
}}
>
<Container style={{ gap: 32 }}>
<ThemedText variant="heading" style={{ color: colors.white }}>
Expenses
</ThemedText>
<Tabs<ExpensesStatisticsVariantEnum>
items={EXPENSES_STATISTICS_VARIANTS}
onSelect={setFilter}
selectedItem={filter}
variant="inverted"
/>
<ExpensesStatistics
selectedDate={selectedDate}
variant={filter}
onSelectDate={setSelectedDate}
/>
<BudgetCard />
</Container>
<ExpensesList />
</ThemedView>
</ParallaxScrollView>
</ModalProvider>
);
}
6 changes: 0 additions & 6 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import Stack from '@/components/common/Stack';
import ThemedText from '@/components/common/ThemedText';
import useExpense from '@/hooks/services/expenses/useExpense';
import { useSQLiteContext } from 'expo-sqlite';

export default function Home() {
const db = useSQLiteContext();
let keyword:string = '%gamb%'
const {data: expenses, isLoading, error} = useExpense([{columnName: "description", condition: "LIKE", value: keyword}]);
console.log(expenses);
return (
<Stack>
<ThemedText variant="heading">Home</ThemedText>
Expand Down
9 changes: 2 additions & 7 deletions app/(tabs)/todos.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import ThemedText from '@/components/common/ThemedText';
import ThemedView from '@/components/common/ThemedView';
import TodoWorkArea from '@/components/todos/TodoWorkArea';

export default function TodoScreen() {
return (
<ThemedView>
<ThemedText variant="heading">Todo</ThemedText>
</ThemedView>
);
return <TodoWorkArea />;
}
2 changes: 1 addition & 1 deletion app/+not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function NotFoundScreen() {
<>
<ThemedView style={styles.container}>
<ThemedText variant="heading">404</ThemedText>
<ThemedText variant="body-lg">This screen doesn't exist.</ThemedText>
<ThemedText variant="body2">This screen doesn't exist.</ThemedText>
<Link href="/" style={styles.link}>
<ThemedText variant="body">Back to home screen</ThemedText>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function RootLayout() {
}

return (
<GestureHandlerRootView>
<GestureHandlerRootView style={{ flex: 1 }}>
<DatabaseProvider>
<ThemeProvider value={DefaultTheme}>
<Stack initialRouteName={RouteNames.Tabs}>
Expand Down
53 changes: 32 additions & 21 deletions app/add.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import AddFactory from '@/components/add/AddFactory';
import { isSupportedAddType } from '@/components/add/utils';
import Container from '@/components/common/Container';
import Tabs from '@/components/common/Tabs';
import ThemedText from '@/components/common/ThemedText';
import ThemedView from '@/components/common/ThemedView';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import { useNavigation } from 'expo-router';
import { useLocalSearchParams, useNavigation } from 'expo-router';
import React, { useState } from 'react';
import { SafeAreaView, ScrollView, StyleSheet } from 'react-native';
import { KeyboardAvoidingView, Platform, ScrollView, StyleSheet } from 'react-native';

export type SupportedAddItems = 'Expense' | 'Todo' | 'Journal';

export default function AddScreen() {
const [selectedItem, setSelectedItem] = useState<SupportedAddItems>('Expense');
const { defaultType } = useLocalSearchParams<{ defaultType?: string }>();
const resolvedDefaultType = isSupportedAddType(defaultType) ? defaultType : 'Expense';
const [selectedItem, setSelectedItem] = useState<SupportedAddItems>(resolvedDefaultType);

const navigation = useNavigation();
const handleBackPress = () => {
if (navigation.canGoBack()) {
Expand All @@ -19,41 +24,47 @@ export default function AddScreen() {
};

return (
<ThemedView style={styles.container}>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={styles.container}
>
<ThemedView style={styles.main}>
<ThemedView style={styles.header}>
<MaterialCommunityIcons name={'chevron-left'} size={32} onPress={handleBackPress} />
<ThemedText variant="body-lg">Add</ThemedText>
<MaterialCommunityIcons name={'chevron-left'} size={32} style={{ opacity: 0 }} />
</ThemedView>
<Tabs<SupportedAddItems>
onSelect={setSelectedItem}
selectedItem={selectedItem}
items={['Expense', 'Todo', 'Journal']}
/>
<ThemedView style={{ flex: 1 }}>
<Container>
<ThemedView style={styles.header}>
<MaterialCommunityIcons name={'chevron-left'} size={32} onPress={handleBackPress} />
<ThemedText variant="body2">Add</ThemedText>
<MaterialCommunityIcons name={'chevron-left'} size={32} style={{ opacity: 0 }} />
</ThemedView>
</Container>
<ScrollView keyboardShouldPersistTaps="handled">
<Container style={{ gap: 16 }}>
<Tabs<SupportedAddItems>
onSelect={setSelectedItem}
selectedItem={selectedItem}
items={['Expense', 'Todo', 'Journal']}
/>

<SafeAreaView style={{ flex: 1 }}>
<ScrollView>
<ThemedView style={styles.formContainer}>
<AddFactory type={selectedItem} />
</ThemedView>
</Container>
</ScrollView>
</SafeAreaView>
</ThemedView>
</ThemedView>
</ThemedView>
</KeyboardAvoidingView>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
padding: 24,
paddingVertical: 12,
},
header: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
paddingVertical: 12,
},
main: {
flex: 1,
Expand Down
Loading
Loading