diff --git a/src/features/staking/components/validator-page.tsx b/src/features/staking/components/validator-page.tsx index 4410f80..86c54e0 100644 --- a/src/features/staking/components/validator-page.tsx +++ b/src/features/staking/components/validator-page.tsx @@ -33,6 +33,7 @@ import { formatVotingPowerPerc, formatXionToUSD, } from "../lib/formatters"; +import { parseWebsite } from "../lib/utils/misc"; import { DivisorHorizontal, DivisorVertical } from "./divisor"; import StakingModals from "./staking-modals"; import ValidatorDelegation from "./validator-delegation"; @@ -90,6 +91,8 @@ export default function ValidatorPage() { stakingRef.staking.state, ); + const validatorWebsite = parseWebsite(validatorDetails.description.website); + return ( <>
@@ -210,14 +213,11 @@ export default function ValidatorPage() {
- {validatorDetails.description.website && ( + {validatorWebsite && (
Website - - {validatorDetails.description.website} + + {validatorWebsite}
)} diff --git a/src/features/staking/lib/utils/misc.ts b/src/features/staking/lib/utils/misc.ts new file mode 100644 index 0000000..2c4f9c3 --- /dev/null +++ b/src/features/staking/lib/utils/misc.ts @@ -0,0 +1,17 @@ +const urlMapping: Record = { + // "https://www.stakelab.fr": "https://www.stakelab.zone", +}; + +export const parseWebsite = (website?: string) => { + if (!website?.trim()) return ""; + + const mappedUrl = urlMapping[website]; + + if (mappedUrl) return mappedUrl; + + if (!website.startsWith("https://")) { + return `https://${website}`; + } + + return website; +};