Skip to content

Commit

Permalink
[frontend] show package version publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenVoich committed Nov 25, 2024
1 parent 6e6a7f6 commit aa6b146
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 14 deletions.
5 changes: 5 additions & 0 deletions cli/declarations/main/main.did
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type PackageSummary__1 =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummaryWithChanges__1 =
Expand All @@ -178,6 +179,7 @@ type PackageSummaryWithChanges__1 =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummaryWithChanges =
Expand All @@ -194,6 +196,7 @@ type PackageSummaryWithChanges =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummary =
Expand All @@ -209,6 +212,7 @@ type PackageSummary =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageQuality =
Expand Down Expand Up @@ -256,6 +260,7 @@ type PackageDetails =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
testStats: TestStats__1;
versionHistory: vec PackageSummaryWithChanges__1;
Expand Down
5 changes: 5 additions & 0 deletions cli/declarations/main/main.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export interface PackageDetails {
'depAlias' : string,
'deps' : Array<PackageSummary__1>,
'quality' : PackageQuality,
'publisher' : User,
'testStats' : TestStats__1,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
Expand Down Expand Up @@ -237,6 +238,7 @@ export interface PackageSummary {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -251,6 +253,7 @@ export interface PackageSummaryWithChanges {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -266,6 +269,7 @@ export interface PackageSummaryWithChanges__1 {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -281,6 +285,7 @@ export interface PackageSummary__1 {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand Down
5 changes: 5 additions & 0 deletions cli/declarations/main/main.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down Expand Up @@ -126,6 +127,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down Expand Up @@ -170,6 +172,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand All @@ -187,6 +190,7 @@ export const idlFactory = ({ IDL }) => {
'depAlias' : IDL.Text,
'deps' : IDL.Vec(PackageSummary__1),
'quality' : PackageQuality,
'publisher' : User,
'testStats' : TestStats__1,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
Expand All @@ -209,6 +213,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down
12 changes: 12 additions & 0 deletions frontend/components/package/PackageVersionSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {markdownToHtml} from '/logic/markdown-to-html';
import Date from '../Date.svelte';
import PackageBenchmarksDiff from './PackageBenchmarksDiff.svelte';
import UserCard from './UserCard.svelte';
export let summary : PackageSummaryWithChanges;
export let showName = false;
Expand Down Expand Up @@ -65,6 +66,10 @@
<PackageBenchmarksDiff curBenchmarks={summary.changes.curBenchmarks} prevBenchmarks={summary.changes.prevBenchmarks}></PackageBenchmarksDiff>
</div>
{/if}

<div class="publisher">
Published by <UserCard user={summary.publisher} compact></UserCard>
</div>
</div>

<style>
Expand All @@ -87,6 +92,13 @@
gap: 10px;
}
.publisher {
display: flex;
gap: 4px;
margin-top: 25px;
font-size: 14px;
}
.version-summary:not(.show-name) .name {
display: none;
}
Expand Down
39 changes: 25 additions & 14 deletions frontend/components/package/UserCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,30 @@
import {User} from '/declarations/main/main.did';
export let user : User;
export let compact = false;
</script>

<div class="user-card">
<div class="user-card" class:compact={compact}>
<div class="value user">
{#if user.name}
<a class="value" href="/search/owner:{user.name}" use:link>@{user.name}</a> <small>{user.id}</small>
<a class="value" href="/search/owner:{user.name}" use:link>{user.name}</a> <small class="principal-text">{user.id}</small>
{:else}
<a class="value" href="/search/owner:{user.id}" use:link>{user.id}</a>
{/if}
</div>
{#if user.github}
<a class="value with-icon" href="https://github.com/{user.github}" target="_blank">
<img class="github-icon" src="{githubImg}" alt="GitHub logo" loading="lazy" />
{user.github}
</a>
{/if}
{#if user.twitter}
<a class="value with-icon" href="https://twitter.com/{user.twitter}" target="_blank">
<img class="twitter-icon" src="{twitterImg}" alt="Twitter logo" loading="lazy" />
{user.twitter}
</a>
{#if !compact}
{#if user.github}
<a class="value with-icon" href="https://github.com/{user.github}" target="_blank">
<img class="github-icon" src="{githubImg}" alt="GitHub logo" loading="lazy" />
{user.github}
</a>
{/if}
{#if user.twitter}
<a class="value with-icon" href="https://twitter.com/{user.twitter}" target="_blank">
<img class="twitter-icon" src="{twitterImg}" alt="Twitter logo" loading="lazy" />
{user.twitter}
</a>
{/if}
{/if}
</div>

Expand All @@ -49,7 +52,15 @@
filter: hue-rotate(45deg) contrast(0.6);
}
.user-card {
.user-card.compact .principal-text::before {
content: '(';
}
.user-card.compact .principal-text::after {
content: ')';
}
.user-card:not(.compact) {
display: flex;
flex-direction: column;
gap: 6px;
Expand Down
5 changes: 5 additions & 0 deletions frontend/declarations/main/main.did
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type PackageSummary__1 =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummaryWithChanges__1 =
Expand All @@ -178,6 +179,7 @@ type PackageSummaryWithChanges__1 =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummaryWithChanges =
Expand All @@ -194,6 +196,7 @@ type PackageSummaryWithChanges =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageSummary =
Expand All @@ -209,6 +212,7 @@ type PackageSummary =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
};
type PackageQuality =
Expand Down Expand Up @@ -256,6 +260,7 @@ type PackageDetails =
ownerInfo: User;
owners: vec User;
publication: PackagePublication;
publisher: User;
quality: PackageQuality;
testStats: TestStats__1;
versionHistory: vec PackageSummaryWithChanges__1;
Expand Down
5 changes: 5 additions & 0 deletions frontend/declarations/main/main.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export interface PackageDetails {
'depAlias' : string,
'deps' : Array<PackageSummary__1>,
'quality' : PackageQuality,
'publisher' : User,
'testStats' : TestStats__1,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
Expand Down Expand Up @@ -237,6 +238,7 @@ export interface PackageSummary {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -251,6 +253,7 @@ export interface PackageSummaryWithChanges {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -266,6 +269,7 @@ export interface PackageSummaryWithChanges__1 {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand All @@ -281,6 +285,7 @@ export interface PackageSummary__1 {
'owner' : Principal,
'depAlias' : string,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : bigint,
'downloadsInLast30Days' : bigint,
Expand Down
5 changes: 5 additions & 0 deletions frontend/declarations/main/main.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down Expand Up @@ -126,6 +127,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down Expand Up @@ -170,6 +172,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand All @@ -187,6 +190,7 @@ export const idlFactory = ({ IDL }) => {
'depAlias' : IDL.Text,
'deps' : IDL.Vec(PackageSummary__1),
'quality' : PackageQuality,
'publisher' : User,
'testStats' : TestStats__1,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
Expand All @@ -209,6 +213,7 @@ export const idlFactory = ({ IDL }) => {
'owner' : IDL.Principal,
'depAlias' : IDL.Text,
'quality' : PackageQuality,
'publisher' : User,
'highestVersion' : PackageVersion,
'downloadsTotal' : IDL.Nat,
'downloadsInLast30Days' : IDL.Nat,
Expand Down

0 comments on commit aa6b146

Please sign in to comment.