Skip to content

Commit 6b2e124

Browse files
committed
Merge branch 'frontend-add-relai-logo'
2 parents f962091 + 1551bea commit 6b2e124

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed
Lines changed: 1 addition & 0 deletions
Loading

frontends/web/src/components/aopp/vasp.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2021 Shift Crypto AG
2+
* Copyright 2021-2025 Shift Crypto AG
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,16 +20,17 @@ import BitcoinSuisseLogo from '@/assets/exchanges/logos/bitcoin_suisse.png';
2020
import BittrLogo from '@/assets/exchanges/logos/bittr.png';
2121
import BityLogo from '@/assets/exchanges/logos/bity.png';
2222
import PocketBitcoinLogo from '@/assets/exchanges/logos/pocketbitcoin.svg';
23+
import RelaiLogo from '@/assets/exchanges/logos/relai.svg';
2324

2425
type TVASPProps = {
25-
fallback?: JSX.Element;
26-
hostname: string;
27-
prominent?: boolean;
28-
withLogoText?: string;
26+
fallback?: JSX.Element;
27+
hostname: string;
28+
prominent?: boolean;
29+
withLogoText?: string;
2930
}
3031

3132
type TVASPMap = {
32-
[hostname: string]: string
33+
[hostname: string]: string;
3334
}
3435

3536
const VASPLogoMap: TVASPMap = {
@@ -39,6 +40,7 @@ const VASPLogoMap: TVASPMap = {
3940
'bity.com': BityLogo,
4041
'getbittr.com': BittrLogo,
4142
'pocketbitcoin.com': PocketBitcoinLogo,
43+
'relai.app': RelaiLogo,
4244
};
4345

4446
const VASPHostnameMap: TVASPMap = {
@@ -52,16 +54,21 @@ export const Vasp = ({
5254
prominent,
5355
withLogoText,
5456
}: TVASPProps) => {
55-
const hasLogo = hostname in VASPLogoMap;
56-
if (!hasLogo) {
57-
return fallback || (<p className={styles.hostname}>{hostname}</p>);
57+
const subdomainOfVasp = Object.keys(VASPLogoMap).find((vasp) => hostname.endsWith(vasp));
58+
const knownVasp = subdomainOfVasp || (hostname in VASPLogoMap && hostname);
59+
60+
if (!knownVasp) {
61+
return fallback || (
62+
<p className={styles.hostname}>{hostname}</p>
63+
);
5864
}
65+
5966
const logoClasses = prominent ? `${styles.logo} ${styles.prominent}` : styles.logo;
6067
return (
6168
<div>
62-
<img className={logoClasses} src={VASPLogoMap[hostname]} alt={hostname} />
69+
<img className={logoClasses} src={VASPLogoMap[knownVasp]} alt={knownVasp} />
6370
<p className={`${styles.hostname} ${styles.capitalized}`}>
64-
{hostname in VASPHostnameMap ? VASPHostnameMap[hostname] : hostname}
71+
{knownVasp in VASPHostnameMap ? VASPHostnameMap[knownVasp] : knownVasp}
6572
</p>
6673
{withLogoText ? (<p>{withLogoText}</p>) : null}
6774
</div>

0 commit comments

Comments
 (0)