Skip to content

Commit

Permalink
fix: banner conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Mar 11, 2024
1 parent 0918a15 commit 346ce39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
25 changes: 15 additions & 10 deletions features/ipfs/update-promt-banner/update-promt-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ const warningContent = ({
isIpfs,
}: WarningContentOptions) => {
switch (true) {
// not veryfiable, only for IPFS
case isIpfs && isNotVerifiable:
return {
content: (
<WarningText>
We could not verify security of this IPFS version
This IPFS version can’t be verified
<br />
<WarningSubText>Please try again later</WarningSubText>
</WarningText>
),
canClose: true,
canClose: false,
};
// IPFS ver is less than leastSafeVersion, but new version is available
case isIpfs && isVersionUnsafe && isUpdateAvailable:
return {
content: (
Expand All @@ -40,25 +44,26 @@ const warningContent = ({
),
canClose: false,
};
case isVersionUnsafe && !isUpdateAvailable:
// we can show this banner on both infra and IPFS
case isVersionUnsafe && (!isIpfs || !isUpdateAvailable):
return {
content: (
<WarningText>
The staking widget is currently down. Resolving is in progress
The Lido staking widget is currently down. A fix is in progress
</WarningText>
),
canClose: false,
showTwitterLink: true,
};
// outdated IPFS
case isIpfs && isUpdateAvailable:
return {
content: (
<WarningText>
This is not the most recent version of IPFS Widget
This is not the most up to date version of the IPFS widget
<br />
<WarningSubText>
Note that you may not find new features or functionality in this
version
Please note that the functionality of this version may be lacking
</WarningSubText>
</WarningText>
),
Expand Down Expand Up @@ -101,7 +106,7 @@ export const UpgradePromtBanner = () => {
rel="noopener noreferrer"
>
<Button size="sm" fullwidth variant="filled">
Follow X for more info
Check X for more info
</Button>
</a>
)}
Expand All @@ -112,7 +117,7 @@ export const UpgradePromtBanner = () => {
rel="noopener noreferrer"
>
<Button size="sm" fullwidth variant="filled">
Get to the actual version
Click to update to the newest version
</Button>
</a>
)}
Expand All @@ -124,7 +129,7 @@ export const UpgradePromtBanner = () => {
variant="outlined"
onClick={() => setConditionsAccepted(true)}
>
Accept possible issues and proceed
Accept the possible issues and proceed
</Button>
)}
</Wrapper>
Expand Down
6 changes: 4 additions & 2 deletions features/ipfs/update-promt-banner/use-version-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { STRATEGY_IMMUTABLE, STRATEGY_LAZY } from 'utils/swrStrategies';
import buildInfo from 'build-info.json';
import { useClientConfig } from 'providers/client-config';

export const NO_SAFE_VERSION = 'NONE_AVAILABLE';

type EnsHashCheckReturn = {
cid: string;
ens?: string;
Expand Down Expand Up @@ -118,12 +120,12 @@ export const useVersionCheck = () => {
remoteVersionSWR.data &&
currentCidSWR.data &&
remoteVersionSWR.data.cid !== currentCidSWR.data &&
remoteVersionSWR.data.leastSafeVersion !== 'none',
remoteVersionSWR.data.leastSafeVersion !== NO_SAFE_VERSION,
);

const isVersionUnsafe = Boolean(
remoteVersionSWR.data?.leastSafeVersion &&
(remoteVersionSWR.data.leastSafeVersion === 'none' ||
(remoteVersionSWR.data.leastSafeVersion === NO_SAFE_VERSION ||
isVersionLess(
buildInfo.version,
remoteVersionSWR.data.leastSafeVersion,
Expand Down

0 comments on commit 346ce39

Please sign in to comment.