-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP DetailPage uber component #432
base: master
Are you sure you want to change the base?
Conversation
} | ||
return ( | ||
<PageContainer title={getTitle(resource!)}> | ||
<PageTabs tabs={tabs} basePath={basePath} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To proper display tabs on the page you need to place it to headerContent of PageContainer
<PageContainer
title={getTitle(resource!)}
layoutVariant="with-tabs"
headerContent={
<PageTabs tabs={tabs} basePath={basePath} />
}
>
|
||
interface DetailPageProps<R extends Resource> { | ||
resourceType: R['resourceType']; | ||
getSearchParams: (params: Readonly<Params<string>>) => SearchParams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Params should be more specific because you're hard-coded to id
below
const menuItems: RouteItem[] = tabs.map(({ label, path }) => ({
label,
path: `/${basePath}/${params.id}/${path}`,
});
I suggest using at least. Params & {id: string}
I think something like
getSearchParams: (params: Readonly<Params<string>>) => SearchParams; | ||
getTitle: (resource: R) => string | undefined; | ||
tabs: Array<Tab<R>>; | ||
basePath: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need basePath here? Maybe we can use relative paths in links? e.g. ../path
export interface Tab<R extends Resource> { | ||
label: string; | ||
path?: string; | ||
component: (resource: R) => JSX.Element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking about having uniform interface like in the ResourceListPage, when we pass {resource:R , bundle: Bundle} to the component. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also getTitle might have the similar interface ({resource,bundle}
) for some use-cases (e.g. when we load Patient and we need to display it's managing organization)
path: `/${basePath}/${params.id}/${path}`, | ||
})); | ||
|
||
const [currentPath, setCurrentPath] = useState(location?.pathname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should store currentPath in the state if we have location and we subscribed to it using useLocation. Just use location.pathname instead of currentPath
Improve error handling
…uestionnaireAction
No description provided.