Skip to content

Commit

Permalink
9844 Removed submit
Browse files Browse the repository at this point in the history
  • Loading branch information
masvelio committed Dec 9, 2024
1 parent da1df39 commit 93cd18f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
import React from 'react';

import { CWCheckbox } from 'views/components/component_kit/cw_checkbox';
import { CWText } from 'views/components/component_kit/cw_text';
import CWBanner from 'views/components/component_kit/new_designs/CWBanner';
import { CONTEST_FAQ_URL } from 'views/pages/CommunityManagement/Contests/utils';

import './ContestThreadBanner.scss';

interface ContestThreadBannerProps {
submitEntryChecked: boolean;
onSetSubmitEntryChecked: (value: boolean) => void;
}

const ContestThreadBanner = ({
submitEntryChecked,
onSetSubmitEntryChecked,
}: ContestThreadBannerProps) => {
const ContestThreadBanner = () => {
return (
<CWBanner
className="ContestThreadBanner"
title="This topic has an ongoing contest(s). Submit thread to contest?"
body="Once a post is submitted it cannot be edited.
The post with the most upvotes will win the contest prize."
type="info"
accessoryRight={
<div className="banner-accessory-right">
<CWText type="caption">Submit Entry</CWText>
<CWCheckbox
checked={submitEntryChecked}
onChange={() => onSetSubmitEntryChecked(!submitEntryChecked)}
/>
</div>
}
footer={
<a href={CONTEST_FAQ_URL} target="_blank" rel="noopener noreferrer">
Learn more about contests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useJoinCommunityBanner from 'hooks/useJoinCommunityBanner';
import useTopicGating from 'hooks/useTopicGating';
import type { Topic } from 'models/Topic';
import { useCommonNavigate } from 'navigation/helpers';
import React, { useEffect, useMemo, useState } from 'react';
import React, { useEffect, useMemo } from 'react';
import { useLocation } from 'react-router-dom';
import app from 'state';
import { useGetUserEthBalanceQuery } from 'state/api/communityStake';
Expand Down Expand Up @@ -50,8 +50,6 @@ export const NewThreadForm = () => {
const navigate = useCommonNavigate();
const location = useLocation();

const [submitEntryChecked, setSubmitEntryChecked] = useState(false);

useAppStatus();

const communityId = app.activeChainId() || '';
Expand Down Expand Up @@ -232,8 +230,6 @@ export const NewThreadForm = () => {

const contestThreadBannerVisible =
isContestAvailable && hasTopicOngoingContest;
const isDisabledBecauseOfContestsConsent =
contestThreadBannerVisible && !submitEntryChecked;

const contestTopicAffordanceVisible =
isContestAvailable && hasTopicOngoingContest;
Expand Down Expand Up @@ -367,12 +363,7 @@ export const NewThreadForm = () => {
placeholder="Enter text or drag images and media here. Use the tab button to see your formatted post."
/>

{!!contestThreadBannerVisible && (
<ContestThreadBanner
submitEntryChecked={submitEntryChecked}
onSetSubmitEntryChecked={setSubmitEntryChecked}
/>
)}
{!!contestThreadBannerVisible && <ContestThreadBanner />}

<MessageRow
hasFeedback={!!walletBalanceError}
Expand All @@ -396,7 +387,6 @@ export const NewThreadForm = () => {
disabled={
isDisabled ||
!user.activeAccount ||
isDisabledBecauseOfContestsConsent ||
walletBalanceError ||
contestTopicError ||
!!disabledActionsTooltipText
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
import React from 'react';

import { CWCheckbox } from 'views/components/component_kit/cw_checkbox';
import { CWText } from 'views/components/component_kit/cw_text';
import CWBanner from 'views/components/component_kit/new_designs/CWBanner';
import { CONTEST_FAQ_URL } from 'views/pages/CommunityManagement/Contests/utils';

import './ContestThreadBanner.scss';

interface ContestThreadBannerProps {
submitEntryChecked: boolean;
onSetSubmitEntryChecked: (value: boolean) => void;
}

const ContestThreadBanner = ({
submitEntryChecked,
onSetSubmitEntryChecked,
}: ContestThreadBannerProps) => {
const ContestThreadBanner = () => {
return (
<CWBanner
className="ContestThreadBanner"
title="This topic has an ongoing contest(s). Submit thread to contest?"
body="Once a post is submitted it cannot be edited.
The post with the most upvotes will win the contest prize."
type="info"
accessoryRight={
<div className="banner-accessory-right">
<CWText type="caption">Submit Entry</CWText>
<CWCheckbox
checked={submitEntryChecked}
onChange={() => onSetSubmitEntryChecked(!submitEntryChecked)}
/>
</div>
}
footer={
<a href={CONTEST_FAQ_URL} target="_blank" rel="noopener noreferrer">
Learn more about contests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { detectURL, getThreadActionTooltipText } from 'helpers/threads';
import useJoinCommunityBanner from 'hooks/useJoinCommunityBanner';
import useTopicGating from 'hooks/useTopicGating';
import { useCommonNavigate } from 'navigation/helpers';
import React, { useEffect, useRef, useState } from 'react';
import React, { useEffect, useRef } from 'react';
import { useLocation } from 'react-router-dom';
import app from 'state';
import { useGetUserEthBalanceQuery } from 'state/api/communityStake';
Expand Down Expand Up @@ -47,8 +47,6 @@ export const NewThreadForm = () => {

const markdownEditorMethodsRef = useRef<MarkdownEditorMethods | null>(null);

const [submitEntryChecked, setSubmitEntryChecked] = useState(false);

useAppStatus();

const communityId = app.activeChainId() || '';
Expand Down Expand Up @@ -216,8 +214,6 @@ export const NewThreadForm = () => {

const contestThreadBannerVisible =
isContestAvailable && hasTopicOngoingContest;
const isDisabledBecauseOfContestsConsent =
contestThreadBannerVisible && !submitEntryChecked;

const contestTopicAffordanceVisible =
isContestAvailable && hasTopicOngoingContest;
Expand Down Expand Up @@ -357,7 +353,6 @@ export const NewThreadForm = () => {
isDisabled ||
!user.activeAccount ||
!!disabledActionsTooltipText ||
isDisabledBecauseOfContestsConsent ||
walletBalanceError ||
contestTopicError
}
Expand All @@ -368,12 +363,7 @@ export const NewThreadForm = () => {
)}
/>

{contestThreadBannerVisible && (
<ContestThreadBanner
submitEntryChecked={submitEntryChecked}
onSetSubmitEntryChecked={setSubmitEntryChecked}
/>
)}
{contestThreadBannerVisible && <ContestThreadBanner />}

<MessageRow
hasFeedback={!!walletBalanceError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ interface ThreadContestTagContainerProps {
const ThreadContestTagContainer = ({
associatedContests,
}: ThreadContestTagContainerProps) => {
console.log('--------------------------------');
console.log('associatedContests', associatedContests);
const contestWinners = getWinnersFromAssociatedContests(associatedContests);

console.log('contestWinners', contestWinners);
console.log('--------------------------------');
const showContestWinnerTag = contestWinners.length > 0;

return (
Expand Down

0 comments on commit 93cd18f

Please sign in to comment.