expose baseurl in SourceExtensions for breadcrumb

This commit is contained in:
Eduard Heimbuch
2020-01-09 13:43:04 +01:00
parent 6f6e6f60d4
commit 28f1319935
3 changed files with 58 additions and 43 deletions

View File

@@ -26,6 +26,14 @@ type State = {
errorFromExtension?: Error;
};
const Header = styled.div`
border-bottom: solid 1px #dbdbdb;
font-size: 1.25em;
font-weight: 300;
line-height: 1.25;
padding: 0.5em 0.75em;
`;
const VCenteredChild = styled.div`
align-items: center;
`;
@@ -38,6 +46,10 @@ const RightMarginFileButtonAddons = styled(FileButtonAddons)`
margin-right: 0.5em;
`;
const BorderBottom = styled.div`
border-bottom: solid 1px #dbdbdb;
`;
const LighterGreyBackgroundPanelBlock = styled.div`
background-color: #fbfbfb;
`;
@@ -129,44 +141,47 @@ class Content extends React.Component<Props, State> {
})}
</p>
) : null;
const fileSize = file.directory ? "" : <FileSize bytes={file.length} />;
const fileSize = file.directory ? "" : <FileSize bytes={file?.length ? file.length : 0} />;
if (!collapsed) {
return (
<LighterGreyBackgroundPanelBlock className="panel-block">
<LighterGreyBackgroundTable className="table">
<tbody>
<tr>
<td>{t("sources.content.path")}</td>
<td className="is-word-break">{file.path}</td>
</tr>
<tr>
<td>{t("sources.content.branch")}</td>
<td className="is-word-break">{revision}</td>
</tr>
<tr>
<td>{t("sources.content.size")}</td>
<td>{fileSize}</td>
</tr>
<tr>
<td>{t("sources.content.commitDate")}</td>
<td>{date}</td>
</tr>
<tr>
<td>{t("sources.content.description")}</td>
<td className="is-word-break">{description}</td>
</tr>
<ExtensionPoint
name="repos.content.metadata"
renderAll={true}
props={{
file,
repository,
revision
}}
/>
</tbody>
</LighterGreyBackgroundTable>
</LighterGreyBackgroundPanelBlock>
<>
<LighterGreyBackgroundPanelBlock className="panel-block">
<LighterGreyBackgroundTable className="table">
<tbody>
<tr>
<td>{t("sources.content.path")}</td>
<td className="is-word-break">{file.path}</td>
</tr>
<tr>
<td>{t("sources.content.branch")}</td>
<td className="is-word-break">{revision}</td>
</tr>
<tr>
<td>{t("sources.content.size")}</td>
<td>{fileSize}</td>
</tr>
<tr>
<td>{t("sources.content.commitDate")}</td>
<td>{date}</td>
</tr>
<tr>
<td>{t("sources.content.description")}</td>
<td className="is-word-break">{description}</td>
</tr>
<ExtensionPoint
name="repos.content.metadata"
renderAll={true}
props={{
file,
repository,
revision
}}
/>
</tbody>
</LighterGreyBackgroundTable>
</LighterGreyBackgroundPanelBlock>
<BorderBottom />
</>
);
}
return null;
@@ -188,9 +203,9 @@ class Content extends React.Component<Props, State> {
return (
<div>
<div className="panel">
<div className="panel-heading">{header}</div>
{moreInformation}
{breadcrumb}
<Header>{header}</Header>
{moreInformation}
{content}
</div>
{errorFromExtension && <ErrorNotification error={errorFromExtension} />}