mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
added global navigation
This commit is contained in:
@@ -1,9 +1,53 @@
|
|||||||
import React, { Component } from "react";
|
import React from "react";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
import { Route } from "react-router";
|
||||||
|
|
||||||
|
import { Page } from "../../components/layout";
|
||||||
|
import { Navigation, NavLink, Section } from "../../components/navigation";
|
||||||
|
import GlobalConfig from "./GlobalConfig";
|
||||||
|
import type { History } from "history";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
// context objects
|
||||||
|
t: string => string,
|
||||||
|
match: any,
|
||||||
|
history: History
|
||||||
|
};
|
||||||
|
|
||||||
|
class Config extends React.Component<Props> {
|
||||||
|
stripEndingSlash = (url: string) => {
|
||||||
|
if (url.endsWith("/")) {
|
||||||
|
return url.substring(0, url.length - 2);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
|
matchedUrl = () => {
|
||||||
|
return this.stripEndingSlash(this.props.match.url);
|
||||||
|
};
|
||||||
|
|
||||||
class Config extends Component {
|
|
||||||
render() {
|
render() {
|
||||||
return <div>Here, Config will be shown</div>;
|
const { t } = this.props;
|
||||||
|
|
||||||
|
const url = this.matchedUrl();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page title={t("config.title")}>
|
||||||
|
<div className="columns">
|
||||||
|
<div className="column is-three-quarters">
|
||||||
|
<Route path={url} exact component={() => <GlobalConfig />} />
|
||||||
|
</div>
|
||||||
|
<div className="column">
|
||||||
|
<Navigation>
|
||||||
|
<Section label={t("config.navigation-title")}>
|
||||||
|
<NavLink to={`${url}`} label={t("config.globalConfig-label")} />
|
||||||
|
</Section>
|
||||||
|
</Navigation>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Config;
|
export default translate("config")(Config);
|
||||||
|
|||||||
19
scm-ui/src/config/containers/GlobalConfig.js
Normal file
19
scm-ui/src/config/containers/GlobalConfig.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Page } from "../../components/layout";
|
||||||
|
import type { History } from "history";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
// context objects
|
||||||
|
t: string => string
|
||||||
|
};
|
||||||
|
|
||||||
|
class GlobalConfig extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { t } = this.props;
|
||||||
|
|
||||||
|
return <div>Here, global config will be shown</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translate("config")(GlobalConfig);
|
||||||
Reference in New Issue
Block a user