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

Rewards (merits) #2283

Merged
merged 171 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 167 commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
e2abc9e
simple profile button and auth modal layout
tom2drum Sep 17, 2024
6494697
connect email and code screens to API
tom2drum Sep 17, 2024
39ac339
add screens to modal for wallet authentication
tom2drum Sep 18, 2024
2c28370
migrate to pin input
tom2drum Sep 18, 2024
ec917a0
user profile menu
tom2drum Sep 18, 2024
7b19b08
refactor otp field
tom2drum Sep 18, 2024
c2f67dd
fix passing set-cookie from api response
tom2drum Sep 18, 2024
149a80b
add wallet info into profile menu
tom2drum Sep 18, 2024
658aeed
add mobile menu
tom2drum Sep 18, 2024
4eb5a26
show connected wallet address in button
tom2drum Sep 18, 2024
6e26942
my profile page re-design
tom2drum Sep 19, 2024
8018001
custom behaviour of connect button on dapp page
tom2drum Sep 19, 2024
b407273
style pin input
tom2drum Sep 19, 2024
9cc3d53
add logout
tom2drum Sep 19, 2024
1878c18
handle case when account is disabled
tom2drum Sep 19, 2024
4b18a65
handle case when wc is disabled
tom2drum Sep 19, 2024
5b91364
remove old components
tom2drum Sep 19, 2024
12e07e0
refactoring
tom2drum Sep 19, 2024
1970de1
workflow to link wallet or email to account
tom2drum Sep 20, 2024
ee71acd
link wallet from profile
tom2drum Sep 20, 2024
da42e08
show better OTP code errors
tom2drum Sep 20, 2024
e2f7ab6
add email alert on watchlist and verified addresses pages
tom2drum Sep 20, 2024
bccb157
deprecate env and remove old code
tom2drum Sep 20, 2024
b98271b
remove code for unverified email page
tom2drum Sep 20, 2024
9837acc
add auth guard to address action items
tom2drum Sep 20, 2024
d75b4b4
move useRedirectForInvalidAuthToken hook
tom2drum Sep 20, 2024
8ef6779
add mixpanel events
tom2drum Sep 20, 2024
ba2000a
refetch csrf token after login and fix connect wallet from contract page
tom2drum Sep 23, 2024
2f496cf
Add NEXT_PUBLIC_RE_CAPTCHA_V3_APP_SITE_KEY env
alik-agaev Sep 24, 2024
b883f4c
migrate to reCAPTCHA v3
tom2drum Sep 24, 2024
d5cf789
resend code and change email from profile page
tom2drum Sep 24, 2024
f54c693
better wallet sign-in message error
tom2drum Sep 24, 2024
632cd0f
fix demo envs
tom2drum Sep 24, 2024
eec8562
update some screenshots
tom2drum Sep 25, 2024
29f3a72
create rewards login modal and dashboard
maxaleks Sep 25, 2024
fb5726b
update input bg color and border radius
maxaleks Sep 25, 2024
45aac83
profile button design fixes
tom2drum Sep 26, 2024
261724c
fix behaviour "connect wallet" button on contract page
tom2drum Sep 26, 2024
67acc9a
implement login
maxaleks Sep 27, 2024
fbffec5
improve login, fetch real data
maxaleks Sep 27, 2024
b9a823d
add referrals query
maxaleks Sep 30, 2024
34bf84b
add rewards config query
maxaleks Sep 30, 2024
7f8a353
update icon
maxaleks Sep 30, 2024
7c58695
fix skeleton
maxaleks Sep 30, 2024
079b6d5
implement referral logic
maxaleks Sep 30, 2024
0657ea5
rename func
maxaleks Oct 1, 2024
fa3f8d9
implement claim
maxaleks Oct 1, 2024
4ff3e40
add hints
maxaleks Oct 2, 2024
33f0cab
improve api token logic
maxaleks Oct 2, 2024
08dfd8c
disable button
maxaleks Oct 2, 2024
9737dbe
add expiration time for token
maxaleks Oct 2, 2024
040d08d
implement ref code logic
maxaleks Oct 2, 2024
82631ed
improve api token management
maxaleks Oct 3, 2024
9df90f5
improve nav item and add red dot
maxaleks Oct 3, 2024
0d7e051
replace complex logic with one more icon
maxaleks Oct 4, 2024
93e846e
implement rewards button
maxaleks Oct 4, 2024
7e87fde
fix NavLink
maxaleks Oct 4, 2024
b4e999c
update ref link
maxaleks Oct 4, 2024
8efaf00
add share link
maxaleks Oct 4, 2024
4f0be5a
remove stub for login
maxaleks Oct 4, 2024
bdeb27d
add new env to docs
maxaleks Oct 4, 2024
24b777f
display rewards nav item without account
maxaleks Oct 4, 2024
000bf0d
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum Oct 8, 2024
f363957
fix linking email and wallet to existing account
tom2drum Oct 14, 2024
cc89fcf
bug fixes
tom2drum Oct 14, 2024
1517d8d
restore the login page
tom2drum Oct 14, 2024
b8adbff
update screenshots
tom2drum Oct 14, 2024
11467f3
tests for auth modal and user profile
tom2drum Oct 14, 2024
a3f9cc1
add name field to profile page and write some tests
tom2drum Oct 14, 2024
db115fe
[skip ci] clean up and more tests
tom2drum Oct 14, 2024
0defa03
update texts
tom2drum Oct 15, 2024
3eefec5
change text once more
tom2drum Oct 16, 2024
ceddc76
show rewards when logged in
maxaleks Oct 16, 2024
4768d08
Merge remote-tracking branch 'origin/tom2drum/issue-2029' into rewards
maxaleks Oct 16, 2024
487dfb3
fix merge
maxaleks Oct 16, 2024
2fde0bb
rewards button styles refactoring
maxaleks Oct 16, 2024
c290cbc
move login to context
maxaleks Oct 16, 2024
0ea2543
move other hooks to context
maxaleks Oct 16, 2024
7531e24
refactoring
maxaleks Oct 17, 2024
d268288
fix verified email checkmark behaviour
tom2drum Oct 18, 2024
4b6e41c
link rewards program to account
maxaleks Oct 18, 2024
a67f071
pass api error to the toast while signing in with wallet
tom2drum Oct 18, 2024
5a3e872
fix ref code
maxaleks Oct 18, 2024
7141aa3
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum Oct 18, 2024
89d2af3
login to account before rewards program
maxaleks Oct 18, 2024
4875ae6
fix address validation
maxaleks Oct 21, 2024
26b7edd
fix rewards config query
maxaleks Oct 21, 2024
de23911
remove unused block of content
maxaleks Oct 21, 2024
748f023
rewards dashboard updates and refactoring
maxaleks Oct 21, 2024
cb04b16
added badges
maxaleks Oct 21, 2024
615db41
replace link
maxaleks Oct 21, 2024
62ffff7
update merits icon
maxaleks Oct 21, 2024
4546db7
[skip ci] disable email field on profile page
tom2drum Oct 21, 2024
02774b9
fix images
maxaleks Oct 22, 2024
d24eb6c
fix merits icon shadow
maxaleks Oct 22, 2024
a014595
add skeleton for image
maxaleks Oct 22, 2024
a7280d3
Update merits_colored.svg
maxaleks Oct 22, 2024
618c3cd
adapt rewards dashboard for mobiles
maxaleks Oct 22, 2024
7d87ecf
fix nav item on mobile
maxaleks Oct 22, 2024
f9e590b
bug fixes
tom2drum Oct 22, 2024
bcc3cb7
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum Oct 22, 2024
10b4c5e
update screenshot
tom2drum Oct 22, 2024
91a6198
fix merits icon
maxaleks Oct 22, 2024
0f8e6b1
hide part of text without rewards feature
maxaleks Oct 22, 2024
54175e6
fix rewards button tooltip
maxaleks Oct 22, 2024
0dc8591
fix login button tooltip
maxaleks Oct 22, 2024
b6fa649
update texts
maxaleks Oct 22, 2024
676d7bc
remove redundant shadow
maxaleks Oct 22, 2024
fed42c9
Blockscout account V2
tom2drum Oct 22, 2024
b42d960
change text
maxaleks Oct 23, 2024
5552cd6
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum Oct 23, 2024
e4a9207
add loader and text
maxaleks Oct 23, 2024
d7a501e
fix warning
maxaleks Oct 24, 2024
f80e9fa
add loaders and skeletons
maxaleks Oct 24, 2024
e0007a5
update input width
maxaleks Oct 24, 2024
bb55149
fix countdown
maxaleks Oct 24, 2024
f292564
hide ref code for registered users
maxaleks Oct 24, 2024
65c5eec
disable menu item
maxaleks Oct 24, 2024
379777b
fix countdown timer
maxaleks Oct 24, 2024
2ac9ac8
Merge remote-tracking branch 'origin/tom2drum/issue-2029' into rewards
maxaleks Oct 24, 2024
478dbec
update screenshots
maxaleks Oct 24, 2024
f3cb371
remove profile button skeleton
maxaleks Oct 25, 2024
bd8afb6
fix paddings
maxaleks Oct 25, 2024
201be84
remove arrow functions from props
maxaleks Oct 25, 2024
b472070
move rewards nav link to separate component
maxaleks Oct 25, 2024
85ec04f
post-review changes
maxaleks Oct 28, 2024
728463b
move claim button to separate component
maxaleks Oct 29, 2024
411af87
remove input custom styles
maxaleks Oct 29, 2024
f5abfb5
remove !important
maxaleks Oct 29, 2024
94dd082
fix merits icon
maxaleks Oct 29, 2024
3ad15d1
update icons and fix text weight
maxaleks Oct 30, 2024
40c6639
fix login modal dark mode and mobile version
maxaleks Oct 30, 2024
25f15c0
replace AvailableSoonLabel with Tag
maxaleks Oct 30, 2024
1797669
replace Box with Divider
maxaleks Oct 30, 2024
2d92ce2
some fixes
maxaleks Oct 30, 2024
dd72526
fix icon
maxaleks Oct 30, 2024
e2f6f62
move components to sub-directories
maxaleks Oct 30, 2024
6547a4f
fix number and replace ref link
maxaleks Oct 30, 2024
4791de5
update claim button timer
maxaleks Oct 30, 2024
ac770e5
fix header gap
maxaleks Oct 30, 2024
0f7de1d
update badges section
maxaleks Oct 30, 2024
6fa230b
fix texts
maxaleks Oct 30, 2024
b0cda74
remove balance from nav link
maxaleks Oct 30, 2024
3ead00d
add ref code validation and example format
maxaleks Oct 30, 2024
dfc33b4
Merge main into rewards
maxaleks Oct 30, 2024
b26b6a4
post merge fixes
maxaleks Oct 30, 2024
1c88f82
remove unused files
maxaleks Oct 30, 2024
3451a0a
fix margin
maxaleks Oct 30, 2024
805ad3d
post-review changes
maxaleks Oct 30, 2024
3e6be97
design fixes for auth modal and user profile menu
tom2drum Oct 31, 2024
1c27f5c
update texts and links
maxaleks Oct 31, 2024
16e77ad
fix wordings
maxaleks Oct 31, 2024
e74a8bf
Merge branch 'rewards' of https://github.com/blockscout/frontend into…
maxaleks Oct 31, 2024
a3b7e74
update share text
maxaleks Oct 31, 2024
650f083
fix ref code validation
maxaleks Oct 31, 2024
f915318
add error handling
maxaleks Oct 31, 2024
c43ea0d
move RewardsNavLink
maxaleks Oct 31, 2024
ee3c848
move common logic to NavLinkBase
maxaleks Oct 31, 2024
c940046
remove unnecessary prop
maxaleks Oct 31, 2024
4f8801c
remove rewards nav link
maxaleks Oct 31, 2024
1a0e35a
redesigned nav link
maxaleks Oct 31, 2024
a9cbaae
refactored nav link
maxaleks Oct 31, 2024
d5f5b85
update screenshots
maxaleks Nov 1, 2024
9f5a0e0
Merge branch 'main' into rewards
maxaleks Nov 1, 2024
22a692d
update tests
maxaleks Nov 1, 2024
97639dc
Merge branch 'rewards' of https://github.com/blockscout/frontend into…
maxaleks Nov 1, 2024
a2226d5
add tests for rewards dashboard
maxaleks Nov 1, 2024
a7d3a05
fix number
maxaleks Nov 4, 2024
7a85c0a
fix badges
maxaleks Nov 4, 2024
8fd381c
add fix for localhost
maxaleks Nov 4, 2024
e53ef3d
change link
maxaleks Nov 4, 2024
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
1 change: 1 addition & 0 deletions configs/app/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export { default as multichainButton } from './multichainButton';
export { default as nameService } from './nameService';
export { default as publicTagsSubmission } from './publicTagsSubmission';
export { default as restApiDocs } from './restApiDocs';
export { default as rewards } from './rewards';
export { default as rollup } from './rollup';
export { default as safe } from './safe';
export { default as saveOnGas } from './saveOnGas';
Expand Down
29 changes: 29 additions & 0 deletions configs/app/features/rewards.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Feature } from './types';

