Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fet-1670 #901

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@noble/hashes": "^1.3.2",
"@rainbow-me/rainbowkit": "2.1.2",
"@sentry/nextjs": "7.43.x",
"@splidejs/react-splide": "^0.7.12",
"@svgr/webpack": "^8.1.0",
"@tanstack/query-persist-client-core": "5.22.2",
"@tanstack/query-sync-storage-persister": "5.22.2",
Expand Down
41 changes: 28 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/confetti.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/DAO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/social/SocialX.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 14 additions & 8 deletions src/components/@atoms/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled, { css } from 'styled-components'
import CalendarSVG from '@app/assets/Calendar.svg'
import { useDefaultRef } from '@app/hooks/useDefaultRef'
import { useBreakpoint } from '@app/utils/BreakpointProvider'
import { secondsToDate, secondsToDateInput } from '@app/utils/date'
import { dateToDateInput, secondsToDate, secondsToDateInput } from '@app/utils/date'
import { formatExpiry } from '@app/utils/utils'

const Label = styled.label<{ $highlighted?: boolean }>(
Expand Down Expand Up @@ -66,10 +66,10 @@ const LabelInput = styled.input(
type InputProps = InputHTMLAttributes<HTMLInputElement>
type Props = {
highlighted?: boolean
value: number
value: number | Date
unit?: string
name?: string
min?: number
min?: number | Date
} & Omit<InputProps, 'value' | 'defaultValue' | 'min' | 'max' | 'name'>

export const Calendar = forwardRef(
Expand All @@ -78,8 +78,8 @@ export const Calendar = forwardRef(
ref: ForwardedRef<HTMLInputElement>,
) => {
const inputRef = useDefaultRef<HTMLInputElement>(ref)
const [minDuratiion] = useState(min ?? value)
const minDate = secondsToDate(minDuratiion)
const [minDuration] = useState(min ?? value)
const minDate = typeof minDuration === 'number' ? secondsToDate(minDuration) : minDuration

const breakpoint = useBreakpoint()

Expand All @@ -91,8 +91,12 @@ export const Calendar = forwardRef(
type="date"
{...props}
ref={inputRef}
value={secondsToDateInput(value)}
min={secondsToDateInput(minDuratiion)}
value={typeof value === 'number' ? secondsToDateInput(value) : dateToDateInput(value)}
min={
typeof minDuration === 'number'
? secondsToDateInput(minDuration)
: dateToDateInput(minDuration)
}
onFocus={(e) => {
e.target.select()
}}
Expand All @@ -117,7 +121,9 @@ export const Calendar = forwardRef(
onClick={() => inputRef.current!.showPicker()}
/>
<span data-testid="calendar-date">
{formatExpiry(secondsToDate(value), { short: !breakpoint.sm })}
{formatExpiry(typeof value === 'number' ? secondsToDate(value) : value, {
short: !breakpoint.sm,
})}
</span>
<CalendarIcon>
<CalendarSVG height={16} width={16} />
Expand Down
21 changes: 21 additions & 0 deletions src/components/pages/migrate/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Splide, SplideSlide } from '@splidejs/react-splide'
import { ReactNode } from 'react'

export const Carousel = ({ children }: { children: ReactNode[] }) => {
return (
<Splide
options={{
arrows: false,
pagination: false,
gap: '16px',
perPage: 2,
fixedWidth: 312,
}}
>
{children.map((child, i) => (
// eslint-disable-next-line react/no-array-index-key
<SplideSlide key={i}>{child}</SplideSlide>
))}
</Splide>
)
}
79 changes: 79 additions & 0 deletions src/components/pages/migrate/EligibleForTokens.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import Link from 'next/link'
import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'

import { InfoCircleSVG, OutlinkSVG, Typography } from '@ensdomains/thorin'

import { REBATE_DATE } from '@app/utils/constants'

const EligibleForTokensContainer = styled.div(
({ theme }) => css`
padding: ${theme.space['4']};
gap: ${theme.space['2']};
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
width: ${theme.space.full};
border-radius: ${theme.radii['2xLarge']};
background: ${theme.colors.greenSurface};

a {
display: flex;
flex-direction: row;
align-items: center;
gap: ${theme.space['2']};
color: ${theme.colors.greenPrimary};
}
`,
)

const InelegibleForTokensContainer = styled.div(
({ theme }) => css`
display: flex;
flex-direction: row;
background: ${theme.colors.greenSurface};
padding: ${theme.space['4']};
gap: ${theme.space['4']};
border-radius: ${theme.radii.large};
align-items: center;
width: 100%;
svg {
color: ${theme.colors.greenDim};
}
`,
)

export const EligibleForTokens = ({
amount,
extendedDate,
}: {
amount: number
extendedDate?: Date
}) => {
const { t } = useTranslation('common')

if (!extendedDate) return null

if (extendedDate < REBATE_DATE) {
return (
<InelegibleForTokensContainer>
<InfoCircleSVG height={24} width={24} />
names expiring in 2031 smth smth
</InelegibleForTokensContainer>
)
}

return (
<EligibleForTokensContainer>
<Typography fontVariant="largeBold">Eligible for {amount} $ENS</Typography>
something something
<Link href="#" target="_blank" rel="noreferrer noopener">
<Typography color="greenPrimary" fontVariant="bodyBold">
{t('action.learnMore')}
</Typography>
<OutlinkSVG />
</Link>
</EligibleForTokensContainer>
)
}
Loading
Loading