Switch from ReactJSS to styled-components in ui-webapp

This commit is contained in:
Florian Scholdei
2019-10-09 16:17:02 +02:00
parent 01ef497d07
commit 004b6e5340
23 changed files with 544 additions and 675 deletions

View File

@@ -116,7 +116,6 @@ class Sources extends React.Component<Props, State> {
const {
repository,
baseUrl,
branches,
loading,
error,
revision,
@@ -124,8 +123,6 @@ class Sources extends React.Component<Props, State> {
currentFileIsDirectory
} = this.props;
const { selectedBranch } = this.state;
if (error) {
return <ErrorNotification error={error} />;
}
@@ -138,17 +135,7 @@ class Sources extends React.Component<Props, State> {
return (
<div className="panel">
{this.renderBranchSelector()}
<Breadcrumb
revision={encodeURIComponent(revision)}
path={path}
baseUrl={baseUrl}
branch={selectedBranch}
defaultBranch={
branches && branches.filter(b => b.defaultBranch === true)[0]
}
branches={branches && branches}
repository={repository}
/>
{this.renderBreadcrumb()}
<FileTree
repository={repository}
revision={revision}
@@ -183,6 +170,28 @@ class Sources extends React.Component<Props, State> {
}
return null;
};
renderBreadcrumb = () => {
const { revision, path, baseUrl, branches, repository } = this.props;
const { selectedBranch } = this.state;
if (revision) {
return (
<Breadcrumb
revision={encodeURIComponent(revision)}
path={path}
baseUrl={baseUrl}
branch={selectedBranch}
defaultBranch={
branches && branches.filter(b => b.defaultBranch === true)[0]
}
branches={branches && branches}
repository={repository}
/>
);
}
return null;
};
}
const mapStateToProps = (state, ownProps) => {