Skip to content

Commit

Permalink
refactor(ui): polish HawtioPage
Browse files Browse the repository at this point in the history
  • Loading branch information
tadayosi committed Nov 9, 2023
1 parent f30eec0 commit 0f3f0c5
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions packages/hawtio/src/ui/page/HawtioPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ import { backgroundImages } from '@hawtiosrc/img'
import { PluginNodeSelectionContext, usePluginNodeSelected } from '@hawtiosrc/plugins'
import { HawtioPreferences } from '@hawtiosrc/preferences/HawtioPreferences'
import { preferencesService } from '@hawtiosrc/preferences/preferences-service'
import {
BackgroundImage,
EmptyState,
EmptyStateIcon,
EmptyStateVariant,
Page,
PageSection,
PageSectionVariants,
Title,
} from '@patternfly/react-core'
import { BackgroundImage, EmptyState, EmptyStateIcon, Page, PageSection, Title } from '@patternfly/react-core'
import { CubesIcon } from '@patternfly/react-icons'
import React from 'react'
import { Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-dom'
Expand Down Expand Up @@ -43,24 +34,8 @@ export const HawtioPage: React.FunctionComponent = () => {
navigate('login')
}

const HawtioHome = () => (
<PageSection variant={PageSectionVariants.light}>
<EmptyState variant={EmptyStateVariant.full}>
<EmptyStateIcon icon={CubesIcon} />
<Title headingLevel='h1' size='lg'>
Hawtio
</Title>
</EmptyState>
</PageSection>
)

const defaultPlugin = plugins[0] ?? null
let defaultPage
if (defaultPlugin) {
defaultPage = <Navigate to={{ pathname: defaultPlugin.path, search }} />
} else {
defaultPage = <HawtioHome />
}
const defaultPage = defaultPlugin ? <Navigate to={{ pathname: defaultPlugin.path, search }} /> : <HawtioHome />

const showVerticalNavByDefault = preferencesService.isShowVerticalNavByDefault()

Expand Down Expand Up @@ -92,3 +67,14 @@ export const HawtioPage: React.FunctionComponent = () => {
</PageContext.Provider>
)
}

const HawtioHome: React.FunctionComponent = () => (
<PageSection variant='light'>
<EmptyState variant='full'>
<EmptyStateIcon icon={CubesIcon} />
<Title headingLevel='h1' size='lg'>
Hawtio
</Title>
</EmptyState>
</PageSection>
)

0 comments on commit 0f3f0c5

Please sign in to comment.