Skip to content

Commit a939784

Browse files
authored
Update faucet alerts (#2041)
* chore: cleanup faucet maintenance logic * remove maintenance component export * chore: update faucet alerting * update alaert * update alert
1 parent 48d4a0d commit a939784

File tree

3 files changed

+78
-43
lines changed

3 files changed

+78
-43
lines changed

src/components/Faucet/Alerts.tsx

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,166 @@
1-
import React from "react";
2-
import { AlertTitle, AlertText } from "@site/src/components/Alert";
3-
import { trackClickForSegment } from "@site/src/lib/segmentAnalytics";
1+
import React from 'react'
2+
import { AlertTitle, AlertText } from '@site/src/components/Alert'
3+
import { trackClickForSegment } from '@site/src/lib/segmentAnalytics'
44

55
const handleClickCommonIssue = () => {
66
trackClickForSegment({
7-
eventName: "Contact us",
7+
eventName: 'Contact us',
88
clickType: `Common Issue Alert`,
9-
userExperience: "B",
9+
userExperience: 'B',
1010
responseStatus: null,
1111
responseMsg: null,
1212
timestamp: Date.now(),
13-
});
14-
};
13+
})
14+
}
1515

1616
const handleClickBalanceLow = () => {
1717
trackClickForSegment({
18-
eventName: "Add funds using MetaMask",
18+
eventName: 'Add funds using MetaMask',
1919
clickType: `Low Balance Alert`,
20-
userExperience: "B",
20+
userExperience: 'B',
2121
responseStatus: null,
2222
responseMsg: null,
2323
timestamp: Date.now(),
24-
});
25-
};
24+
})
25+
}
2626

2727
const handleClickCooldown = () => {
2828
trackClickForSegment({
29-
eventName: "Contact us",
29+
eventName: 'Contact us',
3030
clickType: `Cooldown Alert`,
31-
userExperience: "B",
31+
userExperience: 'B',
3232
responseStatus: null,
3333
responseMsg: null,
3434
timestamp: Date.now(),
35-
});
36-
};
35+
})
36+
}
37+
38+
const handleClickPoh = () => {
39+
trackClickForSegment({
40+
eventName: 'PoH',
41+
clickType: `PoH Alert`,
42+
userExperience: 'B',
43+
responseStatus: null,
44+
responseMsg: null,
45+
timestamp: Date.now(),
46+
})
47+
}
3748

3849
const handleClickViewTransaction = () => {
3950
trackClickForSegment({
40-
eventName: "View on Etherscan",
51+
eventName: 'View on Etherscan',
4152
clickType: `Success Alert`,
42-
userExperience: "B",
53+
userExperience: 'B',
4354
responseStatus: null,
4455
responseMsg: null,
4556
timestamp: Date.now(),
46-
});
47-
};
57+
})
58+
}
4859

4960
export const AlertCommonIssue = () => (
5061
<div>
5162
<AlertTitle>Issue starting transaction</AlertTitle>
5263
<AlertText>
5364
<span>
54-
There was an issue starting your transaction. Try again in a few
55-
minutes. If the problem persists please{" "}
65+
There was an issue starting your transaction. Try again in a few minutes. If the problem
66+
persists please{' '}
5667
<a
5768
data-testid="alert-common-contact-us"
5869
onClick={handleClickCommonIssue}
5970
target="_blank"
60-
href="https://support.metamask.io/"
61-
>
71+
href="https://support.metamask.io/">
6272
contact support
6373
</a>
6474
.
6575
</span>
6676
</AlertText>
6777
</div>
68-
);
78+
)
79+
80+
export const AlertFailedPoh = () => (
81+
<div>
82+
<AlertTitle>Please complete Linea Proof of Humanity</AlertTitle>
83+
<AlertText>
84+
<span>
85+
Free users are required to complete Proof of Humanity to access the faucet. Learn more{' '}
86+
<a
87+
data-testid="alert-poh"
88+
onClick={handleClickPoh}
89+
target="_blank"
90+
href="https://poh.linea.build/">
91+
here
92+
</a>
93+
.
94+
</span>
95+
</AlertText>
96+
</div>
97+
)
6998

