Improve UX on issue and patches stats

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-08-31 10:42:38 +02:00
committed by Alexis Sellier
parent 0d6179d283
commit e5f9317436
2 changed files with 12 additions and 15 deletions
+7 -11
View File
@@ -122,8 +122,8 @@
{#if seed.api.host}
<div
class="stat seed clickable widget"
on:click={() => navigate(`/seeds/${seed.api.host}`)}
title="Project data is fetched from this seed">
on:click={() => navigate(`/seeds/${seed.api.host}`)}
<span>{seed.api.host}</span>
</div>
{/if}
@@ -134,29 +134,25 @@
on:click={() => toggleContent(ProjectContent.History, true)}>
<strong>{tree.stats.commits}</strong> commit(s)
</div>
{#if project.issues > 0}
{#if project.issues}
<div
class="stat issue-count clickable widget"
class:active={content === ProjectContent.Issues}
class:not-allowed={project.issues === 0}
class:clickable={project.issues > 0}
on:click={() => toggleContent(ProjectContent.Issues, false)}>
<strong>{project.issues}</strong> issue(s)
</div>
{:else}
<div class="stat issue-count not-allowed widget" title="Not supported">
0 issue(s)
</div>
{/if}
{#if project.patches > 0}
{#if project.patches}
<div
class="stat patch-count clickable widget"
class:active={content === ProjectContent.Patches}
class:not-allowed={project.patches === 0}
class:clickable={project.patches > 0}
on:click={() => toggleContent(ProjectContent.Patches, false)}>
<strong>{project.patches}</strong> patch(es)
</div>
{:else}
<div class="stat patch-count not-allowed widget" title="Not supported">
0 patch(es)
</div>
{/if}
<div class="stat contributor-count widget">
<strong>{tree.stats.contributors}</strong> contributor(s)
+5 -4
View File
@@ -57,8 +57,8 @@ export interface ProjectInfo {
defaultBranch: string;
delegates: Delegate[];
remotes: PeerId[];
patches: number;
issues: number;
patches?: number;
issues?: number;
}
export interface Tree {
@@ -267,8 +267,9 @@ export class Project implements ProjectInfo {
branches: Branches;
profile: Profile | null;
anchors: string[];
patches: number;
issues: number;
// At the moment we still have seed nodes which won't return neither patches or issues
patches?: number;
issues?: number;
constructor(urn: string, info: ProjectInfo, seed: Seed, peers: Peer[], branches: Branches, profile: Profile | null, anchors: string[]) {
this.urn = urn;