Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into cohort/clrfund
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Jul 9, 2023
2 parents e1899e6 + e17a0c3 commit 99938a1
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clrfund/contracts",
"version": "4.2.2",
"version": "4.2.3",
"license": "GPL-3.0",
"scripts": {
"hardhat": "hardhat",
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clrfund/subgraph",
"version": "4.2.2",
"version": "4.2.3",
"repository": "https://github.com/clrfund/monorepo/subgraph",
"keywords": [
"clr.fund",
Expand Down
4 changes: 4 additions & 0 deletions vue-app/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ AWS_LAMBDA_JS_RUNTIME=nodejs18.x
# This date will be used in the verify landing page. If not set or bad date format, a generic message will be displayed
# format: yyyy-MM-dd e.g. 2023-06-26
VITE_NEXT_ROUND_START_DATE=

# Use this deadline (in UTC) to hide the 'Add Project' button
# format: yyyy-MM-dd
VITE_RECIPIENT_JOIN_DEADLINE=
2 changes: 1 addition & 1 deletion vue-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clrfund/vue-app",
"version": "4.2.2",
"version": "4.2.3",
"private": true,
"license": "GPL-3.0",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions vue-app/src/api/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ const nextStartDate = import.meta.env.VITE_NEXT_ROUND_START_DATE
: null

export const nextRoundStartDate = nextStartDate?.isValid ? nextStartDate : null

// Use this deadline to hide the 'Add Project' button
const deadline = import.meta.env.VITE_RECIPIENT_JOIN_DEADLINE
? DateTime.fromFormat(import.meta.env.VITE_RECIPIENT_JOIN_DEADLINE, 'yyyy-MM-dd', { zone: 'utc' })
: null
export const recipientJoinDeadlineConfig = deadline?.isValid ? deadline : null
18 changes: 15 additions & 3 deletions vue-app/src/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
serializeCart,
} from '@/api/contributions'
import { getCommittedCart } from '@/api/cart'
import { operator, chain, ThemeMode, recipientRegistryType } from '@/api/core'
import { operator, chain, ThemeMode, recipientRegistryType, recipientJoinDeadlineConfig } from '@/api/core'
import { type RoundInfo, RoundStatus, getRoundInfo } from '@/api/round'
import { getTally, type Tally } from '@/api/tally'
import { type Factory, getFactoryInfo } from '@/api/factory'
Expand All @@ -24,6 +24,7 @@ import { getAssetsUrl } from '@/utils/url'
import { getTokenLogo } from '@/utils/tokens'
import { assert, ASSERT_MISSING_ROUND, ASSERT_MISSING_SIGNATURE, ASSERT_NOT_CONNECTED_WALLET } from '@/utils/assert'
import { Keypair } from '@clrfund/maci-utils'
import { DateTime } from 'luxon'

export type AppState = {
isAppReady: boolean
Expand Down Expand Up @@ -65,6 +66,10 @@ export const useAppStore = defineStore('app', {
}),
getters: {
recipientJoinDeadline: state => {
if (recipientJoinDeadlineConfig) {
return recipientJoinDeadlineConfig
}

const recipientStore = useRecipientStore()
if (!state.currentRound || !recipientStore.recipientRegistryInfo) {
return null
Expand All @@ -77,7 +82,7 @@ export const useAppStore = defineStore('app', {
seconds: challengePeriodDuration,
})

return deadline.isValid ? deadline : null
return deadline.isValid ? deadline : state.currentRound.signUpDeadline
},
isRoundReallocationPhase: (state): boolean => {
return !!state.currentRound && state.currentRound.status === RoundStatus.Reallocating
Expand Down Expand Up @@ -118,7 +123,14 @@ export const useAppStore = defineStore('app', {
return !!this.currentRound && this.isRoundJoinPhase && !hasDateElapsed(this.currentRound.startTime)
},
isRoundJoinPhase(): boolean {
return !hasDateElapsed(this.recipientJoinDeadline!)
if (!this.isAppReady) {
return false
}
if (!this.recipientJoinDeadline) {
// no deadline means still accepting application
return true
}
return !hasDateElapsed(this.recipientJoinDeadline)
},
isRoundContributorLimitReached: state => {
return !!state.currentRound && state.currentRound.maxContributors <= state.currentRound.contributors
Expand Down
7 changes: 4 additions & 3 deletions vue-app/src/views/JoinLanding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<div class="breadcrumbs">
<breadcrumbs />
</div>
<div class="content" v-if="loading">
<div class="content" v-if="loading || !isAppReady">
<h1>{{ $t('joinLanding.loading') }}</h1>
<loader />
</div>

<div class="content" v-else-if="hasContributionPhaseEnded">
<div class="content" v-else-if="recipientJoinDeadline && !isRoundJoinPhase">
<div class="big-emoji">☹</div>
<h1>{{ $t('joinLanding.closed.h1') }}</h1>
<div id="subtitle" class="subtitle">
Expand Down Expand Up @@ -167,7 +167,8 @@ import { useAppStore, useRecipientStore } from '@/stores'
import { storeToRefs } from 'pinia'
const appStore = useAppStore()
const { maxRecipients, isMessageLimitReached, hasContributionPhaseEnded } = storeToRefs(appStore)
const { maxRecipients, isMessageLimitReached, isRoundJoinPhase, recipientJoinDeadline, isAppReady } =
storeToRefs(appStore)
const recipientStore = useRecipientStore()
const { recipientRegistryInfo } = storeToRefs(recipientStore)
Expand Down
19 changes: 12 additions & 7 deletions vue-app/src/views/Landing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
</div>
</div>
</div>
<div class="apply-callout" v-if="(!currentRound || isRoundJoinPhase) && !isRecipientRegistryFull">
<div class="apply-callout" v-if="isRoundJoinPhase && !isRecipientRegistryFull">
<div class="column">
<h2>{{ $t('landing.callout.title') }}</h2>
<p>
{{ $t('landing.callout.paragraph') }}
</p>
<div class="button-group">
<links to="/join" class="btn-primary w100">{{ $t('landing.callout.action') }}</links>
<div v-if="signUpDeadline">
<time-left unitClass="none" :date="signUpDeadline" />
<div v-if="recipientJoinDeadline">
<time-left unitClass="none" :date="recipientJoinDeadline" />
{{ $t('landing.callout.deadline') }}
</div>
</div>
Expand Down Expand Up @@ -179,10 +179,15 @@ import { storeToRefs } from 'pinia'
import { getAssetsUrl } from '@/utils/url'
const appStore = useAppStore()
const { operator, isRoundJoinPhase, isRecipientRegistryFull, currentRound, currentRoundAddress, isAppReady } =
storeToRefs(appStore)
const signUpDeadline = computed(() => appStore.currentRound?.signUpDeadline)
const {
operator,
isRoundJoinPhase,
recipientJoinDeadline,
isRecipientRegistryFull,
currentRound,
currentRoundAddress,
isAppReady,
} = storeToRefs(appStore)
function scrollToHowItWorks() {
document.getElementById('section-how-it-works')?.scrollIntoView({ behavior: 'smooth' })
Expand Down
4 changes: 2 additions & 2 deletions vue-app/src/views/ProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<img v-if="search.length > 0" @click="clearSearch" src="@/assets/close.svg" height="20" class="pointer" />
</div>
<div class="add-project">
<div v-if="isRoundJoinPhase" class="add-project">
<links to="/join" class="btn-primary">{{ $t('projectList.link1') }}</links>
</div>
<div class="hr" />
Expand Down Expand Up @@ -96,7 +96,7 @@ function shuffleArray(array: any[]) {
const route = useRoute()
const appStore = useAppStore()
const { currentRoundAddress, currentRound, showCartPanel } = storeToRefs(appStore)
const { currentRoundAddress, currentRound, showCartPanel, isRoundJoinPhase } = storeToRefs(appStore)
const userStore = useUserStore()
const { currentUser } = storeToRefs(userStore)
Expand Down

0 comments on commit 99938a1

Please sign in to comment.