From cb52e9654242d8501f5bd3081ab6799197f6781f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Wed, 5 Jul 2023 14:38:48 +0200 Subject: [PATCH 1/2] Use generic routing Link component everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way we can get rid of the project browsing specific ProjectLink component and simplify the router types. Signed-off-by: Rūdolfs Ošiņš --- httpd-client/index.ts | 2 + src/components/Comment.svelte | 5 ++- src/components/Markdown.svelte | 23 +++++++---- src/components/ProjectLink.svelte | 31 -------------- src/components/Thread.svelte | 7 ++++ src/views/projects/Blob.svelte | 12 +++++- src/views/projects/BranchSelector.svelte | 27 +++++++++++-- src/views/projects/Browser.svelte | 19 +++++---- src/views/projects/Cob/Revision.svelte | 6 +++ src/views/projects/Commit.svelte | 12 ++++-- src/views/projects/History.svelte | 6 +-- src/views/projects/Issue.svelte | 9 ++++- src/views/projects/Issue/New.svelte | 2 + src/views/projects/Patch.svelte | 14 ++++++- src/views/projects/PeerSelector.svelte | 29 +++++++++----- src/views/projects/Readme.svelte | 10 +++-- .../projects/SourceBrowser/Changeset.svelte | 24 ++++++++--- .../projects/SourceBrowser/FileDiff.svelte | 22 ++++++---- .../SourceBrowser/FileLocationChange.svelte | 23 +++++++---- .../projects/SourceBrowsingHeader.svelte | 19 ++++----- src/views/projects/Tree.svelte | 38 +++++++++++++----- src/views/projects/Tree/Folder.svelte | 40 +++++++++++++------ src/views/projects/View.svelte | 12 +++--- src/views/projects/router.ts | 37 ----------------- 24 files changed, 257 insertions(+), 172 deletions(-) delete mode 100644 src/components/ProjectLink.svelte diff --git a/httpd-client/index.ts b/httpd-client/index.ts index 788b33b7c..91ac98b45 100644 --- a/httpd-client/index.ts +++ b/httpd-client/index.ts @@ -12,6 +12,7 @@ import type { CommitHeader, Diff, DiffAddedDeletedModifiedChangeset, + DiffCopiedMovedChangeset, HunkLine, } from "./lib/project/commit.js"; import type { Issue, IssueState } from "./lib/project/issue.js"; @@ -39,6 +40,7 @@ export type { CommitHeader, Diff, DiffAddedDeletedModifiedChangeset, + DiffCopiedMovedChangeset, DiffResponse, HunkLine, Issue, diff --git a/src/components/Comment.svelte b/src/components/Comment.svelte index bbb5c7fde..5073e4eb3 100644 --- a/src/components/Comment.svelte +++ b/src/components/Comment.svelte @@ -1,5 +1,6 @@ - - - - diff --git a/src/components/Thread.svelte b/src/components/Thread.svelte index 1b093faa1..501baaa56 100644 --- a/src/components/Thread.svelte +++ b/src/components/Thread.svelte @@ -1,4 +1,5 @@ @@ -68,8 +68,8 @@ {contributorCount} {peers} {peer} - {resource} - {revision} /> + {revision} + {view} />
@@ -89,5 +89,9 @@
{header.description}
- +
diff --git a/src/views/projects/History.svelte b/src/views/projects/History.svelte index 6b44a1dc3..ae7e4e66a 100644 --- a/src/views/projects/History.svelte +++ b/src/views/projects/History.svelte @@ -20,9 +20,9 @@ export let peer: string | undefined; export let peers: Remote[]; export let project: Project; - export let resource: LoadedSourceBrowsingView["resource"]; export let revision: string | undefined; export let totalCommitCount: number; + export let view: LoadedSourceBrowsingView; const api = new HttpdClient(baseUrl); @@ -92,8 +92,8 @@ {contributorCount} {peers} {peer} - {resource} - {revision} /> + {revision} + {view} />
{#each groupCommits(allCommitHeaders) as group (group.time)} diff --git a/src/views/projects/Issue.svelte b/src/views/projects/Issue.svelte index 42c9b4945..bace5688c 100644 --- a/src/views/projects/Issue.svelte +++ b/src/views/projects/Issue.svelte @@ -332,6 +332,8 @@
@@ -344,7 +346,12 @@ {#each threads as thread (thread.root.id)}
- +
{/each} {#if $httpdStore.state === "authenticated"} diff --git a/src/views/projects/Issue/New.svelte b/src/views/projects/Issue/New.svelte index edb011e66..204dec728 100644 --- a/src/views/projects/Issue/New.svelte +++ b/src/views/projects/Issue/New.svelte @@ -154,6 +154,8 @@

No description

{:else} {#if patch.revisions[0].description} - +
{:catch e} - + {:catch e} diff --git a/src/views/projects/PeerSelector.svelte b/src/views/projects/PeerSelector.svelte index 7487f8014..206497cbd 100644 --- a/src/views/projects/PeerSelector.svelte +++ b/src/views/projects/PeerSelector.svelte @@ -1,6 +1,8 @@ -
- +
diff --git a/src/views/projects/SourceBrowser/Changeset.svelte b/src/views/projects/SourceBrowser/Changeset.svelte index 01e043c5a..387d5620b 100644 --- a/src/views/projects/SourceBrowser/Changeset.svelte +++ b/src/views/projects/SourceBrowser/Changeset.svelte @@ -1,5 +1,5 @@
- +
diff --git a/src/views/projects/router.ts b/src/views/projects/router.ts index 54c4f813b..d1970b997 100644 --- a/src/views/projects/router.ts +++ b/src/views/projects/router.ts @@ -460,20 +460,6 @@ function sanitizeQueryString(queryString: string): string { return queryString.startsWith("?") ? queryString.substring(1) : queryString; } -function createProjectRoute( - activeRoute: ProjectRoute, - projectRouteParams: Partial, -): ProjectRoute { - return { - resource: "projects", - params: { - ...activeRoute.params, - hash: undefined, - ...projectRouteParams, - }, - }; -} - export function resolveProjectRoute( url: URL, baseUrl: BaseUrl,