Skip to content

Commit

Permalink
fix extension-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
yiningwang11 committed May 2, 2023
1 parent 8c19e96 commit 0696508
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion webui/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class MainComponent extends React.Component<MainComponent.Props, MainComponent.S
{ MainHeadTagsComponent ? <MainHeadTagsComponent pageSettings={this.props.pageSettings}/> : null }
<Switch>
<Route path={AdminDashboardRoutes.MAIN}>
<AdminDashboard userLoading={this.state.userLoading} />
<AdminDashboard userLoading={this.state.userLoading} themeType={this.props.pageSettings.themeType}/>
</Route>
<Route path='*'>
<Box className={classes.main}>
Expand Down
7 changes: 5 additions & 2 deletions webui/src/pages/admin-dashboard/admin-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export const AdminDashboard: FunctionComponent<AdminDashboard.Props> = props =>
const [currentPage, setCurrentPage] = useState<string | undefined>(useLocation().pathname);
const handleOpenRoute = (route: string) => setCurrentPage(route);

const themeType = props.themeType;

return <>
<CssBaseline />
<Box display='flex' height='100vh'>
Expand All @@ -71,7 +73,7 @@ export const AdminDashboard: FunctionComponent<AdminDashboard.Props> = props =>
<Container className={classes.container} maxWidth='lg'>
<Switch>
<Route path={AdminDashboardRoutes.NAMESPACE_ADMIN} component={NamespaceAdmin} />
<Route path={AdminDashboardRoutes.EXTENSION_ADMIN} component={ExtensionAdmin} />
<Route path={AdminDashboardRoutes.EXTENSION_ADMIN} render={(props) => <ExtensionAdmin themeType={themeType}/>} />
<Route path={AdminDashboardRoutes.PUBLISHER_ADMIN} component={PublisherAdmin} />
<Route path='*' component={Welcome} />
</Switch>
Expand All @@ -95,6 +97,7 @@ export const AdminDashboard: FunctionComponent<AdminDashboard.Props> = props =>

export namespace AdminDashboard {
export interface Props {
userLoading: boolean;
userLoading: boolean,
themeType: string | undefined
}
}
9 changes: 7 additions & 2 deletions webui/src/pages/admin-dashboard/extension-admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import { isError, Extension } from '../../extension-registry-types';
import { ExtensionVersionContainer } from './extension-version-container';
import { StyledInput } from './namespace-input';

export const ExtensionAdmin: FunctionComponent = props => {
interface ExtensionAdminProps {
themeType: string | undefined;
}

export const ExtensionAdmin: FunctionComponent<ExtensionAdminProps> = props => {
const abortController = new AbortController();
useEffect(() => {
return () => {
Expand Down Expand Up @@ -94,7 +98,8 @@ export const ExtensionAdmin: FunctionComponent = props => {
onSearchSubmit={findExtension}
placeholder='Extension'
hideIconButton={true}
autoFocus={false} />,
autoFocus={false}
themeType={props.themeType} />,
<Button key='btn' variant='contained' onClick={findExtension}>Search Extension</Button>,
error ? <Typography color='error'>{error}</Typography> : ''
]}
Expand Down

0 comments on commit 0696508

Please sign in to comment.