chore: usePageTitle hook to reduce imports

This commit is contained in:
Matthew Russell 2024-02-09 15:51:33 -08:00
parent 6d70b28f30
commit de62f09fda
No known key found for this signature in database
2 changed files with 4 additions and 20 deletions

View File

@ -1,5 +1,3 @@
import React, { useEffect } from 'react';
import { titlefy } from '@vegaprotocol/utils';
import {
LocalStoragePersistTabs as Tabs,
Tab,
@ -7,7 +5,6 @@ import {
} from '@vegaprotocol/ui-toolkit';
import { OpenMarkets } from './open-markets';
import { Proposed } from './proposed';
import { usePageTitleStore } from '../../stores';
import { Closed } from './closed';
import {
DApp,
@ -17,19 +14,14 @@ import {
import { useT } from '../../lib/use-t';
import { ErrorBoundary } from '../../components/error-boundary';
import { MarketsSettings } from './markets-settings';
import { usePageTitle } from '../../lib/hooks/use-page-title';
export const MarketsPage = () => {
const t = useT();
const { updateTitle } = usePageTitleStore((store) => ({
updateTitle: store.updateTitle,
}));
const governanceLink = useLinks(DApp.Governance);
const externalLink = governanceLink(TOKEN_NEW_MARKET_PROPOSAL);
useEffect(() => {
updateTitle(titlefy([t('Markets')]));
}, [updateTitle, t]);
usePageTitle(t('Markets'));
return (
<div className="h-full pt-0.5 pb-3 px-1.5">

View File

@ -1,10 +1,8 @@
import { useEffect } from 'react';
import type { ReactNode } from 'react';
import { LayoutPriority } from 'allotment';
import { titlefy } from '@vegaprotocol/utils';
import { useIncompleteWithdrawals } from '@vegaprotocol/withdraws';
import { Tab, LocalStoragePersistTabs as Tabs } from '@vegaprotocol/ui-toolkit';
import { usePageTitleStore } from '../../stores';
import {
AccountsContainer,
AccountsSettings,
@ -41,6 +39,7 @@ import { WithdrawalsMenu } from '../../components/withdrawals-menu';
import { useGetCurrentRouteId } from '../../lib/hooks/use-get-current-route-id';
import { useT } from '../../lib/use-t';
import { ErrorBoundary } from '../../components/error-boundary';
import { usePageTitle } from '../../lib/hooks/use-page-title';
const WithdrawalsIndicator = () => {
const { ready } = useIncompleteWithdrawals();
@ -69,14 +68,7 @@ const SidebarViewInitializer = () => {
export const Portfolio = () => {
const t = useT();
const { updateTitle } = usePageTitleStore((store) => ({
updateTitle: store.updateTitle,
}));
useEffect(() => {
updateTitle(titlefy([t('Portfolio')]));
}, [updateTitle, t]);
usePageTitle(t('Portfolio'));
const [sizes, handleOnLayoutChange] = usePaneLayout({ id: 'portfolio' });
const wrapperClasses = 'p-0.5 h-full max-h-full flex flex-col';