diff --git a/configs/app/features/easterEggBadge.ts b/configs/app/features/easterEggBadge.ts new file mode 100644 index 0000000000..77ac52a1bf --- /dev/null +++ b/configs/app/features/easterEggBadge.ts @@ -0,0 +1,24 @@ +import type { Feature } from './types'; + +import { getEnvValue } from '../utils'; + +const badgeClaimLink = getEnvValue('NEXT_PUBLIC_BADGE_CLAIM_LINK'); + +const title = 'Easter egg badge'; + +const config: Feature<{ badgeClaimLink: string }> = (() => { + if (badgeClaimLink) { + return Object.freeze({ + title, + isEnabled: true, + badgeClaimLink, + }); + } + + return Object.freeze({ + title, + isEnabled: false, + }); +})(); + +export default config; diff --git a/configs/app/features/index.ts b/configs/app/features/index.ts index 39b7919614..57c91b3e23 100644 --- a/configs/app/features/index.ts +++ b/configs/app/features/index.ts @@ -10,6 +10,7 @@ export { default as celo } from './celo'; export { default as csvExport } from './csvExport'; export { default as dataAvailability } from './dataAvailability'; export { default as deFiDropdown } from './deFiDropdown'; +export { default as easterEggBadge } from './easterEggBadge'; export { default as faultProofSystem } from './faultProofSystem'; export { default as gasTracker } from './gasTracker'; export { default as getGasButton } from './getGasButton'; diff --git a/configs/envs/.env.eth b/configs/envs/.env.eth index ebb31e36ea..f667f08b88 100644 --- a/configs/envs/.env.eth +++ b/configs/envs/.env.eth @@ -66,4 +66,5 @@ NEXT_PUBLIC_STATS_API_HOST=https://stats-eth-main.k8s-prod-1.blockscout.com NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER=blockscout NEXT_PUBLIC_VIEWS_CONTRACT_SOLIDITYSCAN_ENABLED=true NEXT_PUBLIC_VISUALIZE_API_HOST=https://visualizer.services.blockscout.com -NEXT_PUBLIC_XSTAR_SCORE_URL=https://docs.xname.app/the-solution-adaptive-proof-of-humanity-on-blockchain/xhs-scoring-algorithm?utm_source=blockscout&utm_medium=address \ No newline at end of file +NEXT_PUBLIC_XSTAR_SCORE_URL=https://docs.xname.app/the-solution-adaptive-proof-of-humanity-on-blockchain/xhs-scoring-algorithm?utm_source=blockscout&utm_medium=address +NEXT_PUBLIC_BADGE_CLAIM_LINK=https://badges.blockscout.com/mint/hiddenBlockBadge \ No newline at end of file diff --git a/deploy/tools/envs-validator/schema.ts b/deploy/tools/envs-validator/schema.ts index 05eb1c52d0..1aee125078 100644 --- a/deploy/tools/envs-validator/schema.ts +++ b/deploy/tools/envs-validator/schema.ts @@ -886,6 +886,7 @@ const schema = yup }), NEXT_PUBLIC_REWARDS_SERVICE_API_HOST: yup.string().test(urlTest), NEXT_PUBLIC_XSTAR_SCORE_URL: yup.string().test(urlTest), + NEXT_PUBLIC_BADGE_CLAIM_LINK: yup.string().test(urlTest), // 6. External services envs NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: yup.string(), diff --git a/docs/ENVS.md b/docs/ENVS.md index 19cb88d94d..a1f7cc1730 100644 --- a/docs/ENVS.md +++ b/docs/ENVS.md @@ -841,6 +841,12 @@ This feature enables Blockscout Merits program. It requires that the [My account | --- | --- | --- | --- | --- | --- | --- | | NEXT_PUBLIC_REWARDS_SERVICE_API_HOST | `string` | API URL | - | - | `https://example.com` | v1.36.0+ | +### Badge claim link + +| Variable | Type| Description | Compulsoriness | Default value | Example value | Version | +| --- | --- | --- | --- | --- | --- | --- | +| NEXT_PUBLIC_BADGE_CLAIM_LINK | `string` | Provide to enable the easter egg badge feature | - | - | `https://example.com` | v1.37.0+ | + ## External services configuration ### Google ReCaptcha diff --git a/ui/games/CapybaraRunner.tsx b/ui/games/CapybaraRunner.tsx index 3712a60646..0f6ce8b53e 100644 --- a/ui/games/CapybaraRunner.tsx +++ b/ui/games/CapybaraRunner.tsx @@ -1,8 +1,12 @@ -/* eslint-disable max-len */ -import { Box, Text } from '@chakra-ui/react'; +/* eslint-disable @next/next/no-img-element */ +import { Box, Text, Button, Flex } from '@chakra-ui/react'; import Script from 'next/script'; import React from 'react'; +import config from 'configs/app'; + +const easterEggBadgeFeature = config.features.easterEggBadge; + const CapybaraRunner = () => { const [ hasReachedHighScore, setHasReachedHighScore ] = React.useState(false); @@ -38,7 +42,13 @@ const CapybaraRunner = () => { - { hasReachedHighScore && You've reached a high score! } + { easterEggBadgeFeature.isEnabled && hasReachedHighScore && ( + + You unlocked a hidden badge! + Congratulations! You’re eligible to claim an epic hidden badge! + + + ) } ); }; diff --git a/ui/shared/AppError/custom/AppErrorTxNotFound.tsx b/ui/shared/AppError/custom/AppErrorTxNotFound.tsx index 9e439b46f2..64db950d20 100644 --- a/ui/shared/AppError/custom/AppErrorTxNotFound.tsx +++ b/ui/shared/AppError/custom/AppErrorTxNotFound.tsx @@ -1,5 +1,5 @@ /* eslint-disable max-len */ -import { Box, OrderedList, ListItem, useColorModeValue, Flex, chakra, Button, Link } from '@chakra-ui/react'; +import { Box, OrderedList, ListItem, useColorModeValue, Flex, chakra, Button } from '@chakra-ui/react'; import React from 'react'; import { route } from 'nextjs-routes';