Skip to content

Commit

Permalink
fix: [lw-12231] resolve sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vetalcore committed Feb 11, 2025
1 parent 7123f89 commit 09183cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { StateStatus, useWalletStore } from '../../../../../stores';
import { Drawer, DrawerNavigation, useObservable } from '@lace/common';
import { ActivityDetail } from './ActivityDetail';
import { useTranslation } from 'react-i18next';
import { FundWalletBanner, EducationalList, SectionLayout, Layout } from '@src/views/browser-view/components';
import {
FundWalletBanner,
EducationalList,
SectionLayout,
Layout,
EducationalListRowProps
} from '@src/views/browser-view/components';
import { SectionTitle } from '@components/Layout/SectionTitle';
import Book from '@assets/icons/book.svg';
import LightBulb from '@assets/icons/light.svg';
Expand All @@ -17,28 +23,15 @@ import { useAnalyticsContext } from '@providers';
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
import { useWalletActivities } from '@hooks/useWalletActivities';
import { Flex } from '@input-output-hk/lace-ui-toolkit';
import { TFunction } from 'i18next';

export const ActivityLayout = (): ReactElement => {
const { t } = useTranslation();
const { priceResult } = useFetchCoinPrice();
const { inMemoryWallet, walletInfo, activityDetail, resetActivityState, blockchainProvider } = useWalletStore();
const analytics = useAnalyticsContext();
const sendAnalytics = useCallback(() => {
analytics.sendEventToPostHog(PostHogAction.ActivityActivityActivityRowClick);
}, [analytics]);
const { walletActivities, walletActivitiesStatus } = useWalletActivities({
sendAnalytics,
withLimitedRewardsHistory: true
});
const total = useObservable(inMemoryWallet.balance.utxo.total$);

export const getEducationalList = (t: TFunction): EducationalListRowProps[] => {
const titles = {
glossary: t('educationalBanners.title.glossary'),
faq: t('educationalBanners.title.faq'),
video: t('educationalBanners.title.video')
};

const educationalList = [
return [
{
title: titles.glossary,
subtitle: t('browserView.activity.learnAbout.whatAreActivityDetails'),
Expand All @@ -64,6 +57,23 @@ export const ActivityLayout = (): ReactElement => {
link: `${process.env.WEBSITE_URL}/learn?video=lace-introduces-transaction-bundles`
}
];
};

export const ActivityLayout = (): ReactElement => {
const { t } = useTranslation();
const { priceResult } = useFetchCoinPrice();
const { inMemoryWallet, walletInfo, activityDetail, resetActivityState, blockchainProvider } = useWalletStore();
const analytics = useAnalyticsContext();
const sendAnalytics = useCallback(() => {
analytics.sendEventToPostHog(PostHogAction.ActivityActivityActivityRowClick);
}, [analytics]);
const { walletActivities, walletActivitiesStatus } = useWalletActivities({
sendAnalytics,
withLimitedRewardsHistory: true
});
const total = useObservable(inMemoryWallet.balance.utxo.total$);

const educationalList = getEducationalList(t);

// Reset current transaction details and close drawer if network (blockchainProvider) has changed
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React, { ReactElement, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { EducationalList, SectionLayout, Layout } from '@src/views/browser-view/components';
import Book from '@assets/icons/book.svg';
import LightBulb from '@assets/icons/light.svg';
import Video from '@assets/icons/video.svg';
import { VotingCenterBanner } from './VotingCenterBanner';
import { useAnalyticsContext, useExternalLinkOpener } from '@providers';
import { config } from '@src/config';
import { useWalletStore } from '@src/stores';
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
import { getEducationalList } from '../../activity';

export const VotingLayout = (): ReactElement => {
const { t } = useTranslation();
Expand All @@ -18,38 +16,7 @@ export const VotingLayout = (): ReactElement => {
const { environmentName } = useWalletStore();
const { GOV_TOOLS_URLS } = config();

const titles = {
glossary: t('educationalBanners.title.glossary'),
faq: t('educationalBanners.title.faq'),
video: t('educationalBanners.title.video')
};

const educationalList = [
{
title: titles.glossary,
subtitle: t('browserView.activity.learnAbout.whatAreActivityDetails'),
src: Book,
link: `${process.env.WEBSITE_URL}/glossary?term=activity`
},
{
title: titles.glossary,
subtitle: t('browserView.activity.learnAbout.whatIsAnUnconfirmedTransaction'),
src: Book,
link: `${process.env.WEBSITE_URL}/glossary?term=unconfirmed-transaction`
},
{
title: titles.faq,
subtitle: t('browserView.activity.learnAbout.doesLaceHaveFees'),
src: LightBulb,
link: `${process.env.WEBSITE_URL}/faq?question=does-lace-have-fees`
},
{
title: titles.video,
subtitle: t('browserView.activity.learnAbout.transactionBundles'),
src: Video,
link: `${process.env.WEBSITE_URL}/learn?video=lace-introduces-transaction-bundles`
}
];
const educationalList = getEducationalList(t);

const openLink = useCallback(
async (url: string) => {
Expand Down

0 comments on commit 09183cb

Please sign in to comment.