-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update safe fee tooltip label (#5158)
- Loading branch information
Showing
7 changed files
with
31 additions
and
27 deletions.
There are no files selected for viewing
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
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
28 changes: 23 additions & 5 deletions
28
apps/cowswap-frontend/src/modules/volumeFee/hooks/useVolumeFeeTooltip.ts
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 |
---|---|---|
@@ -1,16 +1,34 @@ | ||
import { useAtomValue } from 'jotai' | ||
import { useMemo } from 'react' | ||
|
||
import { useInjectedWidgetParams } from 'modules/injectedWidget' | ||
|
||
import { useInjectedWidgetParams } from '../../injectedWidget' | ||
import { safeAppFeeAtom } from '../state/safeAppFeeAtom' | ||
|
||
const SAFE_FEE_TOOLTIP = | ||
const SAFE_FEE_TOOLTIP_CONTENT = | ||
'The Safe App License Fee incurred here is charged by the Safe Foundation for the display of the app within their Safe Store. The fee is automatically calculated in this quote. Part of the fees will contribute to the CoW DAO treasury that supports the CoW Community.' | ||
const SAFE_FEE_LABEL = 'Safe App License Fee' | ||
|
||
const SAFE_TOOLTIP = { | ||
content: SAFE_FEE_TOOLTIP_CONTENT, | ||
label: SAFE_FEE_LABEL, | ||
} | ||
|
||
export interface VolumeFeeTooltip { | ||
content: string | undefined | ||
label: string | ||
} | ||
|
||
export function useVolumeFeeTooltip() { | ||
export function useVolumeFeeTooltip(): VolumeFeeTooltip { | ||
const safeAppFee = useAtomValue(safeAppFeeAtom) | ||
const widgetParams = useInjectedWidgetParams() | ||
|
||
if (safeAppFee) return SAFE_FEE_TOOLTIP | ||
return useMemo(() => { | ||
if (safeAppFee) return SAFE_TOOLTIP | ||
|
||
return widgetParams.content?.feeTooltipMarkdown | ||
return { | ||
content: widgetParams.content?.feeTooltipMarkdown, | ||
label: widgetParams.content?.feeLabel || 'Total fee', | ||
} | ||
}, [safeAppFee, widgetParams]) | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { useVolumeFee } from './hooks/useVolumeFee' | ||
export { useVolumeFeeTooltip } from './hooks/useVolumeFeeTooltip' | ||
export type { VolumeFeeTooltip } from './hooks/useVolumeFeeTooltip' | ||
export { volumeFeeAtom } from './state/volumeFeeAtom' | ||
export * from './types' |