From bdc133a1429294877925806e68cb1f8a767a0994 Mon Sep 17 00:00:00 2001 From: Lucas de Lima Martins de Souza Date: Mon, 22 Jan 2024 19:43:51 -0300 Subject: [PATCH] :bug: Fix: Correction of the responsive context, correction of character limitations in the table line and addition of treatments in the value of the balance period :bug: --- src/components/Header/NewTransactionForm/index.tsx | 7 ------- src/components/Table/Data.tsx | 2 +- src/components/Table/Row.tsx | 2 +- src/context/responsiveness/index.tsx | 4 +++- src/context/transactions/index.tsx | 8 +++++++- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/Header/NewTransactionForm/index.tsx b/src/components/Header/NewTransactionForm/index.tsx index e527124..07b334a 100644 --- a/src/components/Header/NewTransactionForm/index.tsx +++ b/src/components/Header/NewTransactionForm/index.tsx @@ -50,13 +50,6 @@ type NewTransactionFormProps = { onCloseModal: () => void } -// TODO -// Criar Readme -// Criar branch que usa o localStorage para armazenar as transações e realizar as operações: branch prod -// json server ficará somente na branch de dev -// Anotar sobre o uso do .reducer que fiz para calcular o total de entradas e saídas. -// Anotar toda lógica do useReducer feito aqui - export function NewTransactionForm({ onCloseModal, }: Readonly) { diff --git a/src/components/Table/Data.tsx b/src/components/Table/Data.tsx index d9bdb21..1d693d9 100644 --- a/src/components/Table/Data.tsx +++ b/src/components/Table/Data.tsx @@ -5,7 +5,7 @@ const data = tv({ base: 'flex text-gray-500 dark:text-gray-400 font-normal items-center truncate', variants: { variant: { - description: `text-gray-700 dark:text-white max-w-40 phone-md:max-w-68 + description: `block text-gray-700 dark:text-white max-w-40 phone-md:max-w-68 phone-lg:max-w-76 phone-xl:max-w-80 sm:max-w-full truncate `, income: 'text-green-400 dark:text-green-400 text-xl sm:text-base', outcome: diff --git a/src/components/Table/Row.tsx b/src/components/Table/Row.tsx index 7ea74f9..1cc5d63 100644 --- a/src/components/Table/Row.tsx +++ b/src/components/Table/Row.tsx @@ -7,7 +7,7 @@ const row = tv({ variant: { head: 'bg-transparent pb-5 flex justify-between items-center', body: `flex flex-col px-6 py-4 bg-white dark:bg-zinc-900 my-2 sm:py-5 - drop-shadow-lg rounded-md border-collapse overflow-hidden`, + drop-shadow-lg rounded-md border-collapse overflow-hidden trucante`, }, }, }) diff --git a/src/context/responsiveness/index.tsx b/src/context/responsiveness/index.tsx index 38a1fc6..c1cfee9 100644 --- a/src/context/responsiveness/index.tsx +++ b/src/context/responsiveness/index.tsx @@ -13,7 +13,9 @@ const ResponsivenessContext = createContext({} as ResponsivenessContextProps) function ResponsivenessProvider({ children, }: Readonly) { - const [currentBrowserWidth, setCurrentBrowserWidth] = useState(0) + const [currentBrowserWidth, setCurrentBrowserWidth] = useState( + window.innerWidth, + ) const isMobile = currentBrowserWidth < 640 function onUpdateCurrentBrowserWidth() { diff --git a/src/context/transactions/index.tsx b/src/context/transactions/index.tsx index d0861a4..df309ff 100644 --- a/src/context/transactions/index.tsx +++ b/src/context/transactions/index.tsx @@ -8,6 +8,7 @@ import React, { // useState, } from 'react' // import { api } from '../../server/api' +import { isEqual } from 'date-fns' import { transactionsReducer } from '../../reducers/transactions/reducer' import { dateFormatter, @@ -122,9 +123,12 @@ function TransactionsProvider({ const start = new Date(initial) const end = new Date(final) + const isStartDateAndEndDateEquals = isEqual(start, end) + const endVerified = isStartDateAndEndDateEquals ? new Date() : end + const period = periodBetweenDatesFormatted({ startDate: start, - endDate: end, + endDate: endVerified, }) const initialDateFormatted = dateFormatter.format(start) @@ -137,6 +141,8 @@ function TransactionsProvider({ final: finalDateFormatted, }, }) + } else { + setPeriodBalanceFormatted({} as PeriodBalanceFormattedProps) } }