Skip to content

Commit

Permalink
feat: hide grant and pitch proposal submission buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp committed Nov 12, 2024
1 parent eb3e83a commit a0cc544
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const JOIN_DISCORD_URL = config.get('JOIN_DISCORD_URL')
export const REASON_THRESHOLD = Number(config.get('REASON_THRESHOLD'))
export const TRANSPARENCY_API = config.get('DCL_DATA_API')
export const VESTING_DASHBOARD_URL = config.get('VESTING_DASHBOARD_URL')
export const GRANT_PROPOSAL_SUBMIT_ENABLED = false
export const PITCH_PROPOSAL_SUBMIT_ENABLED = false
5 changes: 5 additions & 0 deletions src/pages/submit/grant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import LoadingView from '../../components/Layout/LoadingView'
import LogIn from '../../components/Layout/LogIn'
import PreventNavigation from '../../components/Layout/PreventNavigation.tsx'
import CategorySelector from '../../components/Projects/CategorySelector'
import { GRANT_PROPOSAL_SUBMIT_ENABLED } from '../../constants/index.ts'
import { SUBMISSION_THRESHOLD_GRANT } from '../../constants/proposals'
import { useAuthContext } from '../../context/AuthProvider'
import useFormatMessage from '../../hooks/useFormatMessage'
Expand Down Expand Up @@ -106,6 +107,10 @@ export default function SubmitGrant() {
const [account, accountState] = useAuthContext()
const navigate = useNavigate()

if (!GRANT_PROPOSAL_SUBMIT_ENABLED) {
navigate('/submit')
}

useEffect(() => {
const params = new URLSearchParams(location.search)
let category: NewGrantCategory | null = null
Expand Down
27 changes: 16 additions & 11 deletions src/pages/submit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
AddRemoveProposalModal,
AddRemoveProposalModalProps,
} from '../../components/Modal/AddRemoveProposalModal/AddRemoveProposalModal'
import { GRANT_PROPOSAL_SUBMIT_ENABLED, PITCH_PROPOSAL_SUBMIT_ENABLED } from '../../constants'
import useFormatMessage from '../../hooks/useFormatMessage'
import { CatalystType, HiringType, PoiType, ProposalType } from '../../types/proposals'
import { getCommitteesWithOpenSlots } from '../../utils/committee'
Expand Down Expand Up @@ -81,19 +82,23 @@ export default function SubmitPage() {
/>
<CategoryBanner type={ProposalType.BanName} href={locations.submit(ProposalType.BanName)} />
<CategoryBanner type={ProposalType.LinkedWearables} href={locations.submit(ProposalType.LinkedWearables)} />
<CategoryBanner
type={ProposalType.Grant}
href={locations.submit(ProposalType.Grant)}
active={isGrantProposalSubmitEnabled(NOW)}
/>
{GRANT_PROPOSAL_SUBMIT_ENABLED && (
<CategoryBanner
type={ProposalType.Grant}
href={locations.submit(ProposalType.Grant)}
active={isGrantProposalSubmitEnabled(NOW)}
/>
)}
<CategoryBanner type={ProposalType.Hiring} onClick={setHiringModalProps} />
</ContentSection>
<ContentSection>
<Text className="SubmitPage__Header" size="sm" weight="semi-bold" color="secondary">
{t('page.submit.bidding_tendering_process')}
</Text>
<CategoryBanner type={ProposalType.Pitch} href={locations.submit(ProposalType.Pitch)} />
</ContentSection>
{PITCH_PROPOSAL_SUBMIT_ENABLED && (
<ContentSection>
<Text className="SubmitPage__Header" size="sm" weight="semi-bold" color="secondary">
{t('page.submit.bidding_tendering_process')}
</Text>
<CategoryBanner type={ProposalType.Pitch} href={locations.submit(ProposalType.Pitch)} />
</ContentSection>
)}
<ContentSection>
<Text className="SubmitPage__Header" size="sm" weight="semi-bold" color="secondary">
{t('page.submit.governance_process')}
Expand Down
5 changes: 5 additions & 0 deletions src/pages/submit/pitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import LoadingView from '../../components/Layout/LoadingView'
import LogIn from '../../components/Layout/LogIn'
import PostLabel from '../../components/PostLabel'
import CoAuthors from '../../components/Proposal/Submit/CoAuthor/CoAuthors'
import { PITCH_PROPOSAL_SUBMIT_ENABLED } from '../../constants/index.ts'
import { SUBMISSION_THRESHOLD_PITCH } from '../../constants/proposals'
import { useAuthContext } from '../../context/AuthProvider'
import useFormatMessage from '../../hooks/useFormatMessage'
Expand Down Expand Up @@ -51,6 +52,10 @@ export default function SubmitPitchProposal() {
const preventNavigation = useRef(false)
const [error, setError] = useState('')

if (!PITCH_PROPOSAL_SUBMIT_ENABLED) {
navigate('/submit')
}

const {
handleSubmit,
formState: { isDirty, isSubmitting, errors },
Expand Down

0 comments on commit a0cc544

Please sign in to comment.