Skip to content

Commit

Permalink
chore: add legal disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed May 6, 2021
1 parent 696e215 commit a6984ab
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 50 deletions.
42 changes: 20 additions & 22 deletions app/components/external-link.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FC } from 'react';
import { Box, Text, BoxProps, color } from '@stacks/ui';
import { openExternalLink } from '@utils/external-links';
import { LegalDisclaimerTooltip } from './legal-disclaimer-tooltip';

interface ExternalLinkProps extends BoxProps {
href: string;
Expand All @@ -9,27 +10,24 @@ interface ExternalLinkProps extends BoxProps {
export const ExternalLink: FC<ExternalLinkProps> = ({ href, children, ...props }) => {
const openUrl = () => openExternalLink(href);
return (
<Text
onClick={openUrl}
as="button"
cursor="pointer"
display="block"
outline={0}
color={color('brand')}
_hover={{ textDecoration: 'underline' }}
_focus={{ textDecoration: 'underline' }}
{...{ type: 'button' }}
{...props}
>
{children}
<Box display="inline-block" ml="extra-tight" mb="1px">
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M8 5.90118V0.745999C8 0.300626 7.71031 0 7.25348 0L2.08914 0.0111343C1.66017 0.0111343 1.35933 0.334029 1.35933 0.707029C1.35933 1.09116 1.68802 1.38622 2.07799 1.38622H3.7883L5.7883 1.30828L4.8468 2.14335L0.233983 6.75296C0.0779944 6.90884 0 7.09812 0 7.27627C0 7.64927 0.339833 8 0.718663 8C0.902507 8 1.08635 7.92206 1.24234 7.76618L5.86072 3.15101L6.69638 2.21016L6.61838 4.13083V5.91788C6.61838 6.31315 6.91922 6.63605 7.29805 6.63605C7.68245 6.63605 8 6.31872 8 5.90118Z"
fill="currentColor"
/>
</svg>
</Box>
</Text>
<LegalDisclaimerTooltip>
<Text
onClick={openUrl}
as="button"
type="button"
cursor="pointer"
display="block"
outline={0}
color={color('brand')}
_hover={{ textDecoration: 'underline' }}
_focus={{ textDecoration: 'underline' }}
{...props}
>
{children}
<Box display="inline-block" ml="extra-tight" mb="1px">
</Box>
</Text>
</LegalDisclaimerTooltip>
);
};
11 changes: 11 additions & 0 deletions app/components/legal-disclaimer-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { FC } from 'react';
import { BoxProps } from '@stacks/ui';
import { Tooltip } from './tooltip';

export const LegalDisclaimerTooltip: FC<BoxProps> = props => (
<Tooltip
display="inherit"
text="This link will take you to an external third-party website that is not affiliated with Hiro Systems PBC."
{...props}
/>
);
3 changes: 2 additions & 1 deletion app/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const STACKING_LEARN_MORE_URL = 'https://stacks.org/stacking-moves-us-for

export const STACKING_GUIDE_URL = 'https://blog.stacks.co/stacking-strategy';

export const STACKING_MINIMIUM_FOR_NEXT_CYCLE_URL = 'https://stacking.club/cycles/next';
export const STACKING_MINIMIUM_FOR_NEXT_CYCLE_URL =
'https://stacking.club/cycles/next?tab=slot_minimum';

export const MAX_STACKING_CYCLES = 12;

Expand Down
4 changes: 1 addition & 3 deletions app/pages/stacking/components/stacking-form-info-card.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { FC } from 'react';
import { color, Flex, FlexProps } from '@stacks/ui';

type StackingFormInfoCardProps = FlexProps;

export const StackingFormInfoCard: FC<StackingFormInfoCardProps> = props => (
export const StackingFormInfoCard: FC<FlexProps> = props => (
<Flex
flexDirection="column"
boxShadow="low"
Expand Down
4 changes: 1 addition & 3 deletions app/pages/stacking/components/stacking-form-info-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { FC } from 'react';
import { Flex, FlexProps } from '@stacks/ui';

type StackingFormInfoPanelProps = FlexProps;

export const StackingFormInfoPanel: FC<StackingFormInfoPanelProps> = props => (
export const StackingFormInfoPanel: FC<FlexProps> = props => (
<Flex flexDirection="column" position="sticky" top="124px" {...props} />
);
2 changes: 1 addition & 1 deletion app/pages/stacking/components/stacking-form-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const StackingStep: FC<StackingFormStepProps> = props => {
};

export const StackingStepDescription: FC = ({ children }) => (
<Stack display="block" textStyle="body.large" mt="tight" spacing="base">
<Stack display="block" textStyle="body.large" spacing="base">
{children}
</Stack>
);
Expand Down
19 changes: 11 additions & 8 deletions app/pages/stacking/components/stacking-guide-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ import { openExternalLink } from '@utils/external-links';
import { STACKING_GUIDE_URL } from '@constants/index';

import { StackingFormInfoCard } from './stacking-form-info-card';

type StackingGuideCardProps = FlexProps;
import { LegalDisclaimerTooltip } from '@components/legal-disclaimer-tooltip';

const openStackingGuide = () => openExternalLink(STACKING_GUIDE_URL);

export const StackingGuideCard: FC<StackingGuideCardProps> = props => {
export const StackingGuideCard: FC<FlexProps> = props => {
const [isHovered, bindHover] = useHover();
const [isFocused, bindFocus] = useFocus();
return (
<Box {...props}>
<LegalDisclaimerTooltip {...props}>
<Box
as="a"
onClick={openStackingGuide}
Expand All @@ -31,9 +30,13 @@ export const StackingGuideCard: FC<StackingGuideCardProps> = props => {
textStyle="body.large"
cursor="pointer"
>
<Box mr="base">
<img src={btcIllustration} alt="Abstract Bitcoin icon on chart-like tower" />
</Box>
<Box
as="img"
mr="base"
display="block"
src={btcIllustration}
alt="Abstract Bitcoin icon on chart-like tower"
/>
<Text maxWidth={[null, null, '292px']}>
<Text as="strong" textDecoration={isHovered || isFocused ? 'underline' : 'unset'}>
Read the Stacking Guide
Expand All @@ -44,6 +47,6 @@ export const StackingGuideCard: FC<StackingGuideCardProps> = props => {
</Text>
</StackingFormInfoCard>
</Box>
</Box>
</LegalDisclaimerTooltip>
);
};
6 changes: 3 additions & 3 deletions app/pages/stacking/components/stacking-term.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export const StackingTermItem: FC<StackingTermItem> = props => {
<Box width={['12px', '16px']} mr="base-tight">
<Icon width={['12px', '16px']} />
</Box>
<Box>
<Stack spacing="extra-tight">
<Text as="h3" textStyle="body.large.medium">
{title}
</Text>
<Stack mt="extra-tight" spacing="base" textStyle="body.large" color={color('text-caption')}>
<Stack spacing="base" textStyle="body.large" color={color('text-caption')}>
{children}
</Stack>
</Box>
</Stack>
</Flex>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ChooseDirectStackingAmountStep: FC<ChooseAmountStepProps> = props =
const numberOfRewardSlots = calculateRewardSlots(
ustxAmount,
new BigNumber(poxInfo.min_amount_ustx)
);
).integerValue();

const floorRoundedStxBuffer = calculateStackingBuffer(
ustxAmount,
Expand Down Expand Up @@ -160,10 +160,11 @@ export const ChooseDirectStackingAmountStep: FC<ChooseAmountStepProps> = props =
<>
<Stack textStyle="body.small" color={color('text-caption')} spacing="base" mt="base">
<Text>
This entered amount would get you {numberOfRewardSlots.integerValue().toString()}{' '}
reward slots with a {toHumanReadableStx((floorRoundedStxBuffer || 0).toString())}{' '}
buffer at the current minimum. However, that minimum is subject to change and there
is no guarantee you will get any reward slots.
This entered amount would get you {numberOfRewardSlots.toString()} reward slot
{numberOfRewardSlots.toNumber() === 1 ? '' : 's'} with a{' '}
{toHumanReadableStx((floorRoundedStxBuffer || 0).toString())} buffer at the current
minimum. However, that minimum is subject to change and there is no guarantee you
will get any reward slots.
</Text>
<Text>
You <strong>will not</strong> be able to add more STX for locking from this address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { Hr } from '@components/hr';
import { ExplainerTooltip } from '@components/tooltip';
import { toHumanReadableStx } from '@utils/unit-convert';
import { StackingFormInfoCard } from '../../components/stacking-form-info-card';
import { calculateStackingBuffer } from '../../utils/calc-stacking-buffer';
import { useSelector } from 'react-redux';
import { selectPoxInfo } from '@store/stacking';

interface StackingInfoCardProps extends FlexProps {
cycles: number;
Expand All @@ -23,6 +26,13 @@ export const DirectStackingInfoCard: FC<StackingInfoCardProps> = props => {

const amountToBeStacked = balance === null ? new BigNumber(0) : balance;

const poxInfo = useSelector(selectPoxInfo);

const buffer = calculateStackingBuffer(
amountToBeStacked,
new BigNumber(poxInfo?.min_amount_ustx || 0)
);

return (
<StackingFormInfoCard minHeight="84px" alignItems="flex-start" {...rest}>
<Flex flexDirection="column" px={['loose', 'extra-loose']} pt="extra-loose" pb="base-loose">
Expand All @@ -34,6 +44,10 @@ export const DirectStackingInfoCard: FC<StackingInfoCardProps> = props => {
<Hr />
<Flex flexDirection="column" px={['loose', 'extra-loose']} py="loose" width="100%">
<Flex justifyContent="space-between">
<Text textStyle="body.large.medium">Buffer</Text>
<Text textAlign="right">{toHumanReadableStx(buffer.toString())}</Text>
</Flex>
<Flex justifyContent="space-between" mt="tight">
<Flex alignItems="center">
<Text textStyle="body.large.medium" mr="tight">
Cycles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export const DirectStackingIntro: FC<StackingIntroProps> = ({ timeUntilNextCycle
<StackingDescription mt="base-tight">
When you stack by yourself, you’ll get the chance to earn Bitcoin each cycle for every reward
slot that you hold.
<br />
<br /> The STX required per reward slot can fluctuate from cycle to cycle. If you’re close to
the current minimum, consider pooling instead to help make sure you don’t end up without
rewards.
</StackingDescription>
<StackingDescription mt="base-tight">
The STX required per reward slot can fluctuate from cycle to cycle. If you’re close to the
current minimum, consider pooling instead to help make sure you don’t end up without rewards.
</StackingDescription>
<ExternalLink href="https://stacks.co/stacking" mt="base">
How it works
Expand Down

0 comments on commit a6984ab

Please sign in to comment.