-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: remove shadow effect from StatCard component for improved visibility * feat: Add dapp remark * chore: Add rounded class to OrmpInfo container * feat: Remark fromDapp protocol name #55 --------- Co-authored-by: snoopy1412 <[email protected]>
- Loading branch information
1 parent
e83f124
commit 8f79657
Showing
10 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import Image from 'next/image'; | ||
import { capitalize } from 'lodash-es'; | ||
import { dappRemark } from '@/config/dapp_remark'; | ||
import { getDAppInfo } from '@/utils/dapp'; | ||
|
||
interface AddressDisplayFilterDappRemarkProps { | ||
address: string; | ||
formatAddress?: (address: string) => string; | ||
} | ||
const AddressDisplayFilterDappRemark = ({ | ||
address, | ||
formatAddress, | ||
children | ||
}: React.PropsWithChildren<AddressDisplayFilterDappRemarkProps>) => { | ||
const { dappLogo, dappName } = getDAppInfo(address); | ||
|
||
const { width, height } = dappName | ||
? dappRemark[dappName as keyof typeof dappRemark] | ||
: { width: 35, height: 20 }; | ||
const displayAddress = formatAddress ? formatAddress(address) : address; | ||
|
||
return dappName && dappLogo ? ( | ||
<span className="flex items-center gap-[0.31rem]"> | ||
<Image src={dappLogo} width={width} height={height} alt={`${capitalize(dappName)}`} /> | ||
<span>{capitalize(dappName)}</span> | ||
{children} | ||
</span> | ||
) : ( | ||
displayAddress | ||
); | ||
}; | ||
|
||
export default AddressDisplayFilterDappRemark; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const dappRemark = { | ||
helix: { | ||
width: 28, | ||
height: 16 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import dappConfig from '@/dappRemark/config.json'; | ||
|
||
export const getDAppInfo = ( | ||
address?: string | ||
): { | ||
dappName: string | null; | ||
dappLogo: string | null; | ||
} => { | ||
if (!address) return { dappName: null, dappLogo: null }; | ||
for (const [key, addresses] of Object.entries(dappConfig)) { | ||
if (addresses.includes(address)) { | ||
const dappName = key; | ||
const dappLogo = `/images/dapp_remark/${key}.svg`; | ||
return { dappName, dappLogo }; | ||
} | ||
} | ||
return { dappName: null, dappLogo: null }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters