Show Goodreads books on about page
This commit is contained in:
1 parent
a2ffd45442
commit
0cfebc385f
12 files changed
+673
-213
No files matched your search
@@ -1,24 +0,0 @@
|
||||
import type { Book } from '#lib/content';
|
||||
|
||||
const coverBaseUrl = 'https://covers.openlibrary.org/b/isbn';
|
||||
const bookPageBaseUrl = 'https://openlibrary.org/isbn';
|
||||
|
||||
function cleanIsbn(isbn: string): string {
|
||||
return isbn.replace(/[^0-9X]/gi, '');
|
||||
}
|
||||
|
||||
export function bookCover(book: Book): string | null {
|
||||
return book.isbn ? `${coverBaseUrl}/${cleanIsbn(book.isbn)}-L.jpg?default=false` : null;
|
||||
}
|
||||
|
||||
export function bookLink(book: Book): string | null {
|
||||
if (book.url) return book.url;
|
||||
return book.isbn ? `${bookPageBaseUrl}/${cleanIsbn(book.isbn)}` : null;
|
||||
}
|
||||
|
||||
export function sortBooks(books: Book[]): Book[] {
|
||||
return [...books].sort((first, second) => {
|
||||
const readingOrder = Number(second.status === 'reading') - Number(first.status === 'reading');
|
||||
return readingOrder || (second.rating ?? 0) - (first.rating ?? 0);
|
||||
});
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { Book } from '#lib/content';
|
||||
import { bookCover, bookLink } from '#lib/books/books';
|
||||
|
||||
let { book }: { book: Book } = $props();
|
||||
|
||||
let coverFailed = $state(false);
|
||||
|
||||
const cover = $derived(bookCover(book));
|
||||
const link = $derived(bookLink(book));
|
||||
</script>
|
||||
|
||||
<svelte:element
|
||||
this={link ? 'a' : 'div'}
|
||||
class="book-card"
|
||||
href={link}
|
||||
target={link ? '_blank' : undefined}
|
||||
rel={link ? 'noopener noreferrer' : undefined}
|
||||
title="{book.title} by {book.author}"
|
||||
>
|
||||
<div class="cover">
|
||||
{#if cover && !coverFailed}
|
||||
<img src={cover} alt="" loading="lazy" data-no-viewer onerror={() => (coverFailed = true)} />
|
||||
{:else}
|
||||
<span class="placeholder">
|
||||
<Icon icon="mdi:book-open-page-variant-outline" width="36" />
|
||||
<span class="placeholder-title">{book.title}</span>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if book.status === 'reading'}
|
||||
<span class="badge reading"><Icon icon="mdi:bookmark" width="13" />reading</span>
|
||||
{:else if book.rating}
|
||||
<span class="badge"><Icon icon="mdi:star" width="13" />{book.rating}/10</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="text">
|
||||
<span class="title">{book.title}</span>
|
||||
<span class="author">{book.author}</span>
|
||||
</div>
|
||||
</svelte:element>
|
||||
|
||||
<style>
|
||||
.book-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cover {
|
||||
position: relative;
|
||||
aspect-ratio: 2 / 3;
|
||||
overflow: hidden;
|
||||
background: var(--dark-background);
|
||||
border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
a.book-card:hover .cover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
a.book-card:hover .cover img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
height: 100%;
|
||||
padding: 0.75rem;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.placeholder-title {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: 0.4rem;
|
||||
right: 0.4rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.2rem;
|
||||
padding: 0 0.4rem;
|
||||
background: var(--background);
|
||||
color: var(--yellow);
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
|
||||
.badge.reading {
|
||||
background: var(--green);
|
||||
color: var(--background);
|
||||
}
|
||||
|
||||
.text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.title,
|
||||
.author {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.author {
|
||||
color: var(--muted);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.cover img {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,36 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Book } from '#lib/content';
|
||||
import Pagination from '#lib/components/ui/Pagination.svelte';
|
||||
import BookCard from './BookCard.svelte';
|
||||
|
||||
let { books }: { books: Book[] } = $props();
|
||||
|
||||
const booksPerPage = 12;
|
||||
|
||||
let currentPage = $state(1);
|
||||
|
||||
const totalPages = $derived(Math.max(1, Math.ceil(books.length / booksPerPage)));
|
||||
const visibleBooks = $derived(books.slice((currentPage - 1) * booksPerPage, currentPage * booksPerPage));
|
||||
</script>
|
||||
|
||||
<div class="book-grid">
|
||||
{#each visibleBooks as book (`${book.title}-${book.author}`)}
|
||||
<BookCard {book} />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<Pagination bind:currentPage {totalPages} />
|
||||
|
||||
<style>
|
||||
.book-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||
gap: 1rem 0.85rem;
|
||||
}
|
||||
|
||||
@container (max-width: 520px) {
|
||||
.book-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,159 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { Book } from '#lib/content';
|
||||
|
||||
let { book }: { book: Book } = $props();
|
||||
|
||||
let coverFailed = $state(false);
|
||||
|
||||
const hasOwnRating = $derived(book.rating !== undefined);
|
||||
</script>
|
||||
|
||||
<a class="book-card" href={book.url} target="_blank" rel="noopener noreferrer" title="{book.title} by {book.authors.join(', ')}">
|
||||
<div class="cover">
|
||||
{#if book.cover && !coverFailed}
|
||||
<img src={book.cover} alt="" loading="lazy" onerror={() => (coverFailed = true)} />
|
||||
{:else}
|
||||
<span class="placeholder">
|
||||
<Icon icon="mdi:book-open-page-variant-outline" width="32" />
|
||||
<span class="placeholder-title">{book.title}</span>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if hasOwnRating}
|
||||
<span class="rating"><Icon icon="mdi:star" width="13" />{book.rating}/10</span>
|
||||
{:else if book.averageRating}
|
||||
<span class="rating community" title="Goodreads average"><Icon icon="mdi:star-outline" width="13" />{book.averageRating}</span>
|
||||
{/if}
|
||||
|
||||
{#if book.description}
|
||||
<p class="description">{book.description}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<span class="title">{book.title}</span>
|
||||
<span class="meta">{book.authors.join(', ')}</span>
|
||||
{#if book.genres.length}
|
||||
<span class="meta">{book.genres.slice(0, 3).join(' · ')}</span>
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
<style>
|
||||
.book-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cover {
|
||||
position: relative;
|
||||
margin-bottom: 0.15rem;
|
||||
aspect-ratio: 2 / 3;
|
||||
overflow: hidden;
|
||||
background: var(--dark-background);
|
||||
border: 1px solid color-mix(in srgb, var(--foreground) 20%, transparent);
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.book-card:hover .cover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.book-card:hover img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
height: 100%;
|
||||
padding: 0.6rem;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.placeholder-title {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.rating {
|
||||
position: absolute;
|
||||
top: 0.35rem;
|
||||
right: 0.35rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
padding: 0 0.35rem;
|
||||
background: var(--background);
|
||||
color: var(--yellow);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.rating.community {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.description {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: -webkit-box;
|
||||
margin: 0;
|
||||
padding: 0.55rem;
|
||||
overflow: hidden;
|
||||
background: color-mix(in srgb, var(--background) 94%, transparent);
|
||||
border-top: 1px solid var(--accent);
|
||||
font-size: 0.72rem;
|
||||
line-height: 1.45;
|
||||
-webkit-line-clamp: 8;
|
||||
line-clamp: 8;
|
||||
-webkit-box-orient: vertical;
|
||||
transform: translateY(100%);
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
|
||||
.book-card:hover .description,
|
||||
.book-card:focus-visible .description {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.title {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
color: var(--accent);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.meta {
|
||||
overflow: hidden;
|
||||
color: var(--muted);
|
||||
font-size: 0.72rem;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.cover,
|
||||
.cover img,
|
||||
.description {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { Book } from '#lib/content';
|
||||
import BookCard from './BookCard.svelte';
|
||||
|
||||
let { title, icon, books }: { title: string; icon: string; books: Book[] } = $props();
|
||||
|
||||
const collapsedCount = 12;
|
||||
|
||||
let showAll = $state(false);
|
||||
|
||||
const shownBooks = $derived(showAll ? books : books.slice(0, collapsedCount));
|
||||
</script>
|
||||
|
||||
<h3 class="subheading"><Icon {icon} width="16" /> {title} <span class="muted">{books.length}</span></h3>
|
||||
<div class="book-grid">
|
||||
{#each shownBooks as book (book.goodreadsId)}
|
||||
<BookCard {book} />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if books.length > collapsedCount}
|
||||
<button class="toggle" onclick={() => (showAll = !showAll)}>
|
||||
<Icon icon={showAll ? 'mdi:chevron-up' : 'mdi:chevron-down'} width="16" />
|
||||
{showAll ? 'Show less' : `Show all ${books.length}`}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.subheading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin: 1.25rem 0 0.6rem;
|
||||
color: var(--foreground);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.book-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 0.9rem 0.75rem;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.3rem 0.7rem;
|
||||
background: none;
|
||||
border: 1px solid color-mix(in srgb, var(--foreground) 30%, transparent);
|
||||
color: var(--foreground);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.toggle:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
@container (max-width: 520px) {
|
||||
.book-grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,180 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@iconify/svelte';
|
||||
import type { Book } from '#lib/content';
|
||||
import Panel from '#lib/components/ui/Panel.svelte';
|
||||
import BookShelfGrid from './BookShelfGrid.svelte';
|
||||
|
||||
let { books }: { books: Book[] } = $props();
|
||||
|
||||
const shelfColors = { read: 'green', reading: 'blue', 'want-to-read': 'magenta' };
|
||||
|
||||
const byRating = (first: Book, second: Book) => (second.rating ?? -1) - (first.rating ?? -1);
|
||||
|
||||
const read = $derived(books.filter((book) => book.shelf === 'read').sort(byRating));
|
||||
const reading = $derived(books.filter((book) => book.shelf === 'reading'));
|
||||
const wantToRead = $derived(books.filter((book) => book.shelf === 'want-to-read'));
|
||||
|
||||
const shelfCounts = $derived([
|
||||
{ label: 'Read', count: read.length, color: shelfColors.read },
|
||||
{ label: 'Reading', count: reading.length, color: shelfColors.reading },
|
||||
{ label: 'Want to read', count: wantToRead.length, color: shelfColors['want-to-read'] }
|
||||
]);
|
||||
const shownCounts = $derived(shelfCounts.filter((shelf) => shelf.count > 0));
|
||||
const pagesRead = $derived(read.reduce((total, book) => total + (book.pages ?? 0), 0));
|
||||
const authorCount = $derived(new Set(read.flatMap((book) => book.authors)).size);
|
||||
const topGenres = $derived.by(() => {
|
||||
const counts = new Map<string, number>();
|
||||
read.flatMap((book) => book.genres).forEach((genre) => counts.set(genre, (counts.get(genre) ?? 0) + 1));
|
||||
return [...counts.entries()].sort((first, second) => second[1] - first[1]).slice(0, 3).map(([genre]) => genre);
|
||||
});
|
||||
const rows = $derived([
|
||||
['Pages read', pagesRead.toLocaleString('en-US')],
|
||||
['Authors', `${authorCount}`],
|
||||
...(topGenres.length ? [['Top genres', topGenres.join(', ')]] : [])
|
||||
]);
|
||||
</script>
|
||||
|
||||
<div class="overview" class:single={!reading.length}>
|
||||
<Panel title="bookshelf" icon="mdi:bookshelf">
|
||||
<div class="fetch">
|
||||
{#each shelfCounts as shelf (shelf.label)}
|
||||
<div><span class="label">{shelf.label}</span>: <span style:color="var(--{shelf.color})">{shelf.count}</span></div>
|
||||
{/each}
|
||||
{#each rows as [label, value] (label)}
|
||||
<div><span class="label">{label}</span>: {value}</div>
|
||||
{/each}
|
||||
|
||||
{#if shownCounts.length}
|
||||
<div class="breakdown" role="img" aria-label="Books by shelf">
|
||||
{#each shownCounts as shelf (shelf.label)}
|
||||
<span class="block" style:flex-grow={shelf.count} style:background="var(--{shelf.color})" title="{shelf.label}: {shelf.count}"></span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
{#if reading.length}
|
||||
<Panel title="Currently reading" icon="mdi:book-open-variant">
|
||||
<div class="reading">
|
||||
{#each reading as book (book.goodreadsId)}
|
||||
<a class="reading-row" href={book.url} target="_blank" rel="noopener noreferrer">
|
||||
{#if book.cover}
|
||||
<img src={book.cover} alt={book.title} loading="lazy" />
|
||||
{:else}
|
||||
<span class="cover-fallback"><Icon icon="mdi:book-outline" width="22" /></span>
|
||||
{/if}
|
||||
<span class="reading-text">
|
||||
<span class="title">{book.title}</span>
|
||||
<span class="muted detail">{book.authors.join(', ')}</span>
|
||||
<span class="muted detail">
|
||||
{[book.pages ? `${book.pages} pages` : '', book.published?.slice(0, 4) ?? ''].filter(Boolean).join(' · ')}
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</Panel>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if read.length}
|
||||
<BookShelfGrid title="Read" icon="mdi:check-circle-outline" books={read} />
|
||||
{/if}
|
||||
|
||||
{#if wantToRead.length}
|
||||
<BookShelfGrid title="Want to read" icon="mdi:bookmark-outline" books={wantToRead} />
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.overview {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.overview.single {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.fetch {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--blue);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.breakdown {
|
||||
display: flex;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.block {
|
||||
flex-basis: 0;
|
||||
min-width: 0.5rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.reading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.reading-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.4rem;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.reading-row:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.reading-row img,
|
||||
.cover-fallback {
|
||||
flex-shrink: 0;
|
||||
width: 52px;
|
||||
height: 78px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.cover-fallback {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: color-mix(in srgb, var(--foreground) 8%, transparent);
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.reading-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.title,
|
||||
.detail {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
@container (max-width: 800px) {
|
||||
.overview {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -11,9 +11,11 @@ import hackathonsData from '#content/projects/hackathons.json';
|
||||
import researchData from '#content/projects/research.json';
|
||||
import organizationsData from '#content/projects/organizations.json';
|
||||
import tcgDecksData from '#content/tcgDecks.json';
|
||||
import booksData from '#content/books.json';
|
||||
import type {
|
||||
AboutContent,
|
||||
BlogSettings,
|
||||
Book,
|
||||
DesktopContent,
|
||||
Experience,
|
||||
Leadership,
|
||||
@@ -37,6 +39,7 @@ export const blogSettings: BlogSettings = blogData;
|
||||
export const playlist: Playlist = musicData;
|
||||
export const researchGroups: ResearchGroup[] = researchData;
|
||||
export const tcgDecks: TcgDeck[] = tcgDecksData as TcgDeck[];
|
||||
export const books: Book[] = booksData as Book[];
|
||||
|
||||
function featuredFirst(projects: Project[]): Project[] {
|
||||
return [...projects].sort((first, second) => Number(!!second.featured) - Number(!!first.featured));
|
||||
|
||||
@@ -139,15 +139,23 @@ export interface RatedTitle {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type BookStatus = 'read' | 'reading';
|
||||
export type BookShelf = 'read' | 'reading' | 'want-to-read';
|
||||
|
||||
export interface Book {
|
||||
goodreadsId: string;
|
||||
url: string;
|
||||
title: string;
|
||||
author: string;
|
||||
authors: string[];
|
||||
cover: string | null;
|
||||
description: string | null;
|
||||
pages: number | null;
|
||||
published: string | null;
|
||||
genres: string[];
|
||||
averageRating: number | null;
|
||||
ratingCount: number | null;
|
||||
shelf: BookShelf;
|
||||
rating?: number;
|
||||
isbn?: string;
|
||||
url?: string;
|
||||
status?: BookStatus;
|
||||
added?: string;
|
||||
}
|
||||
|
||||
export interface LabeledValue {
|
||||
@@ -172,7 +180,6 @@ export interface AboutContent {
|
||||
games: Game[];
|
||||
shows: RatedTitle[];
|
||||
movies: RatedTitle[];
|
||||
books?: Book[];
|
||||
}
|
||||
|
||||
export type GameName = 'snake' | 'breakout';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { about, profile } from '#lib/content';
|
||||
import { about, books, profile } from '#lib/content';
|
||||
import PageHeader from '#lib/components/ui/PageHeader.svelte';
|
||||
import ProfileIntro from '#lib/components/ui/ProfileIntro.svelte';
|
||||
import SectionNav from '#lib/components/ui/SectionNav.svelte';
|
||||
@@ -8,8 +8,7 @@
|
||||
import AniListSection from '#lib/components/about/AniListSection.svelte';
|
||||
import MediaGrid from '#lib/components/about/MediaGrid.svelte';
|
||||
import GameCard from '#lib/components/about/GameCard.svelte';
|
||||
import BookGrid from '#lib/components/about/BookGrid.svelte';
|
||||
import { sortBooks } from '#lib/books/books';
|
||||
import BooksSection from '#lib/components/about/books/BooksSection.svelte';
|
||||
import SetupSection from '#lib/components/about/setup/SetupSection.svelte';
|
||||
import ListeningSection from '#lib/components/about/listening/ListeningSection.svelte';
|
||||
import type { PageProps } from './$types';
|
||||
@@ -19,7 +18,6 @@
|
||||
const byRating = (first: { rating: number }, second: { rating: number }) => second.rating - first.rating;
|
||||
const shows = [...about.shows].sort(byRating);
|
||||
const movies = [...about.movies].sort(byRating);
|
||||
const books = sortBooks(about.books ?? []);
|
||||
const mediaGroups = [
|
||||
{ id: 'shows', title: 'TV Shows', items: shows, kind: 'show' as const },
|
||||
{ id: 'movies', title: 'Movies', items: movies, kind: 'movie' as const }
|
||||
@@ -76,7 +74,7 @@
|
||||
|
||||
{#if books.length}
|
||||
<Section title="Books" id="books">
|
||||
<BookGrid {books} />
|
||||
<BooksSection {books} />
|
||||
</Section>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in new issue
Block a user