-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Zapping; #1550
Open
admsk2
wants to merge
35
commits into
develop
Choose a base branch
from
LF-11022
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Zapping; #1550
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ef17bd0
feat: Zapping;
admsk2 530f571
fix: Build fix;
admsk2 6142f1d
fix: Build fix;
admsk2 30519e4
chore: Cleanup;
admsk2 83807fb
fix: temp fix https://github.com/wevm/wagmi/issues/4429
oktapodia 9d9f06a
Merge branch 'LF-11022' of github.com:jumperexchange/jumper-exchange …
oktapodia 9eb2e90
fix: Contract calls;
admsk2 2f3cbd8
chore: wip zap page
dennyscode 3b63532
style: adjust colors
dennyscode 0d52459
chore: add margin + refactor
dennyscode 1b2aeda
chore: use default theme
dennyscode 90c86b8
fix: metadata
dennyscode 9efaa13
Merge branch 'develop' into LF-11136-jumper-create-react-components-t…
dennyscode fbb92c2
chore: Update zaps widget;
admsk2 8d931de
refactor: revive dedicated useWidgetConfig hook
dennyscode 6f59270
fix: fallback for null translation
dennyscode 89c3e16
refactor: use switch statement
dennyscode b161300
fix: error handling
dennyscode 5d355cc
refactor: types + error handling
dennyscode 960f625
chore: adjust metadata
dennyscode 6385668
Merge branch 'develop' into LF-11136-jumper-create-react-components-t…
dennyscode e86991f
feat: Analytics data for vault;
admsk2 32d0824
chore: Get zap position;
admsk2 cfff1c5
Merge branch 'develop' into LF-11136-jumper-create-react-components-t…
dennyscode 31f9e3a
fix: Build;
admsk2 690b891
Merge remote-tracking branch 'origin/LF-11136-jumper-create-react-com…
tcheee fc1be01
fix: Zap payload;
admsk2 e0e7192
fix: fiix build
tcheee 780439c
feat: integrate custom widget in the zap page
tcheee 995ee5e
automatic push
tcheee 5084637
automatic push
tcheee ec40927
fix: fix build
tcheee 83ef040
fix: fix build
tcheee 4aa743e
fix: Route token;
admsk2 495fb60
chore: Ionic project data;
admsk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,20 @@ | ||
import type { Metadata } from 'next'; | ||
import type { PropsWithChildren } from 'react'; | ||
import { Layout } from 'src/Layout'; | ||
import { WalletProviderZap } from 'src/providers/WalletProvider/ZapWalletProvider'; | ||
|
||
export const metadata: Metadata = { | ||
other: { | ||
'partner-theme': 'default', | ||
}, | ||
}; | ||
|
||
export default async function MainLayout({ children }: PropsWithChildren) { | ||
return ( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary fragments |
||
<WalletProviderZap> | ||
<Layout>{children}</Layout> | ||
</WalletProviderZap> | ||
</> | ||
); | ||
} |
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,23 @@ | ||
import type { Metadata } from 'next'; | ||
import CustomWidgetPage from '@/app/ui/custom-widget/CustomWidgetPage'; | ||
import { getSiteUrl } from '@/const/urls'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Jumper Custom Widget', | ||
description: | ||
'Jumper Custom Widget is the custom widget page of Jumper Exchange.', | ||
alternates: { | ||
canonical: `${getSiteUrl()}/custom-widget`, | ||
}, | ||
}; | ||
|
||
export default async function Page() { | ||
// hardcoded for now | ||
const projectData = { | ||
chain: 'ethereum', | ||
project: 'mellow', | ||
address: '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', | ||
}; | ||
|
||
return <CustomWidgetPage projectData={projectData} />; | ||
} |
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,22 +1,63 @@ | ||
// todo: adjust metadata for quests-page | ||
// export const metadata: Metadata = { | ||
// title: 'Jumper | Quests', | ||
// description: 'Dive into the Quests', | ||
// alternates: { | ||
// canonical: `${process.env.NEXT_PUBLIC_SITE_URL}/quests/`, | ||
// }, | ||
// }; | ||
|
||
import type { Metadata } from 'next'; | ||
import { notFound } from 'next/navigation'; | ||
import { siteName } from 'src/app/lib/metadata'; | ||
import { getSiteUrl } from 'src/const/urls'; | ||
import type { QuestAttributes } from 'src/types/loyaltyPass'; | ||
import { sliceStrToXChar } from 'src/utils/splitStringToXChar'; | ||
import { getQuestBySlug } from '../../../lib/getQuestBySlug'; | ||
import QuestPage from '../../../ui/quests/QuestMissionPage'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { slug: string }; | ||
}): Promise<Metadata> { | ||
try { | ||
const quest = await getQuestBySlug(params.slug); | ||
|
||
if (!quest || !quest.data) { | ||
throw new Error(); | ||
} | ||
|
||
const questData = quest.data.attributes as QuestAttributes; | ||
|
||
const openGraph: Metadata['openGraph'] = { | ||
title: `Jumper Quest | ${sliceStrToXChar(questData.Title, 45)}`, | ||
description: `${sliceStrToXChar(questData.Information || 'Quest description', 60)}`, | ||
siteName: siteName, | ||
url: `${getSiteUrl()}/quests/${params.slug}`, | ||
images: [ | ||
{ | ||
url: `${quest.url}${questData.Image.data.attributes?.url}`, | ||
width: 900, | ||
height: 450, | ||
alt: 'banner image', | ||
}, | ||
], | ||
type: 'article', | ||
}; | ||
|
||
return { | ||
title: `Jumper Quest | ${sliceStrToXChar(questData.Title, 45)}`, | ||
description: questData.Subtitle, | ||
alternates: { | ||
canonical: `${getSiteUrl()}/quests/${params.slug}`, | ||
}, | ||
twitter: openGraph, | ||
openGraph, | ||
}; | ||
} catch (err) { | ||
return { | ||
title: `Jumper Quest | ${sliceStrToXChar(params.slug.replaceAll('-', ' '), 45)}`, | ||
description: `This is the description for the quest "${params.slug.replaceAll('-', ' ')}".`, | ||
}; | ||
} | ||
} | ||
|
||
export default async function Page({ params }: { params: { slug: string } }) { | ||
const { data, url } = await getQuestBySlug(params.slug); | ||
|
||
if (!data?.data?.[0]) { | ||
if (!data) { | ||
return notFound(); | ||
} | ||
|
||
return <QuestPage quest={data?.data?.[0]} url={url} />; | ||
return <QuestPage quest={data} url={url} />; | ||
} |
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,75 @@ | ||
import { type Metadata } from 'next'; | ||
import { notFound } from 'next/navigation'; | ||
import { getQuestBySlug } from 'src/app/lib/getQuestBySlug'; | ||
import { siteName } from 'src/app/lib/metadata'; | ||
import ZapPage from 'src/app/ui/zap/ZapPage'; | ||
import { zapMarkets } from 'src/components/Zap/zapExampleData'; | ||
import { getSiteUrl } from 'src/const/urls'; | ||
import type { QuestAttributes } from 'src/types/loyaltyPass'; | ||
import { sliceStrToXChar } from 'src/utils/splitStringToXChar'; | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { slug: string }; | ||
}): Promise<Metadata> { | ||
try { | ||
const quest = await getQuestBySlug(params.slug); | ||
|
||
if (!quest || !quest.data) { | ||
throw new Error(); | ||
} | ||
|
||
const questData = quest.data.attributes as QuestAttributes; | ||
|
||
const openGraph: Metadata['openGraph'] = { | ||
title: `Jumper | Zaps - ${sliceStrToXChar(questData.Title, 45)}`, | ||
description: `${sliceStrToXChar(questData.Information || 'Zap description', 60)}`, | ||
siteName: siteName, | ||
url: `${getSiteUrl()}/zap/${params.slug}`, | ||
images: [ | ||
{ | ||
url: `${quest.url}${questData.Image.data.attributes?.url}`, | ||
width: 900, | ||
height: 450, | ||
alt: 'banner image', | ||
}, | ||
], | ||
type: 'article', | ||
}; | ||
|
||
return { | ||
title: `Jumper | Zaps - ${sliceStrToXChar(questData.Title, 45)}`, | ||
description: questData.Subtitle, | ||
alternates: { | ||
canonical: `${getSiteUrl()}/zap/${params.slug}`, | ||
}, | ||
twitter: openGraph, | ||
openGraph, | ||
}; | ||
} catch (err) { | ||
return { | ||
title: `Jumper | Zaps - ${sliceStrToXChar(params.slug.replaceAll('-', ' '), 45)}`, | ||
description: 'Use Jumper to zap into DeFi protocols', | ||
}; | ||
} | ||
} | ||
|
||
export default async function Page({ params }: { params: { slug: string } }) { | ||
const { data } = await getQuestBySlug(params.slug, 'ExtendedQuest'); | ||
|
||
if (!data) { | ||
return notFound(); | ||
} | ||
|
||
const questData = data; | ||
|
||
if (questData) { | ||
const protocolDetails = zapMarkets.filter( | ||
(market) => market.slug === questData.attributes.Slug, | ||
); | ||
questData.protocolInfos = protocolDetails[0]; | ||
} | ||
|
||
return <ZapPage market={questData} />; | ||
} |
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 type { Metadata } from 'next'; | ||
import type { PropsWithChildren } from 'react'; | ||
import { Layout } from 'src/Layout'; | ||
import { WalletProviderZap } from 'src/providers/WalletProvider/ZapWalletProvider'; | ||
|
||
export const metadata: Metadata = { | ||
other: { | ||
'partner-theme': 'default', | ||
}, | ||
}; | ||
|
||
export default async function MainLayout({ children }: PropsWithChildren) { | ||
return ( | ||
<WalletProviderZap> | ||
<Layout>{children}</Layout> | ||
</WalletProviderZap> | ||
); | ||
} |
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,18 @@ | ||
'use client'; | ||
import { | ||
CustomWidget as CustomWidgetComponent, | ||
ProjectData, | ||
} from '@/components/CustomWidget/CustomWidget'; | ||
import { useAccount } from '@lifi/wallet-management'; | ||
|
||
interface CustomWidgetPageProps { | ||
projectData: ProjectData; | ||
} | ||
|
||
const CustomWidgetPage = ({ projectData }: CustomWidgetPageProps) => { | ||
const { account } = useAccount(); | ||
|
||
return <CustomWidgetComponent account={account} projectData={projectData} />; | ||
}; | ||
|
||
export default CustomWidgetPage; |
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 @@ | ||
'use client'; | ||
import { ZapAction } from 'src/components/Zap/ZapAction/ZapAction'; | ||
import type { ExtendedQuest } from 'src/types/questDetails'; | ||
|
||
interface ZapPageProps { | ||
market?: ExtendedQuest; | ||
} | ||
|
||
const ZapPage = ({ market }: ZapPageProps) => { | ||
return ( | ||
<ZapAction | ||
market={market} | ||
detailInformation={market?.attributes.CustomInformation} | ||
/> | ||
); | ||
}; | ||
|
||
export default ZapPage; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the component and file could be more consistent 😅