Skip to content

Commit 8b73fb6

Browse files
committed
Merge branch 'dev' into irish
2 parents acd43b0 + f0bd220 commit 8b73fb6

File tree

5 files changed

+63
-62
lines changed

5 files changed

+63
-62
lines changed

next.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ module.exports = (phase, { defaultConfig }) => {
116116
"node_modules/@swc/core-linux-x64-musl",
117117
"node_modules/@esbuild/linux-x64",
118118
"src/data",
119+
"src/intl",
119120
"public/**/*.jpg",
120121
"public/**/*.png",
121122
"public/**/*.webp",
@@ -127,6 +128,7 @@ module.exports = (phase, { defaultConfig }) => {
127128
"public/**/*.pdf",
128129
"public/fonts",
129130
"public/images",
131+
"public/content",
130132
],
131133
},
132134
},
Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
import type { Meta, StoryObj } from "@storybook/react"
2+
import { expect } from "@storybook/test"
3+
import { waitFor } from "@storybook/test"
4+
import { fireEvent } from "@storybook/test"
5+
import { within } from "@storybook/test"
26

3-
import { langViewportModes } from "../../../.storybook/modes"
4-
import { BaseLayout as BaseLayoutComponent } from "../../layouts/BaseLayout"
5-
6-
import ListenToPlayer from "."
7+
import Component from "."
78

89
const meta = {
9-
title: "Atoms / Media & Icons / ListenToPlayer / ListenToPlayer",
10-
component: BaseLayoutComponent,
11-
parameters: {
12-
layout: "fullscreen",
13-
chromatic: {
14-
modes: {
15-
...langViewportModes,
16-
},
17-
},
18-
},
19-
argTypes: {
20-
children: {
21-
table: {
22-
disable: true,
23-
},
24-
},
25-
lastDeployLocaleTimestamp: {
26-
table: {
27-
disable: true,
28-
},
29-
},
10+
title: "Atoms / Media & Icons / ListenToPlayer",
11+
component: Component,
12+
args: {
13+
slug: "/eth/",
3014
},
31-
} satisfies Meta<typeof BaseLayoutComponent>
15+
} satisfies Meta<typeof Component>
3216

3317
export default meta
3418

35-
export const BaseLayout: StoryObj<typeof meta> = {
36-
args: {
37-
children: (
38-
<div className="flex w-full flex-col items-center gap-4 px-8 py-9 md:flex-row">
39-
<ListenToPlayer slug="/eth" />
40-
</div>
41-
),
42-
// contentIsOutdated: false,
43-
// contentNotTranslated: false,
44-
lastDeployLocaleTimestamp: "May 14, 2021",
19+
type Story = StoryObj<typeof meta>
20+
21+
export const PlayerButton: Story = {}
22+
23+
export const PlayerWidget: Story = {
24+
play: async ({ canvasElement }) => {
25+
const canvas = within(canvasElement)
26+
const canvasParent = within(canvasElement.parentElement!)
27+
28+
const playerButton = canvas.getByRole("button")
29+
await waitFor(() => {
30+
// TODO: hacky way to wait for the sound to be loaded
31+
expect(playerButton.textContent).not.toContain("0 min")
32+
})
33+
34+
fireEvent.click(playerButton)
35+
36+
await waitFor(async () => {
37+
await expect(
38+
canvasParent.getByTestId("player-widget-modal")
39+
).toBeVisible()
40+
})
4541
},
4642
}

src/components/ListenToPlayer/TopOfPagePlayer/index.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { PauseCircleIcon, PlayCircleIcon } from "@/components/icons/listen-to"
2+
import { Button } from "@/components/ui/buttons/Button"
23

34
import { trackCustomEvent } from "@/lib/utils/matomo"
45

@@ -18,20 +19,21 @@ const TopOfPagePlayer = ({
1819
handlePlayPause,
1920
}: TopOfPagePlayerProps) => {
2021
return (
21-
<div className="inline-block w-full rounded-lg bg-background-low p-2 hover:bg-background-medium lg:w-auto">
22-
<div
23-
className="flex cursor-pointer flex-row items-center gap-2 text-primary hover:text-primary-hover"
24-
onClick={() => {
25-
if (startedPlaying) {
26-
trackCustomEvent({
27-
eventCategory: "Audio",
28-
eventAction: "click",
29-
eventName: "start",
30-
})
31-
}
32-
handlePlayPause()
33-
}}
34-
>
22+
<Button
23+
variant="ghost"
24+
className="inline-block w-full rounded-lg bg-background-low p-2 hover:bg-background-medium lg:w-auto"
25+
onClick={() => {
26+
if (startedPlaying) {
27+
trackCustomEvent({
28+
eventCategory: "Audio",
29+
eventAction: "click",
30+
eventName: "start",
31+
})
32+
}
33+
handlePlayPause()
34+
}}
35+
>
36+
<div className="flex flex-row items-center gap-2 text-primary hover:text-primary-hover">
3537
{startedPlaying ? (
3638
isPlaying ? (
3739
<PauseCircleIcon className="h-6 w-6 transition-transform" />
@@ -52,7 +54,7 @@ const TopOfPagePlayer = ({
5254
)}
5355
</div>
5456
</div>
55-
</div>
57+
</Button>
5658
)
5759
}
5860

src/components/ListenToPlayer/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
225225
isExpanded ? "bottom-4" : "bottom-0",
226226
"fixed left-1/2 right-auto z-10 -translate-x-1/2 sm:left-auto sm:right-5 sm:translate-x-0"
227227
)}
228+
data-testid="player-widget-modal"
228229
>
229230
<div className="relative">
230231
<PlayerWidget

src/data/execution-bounty-hunters.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
{
33
"username": "holiman",
44
"name": "Martin Holst Swende",
5-
"score": 42500
5+
"score": 43500
6+
},
7+
{
8+
"username": "guidovranken",
9+
"name": "Guido Vranken",
10+
"score": 35250
611
},
712
{
813
"username": "samczsun",
914
"name": "Sam Sun",
1015
"score": 35000
16+
},
17+
{
18+
"username": "",
19+
"name": "nrv (@nervoir)",
20+
"score": 31000
1121
},
1222
{
1323
"username": "chainsecurity",
@@ -24,21 +34,11 @@
2434
"name": "Yoonho Kim (team Hithereum)",
2535
"score": 20000
2636
},
27-
{
28-
"username": "",
29-
"name": "nrv (@nervoir)",
30-
"score": 31000
31-
},
3237
{
3338
"username": "johnyangk",
3439
"name": "John Youngseok Yang (Software Platform Lab)",
3540
"score": 20000
3641
},
37-
{
38-
"username": "guidovranken",
39-
"name": "Guido Vranken",
40-
"score": 34250
41-
},
4242
{
4343
"username": "peckshield",
4444
"name": "PeckShield",

0 commit comments

Comments
 (0)