Skip to content

Commit

Permalink
#316 - (version/0.19.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
victorbalssa authored Jul 12, 2024
1 parent a1a814e commit 31b3515
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 51 deletions.
6 changes: 3 additions & 3 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
'ios',
'android',
],
version: '0.18.0',
version: '0.19.0',
orientation: 'portrait',
updates: {
enabled: true,
Expand Down Expand Up @@ -38,7 +38,7 @@ export default {
usesNonExemptEncryption: false,
},
bundleIdentifier: IS_DEV ? 'abacus.fireflyiii.ios.app.dev' : 'abacus.ios.app',
buildNumber: '0.18.0',
buildNumber: '0.19.0',
},
android: {
icon: './src/images/icon-abacus.png',
Expand All @@ -56,7 +56,7 @@ export default {
},
playStoreUrl: 'https://play.google.com/store/apps/details?id=abacus.fireflyiii.android.app',
package: IS_DEV ? 'abacus.fireflyiii.android.app.dev' : 'abacus.fireflyiii.android.app',
versionCode: 26,
versionCode: 30,
},
scheme: 'abacusfiiiapp',
githubUrl: 'https://github.com/victorbalssa/abacus',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abacus",
"version": "0.18.0",
"version": "0.19.0",
"private": true,
"homepage": "https://github.com/victorbalssa/abacus",
"scripts": {
Expand Down
24 changes: 12 additions & 12 deletions src/components/Charts/AssetsHistoryChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,18 @@ export default function AssetsHistoryChart() {
}}
/>
{accounts.map((chart) => chart.entries.length > 0 && (
<VictoryLine
key={chart.label}
style={{
data: {
stroke: chart.color,
strokeWidth: 2,
},
}}
interpolation="monotoneX"
data={chart.entries}
name={`${chart.label} (${chart.currencySymbol})`}
/>
<VictoryLine
key={chart.label}
style={{
data: {
stroke: chart.color,
strokeWidth: 2,
},
}}
interpolation="monotoneX"
data={chart.entries}
name={`${chart.label} (${chart.currencySymbol})`}
/>
))}
</VictoryChart>
)}
Expand Down
12 changes: 6 additions & 6 deletions src/components/Screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ function Bills() {

function PiggyBanks() {
const { colors } = useThemeColors();
const piggyBanks = useSelector((state: RootState) => state.piggybank.piggyBanks);
const loading = useSelector((state: RootState) => state.loading.effects.piggybanks?.getPiggyBanks?.loading);
const piggyBanks = useSelector((state: RootState) => state.piggyBanks.piggyBanks);
const loading = useSelector((state: RootState) => state.loading.effects.piggyBanks?.getPiggyBanks?.loading);
const dispatch = useDispatch<RootDispatch>();

return (
Expand All @@ -383,7 +383,7 @@ function PiggyBanks() {
<RefreshControl
refreshing={false}
onRefresh={() => Promise.all([
dispatch.piggybank.getPiggyBanks(),
dispatch.piggyBanks.getPiggyBanks(),
dispatch.firefly.getNetWorth(),
])}
/>
Expand All @@ -392,7 +392,7 @@ function PiggyBanks() {
<AText fontSize={25} lineHeight={27} style={{ margin: 15 }} bold>
{translate('home_piggy_banks')}
</AText>
{piggyBanks.map((pb) => (
{piggyBanks.filter((pb) => pb.attributes?.percentage).map((pb) => (
<AStack
key={pb.id}
mx={15}
Expand Down Expand Up @@ -430,7 +430,7 @@ function PiggyBanks() {
style={{ textAlign: 'center' }}
bold
>
{`${pb.attributes.percentage.toFixed(0)}%`}
{`${pb.attributes.percentage?.toFixed(0)}%`}
</AText>
</AStack>
</AStack>
Expand Down Expand Up @@ -572,7 +572,7 @@ export default function HomeScreen() {
dispatch.categories.getInsightCategories();
dispatch.budgets.getInsightBudgets();
dispatch.bills.getBills();
dispatch.piggybank.getPiggyBanks();
dispatch.piggyBanks.getPiggyBanks();
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/models/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default createModel<RootModel>()({
dispatch.currencies.resetState(),
dispatch.firefly.resetState(),
dispatch.transactions.resetState(),
dispatch.piggybank.resetState(),
dispatch.piggyBanks.resetState(),
]);
},
}),
Expand Down
2 changes: 1 addition & 1 deletion src/models/firefly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export default createModel<RootModel>()({
} = rootState;

const accountIdsParam = (selectedAccountIds && selectedAccountIds.length > 0) ? `&accounts[]=${selectedAccountIds.join('&accounts[]=')}` : '';
const { data: accounts } = await dispatch.configuration.apiFetch({ url: `/api/v2/chart/account/dashboard?start=${start}&end=${end}${accountIdsParam}` }) as { data: AssetAccountType[] };
const { data: accounts } = await dispatch.configuration.apiFetch({ url: `/api/v1/chart/account/overview?start=${start}&end=${end}${accountIdsParam}` }) as { data: AssetAccountType[] };
let colorIndex = 0;

accounts
Expand Down
6 changes: 3 additions & 3 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import configuration from './configuration';
import currencies from './currencies';
import firefly from './firefly';
import transactions from './transactions';
import piggybank from './piggybank';
import piggyBanks from './piggyBanks';

export interface RootModel extends Models<RootModel> {
accounts: typeof accounts
bills: typeof bills
piggybank : typeof piggybank
piggyBanks : typeof piggyBanks
budgets: typeof budgets
categories: typeof categories
configuration: typeof configuration
Expand All @@ -24,7 +24,7 @@ export interface RootModel extends Models<RootModel> {
export const models: RootModel = {
accounts,
bills,
piggybank,
piggyBanks,
budgets,
categories,
configuration,
Expand Down
45 changes: 23 additions & 22 deletions src/models/piggybank.ts → src/models/piggyBanks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ import { RootModel } from './index';
* {@link https://api-docs.firefly-iii.org/#/piggy_banks/listPiggyBank|Piggy Bank API}
*/
export type PiggyBank = {
id : string,
type: string,
attributes: {
createdAt: string,
updatedAt: string,
accountId: string,
accountName: string,
name: string,
currencyId: string,
currencyCode: string,
currencySymbol: string,
targetAmount: number,
percentage: number,
currentAmount: number,
leftToSave: number,
savePerMonth: number,
}
id: string, type: string, attributes: {
createdAt: string,
updatedAt: string,
accountId: string,
accountName: string,
name: string,
currencyId: string,
currencyCode: string,
currencySymbol: string,
targetAmount: number,
percentage: number,
currentAmount: number,
leftToSave: number,
savePerMonth: number,
active: boolean,
}
}

type PiggyBankState = {
piggyBanks : PiggyBank[]
piggyBanks: PiggyBank[]
}

const INITIAL_STATE : PiggyBankState = { piggyBanks: [] };
const INITIAL_STATE: PiggyBankState = { piggyBanks: [] };

export default createModel<RootModel>()({
state: INITIAL_STATE,
Expand All @@ -45,9 +44,11 @@ export default createModel<RootModel>()({
},

effects: (dispatch) => ({
async getPiggyBanks(_ : void): Promise<void> {
const { data: piggyBanks } = await dispatch.configuration.apiFetch({ url: '/api/v1/piggy-banks' }) as {data : PiggyBank[]};
dispatch.piggybank.setPiggyBanks({ piggyBanks });
async getPiggyBanks(_: void): Promise<void> {
const { data: piggyBanks } = await dispatch.configuration.apiFetch({ url: '/api/v1/piggy-banks' }) as {
data: PiggyBank[]
};
dispatch.piggyBanks.setPiggyBanks({ piggyBanks });
},
}),
});

0 comments on commit 31b3515

Please sign in to comment.