Skip to content

Commit 69cefbd

Browse files
committed
Merge branch 'dev' into ashiskumar-dev
2 parents 9eecdae + d5e7f7d commit 69cefbd

32 files changed

+624
-214
lines changed

.github/labeler.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@
2929
"translation 🌍":
3030
- public/content/translations/**/*
3131
- src/intl/**/*
32-
- !src/intl/en/**
3332

3433
"content 🖋️":
3534
- src/intl/en/**
3635
- public/content/**/*
37-
- !public/content/translations/**/*
3836

3937
"event 📅":
4038
- src/data/community-events.json

.github/workflows/label.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,26 @@ jobs:
1111
- uses: actions/labeler@v2
1212
with:
1313
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14+
15+
- name: Refine labels
16+
uses: actions/github-script@v5
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
script: |
20+
try {
21+
const { owner, repo, number: pull_number } = context.issue;
22+
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
23+
24+
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
25+
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
26+
27+
if (allInEn) {
28+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
29+
}
30+
31+
if (allInTranslations) {
32+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
33+
}
34+
} catch (error) {
35+
console.warn("Problem occurred refining labels")
36+
}

.storybook/i18next.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const baseLocales = {
1313
const ns = [
1414
"common",
1515
"glossary",
16+
"learn-quizzes",
1617
"page-about",
1718
"page-index",
1819
"page-learn",
@@ -49,6 +50,7 @@ const resources: Resource = ns.reduce((acc, n) => {
4950

5051
return acc
5152
}, {})
53+
console.log("🚀 ~ constresources:Resource=ns.reduce ~ resources:", resources)
5254

5355
i18n.use(initReactI18next).init({
5456
debug: true,
@@ -57,6 +59,7 @@ i18n.use(initReactI18next).init({
5759
react: { useSuspense: false },
5860
supportedLngs,
5961
resources,
62+
defaultNS: "common",
6063
})
6164

6265
export default i18n

.storybook/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ addons.setConfig({
1010
// In order to override the default favicon, and inject a data hash link to the png
1111
const link = document.createElement("link")
1212
link.setAttribute("rel", "shortcut icon")
13-
link.setAttribute("href", favicon)
13+
link.setAttribute("href", favicon.src)
1414
document.head.appendChild(link)

.storybook/preview.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import type { Preview } from "@storybook/react"
2+
import isChromatic from "chromatic/isChromatic"
23

34
import theme from "../src/@chakra-ui/theme"
45

56
import { ChakraDecorator } from "./ChakraDecorator"
67
import i18n, { baseLocales } from "./i18next"
78

89
import "../src/styles/global.css"
10+
import { MotionGlobalConfig } from "framer-motion"
11+
12+
MotionGlobalConfig.skipAnimations = isChromatic()
913

1014
const chakraBreakpointArray = Object.entries(theme.breakpoints) as [
1115
string,
@@ -43,6 +47,9 @@ const preview: Preview = {
4347
backgrounds: {
4448
disable: true,
4549
},
50+
chromatic: {
51+
prefersReducedMotion: "reduce",
52+
},
4653
options: {
4754
storySort: {
4855
order: ["Atoms", "Molecules", "Organisms", "Templates", "Pages"],

.storybook/theme.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { create } from "@storybook/theming"
22

3-
// @ts-ignore
4-
import brandImage from "./preview-logo.svg"
5-
63
export default create({
74
base: "dark",
85

@@ -11,7 +8,7 @@ export default create({
118
appBorderRadius: 4,
129

1310
brandTitle: "Ethereum.org",
14-
brandImage,
11+
brandImage: "./preview-logo.svg",
1512
brandUrl: "https://www.ethereum.org",
1613

1714
barSelectedColor: "#ff7324",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@storybook/addon-links": "7.6.6",
6868
"@storybook/nextjs": "7.6.6",
6969
"@storybook/react": "7.6.6",
70-
"@storybook/testing-library": "0.2.2",
70+
"@storybook/test": "8.0.0",
7171
"@svgr/webpack": "^8.1.0",
7272
"@types/decompress": "^4.2.7",
7373
"@types/hast": "^3.0.0",

src/components/CrowdinContributors.tsx

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/components/FeedbackWidget/FeedbackWidget.stories.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as React from "react"
22
import { Box, Stack } from "@chakra-ui/react"
33
import { Meta, StoryObj } from "@storybook/react"
4+
import { expect, fireEvent, waitFor, within } from "@storybook/test"
45

5-
import FeedbackWidgetComponent from "./"
6+
import FeedbackWidget from "./"
67

7-
type FeedbackWidgetType = typeof FeedbackWidgetComponent
8+
type FeedbackWidgetType = typeof FeedbackWidget
89

910
const meta = {
1011
title: "FeedbackWidget",
@@ -23,6 +24,27 @@ const meta = {
2324

2425
export default meta
2526

26-
export const FeedbackWidget: StoryObj<FeedbackWidgetType> = {
27-
render: () => <FeedbackWidgetComponent />,
27+
type Story = StoryObj<typeof meta>
28+
29+
export const WidgetButton: Story = {
30+
render: () => <FeedbackWidget />,
31+
}
32+
33+
export const WidgetModal: Story = {
34+
render: () => <FeedbackWidget />,
35+
play: async ({ canvasElement }) => {
36+
// Add delay for snapshot capture of the modal
37+
const canvas = within(canvasElement)
38+
const canvasParent = within(canvasElement.parentElement!)
39+
40+
const feedbackButton = canvas.getByTestId("feedback-widget-button")
41+
42+
fireEvent.click(feedbackButton)
43+
44+
await waitFor(async () => {
45+
await expect(
46+
canvasParent.getByTestId("feedback-widget-modal")
47+
).toBeVisible()
48+
})
49+
},
2850
}

src/components/FeedbackWidget/FixedDot.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const FixedDot = ({ bottomOffset, isExpanded, ...props }: FixedDotProps) => {
1212
const size = "12"
1313
return (
1414
<Button
15+
data-testid="feedback-widget-button"
1516
h={size}
1617
w={{ base: size, lg: isExpanded ? "15rem" : size }}
1718
borderRadius="full"

0 commit comments

Comments
 (0)