Skip to content

Commit 4112fd9

Browse files
authored
Merge pull request #15160 from ethereum/tech-debt
Tech debt
2 parents d8388c4 + 5e9cd08 commit 4112fd9

File tree

18 files changed

+72
-46
lines changed

18 files changed

+72
-46
lines changed

next.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ module.exports = (phase, { defaultConfig }) => {
8181
protocol: "https",
8282
hostname: "crowdin-static.downloads.crowdin.com",
8383
},
84+
{
85+
protocol: "https",
86+
hostname: "avatars.githubusercontent.com",
87+
},
88+
{
89+
protocol: "https",
90+
hostname: "coin-images.coingecko.com",
91+
},
8492
],
8593
},
8694
async headers() {

public/content/developers/docs/design-and-ux/dex-design-best-practice/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ The law of proximity states that items that are close together are perceived as
177177

178178
Ultimately, there are pluses and minuses for both options, but it is interesting how the trend appears to be towards token on the right.
179179

180-
# Button behavior {#button-behavior}
180+
## Button behavior {#button-behavior}
181181

182182
Don’t have a separate button for Approve. Also don’t have a separate click for Approve. The user wants to Swap, so just say “swap” on the button and initiate the approval as the first step. A modal can show progress with a stepper, or a simple “tx 1 of 2 - approving” notification.
183183

184184
![A UI with separate buttons for approve and swap](./14.png)
185185

186186
![A UI with one button that says approve](./15.png)
187187

188-
## Button as contextual help {#button-as-contextual-help}
188+
### Button as contextual help {#button-as-contextual-help}
189189

190190
The button can do double duty as an alert!
191191

public/content/developers/tutorials/erc-721-vyper-annotated-code/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ def supportsInterface(_interfaceID: bytes32) -> bool:
278278
```
279279

280280
In contrast to Python, Vyper is a [static typed language](https://wikipedia.org/wiki/Type_system#Static_type_checking).
281-
You can't declare a variable, or a function parameter, without identifying the [data
282-
type](https://vyper.readthedocs.io/en/latest/types.html). In this case the input parameter is `bytes32`, a 256-bit value
281+
You can't declare a variable, or a function parameter, without identifying the [data type](https://vyper.readthedocs.io/en/latest/types.html). In this case the input parameter is `bytes32`, a 256-bit value
283282
(256 bits is the native word size of the [Ethereum Virtual Machine](/developers/docs/evm/)). The output is a boolean
284283
value. By convention, the names of function parameters start with an underscore (`_`).
285284

@@ -689,7 +688,7 @@ Anybody who is allowed to transfer a token is allowed to burn it. While a burn a
689688
transfer to the zero address, the zero address does not actually receives the token. This allows us to
690689
free up all the storage that was used for the token, which can reduce the gas cost of the transaction.
691690

692-
# Using this Contract {#using-contract}
691+
## Using this Contract {#using-contract}
693692

694693
In contrast to Solidity, Vyper does not have inheritance. This is a deliberate design choice to make the
695694
code clearer and therefore easier to secure. So to create your own Vyper ERC-721 contract you take [this

public/content/developers/tutorials/waffle-test-simple-smart-contract/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ published: 2021-02-26
2121
- You have used some package managers like yarn or npm
2222
- You possess very basic knowledge of smart contracts and Solidity
2323

24-
# Getting started {#getting-started}
24+
## Getting started {#getting-started}
2525

2626
The tutorial demonstrates test setup and run using yarn, but there is no problem if you prefer npm - I will provide proper references to the official Waffle [documentation](https://ethereum-waffle.readthedocs.io/en/latest/index.html).
2727

@@ -100,7 +100,7 @@ Testing with Waffle requires using Chai matchers and Mocha, so you need to [add]
100100

101101
If you want to [execute](https://ethereum-waffle.readthedocs.io/en/latest/getting-started.html#running-tests) your tests, just run `yarn test` .
102102

103-
# Testing {#testing}
103+
## Testing {#testing}
104104

105105
Now create the `test` directory and create the new file `test\EtherSplitter.test.ts`.
106106
Copy the snippet below and paste it to our test file.
@@ -194,7 +194,7 @@ it("Reverts when Vei amount uneven", async () => {
194194

195195
The test, if passed, will assure us that the transaction was reverted indeed. However, there must be also an exact match between the messages that we passed in `require` statement and the message we expect in `revertedWith`. If we go back to the code of EtherSplitter contract, in the `require` statement for the wei amount, we provide the message: 'Uneven wei amount not allowed'. This matches the message we expect in our test. If they were not equal, the test would fail.
196196

197-
# Congratulations! {#congratulations}
197+
## Congratulations! {#congratulations}
198198

199199
You've made your first big step towards testing smart contracts with Waffle! You might be interested in other Waffle tutorials:
200200

src/components/Contributors.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useEffect, useState } from "react"
44
import shuffle from "lodash/shuffle"
55

6+
import { Image } from "@/components/Image"
67
import { Flex } from "@/components/ui/flex"
78
import InlineLink from "@/components/ui/Link"
89
import { LinkBox, LinkOverlay } from "@/components/ui/link-box"
@@ -39,7 +40,7 @@ const Contributors = () => {
3940
className="m-2 max-w-[132px] transform shadow transition-transform duration-100 hover:scale-[1.02] hover:rounded hover:bg-background-highlight focus:scale-[1.02] focus:rounded"
4041
key={contributor.login}
4142
>
42-
<img
43+
<Image
4344
className="h-[132px] w-[132px]"
4445
src={contributor.avatar_url}
4546
alt={contributor.name}

src/components/DataTable/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const DataTable = <TData, TValue>({
9797
}
9898

9999
previousExpandedRef.current = expanded
100-
}, [expanded])
100+
}, [expanded, matomoEventCategory, table])
101101

102102
useEffect(() => {
103103
if (JSON.stringify(data) !== JSON.stringify(previousDataRef.current)) {
@@ -111,7 +111,7 @@ const DataTable = <TData, TValue>({
111111

112112
return () => clearTimeout(timer)
113113
}
114-
}, [data])
114+
}, [data, table])
115115

116116
return (
117117
<div className="relative">

src/components/EventCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const EventCard: React.FC<EventCardProps> = ({
4545
</CardHeader>
4646
<div className="flex items-center justify-center">
4747
{imageUrl ? (
48+
// eslint-disable-next-line @next/next/no-img-element
4849
<img
4950
src={imageUrl}
5051
alt={title}

src/components/ListenToPlayer/PlayerWidget/index.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from "react"
1+
import { useCallback, useEffect, useRef, useState } from "react"
22
import { IoClose } from "react-icons/io5"
33

44
import {
@@ -75,27 +75,33 @@ const PlayerWidget = ({
7575
const [showSpeedMenu, setShowSpeedMenu] = useState(false)
7676
const speedMenuRef = useRef<HTMLDivElement>(null)
7777

78-
const calculateNewTime = (clientX: number) => {
79-
if (!scrubBarRef.current) return 0
80-
const rect = scrubBarRef.current.getBoundingClientRect()
81-
const position = Math.max(
82-
0,
83-
Math.min(1, (clientX - rect.left) / rect.width)
84-
)
85-
return duration * position
86-
}
78+
const calculateNewTime = useCallback(
79+
(clientX: number) => {
80+
if (!scrubBarRef.current) return 0
81+
const rect = scrubBarRef.current.getBoundingClientRect()
82+
const position = Math.max(
83+
0,
84+
Math.min(1, (clientX - rect.left) / rect.width)
85+
)
86+
return duration * position
87+
},
88+
[duration]
89+
)
8790

8891
const handleMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
8992
setIsDragging(true)
9093
const newTime = calculateNewTime(e.clientX)
9194
onSeek(newTime)
9295
}
9396

94-
const handleMouseMove = (e: MouseEvent) => {
95-
if (!isDragging) return
96-
const newTime = calculateNewTime(e.clientX)
97-
onSeek(newTime)
98-
}
97+
const handleMouseMove = useCallback(
98+
(e: MouseEvent) => {
99+
if (!isDragging) return
100+
const newTime = calculateNewTime(e.clientX)
101+
onSeek(newTime)
102+
},
103+
[isDragging, calculateNewTime, onSeek]
104+
)
99105

100106
const handleMouseUp = () => {
101107
setIsDragging(false)
@@ -110,7 +116,7 @@ const PlayerWidget = ({
110116
document.removeEventListener("mousemove", handleMouseMove)
111117
document.removeEventListener("mouseup", handleMouseUp)
112118
}
113-
}, [isDragging])
119+
}, [handleMouseMove, isDragging])
114120

115121
useEffect(() => {
116122
const handleClickOutside = (event: MouseEvent) => {

src/components/ListenToPlayer/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
8888
}
8989
audioPlayer.unload()
9090
}
91+
// eslint-disable-next-line react-hooks/exhaustive-deps
9192
}, [currentTrackIndex])
9293

9394
useEffect(() => {
9495
if (sound && autoplay && isPlaying) {
9596
sound.play()
9697
}
98+
// eslint-disable-next-line react-hooks/exhaustive-deps
9799
}, [sound])
98100

99101
useEffect(() => {

src/components/ProductTable/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const ProductTable = <T,>({
9494
// TODO: Fix this, removed to avoid infinite re-renders
9595
// router.replace(pathname, undefined, { shallow: true })
9696
}
97+
// eslint-disable-next-line react-hooks/exhaustive-deps
9798
}, [router.query])
9899

99100
// Update or remove preset filters

0 commit comments

Comments
 (0)