From 8b5595b30c96f2e98cb4950bc5e50b586755dcdc Mon Sep 17 00:00:00 2001 From: Tanner Heffner Date: Wed, 27 Mar 2024 21:17:03 -0700 Subject: [PATCH] prettier --- src/lib/components/Currently.svelte | 4 +++- src/routes/(main)/+page.server.js | 15 +++++++++++---- src/routes/(main)/blog/fuzzySearch.js | 8 +------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/lib/components/Currently.svelte b/src/lib/components/Currently.svelte index 2330a1d..bb3b8e1 100644 --- a/src/lib/components/Currently.svelte +++ b/src/lib/components/Currently.svelte @@ -4,8 +4,10 @@ export let recentlyPlayed export let duolingo - const formattedDate = new Date(duolingo.streakData.currentStreak.startDate).toLocaleDateString('en-us', { year:"numeric", month:"short", day:"numeric"}) + const formattedDate = new Date(duolingo.streakData.currentStreak.startDate) + .toLocaleDateString('en-us', { year: 'numeric', month: 'short', day: 'numeric'}) + // https://dev.to/jorik/country-code-to-flag-emoji-a21 function getFlagEmoji(countryCode) { const codePoints = countryCode .toUpperCase() diff --git a/src/routes/(main)/+page.server.js b/src/routes/(main)/+page.server.js index aa08bb6..9b1a682 100644 --- a/src/routes/(main)/+page.server.js +++ b/src/routes/(main)/+page.server.js @@ -1,5 +1,10 @@ import { LASTFM_API_KEY, STEAM_API_KEY } from '$env/static/private' -import { LASTFM_ID, LETTERBOXD_ID, STEAM_ID, DUOLINGO_ID } from '$lib/siteConfig' +import { + LASTFM_ID, + LETTERBOXD_ID, + STEAM_ID, + DUOLINGO_ID, +} from '$lib/siteConfig' import letterboxd from 'letterboxd' /** @type {import('./$types').PageServerLoad} */ @@ -28,14 +33,16 @@ export async function load({ fetch, params }) { const steam_json = await steam_res.json() const recentlyPlayed = steam_json.response - // Fetch stats from Duolingo. - const duolingo_res = await fetch(`https://www.duolingo.com/2017-06-30/users?username=${DUOLINGO_ID}`) + // Fetch stats from Duolingo. This is an unofficial endpoint, may break!! + const duolingo_res = await fetch( + `https://www.duolingo.com/2017-06-30/users?username=${DUOLINGO_ID}` + ) const duolingo_json = await duolingo_res.json() return { recentlyListened, recentlyWatched, recentlyPlayed, - duolingo: duolingo_json.users[0] + duolingo: duolingo_json.users[0], } } diff --git a/src/routes/(main)/blog/fuzzySearch.js b/src/routes/(main)/blog/fuzzySearch.js index c07d532..caf3d4c 100644 --- a/src/routes/(main)/blog/fuzzySearch.js +++ b/src/routes/(main)/blog/fuzzySearch.js @@ -52,13 +52,7 @@ function _fuzzySearch(items, selectedCategories, search) { }) if (search) { const haystack = filteredItems.map((v) => - [ - v.title, - v.subtitle, - v.tags, - v.content, - v.description, - ].join(' ') + [v.title, v.subtitle, v.tags, v.content, v.description].join(' ') ) const idxs = u.filter(haystack, search) const info = u.info(idxs, haystack, search)