fix(repository): make it easier to switch branch while navigating+ encode URI components when needed for currentRef and path
@@ -1,5 +1,5 @@
{
- "_generatedAtUnix": 1664472419448,
+ "_generatedAtUnix": 1664483830459,
"_hashAlgorithm": "sha1",
"_version": 2,
"islands": {
@@ -22,7 +22,7 @@
"pathSourceMap": "./public/.islands/RepositoriesList.bundle.js.map"
},
"RepositoryCommitSummaryLine": {
- "hash": "6b3c7680e066bb0135550d7aca168fa82701d221",
+ "hash": "4817fda2bb3e3bc43c1875bb9ac7e4f8b89f67fd",
"pathSource": "./app/islands/RepositoryCommitSummaryLine.tsx",
"pathBundle": "./public/.islands/RepositoryCommitSummaryLine.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryCommitSummaryLine.bundle.js.map"
@@ -34,7 +34,7 @@
"pathSourceMap": "./public/.islands/RepositoryCreateForm.bundle.js.map"
},
"RepositoryFilesDiffsList": {
- "hash": "9024355eb96053fcceb30ed9d63c1ee44671524f",
+ "hash": "24537044296f9c6ed127e6dc1659578759e64d5b",
"pathSource": "./app/islands/RepositoryFilesDiffsList.tsx",
"pathBundle": "./public/.islands/RepositoryFilesDiffsList.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryFilesDiffsList.bundle.js.map"
@@ -46,7 +46,7 @@
"pathSourceMap": "./public/.islands/RepositoryInitialSetup.bundle.js.map"
},
"RepositoryTreeView": {
- "hash": "9204e3cad91f6499193336ccb68f57e325ea0017",
+ "hash": "b737555de6ad76fb1d21cca582ddec037a233ea8",
"pathSource": "./app/islands/RepositoryTreeView.tsx",
"pathBundle": "./public/.islands/RepositoryTreeView.bundle.js",
"pathSourceMap": "./public/.islands/RepositoryTreeView.bundle.js.map"
@@ -78,7 +78,7 @@
"pathSource": "./app/views/repository/RepositoryBrowserView.tsx"
},
"RepositoryCommitsLogView": {
- "hash": "9f39b602858be70a8901171204559b70642e859e",
+ "hash": "f94921e18beba0415945a360abd5898cd957fc55",
"pathSource": "./app/views/repository/RepositoryCommitsLogView.tsx"
},
"RepositoryCompareView": {
@@ -90,7 +90,7 @@
"pathSource": "./app/views/repository/RepositoryCreateView.tsx"
},
"RepositoryDetailsView": {
- "hash": "43bfe4e1c66a3f53b2d396146f5f11bf7a6d6405",
+ "hash": "1225328dd31fd20f66cc300505fc6b3bfbec2885",
"pathSource": "./app/views/repository/RepositoryDetailsView.tsx"
},
"RepositoryExploreView": {
@@ -102,7 +102,7 @@
"pathSource": "./app/views/repository/RepositoryPullRequestsView.tsx"
},
"RepositoryShowObjectView": {
- "hash": "6b3bfa5f7ab0fcde85f1516ddb9252955848a615",
+ "hash": "e8f70ae5db50994012de7c6e3bf3ba016554e978",
"pathSource": "./app/views/repository/RepositoryShowObjectView.tsx"
},
"UserDashboardView": {
@@ -32,8 +32,8 @@ const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
text: fileName,
href:
currentPath === "/"
- ? `/${orgSlug}/${repoSlug}/${currentRef}/tree/${fileName}`
- : `/${orgSlug}/${repoSlug}/${currentRef}/tree/${
+ ? `/${orgSlug}/${repoSlug}/${encodeURIComponent(currentRef)}/tree/${encodeURIComponent(fileName)}`
+ : `/${orgSlug}/${repoSlug}/${encodeURIComponent(currentRef)}/tree/${
currentPath.endsWith("/") || currentPath === ""
? currentPath
: `${currentPath}/`
@@ -54,7 +54,7 @@ const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
const prevPathLink =
prevPath === "/"
? `/${orgSlug}/${repoSlug}`
- : `/${orgSlug}/${repoSlug}/${currentRef}/tree/${
+ : `/${orgSlug}/${repoSlug}/${encodeURIComponent(currentRef)}/tree/${
prevPath.endsWith("/") ? prevPath : `${prevPath}/`
}`;
const shouldShowPrevPath = currentPath !== "/";
@@ -68,7 +68,7 @@ const RepositoryTreeView: ReactIsland<RepositoryTreeViewProps> = ({
justifyContent={"flex-end"}
style={{ marginTop: 8, width: "100%" }}
>
- <a href={`/${orgSlug}/${repoSlug}/commits`}>Commits History</a>
+ <a href={`/${orgSlug}/${repoSlug}/${encodeURIComponent(currentRef)}/commits`}>Commits History</a>
</Grid.Row>
<div>
<ul>
@@ -99,9 +99,10 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
themeScheme={commonProps.themeScheme}
>
<RepositoryCommitSummaryLine
+ commit={lastCommit}
+ currentRef={currentRef}
orgSlug={parentOrg.slug}
repoSlug={repo.slug}
- commit={lastCommit}
/>
</Card>
<Card
@@ -181,7 +182,13 @@ const RepositoryDetailsView: ReactView<RepositoryDetailsViewProps> = ({
branch.trim() != "" && (
<React.Fragment key={branch}>
<a
- href={`/${parentOrg.slug}/${repo.slug}/${encodeURIComponent(branch)}/tree/`}
+ href={`/${parentOrg.slug}/${
+ repo.slug
+ }/${encodeURIComponent(branch)}/tree/${
+ path != null && path.trim() !== "" && path !== "/"
+ ? path
+ : ""
+ }`}
>
{branch}
</a>
@@ -17,6 +17,7 @@ import RepositoryCommitSummaryLine from "../../islands/RepositoryCommitSummaryLi
import RepositoryFilesDiffsList from "../../islands/RepositoryFilesDiffsList";
export interface RepositoryShowObjectViewProps extends CommonProps {
+ currentRef: string;
gitObject: RepositoryObject;
gitObjectDiffs: RepositoryFileDiff[] | null;
parentOrg: Organization;
@@ -25,6 +26,7 @@ export interface RepositoryShowObjectViewProps extends CommonProps {
const RepositoryShowObjectView: ReactView<RepositoryShowObjectViewProps> = ({
commonProps,
+ currentRef,
gitObject,
gitObjectDiffs,
parentOrg,
@@ -50,9 +52,10 @@ const RepositoryShowObjectView: ReactView<RepositoryShowObjectViewProps> = ({
themeScheme={commonProps.themeScheme}
>
<RepositoryCommitSummaryLine
+ commit={gitObject}
+ currentRef={currentRef}
orgSlug={parentOrg.slug}
repoSlug={repo.slug}
- commit={gitObject}
/>
</Card>
{gitObject.body.trim() !== "" && (