import { getEnvValue } from '../utils';
import account from './account';
import blockchainInteraction from './blockchainInteraction';

const apiHost = getEnvValue('NEXT_PUBLIC_REWARDS_SERVICE_API_HOST');

const title = 'Rewards service integration';

const config: Feature<{ api: { endpoint: string; basePath: string } }> = (() => {
if (apiHost && account.isEnabled && blockchainInteraction.isEnabled) {
return Object.freeze({
title,
isEnabled: true,
maxaleks marked this conversation as resolved.
Show resolved Hide resolved
api: {
endpoint: apiHost,
basePath: '',
},
});
}

return Object.freeze({
title,
isEnabled: false,
});
})();

export default config;
6 changes: 4 additions & 2 deletions configs/envs/.env.eth_sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ NEXT_PUBLIC_METADATA_SERVICE_API_HOST=https://metadata.services.blockscout.com
NEXT_PUBLIC_METASUITES_ENABLED=true
NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG=[{'name': 'zerion', 'dapp_id': 'zerion', 'url_template': 'https://app.zerion.io/{address}/overview?utm_source=blockscout&utm_medium=address', 'logo': 'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace-logos/zerion.svg'}]
NEXT_PUBLIC_NAME_SERVICE_API_HOST=https://bens.services.blockscout.com
NEXT_PUBLIC_NAVIGATION_HIGHLIGHTED_ROUTES=['/apps']
NEXT_PUBLIC_NAVIGATION_HIGHLIGHTED_ROUTES=['/apps','/account/rewards']
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH
Expand All @@ -59,4 +59,6 @@ NEXT_PUBLIC_SAFE_TX_SERVICE_URL=https://safe-transaction-sepolia.safe.global
NEXT_PUBLIC_SENTRY_ENABLE_TRACING=true
NEXT_PUBLIC_STATS_API_HOST=https://stats-sepolia.k8s-dev.blockscout.com
NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER=noves
NEXT_PUBLIC_VIEWS_CONTRACT_SOLIDITYSCAN_ENABLED=true
NEXT_PUBLIC_VIEWS_CONTRACT_SOLIDITYSCAN_ENABLED=true
NEXT_PUBLIC_VISUALIZE_API_HOST=https://visualizer.services.blockscout.com
NEXT_PUBLIC_REWARDS_SERVICE_API_HOST=https://points.k8s-dev.blockscout.com
1 change: 1 addition & 0 deletions deploy/tools/envs-validator/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ const schema = yup

