mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
fix PageAction detection by using a static class property
This commit is contained in:
@@ -44,6 +44,11 @@ class Page extends React.Component<Props> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPageAction(node: any) {
|
||||||
|
return node.displayName === PageActions.displayName
|
||||||
|
|| (node.type && node.type.displayName === PageActions.displayName);
|
||||||
|
}
|
||||||
|
|
||||||
renderPageHeader() {
|
renderPageHeader() {
|
||||||
const { error, title, subtitle, children, classes } = this.props;
|
const { error, title, subtitle, children, classes } = this.props;
|
||||||
|
|
||||||
@@ -51,7 +56,7 @@ class Page extends React.Component<Props> {
|
|||||||
let pageActionsExists = false;
|
let pageActionsExists = false;
|
||||||
React.Children.forEach(children, child => {
|
React.Children.forEach(children, child => {
|
||||||
if (child && !error) {
|
if (child && !error) {
|
||||||
if (child.displayName === PageActions.displayName) {
|
if (this.isPageAction(child)) {
|
||||||
pageActions = (
|
pageActions = (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -97,7 +102,7 @@ class Page extends React.Component<Props> {
|
|||||||
let content = [];
|
let content = [];
|
||||||
React.Children.forEach(children, child => {
|
React.Children.forEach(children, child => {
|
||||||
if (child) {
|
if (child) {
|
||||||
if (child.displayName !== PageActions.displayName) {
|
if (!this.isPageAction(child)) {
|
||||||
content.push(child);
|
content.push(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default class PageActions extends React.Component<Props> {
|
export default class PageActions extends React.Component<Props> {
|
||||||
displayName: string = "PageActions";
|
static displayName = "PageActions";
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <>{this.renderContent()}</>;
|
return <>{this.renderContent()}</>;
|
||||||
|
|||||||
Reference in New Issue
Block a user