Skip to content

Commit

Permalink
fix: improve powered by with dynamic configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Dec 12, 2024
1 parent 1b4df34 commit 5788cbc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/widget/src/components/PoweredBy/PoweredBy.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import { Box, Tooltip, Typography } from '@mui/material'
import { version } from '../../config/version.js'
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
import { Link } from './PoweredBy.style.js'

const poweredByConfig = {
default: {
url: 'https://li.fi',
text: 'LI.FI',
},
jumper: {
url: 'https://jumper.exchange',
text: 'Jumper',
},
}

export const PoweredBy: React.FC = () => {
const { poweredBy = 'default' } = useWidgetConfig()

return (
<Box
pt={1}
Expand All @@ -16,7 +30,7 @@ export const PoweredBy: React.FC = () => {
>
<Tooltip title={`v${version}`} enterDelay={1000}>
<Link
href="https://li.fi"
href={poweredByConfig[poweredBy].url}
target="_blank"
underline="none"
color="text.primary"
Expand All @@ -30,7 +44,7 @@ export const PoweredBy: React.FC = () => {
Powered by
</Typography>
<Typography color="text.primary" fontSize={12} fontWeight={600}>
LI.FI
{poweredByConfig[poweredBy].text}
</Typography>
</Link>
</Tooltip>
Expand Down
3 changes: 3 additions & 0 deletions packages/widget/src/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ export type WidgetLanguages = {
default?: LanguageKey
} & AllowDeny<LanguageKey>

export type PoweredByType = 'default' | 'jumper'

export interface WidgetConfig {
fromChain?: number
toChain?: number
Expand Down Expand Up @@ -239,6 +241,7 @@ export interface WidgetConfig {
languageResources?: LanguageResources
explorerUrls?: Record<number, string[]> &
Partial<Record<'internal', string[]>>
poweredBy?: PoweredByType
}

export interface FormFieldOptions {
Expand Down

0 comments on commit 5788cbc

Please sign in to comment.