return isUndefined || valueSchema.isValidSync(data);
}),
NEXT_PUBLIC_REWARDS_SERVICE_API_HOST: yup.string().test(urlTest),

// 6. External services envs
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: yup.string(),
Expand Down
1 change: 1 addition & 0 deletions deploy/tools/envs-validator/test/.env.base
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ NEXT_PUBLIC_DEFI_DROPDOWN_ITEMS=[{'text':'Swap','icon':'swap','dappId':'uniswap'
NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG=[{'name': 'zerion', 'url_template': 'https://app.zerion.io/{address}/overview', 'logo': 'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace-logos/zerion.svg'}]
NEXT_PUBLIC_GAS_REFUEL_PROVIDER_CONFIG={'name': 'Need gas?', 'dapp_id': 'smol-refuel', 'url_template': 'https://smolrefuel.com/?outboundChain={chainId}&partner=blockscout&utm_source=blockscout&utm_medium=address&disableBridges=true', 'logo': 'https://blockscout-content.s3.amazonaws.com/smolrefuel-logo-action-button.png'}
NEXT_PUBLIC_SAVE_ON_GAS_ENABLED=true
NEXT_PUBLIC_REWARDS_SERVICE_API_HOST=https://example.com
9 changes: 9 additions & 0 deletions docs/ENVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Please be aware that all environment variables prefixed with `NEXT_PUBLIC_` will
- [Multichain balance button](ENVS.md#multichain-balance-button)
- [Get gas button](ENVS.md#get-gas-button)
- [Save on gas with GasHawk](ENVS.md#save-on-gas-with-gashawk)
- [Rewards service API](ENVS.md#rewards-service-api)
- [3rd party services configuration](ENVS.md#external-services-configuration)

&nbsp;
Expand Down Expand Up @@ -793,6 +794,14 @@ The feature enables a "Save with GasHawk" button next to the "Gas used" value on

&nbsp;

### Rewards service API

This feature enables Blockscout Merits program. It requires that the [My account](ENVS.md#my-account) and [Blockchain interaction](ENVS.md#blockchain-interaction-writing-to-contract-etc) features are also enabled.

| Variable | Type| Description | Compulsoriness | Default value | Example value | Version |
| --- | --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_REWARDS_SERVICE_API_HOST | `string` | API URL | - | - | `https://example.com` | v1.36.0+ |

## External services configuration

### Google ReCaptcha
Expand Down
2 changes: 1 addition & 1 deletion icons/API_slim.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/merits.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions icons/merits_colored.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/merits_slim.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/merits_with_dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions icons/merits_with_dot_slim.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/private_tags_slim.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/sign_out.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading