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

Thorin v1 #838

Draft
wants to merge 52 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cc3d5df
wip remove mq
talentlessguy Aug 27, 2024
2f0eaed
checkpoint
talentlessguy Aug 27, 2024
716bfa1
checkpoint
talentlessguy Aug 28, 2024
bc5e0dc
checkpoint
talentlessguy Aug 28, 2024
c3c3696
use published version
talentlessguy Aug 28, 2024
0a98abd
checkpoint
talentlessguy Aug 28, 2024
c4961f9
checkpoint
talentlessguy Aug 28, 2024
19f2c17
checkpoint, the main page builds
talentlessguy Aug 28, 2024
c9aa5b6
final checkpoint of mq removals
talentlessguy Aug 28, 2024
829d747
fix my/names page crash
talentlessguy Aug 28, 2024
405e63a
fix fill bug
talentlessguy Aug 28, 2024
8cae012
fix prop renames
talentlessguy Aug 28, 2024
429b0f8
fix a few color inheritance issues
talentlessguy Aug 28, 2024
a721a17
add height and width to svgs
talentlessguy Aug 28, 2024
0e85c66
wip try to fix build
talentlessguy Aug 31, 2024
28e095e
Merge branch 'main' of https://github.com/ensdomains/ens-app-v3 into …
talentlessguy Aug 31, 2024
cf7a940
bring back playwright because e2e fails locally
talentlessguy Aug 31, 2024
025dfd3
remove symlinks preserve
talentlessguy Aug 31, 2024
f055e5d
fix a few things
talentlessguy Sep 3, 2024
f8c9985
Merge branch 'main' of https://github.com/ensdomains/ens-app-v3 into …
talentlessguy Nov 30, 2024
206f3cf
wip fix prefixes
talentlessguy Nov 30, 2024
a45c0d8
Merge branch 'main' of https://github.com/ensdomains/ens-app-v3 into …
talentlessguy Dec 3, 2024
fe394bc
regen lockfile
talentlessguy Dec 3, 2024
1da1cff
dedupe @types/react
talentlessguy Dec 3, 2024
d3f78cd
wip
talentlessguy Dec 3, 2024
a362970
Merge branch 'main' into thorin-v1
talentlessguy Dec 5, 2024
b4097cc
fix LegacyDropdown
talentlessguy Dec 6, 2024
89c442d
fix AvatarNFT and other mq stuff
talentlessguy Dec 6, 2024
cbbf613
enable light theme
talentlessguy Dec 8, 2024
de1b3a2
wip mq/icon stuff
talentlessguy Dec 8, 2024
7c5664c
finish with mq stuff
talentlessguy Dec 8, 2024
5d723e2
fix some (not all) icon passings
talentlessguy Dec 8, 2024
cd612b7
undo some svg fixes and replace rarely used theme value with inline val
talentlessguy Dec 8, 2024
4254f62
fix some issues hydration crashes
storywithoutend Dec 9, 2024
a9df93a
Update SubnamesTab.tsx
storywithoutend Dec 9, 2024
479090f
Merge branch 'main' into thorin-v1
talentlessguy Dec 9, 2024
c8b018f
Merge branch 'thorin-v1' of https://github.com/ensdomains/ens-app-v3 …
talentlessguy Dec 9, 2024
175c1ce
make the app build
talentlessguy Dec 9, 2024
0c3bab8
fix up ens-v2 page
talentlessguy Dec 10, 2024
e37b10f
a few fixes
talentlessguy Dec 10, 2024
abb0fea
some fixes
talentlessguy Dec 10, 2024
ee67e09
fmt
talentlessguy Dec 10, 2024
2d0408b
add missing theme object
talentlessguy Dec 10, 2024
0cf8381
fix build errors
talentlessguy Dec 13, 2024
4d81a06
a few more svg/missing theme obj fixes
talentlessguy Dec 13, 2024
fcb70fb
bump thorin
talentlessguy Dec 13, 2024
45af67d
fix some failing unit tests (not all yet)
talentlessguy Dec 13, 2024
378b2d7
wip dark mode
talentlessguy Dec 13, 2024
7edb15a
wip dark mode
talentlessguy Dec 14, 2024
3c393b9
a few fixes with unset colors
talentlessguy Dec 14, 2024
88cc7e6
colocate csp header data
TateB Dec 16, 2024
2574067
Merge pull request #923 from ensdomains/csp-colocate
talentlessguy Dec 16, 2024
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
11 changes: 3 additions & 8 deletions functions/_middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint max-classes-per-file: "off" */
import { cspOnlyFrameAncestors, cspWithFrameAncestors } from '@app/utils/createCsp'

