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

feat: implement addNextQuiz to automate next quiz #13939

Merged
merged 3 commits into from
Nov 18, 2024
Merged
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
13 changes: 12 additions & 1 deletion src/components/Quiz/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { CompletedQuizzes, type Lang, QuizShareStats } from "@/lib/types"
import type {
CompletedQuizzes,
Lang,
QuizShareStats,
QuizzesSection,
} from "@/lib/types"

import { getLocaleForNumberFormat } from "@/lib/utils/translations"

Expand Down Expand Up @@ -87,3 +92,9 @@ export const getFormattedStats = (language, average) => {
),
}
}

export const addNextQuiz = (quizzes: QuizzesSection[]) =>
quizzes.map((quiz, idx) => ({
...quiz,
next: quizzes[idx + 1]?.id,
}))
25 changes: 11 additions & 14 deletions src/data/quizzes/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { QuizzesSection, RawQuizzes } from "@/lib/types"

import { addNextQuiz } from "@/components/Quiz/utils"

// Declare hash-map of quizzes based on slug key
const quizzes = {
"what-is-ethereum": {
Expand Down Expand Up @@ -60,78 +62,73 @@ const quizzes = {
},
} satisfies RawQuizzes

export const ethereumBasicsQuizzes: QuizzesSection[] = [
const ethereumBasicsQuizzesRaw: QuizzesSection[] = [
{
id: "what-is-ethereum",
level: "beginner",
next: "what-is-ether",
},
{
id: "what-is-ether",
level: "beginner",
next: "wallets",
},
{
id: "wallets",
level: "beginner",
next: "web3",
},
{
id: "web3",
level: "beginner",
next: "security",
},
{
id: "security",
level: "beginner",
},
]
export const ethereumBasicsQuizzes: QuizzesSection[] = addNextQuiz(
ethereumBasicsQuizzesRaw
)

export const usingEthereumQuizzes: QuizzesSection[] = [
const usingEthereumQuizzesRaw: QuizzesSection[] = [
{
id: "nfts",
level: "beginner",
next: "stablecoins",
},
{
id: "stablecoins",
level: "beginner",
next: "defi",
},
{
id: "defi",
level: "beginner",
next: "layer-2",
},
{
id: "layer-2",
level: "intermediate",
next: "daos",
},
{
id: "daos",
level: "intermediate",
next: "run-a-node",
},
{
id: "run-a-node",
level: "intermediate",
next: "merge",
},
{
id: "merge",
level: "intermediate",
next: "scaling",
},
{
id: "scaling",
level: "advanced",
next: "solo-staking",
},
{
id: "solo-staking",
level: "advanced",
},
]

export const usingEthereumQuizzes: QuizzesSection[] = addNextQuiz(
usingEthereumQuizzesRaw
)

export default quizzes
4 changes: 1 addition & 3 deletions src/data/wallets/wallet-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1745,9 +1745,7 @@ export const walletsData: WalletData[] = [
open_source: false,
repo_url: "https://github.com/phantom",
non_custodial: true,
security_audit: [
"https://github.com/phantom/audit-reports",
],
security_audit: ["https://github.com/phantom/audit-reports"],
scam_protection: true,
hardware_support: true,
rpc_importing: false,
Expand Down
Loading