Add organizations, research groups and repo stats to projects
This commit is contained in:
1 parent
3fefc814e1
commit
c820672803
25 files changed
+573
-32
No files matched your search
@@ -1,16 +1,28 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { Project, ProjectCategory } from '#lib/content';
|
||||
import type { RepoStats } from '#lib/github/types';
|
||||
import LinkButton from '#lib/components/ui/LinkButton.svelte';
|
||||
import Tag from '#lib/components/ui/Tag.svelte';
|
||||
|
||||
let { project, category }: { project: Project; category: ProjectCategory } = $props();
|
||||
let {
|
||||
project,
|
||||
category,
|
||||
repoStats,
|
||||
downloads
|
||||
}: { project: Project; category: ProjectCategory; repoStats?: RepoStats; downloads?: number } = $props();
|
||||
|
||||
const downloadsLabel = $derived(
|
||||
downloads === undefined ? '' : new Intl.NumberFormat('en-US', { notation: 'compact' }).format(downloads)
|
||||
);
|
||||
|
||||
const linkButtons = $derived(
|
||||
[
|
||||
{ href: project.links.website, label: 'Website', icon: 'mdi:web' },
|
||||
{ href: project.links.demo, label: 'View Demo', icon: 'mdi:open-in-new' },
|
||||
{ href: project.links.package, label: 'View Package', icon: 'mdi:package-variant' },
|
||||
{ href: project.links.code, label: 'View Code', icon: 'mdi:github' },
|
||||
{ href: project.links.docs, label: 'Docs', icon: 'mdi:book-open-page-variant-outline' },
|
||||
{ href: project.links.devpost, label: 'Devpost', icon: 'simple-icons:devpost' },
|
||||
{ href: project.links.article, label: 'Article', icon: 'mdi:newspaper-variant-outline' }
|
||||
].filter((button) => button.href)
|
||||
@@ -33,6 +45,28 @@
|
||||
{#if project.version}
|
||||
<span class="badge version">v{project.version}</span>
|
||||
{/if}
|
||||
{#if repoStats && project.links.code}
|
||||
<a class="repo-stat stars" href="{project.links.code}/stargazers" target="_blank" rel="noopener noreferrer" title="GitHub stars">
|
||||
<Icon icon="mdi:star-outline" width="15" />
|
||||
{repoStats.stars}
|
||||
</a>
|
||||
<a class="repo-stat forks" href="{project.links.code}/forks" target="_blank" rel="noopener noreferrer" title="GitHub forks">
|
||||
<Icon icon="mdi:source-fork" width="15" />
|
||||
{repoStats.forks}
|
||||
</a>
|
||||
{/if}
|
||||
{#if downloads !== undefined && project.links.package}
|
||||
<a
|
||||
class="repo-stat downloads"
|
||||
href={project.links.package}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title="{downloads.toLocaleString('en-US')} npm downloads"
|
||||
>
|
||||
<Icon icon="mdi:download" width="15" />
|
||||
{downloadsLabel}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if project.event}
|
||||
@@ -78,10 +112,82 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if project.gallery?.length}
|
||||
<div class="gallery" data-image-group>
|
||||
{#each project.gallery as photo, index (photo)}
|
||||
<a class="gallery-item" href={photo} target="_blank" rel="noopener noreferrer">
|
||||
<img src={photo} alt="{project.name} photo {index + 1}" loading="lazy" />
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if project.socials?.length}
|
||||
<div class="socials">
|
||||
{#each project.socials as social (social.url)}
|
||||
<a class="social" href={social.url} target="_blank" rel="noopener noreferrer" title={social.name}>
|
||||
<Icon icon={social.icon} width="16" />
|
||||
<span>{social.name}</span>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<style>
|
||||
.gallery {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 0.5rem;
|
||||
max-width: 640px;
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
|
||||
.gallery-item {
|
||||
display: block;
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.gallery-item:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.gallery-item img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.gallery-item:hover img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.socials {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem 0.9rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
.social {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
color: var(--muted);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.social:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.project-entry {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
@@ -153,6 +259,31 @@
|
||||
background: var(--blue);
|
||||
}
|
||||
|
||||
.repo-stat {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 0 0.45rem;
|
||||
border: 1px solid color-mix(in srgb, var(--foreground) 25%, transparent);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.repo-stat.stars {
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
.repo-stat.forks {
|
||||
color: var(--cyan);
|
||||
}
|
||||
|
||||
.repo-stat.downloads {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
.repo-stat:hover {
|
||||
border-color: currentColor;
|
||||
}
|
||||
|
||||
.event {
|
||||
color: var(--blue);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { page } from '$app/state';
|
||||
import { projectCategories } from '#lib/content';
|
||||
|
||||
const chipColors = ['magenta', 'orange', 'green', 'cyan'];
|
||||
const chipColors = ['magenta', 'orange', 'green', 'cyan', 'yellow'];
|
||||
</script>
|
||||
|
||||
<nav class="project-nav">
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { ProjectCategory, ResearchGroup } from '#lib/content';
|
||||
import LinkButton from '#lib/components/ui/LinkButton.svelte';
|
||||
import Tag from '#lib/components/ui/Tag.svelte';
|
||||
import ProjectEntry from '#lib/components/projects/ProjectEntry.svelte';
|
||||
|
||||
let { group, category }: { group: ResearchGroup; category: ProjectCategory } = $props();
|
||||
|
||||
const linkIcons: Record<string, string> = {
|
||||
GitHub: 'mdi:github',
|
||||
'My Profile': 'mdi:account-circle-outline'
|
||||
};
|
||||
</script>
|
||||
|
||||
<section class="research-group">
|
||||
<h2 class="group-title">{group.name}</h2>
|
||||
|
||||
<div class="path">
|
||||
<span class="muted">~/</span>{group.institution}<span class="muted">/</span><a
|
||||
href={group.lab.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">{group.lab.name}</a
|
||||
><span class="muted">/</span><span class="current">{group.shortName}</span>
|
||||
</div>
|
||||
|
||||
<div class="group-body">
|
||||
<div class="badges">
|
||||
<span class="badge group"><Icon icon={category.icon} width="15" /> Research Group</span>
|
||||
<span class="badge short-name">{group.shortName}</span>
|
||||
</div>
|
||||
|
||||
<div class="role">{group.role}</div>
|
||||
<div class="muted">{group.period}</div>
|
||||
|
||||
<p>{group.description}</p>
|
||||
|
||||
<div class="tags">
|
||||
{#each group.focus as area, index (area)}
|
||||
<Tag label={area} colorIndex={index} />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
{#each group.links as link (link.url)}
|
||||
<LinkButton href={link.url} icon={linkIcons[link.label] ?? 'mdi:open-in-new'}>{link.label}</LinkButton>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tree-label">
|
||||
<span class="muted">$</span> ls ~/research/{group.shortName.toLowerCase()}/projects
|
||||
</div>
|
||||
|
||||
<div class="project-tree">
|
||||
{#each group.projects as project, index (project.name)}
|
||||
<div class="tree-item">
|
||||
<span class="branch">{index === group.projects.length - 1 ? '└──' : '├──'}</span>
|
||||
<div class="tree-entry">
|
||||
<ProjectEntry {project} {category} />
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.research-group {
|
||||
padding: 1rem 0 1.5rem;
|
||||
border-top: 1px dashed color-mix(in srgb, var(--foreground) 25%, transparent);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0;
|
||||
color: var(--accent);
|
||||
font-size: 1.1rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.path {
|
||||
margin: 0.25rem 0 0.75rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.path a {
|
||||
color: var(--blue);
|
||||
}
|
||||
|
||||
.path a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.current {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
.group-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.badges,
|
||||
.tags,
|
||||
.buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
padding: 0 0.45rem;
|
||||
color: var(--background);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.badge.group {
|
||||
background: var(--green);
|
||||
}
|
||||
|
||||
.badge.short-name {
|
||||
background: var(--magenta);
|
||||
}
|
||||
|
||||
.role {
|
||||
color: var(--blue);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tree-label {
|
||||
margin: 1.5rem 0 0.25rem;
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.tree-item {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.branch {
|
||||
padding-top: 1rem;
|
||||
color: var(--muted);
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.tree-entry {
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user