mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-08 23:17:42 +02:00
add anonymous mode for webclient / change footer and redirects if user is anonymous / add login button if user is anonymous
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@scm-manager/ui-extensions": "^2.1.0",
|
||||
"@scm-manager/ui-types": "^2.3.0",
|
||||
"@scm-manager/ui-types": "^2.4.0-SNAPSHOT",
|
||||
"classnames": "^2.2.6",
|
||||
"date-fns": "^2.4.1",
|
||||
"gitdiff-parser": "^0.1.2",
|
||||
|
||||
@@ -89,14 +89,24 @@ const Footer: FC<Props> = ({ me, version, links }) => {
|
||||
meSectionTile = <TitleWithIcon title={me.displayName} icon="user-circle" />;
|
||||
}
|
||||
|
||||
let meSectionBody = <div />;
|
||||
{
|
||||
if (me.name !== "_anonymous")
|
||||
meSectionBody = (
|
||||
<>
|
||||
<NavLink to="/me/settings/password" label={t("profile.changePasswordNavLink")} />
|
||||
<ExtensionPoint name="profile.setting" props={extensionProps} renderAll={true} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className="footer">
|
||||
<section className="section container">
|
||||
<div className="columns is-size-7">
|
||||
<FooterSection title={meSectionTile}>
|
||||
<NavLink to="/me" label={t("footer.user.profile")} />
|
||||
<NavLink to="/me/settings/password" label={t("profile.changePasswordNavLink")} />
|
||||
<ExtensionPoint name="profile.setting" props={extensionProps} renderAll={true} />
|
||||
{meSectionBody}
|
||||
</FooterSection>
|
||||
<FooterSection title={<TitleWithIcon title={t("footer.information.title")} icon="info-circle" />}>
|
||||
<ExternalNavLink to="https://www.scm-manager.org/" label={`SCM-Manager ${version}`} />
|
||||
|
||||
@@ -63,6 +63,23 @@ class PrimaryNavigation extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
appendLogin = (navigationItems: ReactNode[], append: Appender) => {
|
||||
const { t, links } = this.props;
|
||||
|
||||
const props = {
|
||||
links,
|
||||
label: t("primary-navigation.login")
|
||||
};
|
||||
|
||||
if (binder.hasExtension("primary-navigation.login", props)) {
|
||||
navigationItems.push(
|
||||
<ExtensionPoint key="primary-navigation.login" name="primary-navigation.login" props={props} />
|
||||
);
|
||||
} else {
|
||||
append("/login", "/login", "primary-navigation.login", "login");
|
||||
}
|
||||
};
|
||||
|
||||
createNavigationItems = () => {
|
||||
const navigationItems: ReactNode[] = [];
|
||||
const { t, links } = this.props;
|
||||
@@ -95,6 +112,7 @@ class PrimaryNavigation extends React.Component<Props> {
|
||||
);
|
||||
|
||||
this.appendLogout(navigationItems, append);
|
||||
this.appendLogin(navigationItems, append);
|
||||
|
||||
return navigationItems;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user