mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
remove contextPath on switching view to changesets
This commit is contained in:
@@ -17,9 +17,12 @@ type Props = {
|
|||||||
const CodeViewSwitcher: FC<Props> = ({ url }) => {
|
const CodeViewSwitcher: FC<Props> = ({ url }) => {
|
||||||
const [t] = useTranslation("repos");
|
const [t] = useTranslation("repos");
|
||||||
|
|
||||||
const createDestinationUrl = (destination: string) => {
|
const createDestinationUrl = (destination: string, removePath: boolean) => {
|
||||||
let splittedUrl = url.split("/");
|
let splittedUrl = url.split("/");
|
||||||
splittedUrl[5] = destination;
|
splittedUrl[5] = destination;
|
||||||
|
if (removePath) {
|
||||||
|
splittedUrl.splice(7, splittedUrl.length);
|
||||||
|
}
|
||||||
return splittedUrl.join("/");
|
return splittedUrl.join("/");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,13 +32,13 @@ const CodeViewSwitcher: FC<Props> = ({ url }) => {
|
|||||||
label={t("code.commits")}
|
label={t("code.commits")}
|
||||||
icon="fa fa-exchange-alt"
|
icon="fa fa-exchange-alt"
|
||||||
color={url.includes("/code/changesets") ? "link is-selected" : undefined}
|
color={url.includes("/code/changesets") ? "link is-selected" : undefined}
|
||||||
link={createDestinationUrl("changesets")}
|
link={createDestinationUrl("changesets", true)}
|
||||||
/>
|
/>
|
||||||
<SmallButton
|
<SmallButton
|
||||||
label={t("code.sources")}
|
label={t("code.sources")}
|
||||||
icon="fa fa-code"
|
icon="fa fa-code"
|
||||||
color={url.includes("/code/sources") ? "link is-selected" : undefined}
|
color={url.includes("/code/sources") ? "link is-selected" : undefined}
|
||||||
link={createDestinationUrl("sources")}
|
link={createDestinationUrl("sources", false)}
|
||||||
/>
|
/>
|
||||||
</ButtonAddons>
|
</ButtonAddons>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user