7099
export const AlertPastActivity = () => (
71100
<div>
72101
<AlertTitle>No past activity</AlertTitle>
73102
<AlertText>
74-
The address provided does not have sufficient historical activity or balance on the Ethereum Mainnet. Please use a
75-
different address to proceed. Read the FAQ below for more information.
103+
The address provided does not have sufficient historical activity or balance on the Ethereum
104+
Mainnet. Please use a different address to proceed. Read the FAQ below for more information.
76105
</AlertText>
77106
</div>
78-
);
107+
)
79108

80109
export const AlertBalanceTooLow = () => (
81110
<div>
82111
<AlertTitle>Balance too low</AlertTitle>
83112
<AlertText>
84113
<span>
85-
Your current Ethereum address does not contain enough ETH on
86-
Ethereum Mainnet. You can add funds to your address using{" "}
114+
Your current Ethereum address does not contain enough ETH on Ethereum Mainnet. You can add
115+
funds to your address using{' '}
87116
<a
88117
data-testid="alert-balance-add-funds"
89118
onClick={handleClickBalanceLow}
90119
className="underline"
91-
href="https://metamask.io/buy-crypto/"
92-
>
120+
href="https://metamask.io/buy-crypto/">
93121
MetaMask
94122
</a>
95123
.
96124
</span>
97125
</AlertText>
98126
</div>
99-
);
127+
)
100128

101129
export const AlertCooldown = () => (
102130
<div>
103131
<AlertTitle>Cooldown period</AlertTitle>
104132
<AlertText>
105133
<span>
106-
You already got ETH from the faucet today. Try again in 24 hours.{" "}
134+
You already got ETH from the faucet today. Try again in 24 hours.{' '}
107135
<a
108136
data-testid="alert-cooldown-contact-us"
109137
onClick={handleClickCooldown}
110138
target="_blank"
111-
href="https://support.metamask.io/"
112-
>
139+
href="https://support.metamask.io/">
113140
Contact us
114141
</a>
115142
.
116143
</span>
117144
</AlertText>
118145
</div>
119-
);
146+
)
120147

121148
export const AlertSuccess = ({ url }: { url: string }) => (
122149
<div>
123150
<AlertTitle>Transaction successful!</AlertTitle>
124151
<AlertText>
125152
<span>
126-
Your transaction has been sent to the Ethereum/Sepolia network. You
127-
will receive your ETH shortly.{" "}
153+
Your transaction has been sent to the Ethereum/Sepolia network. You will receive your ETH
154+
shortly.{' '}
128155
<a
129156
data-testid="alert-success-etherscan"
130157
onClick={handleClickViewTransaction}
131158
target="_blank"
132-
href={url}
133-
>
159+
href={url}>
134160
View on Etherscan
135161
</a>
136162
.
137163
</span>
138164
</AlertText>
139165
</div>
140-
);
166+
)

src/components/Faucet/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
export { default as Faq } from './Faq'
22
export { default as TransactionTable } from './TransactionTable'
33
export { default as Hero } from './Hero'
4-
export { AlertCommonIssue, AlertPastActivity, AlertCooldown, AlertSuccess } from './Alerts'
4+
export {
5+
AlertCommonIssue,
6+
AlertPastActivity,
7+
AlertCooldown,
8+
AlertSuccess,
9+
AlertFailedPoh,
10+
} from './Alerts'

src/pages/developer-tools/faucet.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
TransactionTable,
1313
Hero,
1414
AlertPastActivity,
15+
AlertFailedPoh,
1516
} from '@site/src/components/Faucet'
1617
import { useAlert } from 'react-alert'
1718
import { MetamaskProviderContext } from '@site/src/theme/Root'
@@ -85,7 +86,9 @@ export default function Faucet() {
8586
const error = faucetResponse.error
8687

8788
if (error) {
88-
if (error.code === 'balance_too_low') {
89+
if (error.code === 'failed_poh') {
90+
alert.error(<AlertFailedPoh />)
91+
} else if (error.code === 'balance_too_low') {
8992
alert.error(<AlertBalanceTooLow />)
9093
} else if (error.code === 'transaction_count_too_low') {
9194
alert.error(<AlertPastActivity />)

0 commit comments

Comments
 (0)