Skip to content

Commit

Permalink
Merge pull request #2339 from DistributedCollective/development
Browse files Browse the repository at this point in the history
Release 2022-07-15
  • Loading branch information
soulBit authored Jul 15, 2022
2 parents 890d261 + 74839aa commit cba6c8c
Show file tree
Hide file tree
Showing 19 changed files with 371 additions and 58 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@reduxjs/toolkit": "1.5.1",
"@rsksmart/rsk3": "0.3.4",
"@sovryn/charting-library": "1.0.0",
"@sovryn/perpetual-swap": "3.0.9",
"@sovryn/perpetual-swap": "3.0.11",
"@sovryn/react-wallet": "2.2.5",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "5.1.1",
Expand Down Expand Up @@ -125,7 +125,7 @@
"react": "16.13.1",
"react-app-polyfill": "^1.0.6",
"react-copy-to-clipboard": "5.0.2",
"react-countdown": "2.3.1",
"react-countdown": "2.3.2",
"react-dev-utils": "^11.0.4",
"react-dom": "16.13.0",
"react-helmet-async": "1.0.4",
Expand Down
1 change: 1 addition & 0 deletions src/app/components/UserAssets/Vesting/VestedItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const VestedItem: React.FC<VestedItemProps> = ({
onClick={handleOnWithdraw}
disabled={loading || frozen}
loading={loading}
dataActionId={`portfolio-action-withdraw-${vesting.type}`}
/>
)}
</td>
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const VestingWithdrawForm: React.FC<VestingWithdrawFormProps> = ({
<span
className="tw-link tw-cursor-pointer tw-text-xs"
onClick={openSchedule}
data-action-id="portfolio-vesting-unlockSchedule"
>
{t(translations.vestingDialog.schedule)}
</span>
Expand Down Expand Up @@ -122,12 +123,14 @@ export const VestingWithdrawForm: React.FC<VestingWithdrawFormProps> = ({
}`}
loading={tx.loading}
disabled={value === '0' || tx.loading}
dataActionId={`portfolio-vesting-withdraw-confirm-${vesting.type}`}
/>
<Button
text={t(translations.common.cancel)}
style={ButtonStyle.inverted}
onClick={onClose}
className="tw-ml-4 tw-w-full"
dataActionId={`portfolio-vesting-withdraw-cancel-${vesting.type}`}
/>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/UserAssets/components/BridgeLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const BridgeLink: React.FC<IBridgeLinkProps> = ({
className={classNames(styles.actionLink, {
[styles.disabled]: disableWithdrawal,
})}
data-action-id={`portfolio-action-send-${asset}`}
>
<span className="tw-font-bold">
{t(translations.common.send)}
Expand Down Expand Up @@ -131,6 +132,7 @@ export const BridgeLink: React.FC<IBridgeLinkProps> = ({
pathname: '/cross-chain/deposit',
state: { receiver, asset },
}}
data-action-id={`portfolio-action-receive-${asset}`}
>
<span className="tw-font-bold">
{t(translations.common.receive)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export const UserAssetsTableRow: React.FC<IUserAssetsTableRow> = ({
href="/fast-btc/withdraw"
style={ButtonStyle.link}
size={ButtonSize.sm}
dataActionId={`portfolio-action-send-${asset}`}
/>
)}
</Tooltip>
Expand Down Expand Up @@ -196,6 +197,7 @@ export const UserAssetsTableRow: React.FC<IUserAssetsTableRow> = ({
href="/fast-btc/deposit"
style={ButtonStyle.link}
size={ButtonSize.sm}
dataActionId={`portfolio-action-receive-${asset}`}
/>
)}
</Tooltip>
Expand All @@ -208,6 +210,7 @@ export const UserAssetsTableRow: React.FC<IUserAssetsTableRow> = ({
style={ButtonStyle.link}
size={ButtonSize.sm}
disabled={!hasAnyTokens}
dataActionId={`portfolio-action-convert-${asset}`}
/>
)}
{[Asset.SOV, Asset.ETH, Asset.XUSD, Asset.BNB].includes(asset) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ import {
PerpetualPairType,
} from 'utils/dictionaries/perpetual-pair-dictionary';
import { RegisterDialog } from './components/RegisterDialog';
import Countdown from 'react-countdown';
import { CompetitionEndCountdown } from './components/CompetitionEndCountdown';

const baseUrl = notificationServiceUrl[currentChainId];
const competitionEndTime = new Date(1658232000000); // Tuesday July 19th, 12pm UTC

export const CompetitionPageContainer: React.FC = () => {
const [registerDialogOpen, setRegisterDialogOpen] = useState(false);
Expand Down Expand Up @@ -143,48 +146,103 @@ export const CompetitionPageContainer: React.FC = () => {
/>
</div>
<div className="tw-flex tw-flex-col tw-w-5/12">
<div className="tw-text-2xl tw-font-bold tw-mb-6">
<div className="tw-text-2xl tw-font-bold tw-mb-4">
{t(translations.competitionPage.rules.title)}
</div>

<div className="tw-mt-2 tw-mb-8">
<a
href="https://forms.monday.com/forms/5631b4b3608ad121f7e19af030f3b433"
target="_blank"
rel="noreferrer"
>
{t(translations.competitionPage.rules.reportBugs)}
</a>
</div>

<div className="tw-w-6/12">
{!connected && (
<Button
text={t(translations.competitionPage.cta.connect)}
disabled={connected}
onClick={() => walletContext.connect()}
/>
)}
{connected && !isRegistered && (
<Button
text={t(translations.competitionPage.cta.enter)}
onClick={() => setRegisterDialogOpen(true)}
/>
)}
{connected && isRegistered && (
<>
<p className="tw-mb-8">
<Trans
i18nKey={translations.competitionPage.registered}
components={[<a href={discordInvite}>discord</a>]}
<div className="tw-mt-8 tw-mb-8">
<div>
<Countdown
date={competitionEndTime}
renderer={({ days, hours, minutes, seconds }) => (
<CompetitionEndCountdown
days={days}
hours={hours}
minutes={minutes}
seconds={seconds}
/>
</p>
)}
/>
</div>

<div className="tw-mt-8">
<p>
<Trans
i18nKey={
translations.competitionPage.rules.welcomeMessage
}
components={[
<a
className="tw-text-secondary tw-underline"
href="/perpetuals"
>
Perpetuals page
</a>,
]}
/>
</p>
<p className="tw-mb-11">
<Trans
i18nKey={
translations.perpetualPage.tradeForm.text.welcome4
}
components={[
<a
className="tw-text-secondary tw-underline"
href="https://wiki.sovryn.app/en/sovryn-dapp/perpetual-futures#how-to-trade-perpetual-futures"
target="_blank"
rel="noreferrer"
>
Quickstart Guide
</a>,
]}
/>
</p>
</div>

<div>
{t(translations.competitionPage.rules.prizeDistribution)}
</div>

<div className="tw-mt-6 tw-mb-8">
<a
href="https://forms.monday.com/forms/5631b4b3608ad121f7e19af030f3b433"
target="_blank"
rel="noreferrer"
>
{t(translations.competitionPage.rules.reportBugs)}
</a>
</div>

<div className="tw-w-6/12">
{!connected && (
<Button
text={t(translations.competitionPage.cta.compete)}
onClick={() => history.push('/perpetuals')}
text={t(translations.competitionPage.cta.connect)}
disabled={connected}
onClick={() => walletContext.connect()}
/>
</>
)}
)}
{connected && !isRegistered && (
<Button
text={t(translations.competitionPage.cta.enter)}
onClick={() => setRegisterDialogOpen(true)}
/>
)}
{connected && isRegistered && (
<>
<p className="tw-mb-8">
<Trans
i18nKey={translations.competitionPage.registered}
components={[<a href={discordInvite}>discord</a>]}
/>
</p>
<Button
text={t(translations.competitionPage.cta.compete)}
onClick={() => history.push('/perpetuals')}
/>
</>
)}
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { translations } from 'locales/i18n';
import React from 'react';
import { useTranslation } from 'react-i18next';

type CompetitionEndCountdownProps = {
days: number;
hours: number;
minutes: number;
seconds: number;
};

export const CompetitionEndCountdown: React.FC<CompetitionEndCountdownProps> = ({
days,
hours,
minutes,
seconds,
}) => {
const { t } = useTranslation();
return (
<div className="tw-flex tw-items-center">
<span className="tw-font-bold tw-mr-2">
{t(translations.competitionPage.countdown.label)}
</span>
{days} {t(translations.competitionPage.countdown.days)}
<Divider />
{hours} {t(translations.competitionPage.countdown.hours)}
<Divider />
{minutes} {t(translations.competitionPage.countdown.minutes)}
<Divider />
{seconds} {t(translations.competitionPage.countdown.seconds)}
</div>
);
};

const Divider = () => (
<span className="tw-box-border tw-inline-block tw-h-4 tw-border-r tw-border-solid tw-border-gray-7 tw-mx-2" />
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import { toNumberFormat } from 'utils/display-text/format';
import classNames from 'classnames';
import { LinkToExplorer } from '../../../../../../components/LinkToExplorer';
import { PERPETUAL_CHAIN_ID } from '../../../../types';
import { AssetValue } from 'app/components/AssetValue';
import { Asset } from 'types';
import { AssetValueMode } from 'app/components/AssetValue/types';

interface ITraderRowProps {
data: LeaderboardData;
isUser: boolean;
potentialPrize: number;
}

export const TraderRow = forwardRef<HTMLDivElement, ITraderRowProps>(
({ data, isUser }, ref) => (
({ data, isUser, potentialPrize }, ref) => (
<div
ref={ref}
className={classNames(
Expand Down Expand Up @@ -46,12 +50,12 @@ export const TraderRow = forwardRef<HTMLDivElement, ITraderRowProps>(
<div
className={classNames(
data.openedPositions > 0 ? 'tw-text-success' : 'tw-text-warning',
'tw-px-1 tw-w-2/12 tw-my-auto tw-text-center',
'tw-px-1 tw-w-1/12 tw-my-auto tw-text-center',
)}
>
{data.openedPositions}
</div>
<div className="tw-px-1 tw-w-4/12 tw-my-auto">
<div className="tw-px-1 tw-w-3/12 tw-my-auto">
{!data.lastTrade ? (
'-'
) : (
Expand All @@ -71,6 +75,19 @@ export const TraderRow = forwardRef<HTMLDivElement, ITraderRowProps>(
>
{toNumberFormat(data.totalPnL, 2)}%
</div>
<div className="tw-px-1 tw-w-2/12 tw-my-auto">
{potentialPrize === 0 ? (
'-'
) : (
<AssetValue
value={potentialPrize}
mode={AssetValueMode.auto}
minDecimals={4}
maxDecimals={4}
asset={Asset.BTCS}
/>
)}
</div>
</div>
),
);
Expand Down
Loading

0 comments on commit cba6c8c

Please sign in to comment.