Skip to content

Commit

Permalink
Merge pull request #250 from PotLock/feat/tabs-pot
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen authored Feb 16, 2024
2 parents 3c64e0c + de0372b commit ace03a7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion apps/potlock/widget/Pots/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,32 @@ props.navOptions = [
},
];

if (!props.nav) props.nav = "projects"; // default to home tab
const potDetail = state.potDetail;
const now = Date.now();
const applicationNotStarted = now < potDetail.application_start_ms;
const applicationOpen = now >= potDetail.application_start_ms && now < potDetail.application_end_ms;

const publicRoundOpen =
now >= potDetail.public_round_start_ms && now < potDetail.public_round_end_ms;
const publicRoundClosed = now >= potDetail.public_round_end_ms;

const payoutsPending = publicRoundClosed && !potDetail.cooldown_end_ms;

//console.log("state", canPayoutsBeSet);

if (!props.nav) {
let nav;
applicationNotStarted
? (nav = "sponsors")
: applicationOpen
? (nav = "applications")
: publicRoundOpen
? (nav = "projects")
: !payoutsPending
? (nav = "donations")
: (nav = "payouts");
props.nav = nav;
} // default to home tab

// const imageHeightPx = 120;
// const profileImageTranslateYPx = 220;
Expand Down

0 comments on commit ace03a7

Please sign in to comment.