Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

truncate (...) long project name (closes #540) #670

Merged
merged 12 commits into from
Oct 18, 2023
6 changes: 4 additions & 2 deletions src/lib/components/copyable/copyable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
on:mouseenter={() => (visible = true)}
on:mouseleave={() => (visible = false)}
>
<slot />
<!-- needs a .min-w-0 wrapper so slotted content that truncates can still truncate ("...") -->
<div class="min-w-0">
<slot />
</div>
<div
class="copy-icon"
class:visible={!disabled && (visible || success || alwaysVisible)}
Expand All @@ -48,7 +51,6 @@
display: flex;
align-items: center;
cursor: pointer;
justify-content: space-between;
}

.copy-icon {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/components/project-badge/project-badge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
export let hideAvatar = false;
export let linkToNewTab = false;
export let linkTo: 'external-url' | 'project-page' | 'nothing' = 'project-page';
export let maxWidth: number | false = 320;

let unclaimedProject: UnclaimedGitProject;
$: unclaimedProject = {
Expand All @@ -38,6 +39,7 @@
<svelte:element
this={linkTo === 'nothing' ? 'div' : 'a'}
class="project-badge flex gap-2 items-center typo-text"
style:max-width={maxWidth ? maxWidth + 'px' : 'none'}
href={linkTo === 'project-page'
? buildProjectUrl(project.source)
: buildExternalUrl(processedProject.source.url)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,32 @@
import ProjectAvatar from '$lib/components/project-avatar/project-avatar.svelte';
import ProjectBadge from '$lib/components/project-badge/project-badge.svelte';
import type { GitProject } from '$lib/utils/metadata/types';
import { createEventDispatcher } from 'svelte';
import Button from '../button/button.svelte';
import Copyable from '../copyable/copyable.svelte';
import Pen from 'radicle-design-system/icons/Pen.svelte';

export let project: GitProject;
export let editButton: string | undefined = undefined;

const dispatch = createEventDispatcher<{ editButtonClick: never }>();
</script>

<div class="project-profile-header">
<div class="avatar">
<ProjectAvatar {project} size="huge" />
</div>
<div class="name">
<h1>{project.source.repoName}</h1>
<Copyable alwaysVisible={true} value={project.source.url}>
<ProjectBadge {project} forceUnclaimed tooltip={false} linkTo="external-url" />
</Copyable>
<div class="flex flex-col gap-4 items-start sm:flex-row sm:justify-between relative">
<div class="max-w-full flex-1 min-w-0 flex flex-col gap-2 sm:flex-row sm:gap-8 sm:items-center">
<div class="avatar">
<ProjectAvatar {project} size="huge" />
</div>
<div class="flex-1 min-w-0 flex flex-col gap-1">
<h1>{project.source.repoName}</h1>
<Copyable alwaysVisible={true} value={project.source.url}>
<ProjectBadge {project} forceUnclaimed tooltip={false} linkTo="external-url" />
</Copyable>
</div>
</div>
{#if editButton}
<div class="absolute top-0 right-0 sm:static">
<Button icon={Pen} on:click={() => dispatch('editButtonClick')}>{editButton}</Button>
</div>
{/if}
</div>

<style>
.project-profile-header {
display: flex;
align-items: center;
gap: 2rem;
}

.name {
display: flex;
flex-direction: column;
gap: 0.25rem;
}

@media (max-width: 577px) {
.project-profile-header {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
}
}
</style>
10 changes: 2 additions & 8 deletions src/lib/components/section/section.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
export let collapsed = false;
</script>

<section style:margin-bottom={collapsed ? '-2rem' : 0}>
<section class="app-section" style:margin-bottom={collapsed ? '-2rem' : 0}>
<SectionHeader
bind:collapsable
bind:collapsed
{...header}
actionsDisabled={collapsed || header.actionsDisabled}
/>
<div class="content">
<div>
<SectionSkeleton bind:collapsed {...skeleton}>
<slot />
</SectionSkeleton>
Expand All @@ -26,12 +26,6 @@

<style>
section {
display: flex;
flex-direction: column;
transition: margin-bottom 0.3s ease;
}

.content {
padding-top: 1.5rem;
}
</style>
10 changes: 2 additions & 8 deletions src/lib/components/supporters-section/supporters.section.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
</script>

<div class="section">
<section class="app-section">
<SectionHeader
{infoTooltip}
icon={Heart}
Expand Down Expand Up @@ -146,15 +146,9 @@
<SectionSkeleton loaded={true} error={true} />
{/await}
{/if}
</div>
</section>

<style>
.section {
display: flex;
flex-direction: column;
gap: 2rem;
}

.lists {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="project-info" transition:fly|local={{ y: 8, duration: 300 }}>
{#if project}
<div class="basic-info">
<ProjectBadge linkToNewTab {project} />
<ProjectBadge linkToNewTab {project} maxWidth={false} />
{#if projectMetadata?.description}
<p class="description typo-text">
{projectMetadata.description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
/>

<PrimaryColorThemer colorHex={project.owner ? project.color : undefined}>
<div class="project-profile" class:claimed={project.claimed}>
<div class="header">
<article class="project-profile" class:claimed={project.claimed}>
<header class="header">
{#if project.owner}
<div class="owner">
<span class="typo-text" style:color="var(--color-foreground-level-5)"
Expand Down Expand Up @@ -157,16 +157,13 @@
</AnnotationBox>
</div>
{/if}
<div class="project-profile-header">
<ProjectProfileHeader {project} />
{#if project.claimed && isOwnProject}
<Button
icon={Pen}
on:click={() =>
project.claimed && modal.show(Stepper, undefined, editProjectMetadataSteps(project))}
>Edit</Button
>
{/if}
<div>
<ProjectProfileHeader
{project}
editButton={project.claimed && isOwnProject ? 'Edit' : undefined}
on:editButtonClick={() =>
project.claimed && modal.show(Stepper, undefined, editProjectMetadataSteps(project))}
/>
</div>
{#if project.claimed}
{#await Promise.all([earnedFunds, splits])}
Expand Down Expand Up @@ -202,11 +199,11 @@
</div>
{/await}
{/if}
</div>
</header>
<div class="content">
<Developer accountId={project.repoDriverAccount.accountId} />
{#if project.owner}
<div class="section">
<section class="app-section">
{#if splits}
{#await splits}
<SectionHeader icon={SplitsIcon} label="Splits" />
Expand Down Expand Up @@ -265,9 +262,9 @@
<SectionSkeleton loaded={true} error={true} />
{/await}
{/if}
</div>
</section>
{:else if unclaimedFunds}
<div class="section">
<section class="app-section">
<SectionHeader icon={Wallet} label="Claimable funds" />
{#await unclaimedFunds}
<SectionSkeleton loaded={false} />
Expand All @@ -287,7 +284,7 @@
{:catch}
<SectionSkeleton loaded={true} error={true} />
{/await}
</div>
</section>
{/if}
<SupportersSection type="project" {incomingSplits} />
</div>
Expand All @@ -298,7 +295,7 @@
</div>
</aside>
{/if}
</div>
</article>
</PrimaryColorThemer>

<style>
Expand All @@ -309,7 +306,7 @@
grid-template-areas:
'header'
'content';
gap: 3rem;
gap: 2rem;
}

.project-profile.claimed {
Expand All @@ -320,6 +317,11 @@
'content sidebar';
}

aside {
grid-area: sidebar;
height: 0; /* so it's height doesnt influence .header's height and mess up main column gaps */
}

.project-profile > * {
max-width: 100%;
}
Expand All @@ -329,7 +331,7 @@
align-self: top;
display: flex;
flex-direction: column;
gap: 4rem;
gap: 3rem;
}

.unclaimed-project-notice {
Expand All @@ -338,27 +340,22 @@

.header {
grid-area: header;
}

.header .project-profile-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
flex-direction: column;
gap: 1.5rem;
margin-bottom: 1rem;
}

.header .owner {
display: flex;
gap: 0.375rem;
align-items: center;
margin-bottom: 1.5rem;
}

.stats {
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin-top: 2rem;
}

.stats.loading {
Expand All @@ -376,10 +373,6 @@
min-height: 6.125rem;
}

aside {
grid-area: sidebar;
}

.become-supporter-card {
position: sticky;
top: 0;
Expand All @@ -401,17 +394,12 @@
gap: 1rem;
}

.section {
display: flex;
gap: 2rem;
flex-direction: column;
}

@media (max-width: 1024px) {
.project-profile,
.project-profile.claimed {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto auto auto;
gap: 3rem;
}

.project-profile.claimed {
Expand All @@ -425,11 +413,8 @@
margin-bottom: 0;
}

.header .project-profile-header {
display: flex;
justify-content: space-between;
align-items: baseline;
flex-direction: column;
aside {
height: auto;
}
}
</style>
10 changes: 1 addition & 9 deletions src/routes/app/(app)/streams/sections/splits.section.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
}
</script>

<div class="section">
<div class="app-section">
<SectionHeader
icon={MergeIcon}
label="Splits"
Expand Down Expand Up @@ -174,11 +174,3 @@
</SectionSkeleton>
</div>
</div>

<style>
.section {
display: flex;
flex-direction: column;
gap: 2rem;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import GitProjectService from '$lib/utils/project/GitProjectService';
import PenIcon from 'radicle-design-system/icons/Pen.svelte';
import Drip from '$lib/components/illustrations/drip.svelte';
import Pen from 'radicle-design-system/icons/Pen.svelte';
import modal from '$lib/stores/modal';
import ProjectCustomizerModal from './components/project-customizer-modal.svelte';

Expand Down Expand Up @@ -94,8 +93,11 @@
>
<FormField type="div" title="Git project">
<div class="card">
<ProjectProfileHeader project={fakeClaimedProject} />
<Button icon={Pen} on:click={customize}>Customize</Button>
<ProjectProfileHeader
project={fakeClaimedProject}
editButton="Customize"
on:editButtonClick={customize}
/>
</div>
</FormField>
<FormField type="div" title="Owned by">
Expand Down
Loading
Loading