mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
always render breadcrumd
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { translate } from "react-i18next";
|
||||
import {Link} from "react-router-dom";
|
||||
import {translate} from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import {binder, ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
import type {Branch, Repository} from "@scm-manager/ui-types";
|
||||
import Icon from "./Icon";
|
||||
|
||||
type Props = {
|
||||
@@ -74,6 +74,11 @@ class Breadcrumb extends React.Component<Props> {
|
||||
t
|
||||
} = this.props;
|
||||
|
||||
let homeUrl = baseUrl + "/";
|
||||
if (revision) {
|
||||
homeUrl += encodeURIComponent(revision) + "/";
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="is-flex">
|
||||
@@ -83,7 +88,7 @@ class Breadcrumb extends React.Component<Props> {
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<Link to={baseUrl + "/" + revision + "/"}>
|
||||
<Link to={homeUrl}>
|
||||
<HomeIcon
|
||||
title={t("breadcrumb.home")}
|
||||
name="home"
|
||||
@@ -101,12 +106,13 @@ class Breadcrumb extends React.Component<Props> {
|
||||
props={{
|
||||
baseUrl,
|
||||
branch: branch ? branch : defaultBranch,
|
||||
revision: branches ? undefined : revision,
|
||||
path,
|
||||
isBranchUrl:
|
||||
branches &&
|
||||
branches.filter(
|
||||
isBranchUrl: branches
|
||||
? branches.filter(
|
||||
b => b.name.replace("/", "%2F") === revision
|
||||
).length > 0,
|
||||
).length > 0
|
||||
: true,
|
||||
repository
|
||||
}}
|
||||
renderAll={true}
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import {connect} from "react-redux";
|
||||
import {withRouter} from "react-router-dom";
|
||||
import type {Branch, Repository} from "@scm-manager/ui-types";
|
||||
import FileTree from "../components/FileTree";
|
||||
import {
|
||||
BranchSelector,
|
||||
Breadcrumb,
|
||||
ErrorNotification,
|
||||
Loading
|
||||
} from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import {BranchSelector, Breadcrumb, ErrorNotification, Loading} from "@scm-manager/ui-components";
|
||||
import {translate} from "react-i18next";
|
||||
import {
|
||||
fetchBranches,
|
||||
getBranches,
|
||||
getFetchBranchesFailure,
|
||||
isFetchBranchesPending
|
||||
} from "../../branches/modules/branches";
|
||||
import { compose } from "redux";
|
||||
import {compose} from "redux";
|
||||
import Content from "./Content";
|
||||
import { fetchSources, isDirectory } from "../modules/sources";
|
||||
import {fetchSources, isDirectory} from "../modules/sources";
|
||||
|
||||
type Props = {
|
||||
repository: Repository,
|
||||
@@ -175,10 +170,10 @@ class Sources extends React.Component<Props, State> {
|
||||
const { revision, path, baseUrl, branches, repository } = this.props;
|
||||
const { selectedBranch } = this.state;
|
||||
|
||||
if (revision) {
|
||||
//TODO refactor
|
||||
return (
|
||||
<Breadcrumb
|
||||
revision={encodeURIComponent(revision)}
|
||||
revision={revision}
|
||||
path={path}
|
||||
baseUrl={baseUrl}
|
||||
branch={selectedBranch}
|
||||
@@ -189,8 +184,6 @@ class Sources extends React.Component<Props, State> {
|
||||
repository={repository}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user