class ContentModifier {
private newContent: string
Expand Down Expand Up @@ -57,20 +58,14 @@ const firefoxRewrite: PagesFunction = async ({ request, next }) => {

// firefox CSP exception + metamask script
if (userAgent?.includes('gecko/20100101') && userAgent.includes('firefox/')) {
response.headers.set(
'Content-Security-Policy',
"frame-ancestors 'self' https://app.safe.global;",
)
response.headers.set('Content-Security-Policy', cspOnlyFrameAncestors)
return new HTMLRewriter()
.on('head', new ScriptWriter('/_next/static/chunks/initialise-metamask.js'))
.transform(response)
}

// default headers
response.headers.set(
'Content-Security-Policy',
"worker-src 'self'; script-src 'self' 'sha256-UyYcl+sKCF/ROFZPHBlozJrndwfNiC5KT5ZZfup/pPc=' plausible.io static.cloudflareinsights.com *.ens-app-v3.pages.dev https://app.intercom.io https://widget.intercom.io https://js.intercomcdn.com 'wasm-unsafe-eval'; frame-ancestors 'self' https://app.safe.global;",
)
response.headers.set('Content-Security-Policy', cspWithFrameAncestors)
return response
}

Expand Down
2 changes: 1 addition & 1 deletion functions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["../src/utils/gradient.ts", "./**/*"],
"include": ["../src/utils/createCsp.ts", "./**/*"],
"compilerOptions": {
"noEmit": true,
"target": "ESNext",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@ensdomains/content-hash": "^3.0.0-beta.5",
"@ensdomains/ens-contracts": "1.2.0-beta.0",
"@ensdomains/ensjs": "4.0.2",
"@ensdomains/thorin": "0.6.50",
"@ensdomains/thorin": "1.0.0-beta.16",
"@metamask/post-message-stream": "^6.1.2",
"@metamask/providers": "^14.0.2",
"@noble/hashes": "^1.3.2",
Expand Down Expand Up @@ -123,7 +123,7 @@
"@types/node": "^18.7.13",
"@types/pako": "^2.0.0",
"@types/prettier": "^2.7.0",
"@types/react": "18.2.21",
"@types/react": "18.3.12",
"@types/react-dom": "^18.2.7",
"@types/styled-components": "5.1.23",
"@types/ws": "^8.5.10",
Expand Down
1 change: 0 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig, devices } from '@playwright/test'

export default defineConfig({
Expand Down
204 changes: 109 additions & 95 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/assets/CircleTick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 13 additions & 14 deletions src/components/@atoms/Calendar/Calendar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { fireEvent, mockFunction, render, screen } from '@app/test-utils'
import { InputHTMLAttributes, useState } from 'react'
import { describe, expect, it, vi } from 'vitest'

import { useBreakpoint } from '@app/utils/BreakpointProvider'
import { secondsToDate, secondsToDateInput } from '@app/utils/date'
import { formatExpiry } from '@app/utils/utils'

import { Calendar } from './Calendar'
import { useBreakpoint } from '@app/utils/BreakpointProvider'

vi.mock('@app/utils/BreakpointProvider')

Expand Down Expand Up @@ -44,27 +44,26 @@ describe('Calendar', () => {
it('should handle timezone offset correctly', async () => {
const OnChange = vi.fn()
// Render the Calendar component
const currentDate = new Date();
const currentDateSeconds = Math.floor(currentDate.getTime() / 1000);
render(<Calendar value={currentDateSeconds} onChange={OnChange}/>);
const currentDate = new Date()
const currentDateSeconds = Math.floor(currentDate.getTime() / 1000)
render(<Calendar value={currentDateSeconds} onChange={OnChange} />)

// Find the input element
const calendarInput = screen.getByTestId('calendar');
const calendarInput = screen.getByTestId('calendar')

// Prepare new date and format it
currentDate.setDate(currentDate.getDate() + 2); // Change to the next day
const newDateSeconds = Math.floor(currentDate.getTime() / 1000);
const newFormattedDate = secondsToDateInput(newDateSeconds);
currentDate.setDate(currentDate.getDate() + 2) // Change to the next day
const newDateSeconds = Math.floor(currentDate.getTime() / 1000)
const newFormattedDate = secondsToDateInput(newDateSeconds)

fireEvent.change(calendarInput, { target: { value: newFormattedDate }})
fireEvent.change(calendarInput, { target: { value: newFormattedDate } })

// Assert the onChange handler was called
expect(OnChange).toHaveBeenCalledTimes(1);
expect(OnChange).toHaveBeenCalledTimes(1)

const receivedDate = OnChange.mock.calls[0][0].currentTarget.valueAsDate;
const receivedDate = OnChange.mock.calls[0][0].currentTarget.valueAsDate
const receivedFormattedDate = receivedDate.toISOString().split('T')[0]

expect(receivedFormattedDate).toEqual(newFormattedDate);

});
expect(receivedFormattedDate).toEqual(newFormattedDate)
})
})
28 changes: 23 additions & 5 deletions src/components/@atoms/CheckButton/CheckButton.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import styled, { css } from 'styled-components'

import CircleTick from '@app/assets/CircleTick.svg'

const Container = styled.button<{ $active: boolean }>(
({ theme, $active }) => css`
cursor: pointer;
flex: 0 0 ${theme.space['9']};
width: ${theme.space['9']};
height: ${theme.space['9']};
color: ${$active ? theme.colors.accent : theme.colors.grey};
svg {
path,
rect {
transition: all 0.15s ease-in-out;
stroke: ${$active ? theme.colors.accent : theme.colors.textTertiary};

stroke-width: 1px;
}
}

&:hover {
color: ${theme.colors.accent};
svg {
path,
rect {
stroke: ${theme.colors.accent};
stroke-width: 1.5px;
}
}
Expand All @@ -42,7 +41,26 @@ export const CheckButton = ({ active = false, onChange }: Props) => {
onClick={() => onChange?.(!active)}
data-testid="check-button"
>
<CircleTick />
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fill="none"
d="M7 12.3125L11.0625 16.0625L17 7.9375"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
<rect
fill="none"
x="1"
y="1"
width="22"
height="22"
rx="11"
stroke="currentColor"
strokeWidth="2"
/>
</svg>
</Container>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const ReadableExpiry = ({ expiry }: { expiry: Date }) => {
day: 'numeric',
})}, ${expiry.getFullYear()}`}
</Typography>
<Typography weight="bold" color="textTertiary">
<Typography weight="bold" color="grey">
{`at ${expiry.toLocaleTimeString(undefined, {
hour: '2-digit',
minute: '2-digit',
Expand Down
2 changes: 1 addition & 1 deletion src/components/@atoms/GasDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Container = styled.div(
gap: ${theme.space['1']};

font-size: ${theme.fontSizes.small};
color: ${theme.colors.textTertiary};
color: ${theme.colors.grey};
font-weight: bold;

padding: 0 ${theme.space['4']};
Expand Down
6 changes: 2 additions & 4 deletions src/components/@atoms/InnerDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import styled, { css } from 'styled-components'

import { mq } from '@ensdomains/thorin'

export const InnerDialog = styled.div(
({ theme }) => css`
display: flex;
Expand All @@ -12,9 +10,9 @@ export const InnerDialog = styled.div(
gap: ${theme.space['4']};
max-height: 60vh;
max-width: 100vw;
${mq.sm.min(css`
@media (min-width: ${theme.breakpoints.sm}px) {
width: calc(80vw - 2 * ${theme.space['6']});
max-width: ${theme.space['128']};
`)}
}
`,
)
2 changes: 1 addition & 1 deletion src/components/@atoms/Invoice/Invoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const LineItem = styled.div<{ $color?: Colors }>(
display: flex;
justify-content: space-between;
line-height: ${theme.space['5']};
color: ${$color ? theme.colors[$color] : theme.colors.textTertiary};
color: ${$color ? theme.colors[$color] : theme.colors.grey};
`,
)

Expand Down
6 changes: 2 additions & 4 deletions src/components/@atoms/MobileFullWidth.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import styled, { css } from 'styled-components'

import { mq } from '@ensdomains/thorin'

const MobileFullWidth = styled.div(
({ theme }) => css`
& > div,
& {
width: ${theme.space.full};
max-width: ${theme.space.full};
${mq.sm.min(css`
@media (min-width: ${theme.breakpoints.sm}px) {
min-width: ${theme.space['40']};
width: fit-content;
max-width: max-content;
`)}
}
}
`,
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/@atoms/NameDetailItem/NameDetailItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactNode } from 'react'
import styled, { css } from 'styled-components'
import { useEnsAvatar } from 'wagmi'

import { Avatar, mq } from '@ensdomains/thorin'
import { Avatar } from '@ensdomains/thorin'

import CircleTick from '@app/assets/CircleTick.svg'
import { useZorb } from '@app/hooks/useZorb'
Expand Down Expand Up @@ -39,10 +39,10 @@ const NameItemWrapper = styled.div<{ $highlight: boolean; $disabled: boolean }>(
&:last-of-type {
border: none;
}
${mq.sm.min(css`
@media (min-width: ${theme.breakpoints.sm}px) {
padding: ${theme.space['3']} ${theme.space['4.5']};
gap: ${theme.space['4']};
`)}
}
`,
)

Expand Down
6 changes: 3 additions & 3 deletions src/components/@atoms/NameDetailItem/TaggedNameItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'

import { NameWithRelation } from '@ensdomains/ensjs/subgraph'
import { mq, Tag } from '@ensdomains/thorin'
import { Tag } from '@ensdomains/thorin'

import { validateExpiry } from '@app/utils/utils'

Expand All @@ -16,11 +16,11 @@ const OtherItemsContainer = styled.div(
justify-content: center;
gap: ${theme.space['2']};
flex-gap: ${theme.space['2']};
${mq.md.min(css`
@media (min-width: 768px) {
flex-direction: row;
gap: ${theme.space['4']};
flex-gap: ${theme.space['4']};
`)}
}
`,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ afterAll(() => {

describe('PseudoActionButton', () => {
it('should show loading state when clicked and reset after timeout has been run', async () => {
const testIcon = <div data-testid="icon" />
const testIcon = () => <div data-testid="icon" />
render(
<PseudoActionButton prefix={testIcon} timeout={500}>
Test
Expand All @@ -35,7 +35,7 @@ describe('PseudoActionButton', () => {
})

it('should maintain loading state if loading is set to true', async () => {
const testIcon = <div data-testid="icon" />
const testIcon = () => <div data-testid="icon" />
render(
<PseudoActionButton loading prefix={testIcon} timeout={500}>
Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'

import { Helper, mq } from '@ensdomains/thorin'
import { Helper } from '@ensdomains/thorin'

const InnerContainer = styled.div(
({ theme }) => css`
Expand Down Expand Up @@ -75,10 +75,10 @@ const Marker = styled.div<{ $percent: number }>(
white-space: nowrap;
}

${mq.xs.min(css`
@media (min-width: 360px) {
width: ${theme.space['18']};
font-size: ${theme.fontSizes.small};
`)}
}

&::before {
content: '';
Expand Down Expand Up @@ -133,7 +133,7 @@ export const RegistrationTimeComparisonBanner = ({ message, yearlyFee, transacti
const twentyRounded = calcPercent(twenty.gas, 3)

return (
<Helper type="info">
<Helper alert="info">
<InnerContainer>
<div>{message}</div>
<Bar $highlightPercent={twentyRounded} />
Expand Down
6 changes: 3 additions & 3 deletions src/components/@atoms/StyledName/StyledName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Container = styled.div(

const Name = styled.span<{ $disabled?: boolean }>(
({ theme, $disabled }) => css`
color: ${$disabled ? theme.colors.textTertiary : theme.colors.text};
color: ${$disabled ? theme.colors.grey : theme.colors.text};
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand All @@ -24,13 +24,13 @@ const Name = styled.span<{ $disabled?: boolean }>(

const Dot = styled.span(
({ theme }) => css`
color: ${theme.colors.textTertiary};
color: ${theme.colors.grey};
`,
)

const Tld = styled.span(
({ theme }) => css`
color: ${theme.colors.textTertiary};
color: ${theme.colors.grey};
white-space: nowrap;
`,
)
Expand Down
Loading
Loading