Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
BEPRO 2.11 (#916)
Browse files Browse the repository at this point in the history
* Bepro 1370 fix UI bounty hall logos main nav logo and bounty hero states (#896)

* adding styles and logic bg

* adding color to bountyTags

* adjusting BountyTags component

* update Bagde logic

* adding opacity logic and refactoring style

* adding opacity param to hero

* adjusting space

* adding import

* adding color to hero

* adding ? to colors primary

* adjusting if association network

* DEV-982 Know Your Client (#860)

* DEV-982 add isKyc to bounties

* DEV-982 add isKyc badge

* DEV-982 add kyc session model

* DEV-982 init kyc session

* DEV-982 validate kyc session

* DEV-982 remove tier settings

* DEV-982 create helper find user by session

* DEV-982 isolate helper query

* DEV-982 add isKyc to bounties

* DEV-982 change isKyc to tierList

* DEV-982 add tierList to settings

* DEV-982 validate tier per bounty

* DEV-982 refresh step btn

* DEV-982 restore loading state

* DEV-982 changes request

* DEV-982 fix validate tiers

* DEV-982 fix check isKyc

* DEV-982 restore package-lock

* DEV-982 refresh token

* DEV-982 add isKyc to bounties

* DEV-982 add isKyc badge

* DEV-982 init kyc session

* DEV-982 validate kyc session

* DEV-982 change isKyc to tierList

* DEV-982 changes request

* DEV-982 fix conflicts

* DEV-982 fix conflicts

* DEV-982 remove debugger

* DEV-982 restore package-json

* DEV-982 restore check

* DEV-982 fix loading modal

* DEV-982 fix size modal

* doctors hands: Account for matching accounts before verifying a user

* linted

* clean dupes from rebase

* fix loggers

* make it so page.action on bounty redirects to profile and have the profile hold the kyc button

* dont return if no session

* make it so the timer actually makes sense and cleans when supposed to clean and creates only when needed

* make text green, adds a contextual span if success

* change labels

* add close label

* simpler isVerified logic

* change timer from 30s to 3s

* remove "identifying..." label from modal

---------

Co-authored-by: clarkjoao <[email protected]>
Co-authored-by: clarkjoao <[email protected]>
Co-authored-by: Vitor Hugo <[email protected]>
Co-authored-by: Marcus Vinícius <[email protected]>

* Bepro 1414 is possible to config fees to 100 (#882)

* adding validator

* removing console.log

* validating limits

* using interpolation for limits

* fix limits errors

* fix condition to update network (#908)

* Bepro 1465 explore icon not aligned with rest of nav (#909)

* creating style mgt-3

* adding mgt-3 to main-nav and adjusting Icon

* fix fundedAmount logic (#905)

* fix order disabled disputed button (#904)

* adding text-truncate (#917)

* Bepro 1410 governance tab missing individual fees configuration (#902)

* adding parameters

* updating dappkit version

* oracle exchange rate is not percent

* calculate exchange rate and add colors to modal body

* fix readonly alert visible out of a network

* adding missing parameters

* network can no longer update the treasury address

* fix file name

* adding limits to new parameters and checking solidity integer limit

* change minimum to 1, because of contract things

* only integer

* fix

* adding unable to change warning

* using N scale

* using lower case on address

* using lower case on address

* adding review suggestion

* renaming validators

* fix reading of undefined

* fix reading of undefined

* using calculateDistributedAmounts to check minimum value

* fix condition

* fix NaN

---------

Co-authored-by: Marcus Vinícius <[email protected]>
Co-authored-by: clarkjoao <[email protected]>
Co-authored-by: clarkjoao <[email protected]>
Co-authored-by: Vitor Hugo <[email protected]>
  • Loading branch information
5 people authored Mar 20, 2023
1 parent c9885f4 commit d58a5c9
Show file tree
Hide file tree
Showing 82 changed files with 1,534 additions and 419 deletions.
21 changes: 20 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,23 @@ ELASTIC_APM_ACTIVE=
ELASTIC_APM_LOG_LEVEL=

# true|false - should we index Logger.trace() into elastic
ELASTIC_INDEX_STACK_TRACE=
ELASTIC_INDEX_STACK_TRACE=

# Enables KYC per bounty provided by Synaps
NEXT_PUBLIC_ENABLE_KYC=true

# key-pair for using synaps
NEXT_KYC_API=https://individual-api.synaps.io/v3
NEXT_SYNAPS_KEY=
NEXT_SYNAPS_CLIENT_ID=
#types/settings.d.ts#L17 ex: [{"id": "1234", "name": "Phone", "steps_id":["12345678"]}]
NEXT_SYNAPS_TIER_LIST=

# Leaderboard points per type
NEXT_PUBLIC_BOUNTY_CLOSED_DEV=
NEXT_PUBLIC_BOUNTY_CLOSED_OWNER=
NEXT_PUBLIC_BOUNTY_OPENED=
NEXT_PUBLIC_BOUNTY_CANCELED=
NEXT_PUBLIC_PROPOSAL_CREATED=
NEXT_PUBLIC_PROPOSAL_ACCEPTED=
NEXT_PUBLIC_PROPOSAL_REJECTED=
11 changes: 7 additions & 4 deletions components/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { ReactElement } from "react";
import { CSSProperties, ReactElement } from "react";
import { Badge as ReactBadge } from "react-bootstrap";

interface BadgeProps {
label?: string;
color?: string;
className?: string;
children?: ReactElement
style?: CSSProperties;
}

export default function Badge({
label,
color = "primary",
className,
children
children,
style
}: BadgeProps) {
return(
<ReactBadge
className={className || "p-small family-Regular text-uppercase"}
bg={color}
bg={style ? null : color}
style={style}
>
{label ? label : children}
</ReactBadge>
);
}
}
17 changes: 13 additions & 4 deletions components/bounty-hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import GithubInfo from "components/github-info";
import PriceConversor from "components/price-conversor";
import Translation from "components/translation";

import {useAppState} from "contexts/app-state";

import {getIssueState} from "helpers/handleTypeIssue";
import {truncateAddress} from "helpers/truncate-address";

import {useAppState} from "../contexts/app-state";
import Badge from "./badge";

export default function BountyHero() {
const {t} = useTranslation(["bounty", "common"]);

const {state} = useAppState();

function renderPriceConversor() {
Expand Down Expand Up @@ -52,6 +53,11 @@ export default function BountyHero() {
})}
/>

{state.currentBounty?.data?.isKyc
? <Badge
className={`d-flex status caption-medium py-1 px-3 bg-transparent border border-gray-700 text-gray-300`}
label={t("bounty:kyc.label")}
/> : null}
<div className="d-flex align-items-center">
<Avatar
className="me-2"
Expand Down Expand Up @@ -123,7 +129,10 @@ export default function BountyHero() {

{ !!state.currentBounty?.data?.tags?.length &&
<div className="mt-3">
<BountyTags tags={state.currentBounty.data.tags} />
<BountyTags
tags={state.currentBounty?.data?.tags}
color={state?.Service?.network?.active?.colors?.primary}
/>
</div>
}
</>
Expand Down
13 changes: 9 additions & 4 deletions components/bounty/bounty-tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import Badge from "components/badge";

interface BountyTagsProps {
tags: string[];
color?: string;
opacity?: boolean;
}

export default function BountyTags({
tags
tags,
color,
opacity = true
} : BountyTagsProps) {
if (!tags) return <></>;

Expand All @@ -15,9 +19,10 @@ export default function BountyTags({
<Badge
key={tag}
label={tag}
className="caption-small border border-primary border-radius-8"
color="primary-30"
className={`caption-small ${!color && "border border-primary"} border-radius-8`}
color={opacity ? 'primary-30' : 'primary'}
style={color ? { backgroundColor: `${color}90`, border: `1px solid ${color}` }: null}
/> )}
</div>
);
}
}
2 changes: 1 addition & 1 deletion components/bounty/issue-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import IssueProposalProgressBar from "components/issue-proposal-progress-bar";
import { useAppState } from "contexts/app-state";
import { addToast } from "contexts/reducers/change-toaster";

import { BODY_CHARACTERES_LIMIT } from "helpers/contants";
import { BODY_CHARACTERES_LIMIT } from "helpers/constants";

import useApi from "x-hooks/use-api";
import { useBounty } from "x-hooks/use-bounty";
Expand Down
5 changes: 2 additions & 3 deletions components/bounty/issue-edit-tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { useTranslation } from "next-i18next";

import { PROGRAMMING_LANGUAGES } from "assets/bounty-labels";

import BountyTags from "components/bounty/bounty-tags";
import { ContextualSpan } from "components/contextual-span";

import { useAppState } from "contexts/app-state";

import { MAX_TAGS } from "helpers/contants";

import BountyTags from "./bounty-tags";
import { MAX_TAGS } from "helpers/constants";

interface IssueEditTagProps {
isEdit: boolean;
Expand Down
10 changes: 5 additions & 5 deletions components/bounty/tabs-sections/item-sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function ItemSections({ data, isProposal }: ItemProps) {
const { getURLWithNetwork } = useNetwork();

const branchProtectionRules = state.Service?.network?.repos?.active?.branchProtectionRules;
const approvalsRequired =
branchProtectionRules ?
const approvalsRequired =
branchProtectionRules ?
branchProtectionRules[state.currentBounty?.data?.branch]?.requiredApprovingReviewCount || 0 : 0;
const canUserApprove = state.Service?.network?.repos?.active?.viewerPermission !== "READ";

Expand All @@ -52,7 +52,7 @@ function ItemSections({ data, isProposal }: ItemProps) {
};
const status = []

const proposal =
const proposal =
state.currentBounty?.data?.mergeProposals?.find((proposal) => proposal.contractId === +item?.contractId);
const isDisputed = !!proposal?.isDisputed
const isMerged = item?.isMerged;
Expand Down Expand Up @@ -82,7 +82,7 @@ function ItemSections({ data, isProposal }: ItemProps) {
return (
<ItemRow
key={`${uuidv4()} ${item?.id}`}
id={itemId}
id={itemId}
href={getURLWithNetwork(pathRedirect, valueRedirect)}
githubLogin={item?.githubLogin}
creator={item?.creator}
Expand Down Expand Up @@ -133,7 +133,7 @@ function ItemSections({ data, isProposal }: ItemProps) {
</Button>
</div>

{ shouldRenderApproveButton &&
{ shouldRenderApproveButton &&
<div className="col">
<GithubLink
forcePath={state.Service?.network?.repos?.active?.githubPath}
Expand Down
2 changes: 1 addition & 1 deletion components/create-bounty-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ReactSelect from "components/react-select";

import { useAppState } from "contexts/app-state";

import { BODY_CHARACTERES_LIMIT, BOUNTY_TITLE_LIMIT, MAX_TAGS } from "helpers/contants";
import { BODY_CHARACTERES_LIMIT, BOUNTY_TITLE_LIMIT, MAX_TAGS } from "helpers/constants";

export default function CreateBountyDetails({
bountyTitle,
Expand Down
59 changes: 56 additions & 3 deletions components/create-bounty-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import ReposDropdown from "components/repos-dropdown";

import {toastError, toastWarning} from "contexts/reducers/change-toaster";

import { BODY_CHARACTERES_LIMIT } from "helpers/contants";
import { BODY_CHARACTERES_LIMIT } from "helpers/constants";
import {parseTransaction} from "helpers/transactions";

import {MetamaskErrors} from "interfaces/enums/Errors";
import {TransactionStatus} from "interfaces/enums/transaction-status";
import {TransactionTypes} from "interfaces/enums/transaction-types";
import {Token} from "interfaces/token";
import { SimpleBlockTransactionPayload } from "interfaces/transaction";
import {SimpleBlockTransactionPayload} from "interfaces/transaction";

import {getCoinInfoByContract} from "services/coingecko";

Expand All @@ -40,6 +40,8 @@ import {useAppState} from "../contexts/app-state";
import {addTx, updateTx} from "../contexts/reducers/change-tx-list";
import {changeShowCreateBounty} from "../contexts/reducers/update-show-prop";
import {useRepos} from "../x-hooks/use-repos";
import DropDown from "./dropdown";
import InfoTooltip from "./info-tooltip";

interface BountyPayload {
title: string;
Expand Down Expand Up @@ -72,6 +74,8 @@ export default function CreateBountyModal() {
const [currentSection, setCurrentSection] = useState<number>(0);
const [isBountyType, setisBountyType] = useState<boolean>(true);
const [rewardChecked, setRewardChecked] = useState<boolean>(false);
const [isKyc, setIsKyc] = useState<boolean>(false);
const [tierList, setTierList] = useState<number[]>([]);
const [transactionalToken, setTransactionalToken] = useState<Token>();
const [bountyDescription, setBountyDescription] = useState<string>("");
const [progressPercentage, setProgressPercentage] = useState<number>(0);
Expand Down Expand Up @@ -134,6 +138,10 @@ export default function CreateBountyModal() {
}
}

function handleIsKYCChecked(e) {
setIsKyc(e.target.checked);
}

function renderDetails(review = false) {
return (
<CreateBountyDetails
Expand Down Expand Up @@ -233,6 +241,8 @@ export default function CreateBountyModal() {
onClick={() => {
setisBountyType(false);
setRewardChecked(true);
setIsKyc(false);
setTierList([]);
setIssueAmount(ZeroNumberFormatValues);
}}
>
Expand All @@ -254,6 +264,38 @@ export default function CreateBountyModal() {
{rewardChecked && renderBountyToken(false, "reward")}
</>
)}
{isBountyType && Settings?.kyc?.isKycEnabled ? (
<>
<div className="col-md-12 d-flex flex-row gap-2">
<FormCheck
className="form-control-md pb-0"
type="checkbox"
label={t("bounty:kyc.is-required")}
onChange={handleIsKYCChecked}
checked={isKyc}
/>
<span>
<InfoTooltip
description={t("bounty:kyc.tool-tip")}
secondaryIcon
/>
</span>
</div>
{isKyc && Settings?.kyc?.tierList?.length ? (
<DropDown
className="mt-2"
onSelected={(opt) =>{
setTierList(Array.isArray(opt) ? opt.map((i) => +i.value) : [+opt.value])
}
}
options={Settings?.kyc?.tierList.map((i) => ({
value: i.id,
label: i.name,
}))}
/>
) : null}
</>
) : null}
</div>
</div>
);
Expand Down Expand Up @@ -382,6 +424,13 @@ export default function CreateBountyModal() {
isRewardAmount
)
return true;

if (
currentSection === 1 &&
isKyc && Settings?.kyc?.tierList?.length && !tierList.length
)
return true;

if (currentSection === 2 && (!repository || !branch)) return true;
if (currentSection === 3 && !isTokenApproved) return true;
return currentSection === 3 && isLoadingCreateBounty;
Expand Down Expand Up @@ -412,6 +461,8 @@ export default function CreateBountyModal() {
setRewardAmount(ZeroNumberFormatValues);
setRepository(undefined);
setBranch(null);
setIsKyc(false);
setTierList([]);
setCurrentSection(0);
}

Expand Down Expand Up @@ -472,7 +523,9 @@ export default function CreateBountyModal() {
body: payload.body,
creator: payload.githubUser,
repositoryId: payload.repositoryId,
tags: selectedTags
tags: selectedTags,
isKyc: isBountyType ? isKyc : false,
tierList: isBountyType ? tierList : null,
}, Service?.network?.active?.name)
.then((cid) => cid)

Expand Down
Loading

0 comments on commit d58a5c9

Please sign in to comment.