Skip to content

Commit

Permalink
refactor(CE): fixed imports and routes
Browse files Browse the repository at this point in the history
  • Loading branch information
macintushar committed Dec 13, 2024
1 parent 6241e57 commit a9924c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
8 changes: 4 additions & 4 deletions ui/src/utils/getPageTitle.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { BRAND_NAME } from '@/enterprise/app-constants';
import mwTheme from '@/chakra.config';

const ROUTE_MAP = {
'/reports': 'Reports',
'/data-apps': 'Data Apps',
'/settings': 'Settings',
'/activate/syncs': 'Syncs',
'/setup/sources': 'Sources',
'/define/models': 'Models',
'/setup/destinations': 'Destinations',
};

const BRAND_NAME = mwTheme.brandName;

const getTitle = (pathname: string) => {
if (pathname === '/') {
return 'Reports | ' + BRAND_NAME;
return 'Dashboard | ' + BRAND_NAME;
}
const normalizedPath = pathname.replace(/\/+$/, '');
const matchingRoute = Object.keys(ROUTE_MAP).find((route) => normalizedPath.startsWith(route));
Expand Down
23 changes: 10 additions & 13 deletions ui/src/views/MainLayout/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { Outlet, useLocation } from 'react-router-dom';
import { useState, useEffect } from 'react';

import Loader from '@/components/Loader';
import { useUiConfig } from '@/utils/hooks';
import Sidebar from '@/views/Sidebar/Sidebar';
import useCustomToast from '@/hooks/useCustomToast';
import { CustomToastStatus } from '@/components/Toast';
import ServerError from '../ServerError';
import getTitle from '@/utils/getPageTitle';

import { Box } from '@chakra-ui/layout';
<<<<<<< HEAD
import { Outlet } from 'react-router-dom';
import Loader from '@/components/Loader';
import { useState, useEffect } from 'react';
import { useQuery } from '@tanstack/react-query';

import { getWorkspaces } from '@/services/settings';
import { useStore } from '@/stores';
import ServerError from '../ServerError';
import useCustomToast from '@/hooks/useCustomToast';
import { CustomToastStatus } from '@/components/Toast';
=======
import { Outlet, useLocation } from 'react-router-dom';
import Prefetcher from '@/enterprise/views/Prefetcher';
import { useEffect } from 'react';
import getTitle from '@/utils/getPageTitle';
>>>>>>> 8b3d98e0 (feat(CE): added title change based on route)

const MainLayout = (): JSX.Element => {
const [isLoading, setIsLoading] = useState(true);
Expand Down

0 comments on commit a9924c4

Please sign in to comment.