mirror of
https://github.com/BradNut/personal-website-sveltekit
synced 2025-09-08 23:20:18 +00:00
Cleaning up old React code portions and typing albums.
This commit is contained in:
parent
8f74589539
commit
680a023c87
6 changed files with 66 additions and 53 deletions
|
|
@ -33,7 +33,7 @@
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<h3>{album.title.length > 20 ? `${album.title.slice(0, 20)}...` : album.title}</h3>
|
<h3>{album.title.length > 20 ? `${album.title.slice(0, 20)}...` : album.title}</h3>
|
||||||
<h3>by {album.artist}</h3>
|
<h3>{album.artist}</h3>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
import { BANDCAMP_USERNAME, USE_REDIS_CACHE } from '$env/static/private';
|
import { BANDCAMP_USERNAME, USE_REDIS_CACHE } from '$env/static/private';
|
||||||
import scrapeIt from 'scrape-it';
|
import scrapeIt from 'scrape-it';
|
||||||
|
import type { ScrapeResult } from 'scrape-it';
|
||||||
import { redis } from '../server/redis';
|
import { redis } from '../server/redis';
|
||||||
import type { Album } from '../types/album';
|
import type { Album } from '../types/album';
|
||||||
|
|
||||||
export async function fetchBandcampAlbums() {
|
export async function fetchBandcampAlbums() {
|
||||||
try {
|
try {
|
||||||
if (USE_REDIS_CACHE) {
|
if (USE_REDIS_CACHE) {
|
||||||
const cached = await redis.get('bandcampAlbums');
|
const cached: string | null = await redis.get('bandcampAlbums');
|
||||||
|
|
||||||
if (cached) {
|
if (cached) {
|
||||||
const response = JSON.parse(cached);
|
const response: Album[] = JSON.parse(cached);
|
||||||
console.log(`Cache hit!`);
|
console.log(`Cache hit!`);
|
||||||
const ttl = await redis.ttl('bandcampAlbums');
|
const ttl = await redis.ttl('bandcampAlbums');
|
||||||
|
|
||||||
|
|
@ -17,27 +18,30 @@ export async function fetchBandcampAlbums() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await scrapeIt(`https://bandcamp.com/${BANDCAMP_USERNAME}`, {
|
const { data }: ScrapeResult<Album[]> = await scrapeIt(
|
||||||
collectionItems: {
|
`https://bandcamp.com/${BANDCAMP_USERNAME}`,
|
||||||
listItem: '.collection-item-container',
|
{
|
||||||
data: {
|
collectionItems: {
|
||||||
url: {
|
listItem: '.collection-item-container',
|
||||||
selector: '.collection-title-details > a.item-link',
|
data: {
|
||||||
attr: 'href'
|
url: {
|
||||||
},
|
selector: '.collection-title-details > a.item-link',
|
||||||
artwork: {
|
attr: 'href'
|
||||||
selector: 'div.collection-item-art-container a img',
|
},
|
||||||
attr: 'src'
|
artwork: {
|
||||||
},
|
selector: 'div.collection-item-art-container a img',
|
||||||
title: {
|
attr: 'src'
|
||||||
selector: 'span.item-link-alt > div.collection-item-title'
|
},
|
||||||
},
|
title: {
|
||||||
artist: {
|
selector: 'span.item-link-alt > div.collection-item-title'
|
||||||
selector: 'span.item-link-alt > div.collection-item-artist'
|
},
|
||||||
|
artist: {
|
||||||
|
selector: 'span.item-link-alt > div.collection-item-artist'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
const albums: Album[] = data?.collectionItems || [];
|
const albums: Album[] = data?.collectionItems || [];
|
||||||
// console.log(`Albums ${JSON.stringify(albums)}`);
|
// console.log(`Albums ${JSON.stringify(albums)}`);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import type { PageServerLoad } from './lib/$types';
|
import type { PageServerLoad } from './lib/$types';
|
||||||
import { PAGE_SIZE } from '$env/static/private';
|
|
||||||
import { fetchBandcampAlbums } from '$root/lib/util/fetchBandcampAlbums';
|
import { fetchBandcampAlbums } from '$root/lib/util/fetchBandcampAlbums';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch, setHeaders }) => {
|
export const load: PageServerLoad = async ({ fetch, setHeaders }) => {
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
.home {
|
.home {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: 2rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.social-info {
|
.social-info {
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</Picture>
|
</Picture>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="portfolio-details">
|
||||||
<p>
|
<p>
|
||||||
My personal website written using the following
|
My personal website written using the following
|
||||||
technologies.
|
technologies.
|
||||||
|
|
@ -332,6 +332,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.portfolio-details) {
|
||||||
|
margin: 1rem;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 1rem;
|
||||||
|
list-style: circle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:global(.portfolioPicture) {
|
:global(.portfolioPicture) {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
width: minmax(200px, 500px);
|
width: minmax(200px, 500px);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Picture } from "svelte-lazy-loader";
|
import { Picture } from "svelte-lazy-loader";
|
||||||
import SEO from "$root/lib/components/SEO.svelte";
|
|
||||||
import desktop from '$lib/assets/images/Desktop_so_clean.jpg';
|
import desktop from '$lib/assets/images/Desktop_so_clean.jpg';
|
||||||
import desktopFormats from '$lib/assets/images/Desktop_so_clean.jpg?format=webp;avif;jpg&metadata';
|
import desktopFormats from '$lib/assets/images/Desktop_so_clean.jpg?format=webp;avif;jpg&metadata';
|
||||||
import desktopBlurred from '$lib/assets/images/Desktop_so_clean.jpg?w=100&jpg&blur=10';
|
import desktopBlurred from '$lib/assets/images/Desktop_so_clean.jpg?w=100&jpg&blur=10';
|
||||||
|
|
@ -14,7 +13,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h1>/Uses</h1>
|
<h1>/Uses</h1>
|
||||||
<p>
|
<p>
|
||||||
Inspired by{' '}
|
Inspired by
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://wesbos.com"
|
href="https://wesbos.com"
|
||||||
|
|
@ -22,7 +21,7 @@
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
Wes Bos's
|
Wes Bos's
|
||||||
</a>{' '}
|
</a>
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://wesbos.com/uses"
|
href="https://wesbos.com/uses"
|
||||||
|
|
@ -30,8 +29,8 @@
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
/uses
|
/uses
|
||||||
</a>{' '}
|
</a>
|
||||||
page and{' '}
|
page and
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://uses.tech/"
|
href="https://uses.tech/"
|
||||||
|
|
@ -39,27 +38,22 @@
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
uses.tech
|
uses.tech
|
||||||
</a>
|
</a>, this is a list of what I use everyday for my work and personal life.
|
||||||
, this is a list of what I use everyday for my work and personal life.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="uses-block-styles">
|
<div class="uses-block-styles">
|
||||||
<div style="display: grid; grid-template-columns: minmax(400px, 0.65fr); justify-content: center; margin-bottom: 2rem;">
|
<figure>
|
||||||
<figure>
|
<Picture placeholder={desktopBlurred} src={desktop} alt="Clean desk with Samsung monitor and Ducky Keyboard" loading='eager'>
|
||||||
<div>
|
{#each desktopFormats as { src, format }}
|
||||||
<Picture placeholder={desktopBlurred} src={desktop} alt="Clean desk with Samsung monitor and Ducky Keyboard" loading='eager'>
|
<source data-srcset={src} type="image/{format}" />
|
||||||
{#each desktopFormats as { src, format }}
|
{/each}
|
||||||
<source data-srcset={src} type="image/{format}" />
|
</Picture>
|
||||||
{/each}
|
</figure>
|
||||||
</Picture>
|
|
||||||
</div>
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
<h2>Hardware & Accessories</h2>
|
<h2>Hardware & Accessories</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>MacBook Pro 15-inch for work.</li>
|
<li>MacBook Pro 15-inch for work.</li>
|
||||||
<li>
|
<li>
|
||||||
Personal desktop running{' '}
|
Personal desktop running
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="PopOS Linux Distro"
|
aria-label="PopOS Linux Distro"
|
||||||
|
|
@ -73,7 +67,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>Dell XPS 13 running PopOS.</li>
|
<li>Dell XPS 13 running PopOS.</li>
|
||||||
<li>
|
<li>
|
||||||
Phone 📱: Pixel 6 running{' '}
|
Phone 📱: Pixel 6 running
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="GrapheneOS"
|
aria-label="GrapheneOS"
|
||||||
|
|
@ -86,7 +80,7 @@
|
||||||
.
|
.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Keyboard ⌨️:{' '}
|
Keyboard ⌨️:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Ducky Keyboard"
|
aria-label="Ducky Keyboard"
|
||||||
|
|
@ -98,7 +92,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Mouse 🖱️:{' '}
|
Mouse 🖱️:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Logitech G502 Gaming Mouse"
|
aria-label="Logitech G502 Gaming Mouse"
|
||||||
|
|
@ -110,7 +104,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Chair 🪑:{' '}
|
Chair 🪑:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Secretlab Omega 2020 Fabric"
|
aria-label="Secretlab Omega 2020 Fabric"
|
||||||
|
|
@ -122,7 +116,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Monitor 🖥️:{' '}
|
Monitor 🖥️:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Samsung Odyssey G7 Gaming Monitor"
|
aria-label="Samsung Odyssey G7 Gaming Monitor"
|
||||||
|
|
@ -138,7 +132,7 @@
|
||||||
<div class="uses-block-styles">
|
<div class="uses-block-styles">
|
||||||
<h2>Development</h2>
|
<h2>Development</h2>
|
||||||
<p>
|
<p>
|
||||||
My development setup has been documented here:{' '}
|
My development setup has been documented here:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Bradley Shellnut Computer Setup"
|
aria-label="Bradley Shellnut Computer Setup"
|
||||||
|
|
@ -150,7 +144,7 @@
|
||||||
{'. '}
|
{'. '}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
And documentation for my terminal and coding setup can be found here:{' '}
|
And documentation for my terminal and coding setup can be found here:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Bradley Shellnut Dotfiles"
|
aria-label="Bradley Shellnut Dotfiles"
|
||||||
|
|
@ -275,7 +269,7 @@
|
||||||
>
|
>
|
||||||
VSCodium
|
VSCodium
|
||||||
</a>
|
</a>
|
||||||
: Editor for non-Java projects. List of mostly used extensions:{' '}
|
: Editor for non-Java projects. List of mostly used extensions:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/BradNut/dotfiles/blob/master/vs-code-extensions-i-use.md"
|
href="https://github.com/BradNut/dotfiles/blob/master/vs-code-extensions-i-use.md"
|
||||||
|
|
@ -445,7 +439,7 @@
|
||||||
: My go to multi-platform Posting utility
|
: My go to multi-platform Posting utility
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Browser of choice:{' '}
|
Browser of choice:
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Firefox Best Edition"
|
aria-label="Firefox Best Edition"
|
||||||
|
|
@ -464,7 +458,7 @@
|
||||||
self-hosted systems and systems I trust to hold my data.
|
self-hosted systems and systems I trust to hold my data.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If you want to see more info about this head to my{' '}
|
If you want to see more info about this head to my
|
||||||
<a href="/privacy">Privacy</a> page.
|
<a href="/privacy">Privacy</a> page.
|
||||||
</p>
|
</p>
|
||||||
<p>Hardware Authentication</p>
|
<p>Hardware Authentication</p>
|
||||||
|
|
@ -551,6 +545,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
|
figure {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(400px, 0.65fr);
|
||||||
|
place-content: center;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.uses {
|
.uses {
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue