From 8e1945853bd1f08a5a6aa522b9518e438c42fc13 Mon Sep 17 00:00:00 2001 From: Victor Lucas Date: Mon, 20 Nov 2023 21:03:47 -0500 Subject: [PATCH 1/8] feat: budgets --- .gitignore | 4 +- .vscode/settings.json | 3 - components/LateralMenu/index.tsx | 2 + configs/collections.config.ts | 3 + .../BaseModule/components/Bubble/index.tsx | 17 ++- modules/BaseModule/constants/Bubble.ts | 1 + .../BaseModule/container/BaseForm/index.tsx | 21 +++- .../BaseModule/container/BaseList/index.tsx | 48 +++---- modules/BaseModule/shared/renderFields.tsx | 2 +- .../FormBill/form-bill.container.tsx | 20 ++- .../components/form-budget.component.tsx | 119 ++++++++++++++++++ .../container/form-budget.container.tsx | 12 ++ .../container/list-budget.container.tsx | 82 ++++++++++++ modules/Budget/services/budget.service.ts | 43 +++++++ modules/Category/hooks/useCategories.tsx | 41 ++++++ .../Category/hooks/useCategoriesSelect.tsx | 26 ---- pages/budget/create.tsx | 12 ++ pages/budget/index.tsx | 10 ++ 18 files changed, 396 insertions(+), 70 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 configs/collections.config.ts create mode 100644 modules/Budget/components/form-budget.component.tsx create mode 100644 modules/Budget/container/form-budget.container.tsx create mode 100644 modules/Budget/container/list-budget.container.tsx create mode 100644 modules/Budget/services/budget.service.ts create mode 100644 modules/Category/hooks/useCategories.tsx delete mode 100644 modules/Category/hooks/useCategoriesSelect.tsx create mode 100644 pages/budget/create.tsx create mode 100644 pages/budget/index.tsx diff --git a/.gitignore b/.gitignore index cb034b6..992029d 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,8 @@ yarn-error.log* .env.development.local .env.test.local .env.production.local +.env.prod # vercel -.vercel \ No newline at end of file +.vercel +.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3662b37..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file diff --git a/components/LateralMenu/index.tsx b/components/LateralMenu/index.tsx index 1bbc53e..eb5c7ac 100644 --- a/components/LateralMenu/index.tsx +++ b/components/LateralMenu/index.tsx @@ -20,6 +20,7 @@ import { FiHome, FiPower, FiTrendingUp, FiTrendingDown, FiMenu } from 'react-ico import { IconType } from 'react-icons'; import Image from 'next/image'; import { BiSolidCategoryAlt } from 'react-icons/bi'; +import { TbPigMoney } from "react-icons/tb"; interface LinkItemProps { name: string; @@ -30,6 +31,7 @@ const LinkItems: Array = [ { name: 'Início', icon: FiHome, link: '/' }, { name: 'Criar receita', icon: FiTrendingUp, link: '/bill?type=INCOME' }, { name: 'Criar despesa', icon: FiTrendingDown, link: '/bill?type=EXPENSE' }, + { name: 'Orçamentos', icon: TbPigMoney, link: '/budget' }, { name: 'Categorias', icon: BiSolidCategoryAlt, link: '/category' }, { name: 'Sair', diff --git a/configs/collections.config.ts b/configs/collections.config.ts new file mode 100644 index 0000000..d0a37d8 --- /dev/null +++ b/configs/collections.config.ts @@ -0,0 +1,3 @@ +import { firestore } from '@Configs/Firebase'; + +export const budgetsCollection = firestore.collection('budgets'); diff --git a/modules/BaseModule/components/Bubble/index.tsx b/modules/BaseModule/components/Bubble/index.tsx index d9e57b1..f5b8637 100644 --- a/modules/BaseModule/components/Bubble/index.tsx +++ b/modules/BaseModule/components/Bubble/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FieldErrors, FieldValues, UseFormRegister } from 'react-hook-form'; -import { Input, Select } from '@Components'; +import { Input, Select, MoneyInput } from '@Components'; import SelectOption from '@Modules/BaseModule/interfaces/SelectOption'; import { BubbleEnum, BUBBLE_TYPES } from '../../constants/Bubble'; @@ -51,10 +51,21 @@ const Bubble = ({ {...register(name, { required })} error={errors[name]?.message} value={value} - {...props} - /> + + {...props}/> ); + case BUBBLE_TYPES.MONEY: + return ( + + ); + case BUBBLE_TYPES.SELECT: return (