mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
add home icon to breadcrumb
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import type {Branch, Repository} from "@scm-manager/ui-types";
|
import { translate } from "react-i18next";
|
||||||
import injectSheet from "react-jss";
|
import injectSheet from "react-jss";
|
||||||
import {binder, ExtensionPoint} from "@scm-manager/ui-extensions";
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||||
|
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||||
|
import Icon from "./Icon";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repository: Repository,
|
repository: Repository,
|
||||||
@@ -14,7 +16,10 @@ type Props = {
|
|||||||
revision: string,
|
revision: string,
|
||||||
path: string,
|
path: string,
|
||||||
baseUrl: string,
|
baseUrl: string,
|
||||||
classes: any
|
|
||||||
|
// Context props
|
||||||
|
classes: any,
|
||||||
|
t: string => string
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
@@ -45,7 +50,7 @@ class Breadcrumb extends React.Component<Props> {
|
|||||||
if (paths.length - 1 === index) {
|
if (paths.length - 1 === index) {
|
||||||
return (
|
return (
|
||||||
<li className="is-active" key={index}>
|
<li className="is-active" key={index}>
|
||||||
<Link to={"#"} aria-current="page">
|
<Link to="#" aria-current="page">
|
||||||
{path}
|
{path}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@@ -59,19 +64,20 @@ class Breadcrumb extends React.Component<Props> {
|
|||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
return <li />;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
classes,
|
|
||||||
baseUrl,
|
baseUrl,
|
||||||
branch,
|
branch,
|
||||||
defaultBranch,
|
defaultBranch,
|
||||||
branches,
|
branches,
|
||||||
revision,
|
revision,
|
||||||
path,
|
path,
|
||||||
repository
|
repository,
|
||||||
|
classes,
|
||||||
|
t
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -84,7 +90,18 @@ class Breadcrumb extends React.Component<Props> {
|
|||||||
)}
|
)}
|
||||||
aria-label="breadcrumbs"
|
aria-label="breadcrumbs"
|
||||||
>
|
>
|
||||||
<ul>{this.renderPath()}</ul>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<Link to={baseUrl + "/" + revision + "/"}>
|
||||||
|
<Icon
|
||||||
|
title={t("breadcrumb.home")}
|
||||||
|
name="home"
|
||||||
|
color="inherit"
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
{this.renderPath()}
|
||||||
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{binder.hasExtension("repos.sources.actionbar") && (
|
{binder.hasExtension("repos.sources.actionbar") && (
|
||||||
<div className={classes.buttonGroup}>
|
<div className={classes.buttonGroup}>
|
||||||
@@ -112,4 +129,4 @@ class Breadcrumb extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default injectSheet(styles)(Breadcrumb);
|
export default translate("commons")(injectSheet(styles)(Breadcrumb));
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
"subtitle": "Ein unbekannter Fehler ist aufgetreten."
|
"subtitle": "Ein unbekannter Fehler ist aufgetreten."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"breadcrumb": {
|
||||||
|
"home": "Hauptseite"
|
||||||
|
},
|
||||||
"errorNotification": {
|
"errorNotification": {
|
||||||
"prefix": "Fehler",
|
"prefix": "Fehler",
|
||||||
"loginLink": "Erneute Anmeldung",
|
"loginLink": "Erneute Anmeldung",
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
"subtitle": "Unknown error occurred"
|
"subtitle": "Unknown error occurred"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"breadcrumb": {
|
||||||
|
"home": "Main page"
|
||||||
|
},
|
||||||
"errorNotification": {
|
"errorNotification": {
|
||||||
"prefix": "Error",
|
"prefix": "Error",
|
||||||
"loginLink": "You can login here again.",
|
"loginLink": "You can login here again.",
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
"subtitle": "Ha ocurrido un error desconocido"
|
"subtitle": "Ha ocurrido un error desconocido"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"breadcrumb": {
|
||||||
|
"home": "Página principal"
|
||||||
|
},
|
||||||
"errorNotification": {
|
"errorNotification": {
|
||||||
"prefix": "Error",
|
"prefix": "Error",
|
||||||
"loginLink": "Aquí puede iniciar la sesión de nuevo.",
|
"loginLink": "Aquí puede iniciar la sesión de nuevo.",
|
||||||
|
|||||||
Reference in New Issue
Block a user