Skip to content

Commit

Permalink
🐛 Fix: Correction of the responsive context, correction of character …
Browse files Browse the repository at this point in the history
…limitations in the table line and addition of treatments in the value of the balance period 🐛
  • Loading branch information
Aszurar committed Jan 22, 2024
1 parent 0f4eb6a commit bdc133a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/components/Header/NewTransactionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<NewTransactionFormProps>) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/Data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
},
},
})
Expand Down
4 changes: 3 additions & 1 deletion src/context/responsiveness/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const ResponsivenessContext = createContext({} as ResponsivenessContextProps)
function ResponsivenessProvider({
children,
}: Readonly<ResponsivenessProviderProps>) {
const [currentBrowserWidth, setCurrentBrowserWidth] = useState(0)
const [currentBrowserWidth, setCurrentBrowserWidth] = useState(
window.innerWidth,
)
const isMobile = currentBrowserWidth < 640

function onUpdateCurrentBrowserWidth() {
Expand Down
8 changes: 7 additions & 1 deletion src/context/transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -137,6 +141,8 @@ function TransactionsProvider({
final: finalDateFormatted,
},
})
} else {
setPeriodBalanceFormatted({} as PeriodBalanceFormattedProps)
}
}

Expand Down

0 comments on commit bdc133a

Please sign in to comment.