Skip to content

Commit

Permalink
Move logic from PostponeButton to PostponeSection and reuse date logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePavolC committed Jul 19, 2024
1 parent 797b348 commit 83d309f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const TaxFormSection = ({ nextRoute, isDebug, isLive }) => {
}

const PostponeSection = ({ nextPostponeRoute, now, isPostponeLive, isDebug }) => {
const isPostponeExtensionTime = now.getMonth() < 11;
const isPostponeTime = now.getMonth() < 3

return (
<>
Expand All @@ -172,14 +172,14 @@ const PostponeSection = ({ nextPostponeRoute, now, isPostponeLive, isDebug }) =>
</ul>

{
((isPostponeExtensionTime && isPostponeLive) || isDebug) && (
((isPostponeTime && isPostponeLive) || isDebug) && (
<>
<p className="govuk-body-xs">
Používaním tejto služby súhlasíte so spracovaním osobných údajov v rozsahu
nevyhnutnom na vygenerovanie odkladu daňového priznania. Vaše údaje
neukladáme, sú použité výlučne na spracovanie odkladu daňového priznania.
</p>
<PostponeButton now={now} nextPostponeRoute={nextPostponeRoute} />
<PostponeButton isPostponeTime={isPostponeTime} nextPostponeRoute={nextPostponeRoute} />
</>
)
}
Expand Down Expand Up @@ -208,9 +208,7 @@ const PostponeText = ({ now }: { now: Date }) => (
</>
)

const PostponeButton = ({ now, nextPostponeRoute }) => {
const isPostponeTime = now.getMonth() < 3

const PostponeButton = ({ isPostponeTime, nextPostponeRoute }) => {
if (!isPostponeTime) {
return (
<button
Expand Down

0 comments on commit 83d309f

Please sign in to comment.