Skip to content

Commit

Permalink
Merge pull request #11 from victorbalssa/version/0.1.0
Browse files Browse the repository at this point in the history
version/0.1.0
  • Loading branch information
victorbalssa authored Jul 22, 2022
2 parents 6b3d70a + 201d486 commit e6003f1
Show file tree
Hide file tree
Showing 12 changed files with 14,890 additions and 15,353 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
![size](https://img.shields.io/github/repo-size/victorbalssa/abacus?style=for-the-badge)
![licence](https://img.shields.io/github/license/victorbalssa/abacus?style=for-the-badge)
![stars](https://img.shields.io/github/stars/victorbalssa/abacus?style=for-the-badge)
[![sdk](https://img.shields.io/badge/SDK-44.0.0-blue?style=for-the-badge)](https://www.npmjs.com/package/expo)
[![sdk](https://img.shields.io/badge/SDK-45.0.0-blue?style=for-the-badge)](https://www.npmjs.com/package/expo)
[![sdk](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com)

</sup>
Expand All @@ -29,14 +29,14 @@
- Support the Net Worth by currency.
- Chart to display history for each asset accounts.
- List, Create, Update, Delete transactions.
- Report new error to github.
- Report new error to GitHub.
- Display source link.

---

### 📡 Technologies

- __Expo SDK 44__ Framework and a Platform for universal React applications. [docs.expo.io](https://docs.expo.io/)
- __Expo SDK 45__ Framework and a Platform for universal React applications. [docs.expo.io](https://docs.expo.io/)
- __Routing and navigation__ React Navigation V6. [https://reactnavigation.org/docs](https://reactnavigation.org/docs/getting-started)
- __Redux architecture__
- Rematch core [@rematch/core](https://github.com/rematch/rematch)
Expand Down
9 changes: 6 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"platforms": [
"ios"
],
"version": "0.0.9",
"version": "0.1.0",
"orientation": "portrait",
"icon": "./src/images/icon-abacus.png",
"splash": {
Expand All @@ -20,8 +20,11 @@
"fallbackToCacheTimeout": 0
},
"ios": {
"buildNumber": "0.0.9",
"bundleIdentifier": "abacus.ios.app"
"buildNumber": "0.1.0",
"bundleIdentifier": "abacus.ios.app",
"config": {
"usesNonExemptEncryption": false
}
},
"scheme": "abacusiosapp",
"githubUrl": "https://github.com/victorbalssa/abacus"
Expand Down
30,094 changes: 14,796 additions & 15,298 deletions package-lock.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abacus",
"homepage": "https://github.com/victorbalssa/abacus",
"version": "0.0.9",
"version": "0.1.0",
"private": true,
"jest": {
"preset": "jest-expo",
Expand All @@ -16,9 +16,9 @@
"debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=19001'"
},
"dependencies": {
"@expo/vector-icons": "^12.0.0",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/datetimepicker": "4.0.0",
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/datetimepicker": "6.1.2",
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
Expand All @@ -29,36 +29,36 @@
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.4.1",
"eslint": "^7.32.0",
"expo": "^44.0.0",
"expo-asset": "~8.4.6",
"expo-auth-session": "~3.5.0",
"expo-font": "~10.0.4",
"expo-haptics": "~11.1.0",
"expo-linear-gradient": "~11.0.3",
"expo-random": "~12.1.1",
"expo-secure-store": "~11.1.0",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.7",
"expo-web-browser": "~10.1.0",
"expo": "^45.0.0",
"expo-asset": "~8.5.0",
"expo-auth-session": "~3.6.1",
"expo-font": "~10.1.0",
"expo-haptics": "~11.2.0",
"expo-linear-gradient": "~11.3.0",
"expo-random": "~12.2.0",
"expo-secure-store": "~11.2.0",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-updates": "~0.13.3",
"expo-web-browser": "~10.2.1",
"globally": "^0.0.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"native-base": "^3.3.7",
"prop-types": "^15.7.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-helmet": "^5.2.1",
"react-native": "0.64.3",
"react-native": "0.68.2",
"react-native-animated-splash-screen": "^2.0.5",
"react-native-gesture-handler": "~2.1.0",
"react-native-gesture-handler": "~2.2.1",
"react-native-modal": "^11.5.6",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-svg": "12.1.1",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-svg": "12.3.0",
"react-native-swipe-list-view": "^3.2.9",
"react-native-web": "0.17.1",
"react-native-web": "0.17.7",
"react-redux": "^7.1.3",
"redux": "^4.1.2",
"redux-persist": "^6.0.0",
Expand All @@ -69,18 +69,18 @@
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "~17.0.21",
"@types/react-native": "^0.67.8",
"@types/react-native": "~0.67.6",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"babel-preset-expo": "9.0.2",
"babel-preset-expo": "~9.1.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.0",
"jest-expo": "^44.0.0",
"jest-expo": "^45.0.0",
"node-sass": "^7.0.0",
"react-scripts": "2.1.8",
"typescript": "^4.7.3"
"typescript": "~4.3.5"
}
}
31 changes: 30 additions & 1 deletion src/models/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export type AccountType = {
type: string,
}

export type ApiAccountType = {
data: AccountType[],
}

export type AccountStateType = {
accounts: AccountType[],
}
Expand Down Expand Up @@ -82,7 +86,32 @@ export default createModel<RootModel>()({
* @returns {Promise}
*/
async getAccounts(): Promise<void> {
const { data: accounts } = await dispatch.configuration.apiFetch({ url: '/api/v1/accounts' });
let { data: accounts, meta } = await dispatch.configuration.apiFetch({ url: '/api/v1/accounts?page=1' });

const {
pagination: {
total_pages: totalPages,
},
} = meta;

// /!\ TODO: implement search select with /autocomplete endpoints https://api-docs.firefly-iii.org/#/autocomplete/getAccountsAC
if (totalPages > 1) {
const promises: Promise<ApiAccountType>[] = [];
for (let i = 2; i < totalPages + 1; i += 1) {
promises.push(dispatch.configuration.apiFetch({ url: `/api/v1/accounts?page=${i}` }));
}

const pageAccounts = await Promise.all(promises);

pageAccounts.forEach((a) => {
const { data } = a;

accounts = [...accounts, ...data];
});

dispatch.accounts.setAccounts({ accounts });
return;
}

dispatch.accounts.setAccounts({ accounts });
},
Expand Down
10 changes: 5 additions & 5 deletions src/models/firefly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,19 @@ export default createModel<RootModel>()({

switch (rangeInt) {
case 1:
rangeTitle = `${moment(start).utc().format('MMMM')} ${moment(start).utc().year()}.`;
rangeTitle = `${moment(end).format('MMM')} ${moment(end).year()}.`;
break;
case 3:
rangeTitle = `Q${moment(start).utc().quarter()} ${moment(start).utc().year()}.`;
rangeTitle = `Q${moment(start).quarter()} ${moment(start).year()}.`;
break;
case 6:
rangeTitle = `S${moment(start).utc().quarter() < 3 ? 1 : 2} ${moment(start).utc().year()}.`;
rangeTitle = `S${moment(start).quarter() < 3 ? 1 : 2} ${moment(start).year()}.`;
break;
case 12:
rangeTitle = `${moment(start).utc().year()} Year.`;
rangeTitle = `${moment(start).year()} Year.`;
break;
default:
rangeTitle = `${moment(start).utc().year()} Year.`;
rangeTitle = `${moment(start).year()} Year.`;
break;
}

Expand Down
8 changes: 4 additions & 4 deletions src/native/components/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ const TransactionForm = ({ accounts = [], loading, submit }) => {
source_id: value,
})}
>
{accounts.filter((a) => ['asset', 'revenue'].includes(a.attributes.type)).map((a) => (
<Select.Item key={a.id} label={a.attributes.name} value={a.id} />))}
{accounts.filter((a) => ['asset', 'revenue'].includes(a.attributes?.type)).map((a) => (
<Select.Item key={a.id} label={a.attributes?.name} value={a.id} />))}
</Select>
</FormControl>
<FormControl mt="1" isRequired isInvalid={'destination_id' in errors}>
Expand All @@ -137,8 +137,8 @@ const TransactionForm = ({ accounts = [], loading, submit }) => {
destination_id: value,
})}
>
{accounts.filter((a) => ['asset', 'expense'].includes(a.attributes.type)).map((a) => (
<Select.Item key={a.id} label={a.attributes.name} value={a.id} />))}
{accounts.filter((a) => ['asset', 'expense'].includes(a.attributes?.type)).map((a) => (
<Select.Item key={a.id} label={a.attributes?.name} value={a.id} />))}
</Select>
</FormControl>
<FormControl mt="1" isRequired>
Expand Down
8 changes: 4 additions & 4 deletions src/native/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Home = ({
<HStack flexWrap="wrap" justifyContent="center" alignItems="center">
{netWorth.map((nw) => (
<VStack
flex={1}
minW={165}
key={nw.title}
height={65}
margin={1}
Expand Down Expand Up @@ -89,7 +89,7 @@ const Home = ({
<HStack flexWrap="wrap" justifyContent="center" alignItems="center">
{spent.map((s) => (
<VStack
flex={1}
minW={165}
key={s.title}
height={65}
margin={1}
Expand Down Expand Up @@ -129,7 +129,7 @@ const Home = ({
<HStack flexWrap="wrap" justifyContent="center" alignItems="center">
{balance.map((s) => (
<VStack
flex={1}
minW={165}
key={s.title}
height={65}
margin={1}
Expand Down Expand Up @@ -169,7 +169,7 @@ const Home = ({
<HStack flexWrap="wrap" justifyContent="center" alignItems="center">
{earned.map((s) => (
<VStack
flex={1}
minW={165}
key={s.title}
height={65}
margin={1}
Expand Down
1 change: 1 addition & 0 deletions src/native/components/Oauth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const Configuration = ({
colorScheme="primary"
isDisabled={!isValidHttpUrl(backendURL) || config.oauthClientId === ''}
isLoading={loading}
isLoadingText="Submitting..."
onPress={() => promptAsync()}
>
Sign In
Expand Down
10 changes: 4 additions & 6 deletions src/native/components/UI/RangeTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ const RangeTitle = ({
<Box
shadow={2}
backgroundColor="white"
pl={4}
pr={4}
pl={3}
pr={3}
zIndex={30}
safeAreaTop
>
<HStack justifyContent="space-between" alignItems="center">
<IconButton
shadow={2}
size="sm"
borderRadius={15}
variant="solid"
_icon={{
Expand All @@ -48,7 +47,7 @@ const RangeTitle = ({
},
}}
/>
<Box flex={1} pl={3} mt={1} height={41} justifyContent="center">
<Box pl={2} mt={1} height={41} width={170} justifyContent="center">
<Text style={{ fontFamily: 'Montserrat_Bold', fontSize: 21 }}>
{rangeTitle}
</Text>
Expand All @@ -62,7 +61,7 @@ const RangeTitle = ({
variant="outline"
dropdownIcon={<></>}
height={41}
width={78}
width={84}
_selectedItem={{
bg: 'primary.600',
endIcon: <CheckIcon size="5" />,
Expand All @@ -78,7 +77,6 @@ const RangeTitle = ({

<IconButton
shadow={2}
size="sm"
borderRadius={15}
variant="solid"
_icon={{
Expand Down
7 changes: 7 additions & 0 deletions src/native/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ const theme = extendTheme({
fontFamily: 'Montserrat_Bold',
},
},
IconButton: {
baseStyle: {
_icon: {
size: 'xl',
},
},
},
Input: {
baseStyle: {
borderRadius: 15,
Expand Down
1 change: 1 addition & 0 deletions src/native/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const TabBarAdvancedButton = ({ onPress }) => (
_icon={{
as: AntDesign,
name: 'edit',
size: 'xl',
}}
onPress={onPress}
onTouchStart={() => Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)}
Expand Down

0 comments on commit e6003f1

Please sign in to comment.