1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Special case goBack to navigate to catalog if no where to go back to (#4544)

This commit is contained in:
Sebastian Malton 2021-12-10 09:07:07 -05:00 committed by GitHub
parent 6284bd1eb4
commit 747ef8daee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ import { observer } from "mobx-react";
import { cssNames, IClassName } from "../../utils"; import { cssNames, IClassName } from "../../utils";
import { navigation } from "../../navigation"; import { navigation } from "../../navigation";
import { Icon } from "../icon"; import { Icon } from "../icon";
import { catalogURL } from "../../../common/routes";
export interface SettingLayoutProps extends React.DOMAttributes<any> { export interface SettingLayoutProps extends React.DOMAttributes<any> {
className?: IClassName; className?: IClassName;
@ -39,7 +40,13 @@ export interface SettingLayoutProps extends React.DOMAttributes<any> {
const defaultProps: Partial<SettingLayoutProps> = { const defaultProps: Partial<SettingLayoutProps> = {
provideBackButtonNavigation: true, provideBackButtonNavigation: true,
contentGaps: true, contentGaps: true,
back: () => navigation.goBack(), back: () => {
if (navigation.length <= 1) {
navigation.push(catalogURL());
} else {
navigation.goBack();
}
},
}; };
/** /**