Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/containers/App/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ function renderRouteSlot(slots: SlotMap, route: RouteSlot) {
key={route.path}
path={route.path}
exact={route.exact}
render={() => {
render={(props) => {
const slot = slots.get(route.slot);
let content;
if (!slot) {
const Component = route.component;
content = <Component />;
content = <Component {...props} />;
} else if (typeof slot.rendered === 'function') {
content = slot.rendered({component: route.component});
content = slot.rendered({component: route.component, ...props});
} else {
content = slot.rendered;
}
Expand Down
26 changes: 19 additions & 7 deletions src/containers/App/appSlots.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createSlot} from '../../components/slots';

import type {RedirectProps} from 'react-router';
import type {RedirectProps, RouteComponentProps} from 'react-router';
import type Cluster from '../Cluster/Cluster';
import type {Clusters} from '../Clusters/Clusters';
import type Node from '../Node/Node';
Expand All @@ -9,22 +9,34 @@ import type TabletsFilters from '../TabletsFilters/TabletsFilters';
import type Tenant from '../Tenant/Tenant';

export const ClustersSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof Clusters}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof Clusters} & RouteComponentProps) => React.ReactNode);
}>('clusters');
export const ClusterSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof Cluster}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof Cluster} & RouteComponentProps) => React.ReactNode);
}>('cluster');
export const TenantSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof Tenant}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof Tenant} & RouteComponentProps) => React.ReactNode);
}>('tenant');
export const NodeSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof Node}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof Node} & RouteComponentProps) => React.ReactNode);
}>('node');
export const TabletSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof Tablet}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof Tablet} & RouteComponentProps) => React.ReactNode);
}>('tablet');
export const TabletsFiltersSlot = createSlot<{
children: React.ReactNode | ((props: {component: typeof TabletsFilters}) => React.ReactNode);
children:
| React.ReactNode
| ((props: {component: typeof TabletsFilters} & RouteComponentProps) => React.ReactNode);
}>('tabletsFilters');

export const RoutesSlot = createSlot('routes');
Expand Down