mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Remove source browsing header from commit view
For a single commit view the source browsing header (peer selector, branch selector, commits, contributor count) does not contain meaningful information. We remove the header and simply show the commit. See #938. Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Commit, BaseUrl, Remote, Project } from "@httpd-client";
|
||||
import type { LoadedSourceBrowsingView } from "@app/views/projects/router";
|
||||
import type { Commit, BaseUrl, Project } from "@httpd-client";
|
||||
|
||||
import { formatCommit } from "@app/lib/utils";
|
||||
|
||||
@@ -8,24 +7,17 @@
|
||||
import Clipboard from "@app/components/Clipboard.svelte";
|
||||
import CommitAuthorship from "@app/views/projects/Commit/CommitAuthorship.svelte";
|
||||
import InlineMarkdown from "@app/components/InlineMarkdown.svelte";
|
||||
import SourceBrowsingHeader from "./SourceBrowsingHeader.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
export let branches: Record<string, string> | undefined;
|
||||
export let commit: Commit;
|
||||
export let commitCount: number;
|
||||
export let contributorCount: number;
|
||||
export let peer: string | undefined = undefined;
|
||||
export let peers: Remote[];
|
||||
export let project: Project;
|
||||
export let view: LoadedSourceBrowsingView;
|
||||
|
||||
const { commit: header } = commit;
|
||||
$: header = commit.commit;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.commit {
|
||||
padding: 0 2rem 0 8rem;
|
||||
padding: 1rem 2rem 0 8rem;
|
||||
}
|
||||
.header {
|
||||
padding: 1rem;
|
||||
@@ -57,19 +49,6 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<SourceBrowsingHeader
|
||||
defaultBranch={project.defaultBranch}
|
||||
projectId={project.id}
|
||||
commitId={commit.commit.id}
|
||||
{baseUrl}
|
||||
{branches}
|
||||
{commitCount}
|
||||
{contributorCount}
|
||||
{peers}
|
||||
{peer}
|
||||
revision={commit.commit.id}
|
||||
{view} />
|
||||
|
||||
<div class="commit">
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
|
||||
@@ -48,10 +48,7 @@
|
||||
seed: baseUrl,
|
||||
path: "/",
|
||||
}}>
|
||||
<SquareButton
|
||||
active={resource === "tree" ||
|
||||
resource === "history" ||
|
||||
resource === "commits"}>
|
||||
<SquareButton active={resource === "tree" || resource === "history"}>
|
||||
<svelte:fragment slot="icon">
|
||||
<Icon size="small" name="chevron-left-right" />
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
.issue {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 3fr) 1fr;
|
||||
padding: 0 2rem 0 8rem;
|
||||
padding: 1rem 2rem 0 8rem;
|
||||
margin-bottom: 4.5rem;
|
||||
}
|
||||
.metadata {
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
.patch {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 3fr) 1fr;
|
||||
padding: 0 2rem 0 8rem;
|
||||
padding: 1rem 2rem 0 8rem;
|
||||
margin-bottom: 4.5rem;
|
||||
}
|
||||
.metadata {
|
||||
|
||||
@@ -56,13 +56,6 @@
|
||||
project: projectId,
|
||||
peer,
|
||||
};
|
||||
} else if (view.resource === "commits") {
|
||||
return {
|
||||
resource: "project.commit",
|
||||
seed: baseUrl,
|
||||
project: projectId,
|
||||
commit: view.commit.commit.id,
|
||||
};
|
||||
} else {
|
||||
return unreachable(view);
|
||||
}
|
||||
@@ -93,13 +86,6 @@
|
||||
peer,
|
||||
revision,
|
||||
};
|
||||
} else if (view.resource === "commits") {
|
||||
return {
|
||||
resource: "project.commit",
|
||||
seed: baseUrl,
|
||||
project: projectId,
|
||||
commit: view.commit.commit.id,
|
||||
};
|
||||
} else {
|
||||
return unreachable(view);
|
||||
}
|
||||
@@ -146,8 +132,7 @@
|
||||
peer,
|
||||
revision,
|
||||
}}>
|
||||
<SquareButton
|
||||
active={view.resource === "history" || view.resource === "commits"}>
|
||||
<SquareButton active={view.resource === "history"}>
|
||||
<span class="txt-bold">{commitCount}</span>
|
||||
{pluralize("commit", commitCount)}
|
||||
</SquareButton>
|
||||
|
||||
@@ -88,17 +88,8 @@
|
||||
{project}
|
||||
revision={view.revision}
|
||||
{view} />
|
||||
{:else if view.resource === "commits"}
|
||||
<Commit
|
||||
branches={view.params.loadedBranches}
|
||||
commit={view.commit}
|
||||
commitCount={view.params.loadedTree.stats.commits}
|
||||
contributorCount={view.params.loadedTree.stats.contributors}
|
||||
peers={view.params.loadedPeers}
|
||||
{baseUrl}
|
||||
{peer}
|
||||
{project}
|
||||
{view} />
|
||||
{:else if view.resource === "commit"}
|
||||
<Commit commit={view.commit} {baseUrl} {project} />
|
||||
{:else if view.resource === "issues"}
|
||||
<Issues
|
||||
{baseUrl}
|
||||
|
||||
@@ -109,11 +109,6 @@ export type LoadedSourceBrowsingView =
|
||||
path: string;
|
||||
blobResult: BlobResult;
|
||||
}
|
||||
| {
|
||||
resource: "commits";
|
||||
params: LoadedSourceBrowsingParams;
|
||||
commit: Commit;
|
||||
}
|
||||
| {
|
||||
resource: "history";
|
||||
peer: string | undefined;
|
||||
@@ -131,6 +126,10 @@ interface LoadedSourceBrowsingParams {
|
||||
|
||||
export type ProjectLoadedView =
|
||||
| LoadedSourceBrowsingView
|
||||
| {
|
||||
resource: "commit";
|
||||
commit: Commit;
|
||||
}
|
||||
| { resource: "issue"; issue: Issue }
|
||||
| { resource: "issues"; search: string }
|
||||
| { resource: "newIssue" }
|
||||
@@ -199,25 +198,11 @@ export async function loadProjectRoute(
|
||||
} else if (route.resource === "project.history") {
|
||||
return loadHistoryView(route);
|
||||
} else if (route.resource === "project.commit") {
|
||||
const projectPromise = api.project.getById(route.project);
|
||||
const peersPromise = api.project.getAllRemotes(route.project);
|
||||
|
||||
const [project, peers] = await Promise.all([
|
||||
projectPromise,
|
||||
peersPromise,
|
||||
const [project, commit] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getCommitBySha(route.project, route.commit),
|
||||
]);
|
||||
|
||||
const tree = await api.project.getTree(route.project, route.commit);
|
||||
const viewParams = {
|
||||
loadedBranches: undefined,
|
||||
loadedPeers: peers,
|
||||
loadedTree: tree,
|
||||
};
|
||||
const loadedCommit = await api.project.getCommitBySha(
|
||||
route.project,
|
||||
route.commit,
|
||||
);
|
||||
|
||||
return {
|
||||
resource: "projects",
|
||||
params: {
|
||||
@@ -225,9 +210,8 @@ export async function loadProjectRoute(
|
||||
baseUrl: route.seed,
|
||||
project,
|
||||
view: {
|
||||
resource: "commits",
|
||||
params: viewParams,
|
||||
commit: loadedCommit,
|
||||
resource: "commit",
|
||||
commit,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -809,7 +793,7 @@ export function projectTitle(loadedRoute: ProjectLoadedRoute) {
|
||||
if (loadedRoute.params.view.resource === "tree") {
|
||||
title.push(loadedRoute.params.project.name);
|
||||
title.push(loadedRoute.params.project.description);
|
||||
} else if (loadedRoute.params.view.resource === "commits") {
|
||||
} else if (loadedRoute.params.view.resource === "commit") {
|
||||
title.push(loadedRoute.params.view.commit.commit.summary);
|
||||
title.push("commit");
|
||||
} else if (loadedRoute.params.view.resource === "history") {
|
||||
|
||||
Reference in New Issue
Block a user