Skip to content

Commit

Permalink
Polished header outline.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Mar 18, 2024
1 parent e21e439 commit 39435c9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/data/Amy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4400,6 +4400,7 @@ export const Amy: ProfileSpec = {
'2021': 'Informatics program chair; COVID-19; gender transition',
'2022': 'Informatics program chair; gender transition; sabbatical (Summer/Fall)',
'2023': 'Sabbatical (Winter/Spring/Summer)',
'2024': 'Informatics program chair; Associate Dean for Academics',
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
<li
><Link
to={`${$page.url.pathname.replace(base, '')}#${id}`}
active={id === activeid}>{header}</Link
active={id === activeid}
>{header.substring(0, 32) +
(header.length > 32 ? '' : '')}</Link
></li
>
{/each}
Expand Down
19 changes: 9 additions & 10 deletions src/lib/components/Page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
let closestID: string | undefined = undefined;
let scrollY: number;
$: if (browser && typeof document !== undefined && $navigating === null) {
headers = Array.from(document.getElementsByTagName('h2'))
.map((a) =>
a instanceof HTMLElement
? [a.innerText.replaceAll('🔗', '').trim(), a.id]
: undefined
)
.filter((a): a is [string, string] => a !== undefined);
}
$: if (scrollY >= 0) {
if (browser && typeof document !== undefined && $navigating === null) {
headers = Array.from(document.getElementsByTagName('h2'))
.map((a) =>
a instanceof HTMLElement
? [a.innerText.replaceAll('🔗', '').trim(), a.id]
: undefined
)
.filter((a): a is [string, string] => a !== undefined);
}
closestID = Array.from(document.getElementsByTagName('h2')).sort(
(h1, h2) =>
Math.abs(h1.offsetTop - scrollY) -
Expand Down
15 changes: 14 additions & 1 deletion src/routes/(app)/essays/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@
import Image from '$lib/components/Thumbnail.svelte';
import type { PostTagType } from '../../../lib/models/Post';
import Title from '$lib/components/Title.svelte';
import Linkable from '$lib/components/Linkable.svelte';
let filter: Record<string, PostTagType> = {};
$: posts = $profile.getPosts(
(post) => !('topic' in filter) || post.tags.includes(filter.topic),
(post) =>
-(
$profile.getPostMonthYear(post).year * 12 +
$profile.getPostMonthYear(post).month
)
);
function setFilter(tag: Record<string, PostTagType>) {
filter = tag;
}
Expand All @@ -35,8 +45,11 @@

<Facets facets={$profile.getPostTags()} update={setFilter} />

{#each $profile.getPosts( (post) => !('topic' in filter) || post.tags.includes(filter.topic), (post) => -($profile.getPostMonthYear(post).year * 12 + $profile.getPostMonthYear(post).month) ) as post}
{#each posts as post, index}
{@const date = $profile.getPostMonthYear(post)}
{#if index === 0 || date.year !== $profile.getPostMonthYear(posts[index - 1]).year}
<Linkable id={`${date.year}`}>{date.year}</Linkable>
{/if}
<Block link={post.url} header={post.title}>
<svelte:fragment slot="image">
{#if post.img}
Expand Down
9 changes: 5 additions & 4 deletions src/routes/(app)/publications/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { scrollToHash } from '$lib/models/utilities';
import Alert from '../../../lib/components/Alert.svelte';
import Title from '$lib/components/Title.svelte';
import Linkable from '$lib/components/Linkable.svelte';
let selection: Record<string, string> = {};
Expand Down Expand Up @@ -84,11 +85,11 @@
<!-- // Create a list of publications, inserting year headers when the year changes. -->
{#each pubs as pub, index}
{#if index === 0 || pubs[index - 1].year !== pub.year}
<h3
>{pub.year}{#if $profile.getYearContexts()[pub.year]}<small>
&mdash; <em>{$profile.getYearContexts()[pub.year]}</em
<Linkable id={`${pub.year}`}>
{pub.year}{#if $profile.getYearContexts()[pub.year]}<small>
&ndash; <em>{$profile.getYearContexts()[pub.year]}</em
></small
>{/if}</h3
>{/if}</Linkable
>
{/if}

Expand Down
14 changes: 13 additions & 1 deletion src/routes/(app)/talks/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import Image from '$lib/components/Thumbnail.svelte';
import Link from '$lib/components/Link.svelte';
import Title from '$lib/components/Title.svelte';
import Linkable from '$lib/components/Linkable.svelte';
$: talks = $profile.getTalks(
undefined,
(talk) => -parseDate(talk.date).getTime()
);
const months = [
'Jan',
Expand All @@ -27,8 +33,14 @@

<h1> These are my upcoming and past keynotes and invited talks. </h1>

{#each $profile.getTalks(undefined, (talk) => -parseDate(talk.date).getTime()) as talk}
{#each talks as talk, index}
{@const date = parseDate(talk.date)}
{#if index === 0 || date.getFullYear() !== parseDate(talks[index - 1].date).getFullYear()}
<Linkable id={`${date.getFullYear()}`}>
{date.getFullYear()}</Linkable
>
{/if}

<Block
link={talk.recording
? talk.recording
Expand Down

0 comments on commit 39435c9

Please sign in to comment.