Skip to content

Commit

Permalink
Develop Release
Browse files Browse the repository at this point in the history
  • Loading branch information
tcheee authored Dec 5, 2024
2 parents 733b92b + c46d87f commit 83d0a89
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 39 deletions.
5 changes: 5 additions & 0 deletions src/app/[lng]/quests/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@

import { getQuestBySlug } from '../../../lib/getQuestBySlug';
import QuestPage from '../../../ui/quests/QuestMissionPage';
import { notFound } from 'next/navigation';

export default async function Page({ params }: { params: { slug: string } }) {
const { data, url } = await getQuestBySlug(params.slug);

if (!data?.data?.[0]) {
return notFound();
}

return <QuestPage quest={data?.data?.[0]} url={url} />;
}
5 changes: 5 additions & 0 deletions src/app/[lng]/superfest/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getQuestBySlug } from 'src/app/lib/getQuestBySlug';
import SuperfestPage from 'src/app/ui/superfest/SuperfestMissionPage';
import { notFound } from 'next/navigation';

// export async function generateMetadata({
// params,
Expand Down Expand Up @@ -44,5 +45,9 @@ import SuperfestPage from 'src/app/ui/superfest/SuperfestMissionPage';
export default async function Page({ params }: { params: { slug: string } }) {
const { data, url } = await getQuestBySlug(params.slug);

if (!data?.data?.[0]) {
return notFound();
}

return <SuperfestPage quest={data?.data?.[0]} url={url} />;
}
78 changes: 39 additions & 39 deletions src/components/Widgets/WidgetEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,46 +281,46 @@ export function WidgetEvents() {
}
};

const onTokenSearch = async ({ value, tokens }: TokenSearchProps) => {
const lowercaseValue = value?.toLowerCase();
const { isValid, addressType } = isValidEvmOrSvmAddress(lowercaseValue);
const SearchNothingFound = tokens?.length > 0 ? false : true;
const tokenAddress = tokens?.length > 0 ? tokens?.[0]?.address : '';
const tokenName = tokens?.length > 0 ? tokens?.[0]?.name : '';
const tokenSymbol = tokens?.length > 0 ? tokens?.[0]?.symbol : '';
const tokenChainId = tokens?.length > 0 ? tokens?.[0]?.chainId : '';
// const onTokenSearch = async ({ value, tokens }: TokenSearchProps) => {
// const lowercaseValue = value?.toLowerCase();
// const { isValid, addressType } = isValidEvmOrSvmAddress(lowercaseValue);
// const SearchNothingFound = tokens?.length > 0 ? false : true;
// const tokenAddress = tokens?.length > 0 ? tokens?.[0]?.address : '';
// const tokenName = tokens?.length > 0 ? tokens?.[0]?.name : '';
// const tokenSymbol = tokens?.length > 0 ? tokens?.[0]?.symbol : '';
// const tokenChainId = tokens?.length > 0 ? tokens?.[0]?.chainId : '';

trackEvent({
category: TrackingCategory.WidgetEvent,
action: TrackingAction.OnTokenSearch,
label: `token_search`,
data: {
[TrackingEventParameter.SearchValue]: lowercaseValue,
[TrackingEventParameter.SearchIsAddress]: isValid,
[TrackingEventParameter.SearchAddressType]: addressType as string,
[TrackingEventParameter.SearchNumberOfResult]: tokens?.length,
[TrackingEventParameter.SearchNothingFound]: SearchNothingFound,
[TrackingEventParameter.SearchFirstResultAddress]: tokenAddress,
[TrackingEventParameter.SearchFirstResultName]: tokenName,
[TrackingEventParameter.SearchFirstResultSymbol]: tokenSymbol,
[TrackingEventParameter.SearchFirstResultChainId]: tokenChainId,
},
});
};
// trackEvent({
// category: TrackingCategory.WidgetEvent,
// action: TrackingAction.OnTokenSearch,
// label: `token_search`,
// data: {
// [TrackingEventParameter.SearchValue]: lowercaseValue,
// [TrackingEventParameter.SearchIsAddress]: isValid,
// [TrackingEventParameter.SearchAddressType]: addressType as string,
// [TrackingEventParameter.SearchNumberOfResult]: tokens?.length,
// [TrackingEventParameter.SearchNothingFound]: SearchNothingFound,
// [TrackingEventParameter.SearchFirstResultAddress]: tokenAddress,
// [TrackingEventParameter.SearchFirstResultName]: tokenName,
// [TrackingEventParameter.SearchFirstResultSymbol]: tokenSymbol,
// [TrackingEventParameter.SearchFirstResultChainId]: tokenChainId,
// },
// });
// };

const onRouteSelected = async ({ route, routes }: RouteSelectedProps) => {
const position = routes.findIndex((elem: Route) => elem.id === route.id);
const data = handleRouteEventDetails(route, {
[TrackingEventParameter.RoutePosition]: position,
});
// const onRouteSelected = async ({ route, routes }: RouteSelectedProps) => {
// const position = routes.findIndex((elem: Route) => elem.id === route.id);
// const data = handleRouteEventDetails(route, {
// [TrackingEventParameter.RoutePosition]: position,
// });

trackEvent({
category: TrackingCategory.WidgetEvent,
action: TrackingAction.OnRouteSelected,
label: `route_selected`,
data,
});
};
// trackEvent({
// category: TrackingCategory.WidgetEvent,
// action: TrackingAction.OnRouteSelected,
// label: `route_selected`,
// data,
// });
// };

widgetEvents.on(WidgetEvent.RouteExecutionStarted, onRouteExecutionStarted);
widgetEvents.on(WidgetEvent.RouteExecutionUpdated, onRouteExecutionUpdated);
Expand All @@ -344,8 +344,8 @@ export function WidgetEvents() {
WidgetEvent.DestinationChainTokenSelected,
onDestinationChainTokenSelection,
);
widgetEvents.on(WidgetEvent.RouteSelected, onRouteSelected);
widgetEvents.on(WidgetEvent.TokenSearch, onTokenSearch);
// widgetEvents.on(WidgetEvent.RouteSelected, onRouteSelected);
// widgetEvents.on(WidgetEvent.TokenSearch, onTokenSearch);

// widgetEvents.on(WidgetEvent.WidgetExpanded, onWidgetExpanded);

Expand Down

0 comments on commit 83d0a89

Please sign in to comment.