Skip to content

Commit b0c555c

Browse files
Merge pull request #1387 from MahtabBukhari/Update-the-New-Bounty-and-Edit-Bounty-Form-to-include-set-Stake-on-Bounty
Update the New Bounty and Edit Bounty Form to include set Stake on Bounty
2 parents 0df3967 + a7f6a7c commit b0c555c

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

src/components/form/bounty/index.tsx

+13-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EuiText } from '@elastic/eui';
33
import { Formik } from 'formik';
44
import { observer } from 'mobx-react-lite';
55
import React, { useCallback, useEffect, useRef, useState } from 'react';
6-
import { useIsMobile } from 'hooks';
6+
import { useFeatureFlag, useIsMobile } from 'hooks';
77
import { RefineDescriptionModal } from 'components/common/RefineDescriptionModal';
88
import { snippetStore } from 'store/snippetStore';
99
import { toCapitalize } from '../../../helpers/helpers';
@@ -41,7 +41,7 @@ function Form(props: FormProps) {
4141
} = props;
4242
const page = 1;
4343
const isMobile = useIsMobile();
44-
44+
const { isEnabled } = useFeatureFlag('staking');
4545
const [loading, setLoading] = useState(true);
4646
const [dynamicInitialValues, setDynamicInitialValues]: any = useState(null);
4747
const [dynamicSchema, setDynamicSchema]: any = useState(null);
@@ -374,6 +374,11 @@ function Form(props: FormProps) {
374374
<Input
375375
{...item}
376376
key={item.name}
377+
type={
378+
(item.name === 'isStakable' || item.name === 'stakeMin') && !isEnabled
379+
? 'hidden'
380+
: item.type
381+
}
377382
newDesign={item.name === 'description' ? false : true}
378383
values={values}
379384
testId={item.name}
@@ -605,7 +610,12 @@ function Form(props: FormProps) {
605610
>
606611
<Input
607612
{...item}
608-
type={item.type}
613+
type={
614+
(item.name === 'isStakable' || item.name === 'stakeMin') &&
615+
!isEnabled
616+
? 'hidden'
617+
: item.type
618+
}
609619
newDesign={item.name === 'description' ? false : true}
610620
values={values}
611621
setAssigneefunction={item.name === 'assignee' && setAssigneeName}

src/components/form/inputs/NumberSatsInput.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export default function NumberInputNew({
5353
value,
5454
handleChange,
5555
handleBlur,
56-
handleFocus
56+
handleFocus,
57+
values
5758
}: Props) {
5859
let labeltext = label;
5960

@@ -76,6 +77,10 @@ export default function NumberInputNew({
7677
}
7778
}, [textValue]);
7879

80+
if (name === 'stakeMin' && values?.estimated_session_length === undefined) {
81+
return <></>;
82+
}
83+
7984
return (
8085
<InputOuterBox color={color} borderColor={isError ? color.red2 : color.grayish.G600}>
8186
<input

src/components/form/inputs/SwitchInput.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export default function SwitchInput({
7878

7979
const color = colors['light'];
8080

81+
if (name === 'isStakable' && values?.estimated_session_length === undefined) {
82+
return <></>;
83+
}
84+
8185
return (
8286
<>
8387
<Container style={style} color={color}>

src/components/form/schema.ts

+11
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,17 @@ export const wantedCodingTaskSchema: FormField[] = [
797797
label: 'Show to public',
798798
type: 'switch'
799799
},
800+
{
801+
name: 'isStakable',
802+
label: 'Self Assign',
803+
type: 'switch'
804+
},
805+
{
806+
name: 'stakeMin',
807+
label: 'Stake Amount (Sats)',
808+
validator: strValidatorNotRequired,
809+
type: 'numbersats'
810+
},
800811
{
801812
name: 'assignee',
802813
label: 'Assignee',

src/people/utils/BountyCreationConstant.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ export const BountyDetailsCreationData = {
5555
schemaName: 'Freelance Job Request',
5656
heading: 'Price and Estimate',
5757
sub_heading: ' ',
58-
schema: ['price', 'estimated_session_length', 'estimated_completion_date'],
58+
schema: [
59+
'price',
60+
'estimated_session_length',
61+
'estimated_completion_date',
62+
'isStakable',
63+
'stakeMin'
64+
],
5965
schema2: ['tribe', 'deliverables', 'access_restriction', 'show'],
6066
required: ['price'],
6167
outerContainerStyle: {

0 commit comments

Comments
 (0)