From 2f6cfbe7aed2f89f3563f6165357b9d09c43bfb6 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sat, 19 Oct 2024 19:50:10 -0700 Subject: [PATCH] chore: normalize formatting --- config/collections/index.js | 62 ++++--- config/events/index.js | 78 ++++---- config/filters/dates.js | 34 ++-- config/filters/general.js | 27 +-- config/filters/index.js | 10 +- config/filters/media.js | 56 +++--- config/filters/navigation.js | 6 +- config/plugins/css-config.js | 38 ++-- config/utilities/index.js | 37 ++-- scripts/worker-build.mjs | 33 ++-- src/assets/scripts/index.js | 2 +- src/assets/styles/base/index.css | 174 +++++++++++++----- src/assets/styles/components/badge-grid.css | 2 +- src/assets/styles/components/banners.css | 26 ++- src/assets/styles/components/buttons.css | 9 +- src/assets/styles/components/forms.css | 4 +- .../styles/components/mastodon-post.css | 7 +- src/assets/styles/components/media-grid.css | 7 +- src/assets/styles/components/menu.css | 2 +- src/assets/styles/components/modal.css | 2 +- src/assets/styles/components/music-chart.css | 2 +- src/assets/styles/components/paginator.css | 2 +- src/assets/styles/components/progress-bar.css | 2 +- src/assets/styles/components/tab-buttons.css | 2 +- src/assets/styles/components/text-toggle.css | 4 +- src/assets/styles/components/theme-toggle.css | 12 +- src/assets/styles/defaults/fonts.css | 10 +- src/assets/styles/defaults/vars.css | 13 +- src/assets/styles/feed.xsl | 45 +++-- src/assets/styles/index.css | 56 +++--- src/assets/styles/pages/about.css | 2 +- src/assets/styles/pages/articles.css | 2 +- src/assets/styles/pages/blogroll.css | 2 +- src/assets/styles/pages/books.css | 5 +- src/assets/styles/pages/contact.css | 2 +- src/assets/styles/pages/feeds.css | 2 +- src/assets/styles/pages/links.css | 2 +- src/assets/styles/pages/music.css | 2 +- src/assets/styles/pages/watching.css | 7 +- src/assets/styles/pages/webrings.css | 2 +- src/assets/styles/plugins/prism.css | 4 +- src/assets/styles/reset.css | 19 +- src/assets/styles/styles.json | 2 +- src/data/activity.js | 22 +-- src/data/albumReleases.js | 56 +++--- src/data/artists.js | 54 +++--- src/data/blogroll.js | 34 ++-- src/data/books.js | 70 +++---- src/data/concerts.js | 50 ++--- src/data/genres.js | 28 ++- src/data/globals.js | 30 +-- src/data/links.js | 44 ++--- src/data/movies.js | 71 +++---- src/data/music.js | 66 +++---- src/data/nav.js | 54 +++--- src/data/nowPlaying.js | 38 ++-- src/data/pages.js | 44 ++--- src/data/posts.js | 46 ++--- src/data/robots.js | 44 ++--- src/data/syndication.js | 22 +-- src/data/tv.js | 74 ++++---- 61 files changed, 921 insertions(+), 743 deletions(-) diff --git a/config/collections/index.js b/config/collections/index.js index cde79213..f8c82641 100644 --- a/config/collections/index.js +++ b/config/collections/index.js @@ -1,37 +1,45 @@ -import { DateTime } from 'luxon' -import ics from 'ics' +import { DateTime } from "luxon"; +import ics from "ics"; export const albumReleasesCalendar = (collection) => { - const collectionData = collection.getAll()[0] - const { data } = collectionData - const { albumReleases: { all } } = data - if (!all || all.length === 0) return '' + const collectionData = collection.getAll()[0]; + const { data } = collectionData; + const { + albumReleases: { all }, + } = data; + if (!all || all.length === 0) return ""; - const events = all.map(album => { - const date = DateTime.fromISO(album['release_date']) - if (!date.isValid) return null + const events = all + .map((album) => { + const date = DateTime.fromISO(album["release_date"]); + if (!date.isValid) return null; - return { - start: [date.year, date.month, date.day], - startInputType: 'local', - startOutputType: 'local', - title: `Release: ${album['artist']['name']} - ${album['title']}`, - description: `Check out this new album release: ${album['url']}. Read more about ${album['artist']['name']} at https://coryd.dev${album['artist']['url']}`, - url: album['url'], - uid: `${date.toFormat('yyyyMMdd')}-${album['artist']['name']}-${album['title']}@coryd.dev`, - timestamp: DateTime.now().toUTC().toFormat("yyyyMMdd'T'HHmmss'Z'") - } - }).filter(event => event !== null) + return { + start: [date.year, date.month, date.day], + startInputType: "local", + startOutputType: "local", + title: `Release: ${album["artist"]["name"]} - ${album["title"]}`, + description: `Check out this new album release: ${album["url"]}. Read more about ${album["artist"]["name"]} at https://coryd.dev${album["artist"]["url"]}`, + url: album["url"], + uid: `${date.toFormat("yyyyMMdd")}-${album["artist"]["name"]}-${ + album["title"] + }@coryd.dev`, + timestamp: DateTime.now().toUTC().toFormat("yyyyMMdd'T'HHmmss'Z'"), + }; + }) + .filter((event) => event !== null); - const { error, value } = ics.createEvents(events, { calName: 'Album releases calendar / coryd.dev' }) + const { error, value } = ics.createEvents(events, { + calName: "Album releases calendar / coryd.dev", + }); if (error) { - console.error('Error creating events: ', error) + console.error("Error creating events: ", error); events.forEach((event, index) => { - console.error(`Event ${index}:`, event) - }) - return '' + console.error(`Event ${index}:`, event); + }); + return ""; } - return value -} \ No newline at end of file + return value; +}; diff --git a/config/events/index.js b/config/events/index.js index df9378f2..ebc6ba10 100644 --- a/config/events/index.js +++ b/config/events/index.js @@ -1,59 +1,75 @@ -import fs from 'fs' -import path from 'path' -import { minify } from 'terser' +import fs from "fs"; +import path from "path"; +import { minify } from "terser"; -const errorPages = ['404', '500', '1000', 'broken', 'error', 'js-challenge', 'not-allowed', 'rate-limit'] +const errorPages = [ + "404", + "500", + "1000", + "broken", + "error", + "js-challenge", + "not-allowed", + "rate-limit", +]; export const copyErrorPages = () => { errorPages.forEach((errorPage) => { - const sourcePath = path.join('_site', errorPage, 'index.html') - const destinationPath = path.join('_site', `${errorPage}.html`) - const directoryPath = path.join('_site', errorPage) + const sourcePath = path.join("_site", errorPage, "index.html"); + const destinationPath = path.join("_site", `${errorPage}.html`); + const directoryPath = path.join("_site", errorPage); fs.copyFile(sourcePath, destinationPath, (err) => { if (err) { - console.error(`Error copying ${errorPage} page:`, err) - return + console.error(`Error copying ${errorPage} page:`, err); + return; } fs.unlink(sourcePath, (unlinkErr) => { if (unlinkErr) { - console.error(`Error deleting source file for ${errorPage} page:`, unlinkErr) - return + console.error( + `Error deleting source file for ${errorPage} page:`, + unlinkErr + ); + return; } fs.rmdir(directoryPath, (rmdirErr) => { - if (rmdirErr) console.error(`Error removing directory for ${errorPage} page:`, rmdirErr) - }) - }) - }) - }) -} + if (rmdirErr) + console.error( + `Error removing directory for ${errorPage} page:`, + rmdirErr + ); + }); + }); + }); + }); +}; export const minifyJsComponents = async () => { - const scriptsDir = '_site/assets/scripts' + const scriptsDir = "_site/assets/scripts"; const minifyJsFilesInDir = async (dir) => { - const files = fs.readdirSync(dir) + const files = fs.readdirSync(dir); for (const fileName of files) { - const filePath = path.join(dir, fileName) - const stat = fs.statSync(filePath) + const filePath = path.join(dir, fileName); + const stat = fs.statSync(filePath); if (stat.isDirectory()) { - await minifyJsFilesInDir(filePath) - } else if (fileName.endsWith('.js')) { - const fileContent = fs.readFileSync(filePath, 'utf8') - const minified = await minify(fileContent) + await minifyJsFilesInDir(filePath); + } else if (fileName.endsWith(".js")) { + const fileContent = fs.readFileSync(filePath, "utf8"); + const minified = await minify(fileContent); if (minified.error) { - console.error(`Error minifying ${filePath}:`, minified.error) + console.error(`Error minifying ${filePath}:`, minified.error); } else { - fs.writeFileSync(filePath, minified.code) + fs.writeFileSync(filePath, minified.code); } } else { - console.log(`No .js files to minify in ${filePath}`) + console.log(`No .js files to minify in ${filePath}`); } } - } + }; - await minifyJsFilesInDir(scriptsDir) -} \ No newline at end of file + await minifyJsFilesInDir(scriptsDir); +}; diff --git a/config/filters/dates.js b/config/filters/dates.js index 1e308d9a..5ef3c07c 100644 --- a/config/filters/dates.js +++ b/config/filters/dates.js @@ -1,26 +1,26 @@ export default { stringToRFC822Date: (dateString) => { - const date = new Date(dateString) + const date = new Date(dateString); - if (isNaN(date)) return '' + if (isNaN(date)) return ""; const options = { - weekday: 'short', - day: '2-digit', - month: 'short', - year: 'numeric', - hour: '2-digit', - minute: '2-digit', - second: '2-digit', - timeZoneName: 'short' - } - const formatter = new Intl.DateTimeFormat('en-GB', options) + weekday: "short", + day: "2-digit", + month: "short", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + timeZoneName: "short", + }; + const formatter = new Intl.DateTimeFormat("en-GB", options); - return formatter.format(date).replace(',', '') + return formatter.format(date).replace(",", ""); }, stringToRFC3339: (dateString) => { - const date = new Date(dateString) + const date = new Date(dateString); - return isNaN(date) ? '' : date.toISOString() - } -} \ No newline at end of file + return isNaN(date) ? "" : date.toISOString(); + }, +}; diff --git a/config/filters/general.js b/config/filters/general.js index 97bd9651..43f86aa9 100644 --- a/config/filters/general.js +++ b/config/filters/general.js @@ -1,18 +1,19 @@ -import truncateHtml from 'truncate-html' -import { shuffleArray } from '../utilities/index.js' +import truncateHtml from "truncate-html"; +import { shuffleArray } from "../utilities/index.js"; export default { encodeAmp: (string) => { - if (!string) return - const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g - const replacement = '&' - return string.replace(pattern, replacement) + if (!string) return; + const pattern = /&(?!(?:[a-zA-Z]+|#[0-9]+|#x[0-9a-fA-F]+);)/g; + const replacement = "&"; + return string.replace(pattern, replacement); }, - replaceQuotes: (string) => string.replace(/"/g, '"'), - formatNumber: (number) => number.toLocaleString('en-US'), - htmlTruncate: (content, limit = 50) => truncateHtml(content, limit, { - byWords: true, - ellipsis: '...' - }), + replaceQuotes: (string) => string.replace(/"/g, """), + formatNumber: (number) => number.toLocaleString("en-US"), + htmlTruncate: (content, limit = 50) => + truncateHtml(content, limit, { + byWords: true, + ellipsis: "...", + }), shuffleArray, -} \ No newline at end of file +}; diff --git a/config/filters/index.js b/config/filters/index.js index 94a6a2cf..668f3839 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -1,11 +1,11 @@ -import dates from './dates.js' -import general from './general.js' -import media from './media.js' -import navigation from './navigation.js' +import dates from "./dates.js"; +import general from "./general.js"; +import media from "./media.js"; +import navigation from "./navigation.js"; export default { ...dates, ...general, ...media, ...navigation, -} \ No newline at end of file +}; diff --git a/config/filters/media.js b/config/filters/media.js index b7d0d895..80548dc3 100644 --- a/config/filters/media.js +++ b/config/filters/media.js @@ -1,35 +1,43 @@ export default { - filterBooksByStatus: (books, status) => books.filter(book => book['status'] === status), - findFavoriteBooks: (books) => books.filter(book => book['favorite'] === true), - bookYearLinks: (years) => years - .sort((a, b) => b['value'] - a['value']) - .map((year, index) => `${year['value']}${index < years.length - 1 ? ' / ' : ''}`) - .join(''), + filterBooksByStatus: (books, status) => + books.filter((book) => book["status"] === status), + findFavoriteBooks: (books) => + books.filter((book) => book["favorite"] === true), + bookYearLinks: (years) => + years + .sort((a, b) => b["value"] - a["value"]) + .map( + (year, index) => + `${year["value"]}${ + index < years.length - 1 ? " / " : "" + }` + ) + .join(""), mediaLinks: (data, type, count = 10) => { - if (!data || !type) return '' + if (!data || !type) return ""; - const dataSlice = data.slice(0, count) - if (dataSlice.length === 0) return null + const dataSlice = data.slice(0, count); + if (dataSlice.length === 0) return null; const buildLink = (item) => { switch (type) { - case 'genre': - return `${item['genre_name']}` - case 'artist': - return `${item['name']}` - case 'book': - return `${item['title']}` + case "genre": + return `${item["genre_name"]}`; + case "artist": + return `${item["name"]}`; + case "book": + return `${item["title"]}`; default: - return '' + return ""; } - } + }; - if (dataSlice.length === 1) return buildLink(dataSlice[0]) + if (dataSlice.length === 1) return buildLink(dataSlice[0]); - const links = dataSlice.map(buildLink) - const allButLast = links.slice(0, -1).join(', ') - const last = links[links.length - 1] + const links = dataSlice.map(buildLink); + const allButLast = links.slice(0, -1).join(", "); + const last = links[links.length - 1]; - return `${allButLast} and ${last}` - } -} \ No newline at end of file + return `${allButLast} and ${last}`; + }, +}; diff --git a/config/filters/navigation.js b/config/filters/navigation.js index 1b139039..587d26fa 100644 --- a/config/filters/navigation.js +++ b/config/filters/navigation.js @@ -1,3 +1,5 @@ export default { - isLinkActive: (category, page) => page.includes(category) && page.split('/').filter(a => a !== '').length <= 1 -} \ No newline at end of file + isLinkActive: (category, page) => + page.includes(category) && + page.split("/").filter((a) => a !== "").length <= 1, +}; diff --git a/config/plugins/css-config.js b/config/plugins/css-config.js index fd55c8d8..677ea385 100644 --- a/config/plugins/css-config.js +++ b/config/plugins/css-config.js @@ -1,33 +1,33 @@ -import fs from 'node:fs/promises' -import path from 'node:path' -import postcss from 'postcss' -import postcssImport from 'postcss-import' -import postcssImportExtGlob from 'postcss-import-ext-glob' -import autoprefixer from 'autoprefixer' -import cssnano from 'cssnano' +import fs from "node:fs/promises"; +import path from "node:path"; +import postcss from "postcss"; +import postcssImport from "postcss-import"; +import postcssImportExtGlob from "postcss-import-ext-glob"; +import autoprefixer from "autoprefixer"; +import cssnano from "cssnano"; export const cssConfig = (eleventyConfig) => { - eleventyConfig.addTemplateFormats('css') - eleventyConfig.addExtension('css', { - outputFileExtension: 'css', + eleventyConfig.addTemplateFormats("css"); + eleventyConfig.addExtension("css", { + outputFileExtension: "css", compile: async (inputContent, inputPath) => { - const outputPath = '_site/assets/css/index.css' + const outputPath = "_site/assets/css/index.css"; - if (inputPath.endsWith('index.css')) { + if (inputPath.endsWith("index.css")) { return async () => { let result = await postcss([ postcssImportExtGlob, postcssImport, autoprefixer, cssnano, - ]).process(inputContent, { from: inputPath }) + ]).process(inputContent, { from: inputPath }); - await fs.mkdir(path.dirname(outputPath), { recursive: true }) - await fs.writeFile(outputPath, result.css) + await fs.mkdir(path.dirname(outputPath), { recursive: true }); + await fs.writeFile(outputPath, result.css); - return result.css - } + return result.css; + }; } }, - }) -} \ No newline at end of file + }); +}; diff --git a/config/utilities/index.js b/config/utilities/index.js index 34d8eeb0..47e5636a 100644 --- a/config/utilities/index.js +++ b/config/utilities/index.js @@ -1,27 +1,28 @@ -export const shuffleArray = array => { - const shuffled = [...array] +export const shuffleArray = (array) => { + const shuffled = [...array]; for (let i = shuffled.length - 1; i > 0; i--) { - let j = Math.floor(Math.random() * (i + 1)) - let temp = shuffled[i] - shuffled[i] = shuffled[j] - shuffled[j] = temp + let j = Math.floor(Math.random() * (i + 1)); + let temp = shuffled[i]; + shuffled[i] = shuffled[j]; + shuffled[j] = temp; } - return shuffled -} + return shuffled; +}; -export const regionNames = new Intl.DisplayNames(['en'], { type: 'region' }) +export const regionNames = new Intl.DisplayNames(["en"], { type: "region" }); -export const getCountryName = (countryCode) => regionNames.of(countryCode.trim()) || countryCode.trim() +export const getCountryName = (countryCode) => + regionNames.of(countryCode.trim()) || countryCode.trim(); export const parseCountryField = (countryField) => { - if (!countryField) return null + if (!countryField) return null; - const delimiters = [',', '/', '&', 'and'] - let countries = [countryField] + const delimiters = [",", "/", "&", "and"]; + let countries = [countryField]; - delimiters.forEach(delimiter => { - countries = countries.flatMap(country => country.split(delimiter)) - }) + delimiters.forEach((delimiter) => { + countries = countries.flatMap((country) => country.split(delimiter)); + }); - return countries.map(getCountryName).join(', ') -} \ No newline at end of file + return countries.map(getCountryName).join(", "); +}; diff --git a/scripts/worker-build.mjs b/scripts/worker-build.mjs index bf9f4387..8a9c0f5d 100644 --- a/scripts/worker-build.mjs +++ b/scripts/worker-build.mjs @@ -1,33 +1,36 @@ -import fs from 'fs/promises' -import dotenv from 'dotenv-flow' +import fs from "fs/promises"; +import dotenv from "dotenv-flow"; -dotenv.config() +dotenv.config(); -const workerName = process.argv[2] +const workerName = process.argv[2]; if (!workerName) { - console.error('Please specify a worker name.') - process.exit(1) + console.error("Please specify a worker name."); + process.exit(1); } -const templatePath = `workers/${workerName}/wrangler.template.toml` -const outputPath = `workers/${workerName}/wrangler.toml` +const templatePath = `workers/${workerName}/wrangler.template.toml`; +const outputPath = `workers/${workerName}/wrangler.toml`; async function generateToml() { try { - const template = await fs.readFile(templatePath, 'utf8') + const template = await fs.readFile(templatePath, "utf8"); const output = template .replace(/\${CF_ACCOUNT_ID}/g, process.env.CF_ACCOUNT_ID) .replace(/\${CF_ZONE_ID}/g, process.env.CF_ZONE_ID) - .replace(/\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g, process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID) + .replace( + /\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g, + process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID + ); - await fs.writeFile(outputPath, output) + await fs.writeFile(outputPath, output); - console.log(`Generated wrangler.toml for ${workerName}`) + console.log(`Generated wrangler.toml for ${workerName}`); } catch (error) { - console.error('Error generating wrangler.toml:', error) - process.exit(1) + console.error("Error generating wrangler.toml:", error); + process.exit(1); } } -generateToml() \ No newline at end of file +generateToml(); diff --git a/src/assets/scripts/index.js b/src/assets/scripts/index.js index 9bd36ae9..a71f4446 100644 --- a/src/assets/scripts/index.js +++ b/src/assets/scripts/index.js @@ -297,4 +297,4 @@ window.addEventListener("load", () => { updateSearchResults(nextResults); }); })(); -}); \ No newline at end of file +}); diff --git a/src/assets/styles/base/index.css b/src/assets/styles/base/index.css index d919f801..918c016c 100644 --- a/src/assets/styles/base/index.css +++ b/src/assets/styles/base/index.css @@ -1,5 +1,4 @@ -html -body { +html body { color: var(--text-color); background: var(--background-color); font-family: var(--font-mono); @@ -13,8 +12,8 @@ html { body { font-size: var(--font-size-base); line-height: var(--line-height-base); - letter-spacing: -.025rem; - word-spacing: -.05rem; + letter-spacing: -0.025rem; + word-spacing: -0.05rem; } ::-webkit-scrollbar { @@ -81,7 +80,7 @@ p:not(.banner p) > svg { :is(h1, h2, h3, h4, h5, h6):has(svg) { display: flex; align-items: center; - gap: var(--spacing-sm) + gap: var(--spacing-sm); } strong, @@ -125,29 +124,76 @@ svg { .search, .tattoo, .tv { - &.article { --section-color: var(--article); } - &.books { --section-color: var(--books); } - &.brand-github { --section-color: var(--brand-github); } - &.brand-mastodon { --section-color: var(--brand-mastodon); } - &.brand-npm { --section-color: var(--brand-npm); } - &.coffee { --section-color: var(--brand-buy-me-a-coffee); } - &.collected { --section-color: var(--collected); } - &.concerts { --section-color: var(--concerts); } - &.country { --section-color: var(--country); } - &.device-tv-old { --section-color: var(--tv); } - &.device-watch { --section-color: var(--now); } - &.favorite { --section-color: var(--favorite); } - &.headphones { --section-color: var(--music); } - &.heart-handshake { --section-color: var(--webrings); } - &.info-circle { --section-color: var(--about); } - &.link { --section-color: var(--link); } - &.mail { --section-color: var(--brand-gmail); } - &.mail-plus { --section-color: var(--newsletter); } - &.movies, &.tv { --section-color: var(--tv); } - &.music { --section-color: var(--music); } - &.rss { --section-color: var(--brand-rss); } - &.search { --section-color: var(--search); } - &.tattoo { --section-color: var(--tattoo); } + &.article { + --section-color: var(--article); + } + &.books { + --section-color: var(--books); + } + &.brand-github { + --section-color: var(--brand-github); + } + &.brand-mastodon { + --section-color: var(--brand-mastodon); + } + &.brand-npm { + --section-color: var(--brand-npm); + } + &.coffee { + --section-color: var(--brand-buy-me-a-coffee); + } + &.collected { + --section-color: var(--collected); + } + &.concerts { + --section-color: var(--concerts); + } + &.country { + --section-color: var(--country); + } + &.device-tv-old { + --section-color: var(--tv); + } + &.device-watch { + --section-color: var(--now); + } + &.favorite { + --section-color: var(--favorite); + } + &.headphones { + --section-color: var(--music); + } + &.heart-handshake { + --section-color: var(--webrings); + } + &.info-circle { + --section-color: var(--about); + } + &.link { + --section-color: var(--link); + } + &.mail { + --section-color: var(--brand-gmail); + } + &.mail-plus { + --section-color: var(--newsletter); + } + &.movies, + &.tv { + --section-color: var(--tv); + } + &.music { + --section-color: var(--music); + } + &.rss { + --section-color: var(--brand-rss); + } + &.search { + --section-color: var(--search); + } + &.tattoo { + --section-color: var(--tattoo); + } color: var(--section-color); @@ -173,14 +219,11 @@ a:active, :is(.main-title, footer nav.sub-pages) a:focus, :is(.main-title, footer nav.sub-pages) a:active { color: var(--accent-color-hover); - transition: color var(--transition-duration-default) var(--transition-ease-in-out); + transition: color var(--transition-duration-default) + var(--transition-ease-in-out); } -:is( - a:has(svg):hover, - a:has(svg):active, - a:has(svg):focus -) svg { +:is(a:has(svg):hover, a:has(svg):active, a:has(svg):focus) svg { stroke: var(--accent-color-hover); } @@ -201,26 +244,55 @@ a:active, } /* headers */ -h1, h2, h3, h4, h5, h6 { +h1, +h2, +h3, +h4, +h5, +h6 { font-weight: var(--font-weight-bold); line-height: var(--line-height-md); margin: var(--margin-vertical-base-horizontal-zero); } -h1 { font-size: var(--font-size-2xl); } -h2 { font-size: var(--font-size-xl); } -h3 { font-size: var(--font-size-lg); } -h4 { font-size: var(--font-size-base); } -h5 { font-size: var(--font-size-md); } -h6 { font-size: var(--font-size-sm); } +h1 { + font-size: var(--font-size-2xl); +} +h2 { + font-size: var(--font-size-xl); +} +h3 { + font-size: var(--font-size-lg); +} +h4 { + font-size: var(--font-size-base); +} +h5 { + font-size: var(--font-size-md); +} +h6 { + font-size: var(--font-size-sm); +} @media screen and (min-width: 768px) { - h1 { font-size: var(--font-size-3xl); } - h2 { font-size: var(--font-size-2xl); } - h3 { font-size: var(--font-size-xl); } - h4 { font-size: var(--font-size-lg); } - h5 { font-size: var(--font-size-base); } - h6 { font-size: var(--font-size-md); } + h1 { + font-size: var(--font-size-3xl); + } + h2 { + font-size: var(--font-size-2xl); + } + h3 { + font-size: var(--font-size-xl); + } + h4 { + font-size: var(--font-size-lg); + } + h5 { + font-size: var(--font-size-base); + } + h6 { + font-size: var(--font-size-md); + } } /* dividers */ @@ -272,7 +344,7 @@ td { text-overflow: ellipsis; &::after { - content: ''; + content: ""; position: absolute; inset-block-start: 0; inset-inline-end: 0; @@ -410,9 +482,9 @@ footer { color: var(--text-color); } - /* lists */ -ul, ol { +ul, +ol { list-style-position: inside; margin: var(--margin-vertical-base-horizontal-zero); padding-left: var(--spacing-base); @@ -428,4 +500,4 @@ ul, ol { border-radius: var(--border-radius-slight); height: auto; width: 100%; -} \ No newline at end of file +} diff --git a/src/assets/styles/components/badge-grid.css b/src/assets/styles/components/badge-grid.css index 1305828e..36dc81f5 100644 --- a/src/assets/styles/components/badge-grid.css +++ b/src/assets/styles/components/badge-grid.css @@ -15,4 +15,4 @@ & img { image-rendering: pixelated; } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/banners.css b/src/assets/styles/components/banners.css index 25b4afe5..0e61549f 100644 --- a/src/assets/styles/components/banners.css +++ b/src/assets/styles/components/banners.css @@ -37,12 +37,24 @@ &.old-post, &.rss, &.warning { - &.error { --banner-accent-color: var(--error); } - &.github { --banner-accent-color: var(--brand-github); } - &.npm { --banner-accent-color: var(--brand-npm); } - &.old-post { --banner-accent-color: var(--gray-dark); } - &.rss { --banner-accent-color: var(--brand-rss); } - &.warning { --banner-accent-color: var(--warning); } + &.error { + --banner-accent-color: var(--error); + } + &.github { + --banner-accent-color: var(--brand-github); + } + &.npm { + --banner-accent-color: var(--brand-npm); + } + &.old-post { + --banner-accent-color: var(--gray-dark); + } + &.rss { + --banner-accent-color: var(--brand-rss); + } + &.warning { + --banner-accent-color: var(--warning); + } border-color: var(--banner-accent-color); @@ -56,4 +68,4 @@ stroke: var(--banner-accent-color); } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/buttons.css b/src/assets/styles/components/buttons.css index a87a3a46..238e7aa3 100644 --- a/src/assets/styles/components/buttons.css +++ b/src/assets/styles/components/buttons.css @@ -1,5 +1,5 @@ -@import url('./tab-buttons.css'); -@import url('./text-toggle.css'); +@import url("./tab-buttons.css"); +@import url("./text-toggle.css"); button, .button { @@ -22,7 +22,8 @@ button, color: var(--text-color-inverted); background-color: var(--accent-color); appearance: none; - transition: color var(--transition-duration-default) var(--transition-ease-in-out); + transition: color var(--transition-duration-default) + var(--transition-ease-in-out); } &:not(.theme-toggle, .active):hover, @@ -32,4 +33,4 @@ button, background-color: var(--accent-color-hover); border-color: var(--accent-color-hover); } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/forms.css b/src/assets/styles/components/forms.css index f2974229..9f04f7f8 100644 --- a/src/assets/styles/components/forms.css +++ b/src/assets/styles/components/forms.css @@ -1,6 +1,6 @@ ::placeholder { color: var(--text-color); - opacity: .5; + opacity: 0.5; } input[type="text"], @@ -90,4 +90,4 @@ fieldset { text-decoration: none; } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/mastodon-post.css b/src/assets/styles/components/mastodon-post.css index 729a68e4..6299ddde 100644 --- a/src/assets/styles/components/mastodon-post.css +++ b/src/assets/styles/components/mastodon-post.css @@ -1,5 +1,6 @@ .mastodon-post-wrapper { - & dl, dt { + & dl, + dt { display: flex; } @@ -7,11 +8,11 @@ align-items: center; & dd { - margin-left: var(--spacing-xs);; + margin-left: var(--spacing-xs); &:not(:last-child) { margin-right: var(--spacing-lg); } } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/media-grid.css b/src/assets/styles/components/media-grid.css index 1ca31f09..b529f944 100644 --- a/src/assets/styles/components/media-grid.css +++ b/src/assets/styles/components/media-grid.css @@ -56,7 +56,7 @@ &::after { position: absolute; z-index: 1; - content: ''; + content: ""; top: 0; left: 0; box-shadow: var(--box-shadow-media); @@ -64,7 +64,8 @@ height: 100%; border: var(--border-default); border-radius: var(--border-radius-slight); - transition: border-color var(--transition-duration-default) var(--transition-ease-in-out); + transition: border-color var(--transition-duration-default) + var(--transition-ease-in-out); } } @@ -98,4 +99,4 @@ overflow: hidden; } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/menu.css b/src/assets/styles/components/menu.css index bebe8568..60731ce4 100644 --- a/src/assets/styles/components/menu.css +++ b/src/assets/styles/components/menu.css @@ -144,4 +144,4 @@ menu { display: none; } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/modal.css b/src/assets/styles/components/modal.css index cdc3074b..09952fb4 100644 --- a/src/assets/styles/components/modal.css +++ b/src/assets/styles/components/modal.css @@ -64,4 +64,4 @@ stroke: var(--accent-color-hover); } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/music-chart.css b/src/assets/styles/components/music-chart.css index 57122318..5ce4d231 100644 --- a/src/assets/styles/components/music-chart.css +++ b/src/assets/styles/components/music-chart.css @@ -138,4 +138,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/paginator.css b/src/assets/styles/components/paginator.css index f49b2391..487b7928 100644 --- a/src/assets/styles/components/paginator.css +++ b/src/assets/styles/components/paginator.css @@ -22,4 +22,4 @@ cursor: not-allowed; stroke: var(--gray-medium); stroke-width: var(--stroke-width-default); -} \ No newline at end of file +} diff --git a/src/assets/styles/components/progress-bar.css b/src/assets/styles/components/progress-bar.css index bae94f5e..b2a7caba 100644 --- a/src/assets/styles/components/progress-bar.css +++ b/src/assets/styles/components/progress-bar.css @@ -10,4 +10,4 @@ background-color: var(--accent-color); border-radius: var(--border-radius-full); } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/tab-buttons.css b/src/assets/styles/components/tab-buttons.css index c11a3a6e..5b50afd2 100644 --- a/src/assets/styles/components/tab-buttons.css +++ b/src/assets/styles/components/tab-buttons.css @@ -37,4 +37,4 @@ input[id="tracks-recent"] ~ [for="tracks-recent"]:has(+ [for="tracks-chart"]) { #tracks-chart:not(:checked) ~ [for="tracks-chart"]:hover, #tracks-chart:not(:checked) ~ [for="tracks-chart"]:active { color: var(--accent-color-hover); -} \ No newline at end of file +} diff --git a/src/assets/styles/components/text-toggle.css b/src/assets/styles/components/text-toggle.css index b1bf05f7..f8b6afdf 100644 --- a/src/assets/styles/components/text-toggle.css +++ b/src/assets/styles/components/text-toggle.css @@ -12,7 +12,7 @@ &::after { position: absolute; z-index: 1; - content: ''; + content: ""; box-shadow: var(--box-shadow-text-toggle); width: 100%; height: 20%; @@ -24,4 +24,4 @@ & + button[data-toggle-button]:has(+ *) { margin: 0 0 var(--spacing-base); } -} \ No newline at end of file +} diff --git a/src/assets/styles/components/theme-toggle.css b/src/assets/styles/components/theme-toggle.css index 72b40e0a..c2f5432e 100644 --- a/src/assets/styles/components/theme-toggle.css +++ b/src/assets/styles/components/theme-toggle.css @@ -20,10 +20,14 @@ theme-toggle { stroke: var(--accent-color-hover); } - & > .light svg { stroke: var(--sun); } - & > .dark svg { stroke: var(--moon); } + & > .light svg { + stroke: var(--sun); + } + & > .dark svg { + stroke: var(--moon); + } - & > .light , + & > .light, & > .dark { display: none; } @@ -47,4 +51,4 @@ theme-toggle { & .theme-toggle > .dark { display: inline; } -} \ No newline at end of file +} diff --git a/src/assets/styles/defaults/fonts.css b/src/assets/styles/defaults/fonts.css index 132ab874..15ba0e5a 100644 --- a/src/assets/styles/defaults/fonts.css +++ b/src/assets/styles/defaults/fonts.css @@ -1,6 +1,6 @@ @font-face { font-family: MonoLisa; - src: url('/assets/fonts/ml.woff2') format('woff2'); + src: url("/assets/fonts/ml.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; @@ -8,7 +8,7 @@ @font-face { font-family: MonoLisa; - src: url('/assets/fonts/mlb.woff2') format('woff2'); + src: url("/assets/fonts/mlb.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; @@ -16,7 +16,7 @@ @font-face { font-family: MonoLisa; - src: url('/assets/fonts/mli.woff2') format('woff2'); + src: url("/assets/fonts/mli.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; @@ -24,8 +24,8 @@ @font-face { font-family: MonoLisa; - src: url('/assets/fonts/mlbi.woff2') format('woff2'); + src: url("/assets/fonts/mlbi.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; -} \ No newline at end of file +} diff --git a/src/assets/styles/defaults/vars.css b/src/assets/styles/defaults/vars.css index 0b1bed1e..829f1454 100644 --- a/src/assets/styles/defaults/vars.css +++ b/src/assets/styles/defaults/vars.css @@ -108,11 +108,12 @@ --border-gray: 1px solid var(--gray-light); /* fonts */ - --font-mono: MonoLisa, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, ui-monospace, monospace; + --font-mono: MonoLisa, Menlo, Consolas, Monaco, Liberation Mono, + Lucida Console, ui-monospace, monospace; /* text */ - --font-size-xs: .7rem; - --font-size-sm: .85rem; + --font-size-xs: 0.7rem; + --font-size-sm: 0.85rem; --font-size-base: 1rem; --font-size-lg: 1.15rem; --font-size-xl: 1.3rem; @@ -127,9 +128,9 @@ --line-height-base: 2; /* sizing */ - --sizing-xs: .25rem; - --sizing-sm: .5rem; - --sizing-md: .75rem; + --sizing-xs: 0.25rem; + --sizing-sm: 0.5rem; + --sizing-md: 0.75rem; --sizing-lg: 1rem; --sizing-base: 1.5rem; --sizing-xl: 1.75rem; diff --git a/src/assets/styles/feed.xsl b/src/assets/styles/feed.xsl index 52e33a05..b645558a 100644 --- a/src/assets/styles/feed.xsl +++ b/src/assets/styles/feed.xsl @@ -1,43 +1,57 @@ - - + + - <xsl:value-of select="/rss/channel/title"/> - - + + <xsl:value-of select="/rss/channel/title" /> + + +
-

+

+ + + +

-

-

Subscribe by adding the URL below to your feed reader of choice.

+

+ +

+

+ Subscribe by adding the URL below to your feed reader + of choice. +

                   
                 

-

View more of the feeds from my site.

+

+ View more of the feeds from my site. +


-

Published:

+

Published:

- + - +

- + {title} @@ -48,7 +62,10 @@

-

Subscribe by adding to your feed reader of choice.

+

Subscribe by adding + + to your + feed reader of choice.

diff --git a/src/assets/styles/index.css b/src/assets/styles/index.css index 0c5d0897..d021e587 100644 --- a/src/assets/styles/index.css +++ b/src/assets/styles/index.css @@ -1,40 +1,40 @@ @layer reset, defaults, base, page, components, plugins; /* style resets */ -@import url('./reset.css') layer(reset); +@import url("./reset.css") layer(reset); /* core defaults */ -@import url('./defaults/fonts.css') layer(defaults); -@import url('./defaults/vars.css') layer(defaults); +@import url("./defaults/fonts.css") layer(defaults); +@import url("./defaults/vars.css") layer(defaults); - /* base styles */ -@import url('./base/index.css') layer(base); +/* base styles */ +@import url("./base/index.css") layer(base); /* plugins */ -@import url('./plugins/prism.css') layer(plugins); +@import url("./plugins/prism.css") layer(plugins); /* page styles */ -@import url('./pages/about.css') layer(page); -@import url('./pages/books.css') layer(page); -@import url('./pages/blogroll.css') layer(page); -@import url('./pages/contact.css') layer(page); -@import url('./pages/feeds.css') layer(page); -@import url('./pages/links.css') layer(page); -@import url('./pages/music.css') layer(page); -@import url('./pages/articles.css') layer(page); -@import url('./pages/watching.css') layer(page); -@import url('./pages/webrings.css') layer(page); +@import url("./pages/about.css") layer(page); +@import url("./pages/books.css") layer(page); +@import url("./pages/blogroll.css") layer(page); +@import url("./pages/contact.css") layer(page); +@import url("./pages/feeds.css") layer(page); +@import url("./pages/links.css") layer(page); +@import url("./pages/music.css") layer(page); +@import url("./pages/articles.css") layer(page); +@import url("./pages/watching.css") layer(page); +@import url("./pages/webrings.css") layer(page); /* component styles */ -@import url('./components/badge-grid.css') layer(components); -@import url('./components/banners.css') layer(components); -@import url('./components/buttons.css') layer(components); -@import url('./components/forms.css') layer(components); -@import url('./components/mastodon-post.css') layer(components); -@import url('./components/media-grid.css') layer(components); -@import url('./components/menu.css') layer(components); -@import url('./components/modal.css') layer(components); -@import url('./components/music-chart.css') layer(components); -@import url('./components/paginator.css') layer(components); -@import url('./components/progress-bar.css') layer(components); -@import url('./components/theme-toggle.css') layer(components); \ No newline at end of file +@import url("./components/badge-grid.css") layer(components); +@import url("./components/banners.css") layer(components); +@import url("./components/buttons.css") layer(components); +@import url("./components/forms.css") layer(components); +@import url("./components/mastodon-post.css") layer(components); +@import url("./components/media-grid.css") layer(components); +@import url("./components/menu.css") layer(components); +@import url("./components/modal.css") layer(components); +@import url("./components/music-chart.css") layer(components); +@import url("./components/paginator.css") layer(components); +@import url("./components/progress-bar.css") layer(components); +@import url("./components/theme-toggle.css") layer(components); diff --git a/src/assets/styles/pages/about.css b/src/assets/styles/pages/about.css index ccbafde9..5ad415d7 100644 --- a/src/assets/styles/pages/about.css +++ b/src/assets/styles/pages/about.css @@ -26,4 +26,4 @@ .about-title { text-align: center; -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/articles.css b/src/assets/styles/pages/articles.css index f1affc46..8544955f 100644 --- a/src/assets/styles/pages/articles.css +++ b/src/assets/styles/pages/articles.css @@ -77,4 +77,4 @@ sup.footnote-ref { sup.footnote-ref a, .footnote-backref { text-decoration: none; -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/blogroll.css b/src/assets/styles/pages/blogroll.css index 8ca3468c..37d43ba0 100644 --- a/src/assets/styles/pages/blogroll.css +++ b/src/assets/styles/pages/blogroll.css @@ -1,3 +1,3 @@ .blog-roll-icons { display: flex; -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/books.css b/src/assets/styles/pages/books.css index 9ed9f1a0..65cfc74a 100644 --- a/src/assets/styles/pages/books.css +++ b/src/assets/styles/pages/books.css @@ -27,7 +27,8 @@ max-width: calc(var(--sizing-3xl) * 4); height: auto; aspect-ratio: var(--aspect-ratio-vertical); - transition: border-color var(--transition-duration-default) var(--transition-ease-in-out); + transition: border-color var(--transition-duration-default) + var(--transition-ease-in-out); } & a:focus img, @@ -136,4 +137,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/contact.css b/src/assets/styles/pages/contact.css index de274219..63d00808 100644 --- a/src/assets/styles/pages/contact.css +++ b/src/assets/styles/pages/contact.css @@ -43,4 +43,4 @@ & h2 { margin: 0; } -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/feeds.css b/src/assets/styles/pages/feeds.css index 9ea4bf05..2867323c 100644 --- a/src/assets/styles/pages/feeds.css +++ b/src/assets/styles/pages/feeds.css @@ -44,4 +44,4 @@ & footer { padding-bottom: var(--spacing-3xl); } -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/links.css b/src/assets/styles/pages/links.css index 7ac97bec..67e56abb 100644 --- a/src/assets/styles/pages/links.css +++ b/src/assets/styles/pages/links.css @@ -13,4 +13,4 @@ border-radius: var(--border-radius-slight); padding: var(--spacing-xs) var(--spacing-sm); } -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/music.css b/src/assets/styles/pages/music.css index 6e1c53d2..0329e8e6 100644 --- a/src/assets/styles/pages/music.css +++ b/src/assets/styles/pages/music.css @@ -81,4 +81,4 @@ p.concerts + ul + hr { display: none; -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/watching.css b/src/assets/styles/pages/watching.css index 581998b6..05fcd8d1 100644 --- a/src/assets/styles/pages/watching.css +++ b/src/assets/styles/pages/watching.css @@ -45,7 +45,7 @@ a:active > .watching.hero::after { &::after { position: absolute; z-index: 1; - content: ''; + content: ""; top: 0; left: 0; box-shadow: var(--box-shadow-media); @@ -53,7 +53,8 @@ a:active > .watching.hero::after { height: 100%; border: var(--border-default); border-radius: var(--border-radius-slight); - transition: border-color var(--transition-duration-default) var(--transition-ease-in-out); + transition: border-color var(--transition-duration-default) + var(--transition-ease-in-out); } } @@ -98,4 +99,4 @@ a:active > .watching.hero::after { .icon-link + .poster.grid { margin-top: var(--spacing-base); -} \ No newline at end of file +} diff --git a/src/assets/styles/pages/webrings.css b/src/assets/styles/pages/webrings.css index cc23c248..e1588931 100644 --- a/src/assets/styles/pages/webrings.css +++ b/src/assets/styles/pages/webrings.css @@ -20,4 +20,4 @@ display: flex; } } -} \ No newline at end of file +} diff --git a/src/assets/styles/plugins/prism.css b/src/assets/styles/plugins/prism.css index e7a8219d..09da3995 100644 --- a/src/assets/styles/plugins/prism.css +++ b/src/assets/styles/plugins/prism.css @@ -20,7 +20,7 @@ pre { margin: var(--sizing-xl) 0; overflow: auto; - & > code { + & > code { padding: 0; } } @@ -108,4 +108,4 @@ pre, &.bold { font-weight: var(--font-weight-bold); } -} \ No newline at end of file +} diff --git a/src/assets/styles/reset.css b/src/assets/styles/reset.css index 8ed94993..27f25b6d 100644 --- a/src/assets/styles/reset.css +++ b/src/assets/styles/reset.css @@ -1,4 +1,6 @@ -*, *::before, *::after { +*, +*::before, +*::after { box-sizing: border-box; margin: 0; } @@ -9,10 +11,19 @@ body { -webkit-text-size-adjust: none; } -input, button, textarea, select { +input, +button, +textarea, +select { font: inherit; } -p, h1, h2, h3, h4, h5, h6 { +p, +h1, +h2, +h3, +h4, +h5, +h6 { overflow-wrap: break-word; -} \ No newline at end of file +} diff --git a/src/assets/styles/styles.json b/src/assets/styles/styles.json index 15680bcb..b8225347 100644 --- a/src/assets/styles/styles.json +++ b/src/assets/styles/styles.json @@ -1,3 +1,3 @@ { "eleventyExcludeFromCollections": true -} \ No newline at end of file +} diff --git a/src/data/activity.js b/src/data/activity.js index 55dabad4..e4caabae 100644 --- a/src/data/activity.js +++ b/src/data/activity.js @@ -1,20 +1,20 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); export default async function fetchActivity() { const { data, error } = await supabase - .from('optimized_all_activity') - .select('feed') + .from("optimized_all_activity") + .select("feed"); if (error) { - console.error('Error fetching activity data:', error) - return [] + console.error("Error fetching activity data:", error); + return []; } - const [{ feed } = {}] = data + const [{ feed } = {}] = data; - return feed?.filter(item => item['feed'] !== null) || [] -} \ No newline at end of file + return feed?.filter((item) => item["feed"] !== null) || []; +} diff --git a/src/data/albumReleases.js b/src/data/albumReleases.js index 94d3a8c4..464d9c3a 100644 --- a/src/data/albumReleases.js +++ b/src/data/albumReleases.js @@ -1,43 +1,47 @@ -import { createClient } from '@supabase/supabase-js' -import { DateTime } from 'luxon' +import { createClient } from "@supabase/supabase-js"; +import { DateTime } from "luxon"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchAlbumReleases = async () => { - const today = DateTime.utc().startOf('day').toSeconds() + const today = DateTime.utc().startOf("day").toSeconds(); const { data, error } = await supabase - .from('optimized_album_releases') - .select('*') + .from("optimized_album_releases") + .select("*"); if (error) { - console.error('Error fetching data:', error) - return [] + console.error("Error fetching data:", error); + return []; } - const all = data.map(album => { - const releaseDate = DateTime.fromSeconds(album['release_timestamp']).toUTC().startOf('day') + const all = data + .map((album) => { + const releaseDate = DateTime.fromSeconds(album["release_timestamp"]) + .toUTC() + .startOf("day"); - return { - ...album, - description: album['artist']['description'], - date: releaseDate.toLocaleString(DateTime.DATE_FULL), - timestamp: releaseDate.toSeconds() - } - }).sort((a, b) => a['timestamp'] - b['timestamp']) + return { + ...album, + description: album["artist"]["description"], + date: releaseDate.toLocaleString(DateTime.DATE_FULL), + timestamp: releaseDate.toSeconds(), + }; + }) + .sort((a, b) => a["timestamp"] - b["timestamp"]); - const upcoming = all.filter(album => album['release_timestamp'] > today) + const upcoming = all.filter((album) => album["release_timestamp"] > today); - return { all, upcoming } -} + return { all, upcoming }; +}; export default async function () { try { - return await fetchAlbumReleases() + return await fetchAlbumReleases(); } catch (error) { - console.error('Error fetching and processing album releases:', error) - return [] + console.error("Error fetching and processing album releases:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/artists.js b/src/data/artists.js index c8ba947a..fac0065f 100644 --- a/src/data/artists.js +++ b/src/data/artists.js @@ -1,47 +1,47 @@ -import { createClient } from '@supabase/supabase-js' -import { parseCountryField } from '../../config/utilities/index.js' +import { createClient } from "@supabase/supabase-js"; +import { parseCountryField } from "../../config/utilities/index.js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllArtists = async () => { - let artists = [] - let rangeStart = 0 + let artists = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase - .from('optimized_artists') - .select('*') - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .from("optimized_artists") + .select("*") + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error('Error fetching artists:', error) - break + console.error("Error fetching artists:", error); + break; } - artists = artists.concat(data) - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + artists = artists.concat(data); + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return artists -} + return artists; +}; const processArtists = (artists) => { - return artists.map(artist => ({ + return artists.map((artist) => ({ ...artist, - country: parseCountryField(artist['country']), - })) -} + country: parseCountryField(artist["country"]), + })); +}; export default async function () { try { - const artists = await fetchAllArtists() - return processArtists(artists) + const artists = await fetchAllArtists(); + return processArtists(artists); } catch (error) { - console.error('Error fetching and processing artists data:', error) - return [] + console.error("Error fetching and processing artists data:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/blogroll.js b/src/data/blogroll.js index 61e460d2..d955392e 100644 --- a/src/data/blogroll.js +++ b/src/data/blogroll.js @@ -1,29 +1,31 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchBlogroll = async () => { const { data, error } = await supabase - .from('authors') - .select('*') - .eq('blogroll', true) - .order('name', { ascending: true }) + .from("authors") + .select("*") + .eq("blogroll", true) + .order("name", { ascending: true }); if (error) { - console.error('Error fetching authors for the blogroll:', error) - return [] + console.error("Error fetching authors for the blogroll:", error); + return []; } - return data.sort((a, b) => a['name'].toLowerCase().localeCompare(b['name'].toLowerCase())) -} + return data.sort((a, b) => + a["name"].toLowerCase().localeCompare(b["name"].toLowerCase()) + ); +}; export default async function () { try { - return await fetchBlogroll() + return await fetchBlogroll(); } catch (error) { - console.error('Error fetching and processing the blogroll:', error) - return [] + console.error("Error fetching and processing the blogroll:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/books.js b/src/data/books.js index e4128157..e23f2c76 100644 --- a/src/data/books.js +++ b/src/data/books.js @@ -1,60 +1,60 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllBooks = async () => { - let books = [] - let rangeStart = 0 + let books = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase - .from('optimized_books') - .select('*') - .order('date_finished', { ascending: false }) - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .from("optimized_books") + .select("*") + .order("date_finished", { ascending: false }) + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error('Error fetching books:', error) - break + console.error("Error fetching books:", error); + break; } - books = books.concat(data) - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + books = books.concat(data); + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return books -} + return books; +}; const sortBooksByYear = (books) => { - const years = {} - books.forEach(book => { - const year = book['year'] + const years = {}; + books.forEach((book) => { + const year = book["year"]; if (!years[year]) { - years[year] = { value: year, data: [book] } + years[year] = { value: year, data: [book] }; } else { - years[year]['data'].push(book) + years[year]["data"].push(book); } - }) - return Object.values(years).filter(year => year['value'] > 2017) -} + }); + return Object.values(years).filter((year) => year["value"] > 2017); +}; -const currentYear = new Date().getFullYear() +const currentYear = new Date().getFullYear(); export default async function () { - const books = await fetchAllBooks() - const sortedByYear = sortBooksByYear(books) - const booksForCurrentYear = sortedByYear.find( - yearGroup => yearGroup.value === currentYear - )?.data || [] + const books = await fetchAllBooks(); + const sortedByYear = sortBooksByYear(books); + const booksForCurrentYear = + sortedByYear.find((yearGroup) => yearGroup.value === currentYear)?.data || + []; return { all: books, years: sortedByYear, currentYear: booksForCurrentYear, - feed: books.filter(book => book['feed']) - } -} \ No newline at end of file + feed: books.filter((book) => book["feed"]), + }; +} diff --git a/src/data/concerts.js b/src/data/concerts.js index 0d8dd3e1..831fb90a 100644 --- a/src/data/concerts.js +++ b/src/data/concerts.js @@ -1,46 +1,46 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllConcerts = async () => { - let concerts = [] - let rangeStart = 0 + let concerts = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase - .from('optimized_concerts') - .select('*') - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .from("optimized_concerts") + .select("*") + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error('Error fetching concerts:', error) - break + console.error("Error fetching concerts:", error); + break; } - concerts = concerts.concat(data) - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + concerts = concerts.concat(data); + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return concerts -} + return concerts; +}; const processConcerts = (concerts) => { - return concerts.map(concert => ({ + return concerts.map((concert) => ({ ...concert, artist: concert.artist || { name: concert.artist_name_string, url: null }, - })) -} + })); +}; export default async function () { try { - const concerts = await fetchAllConcerts() - return processConcerts(concerts) + const concerts = await fetchAllConcerts(); + return processConcerts(concerts); } catch (error) { - console.error('Error fetching and processing concerts data:', error) - return [] + console.error("Error fetching and processing concerts data:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/genres.js b/src/data/genres.js index aa6f20a9..4ffdc641 100644 --- a/src/data/genres.js +++ b/src/data/genres.js @@ -1,27 +1,25 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchGenres = async () => { - const { data, error } = await supabase - .from('optimized_genres') - .select('*') + const { data, error } = await supabase.from("optimized_genres").select("*"); if (error) { - console.error('Error fetching genres with artists:', error) - return [] + console.error("Error fetching genres with artists:", error); + return []; } - return data -} + return data; +}; export default async function () { try { - return await fetchGenres() + return await fetchGenres(); } catch (error) { - console.error('Error fetching and processing genres:', error) - return [] + console.error("Error fetching and processing genres:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/globals.js b/src/data/globals.js index a1b6bd1b..cc3da4d7 100644 --- a/src/data/globals.js +++ b/src/data/globals.js @@ -1,28 +1,28 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchGlobals = async () => { const { data, error } = await supabase - .from('optimized_globals') - .select('*') - .single() + .from("optimized_globals") + .select("*") + .single(); if (error) { - console.error('Error fetching globals:', error) - return {} + console.error("Error fetching globals:", error); + return {}; } - return data -} + return data; +}; export default async function () { try { - return await fetchGlobals() + return await fetchGlobals(); } catch (error) { - console.error('Error fetching and processing globals:', error) - return {} + console.error("Error fetching and processing globals:", error); + return {}; } -} \ No newline at end of file +} diff --git a/src/data/links.js b/src/data/links.js index e6d2a76a..62a33f5b 100644 --- a/src/data/links.js +++ b/src/data/links.js @@ -1,40 +1,40 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllLinks = async () => { - let links = [] - let page = 0 - let fetchMore = true + let links = []; + let page = 0; + let fetchMore = true; while (fetchMore) { const { data, error } = await supabase - .from('optimized_links') - .select('*') - .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1) + .from("optimized_links") + .select("*") + .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1); if (error) { - console.error('Error fetching links:', error) - return links + console.error("Error fetching links:", error); + return links; } - if (data.length < PAGE_SIZE) fetchMore = false + if (data.length < PAGE_SIZE) fetchMore = false; - links = links.concat(data) - page++ + links = links.concat(data); + page++; } - return links -} + return links; +}; export default async function () { try { - return await fetchAllLinks() + return await fetchAllLinks(); } catch (error) { - console.error('Error fetching and processing links:', error) - return [] + console.error("Error fetching and processing links:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/movies.js b/src/data/movies.js index a83e332e..d48a581f 100644 --- a/src/data/movies.js +++ b/src/data/movies.js @@ -1,62 +1,67 @@ -import { createClient } from '@supabase/supabase-js' -import { DateTime } from 'luxon' +import { createClient } from "@supabase/supabase-js"; +import { DateTime } from "luxon"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllMovies = async () => { - let movies = [] - let rangeStart = 0 + let movies = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase - .from('optimized_movies') - .select('*') - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .from("optimized_movies") + .select("*") + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error('Error fetching movies:', error) - break + console.error("Error fetching movies:", error); + break; } - movies = movies.concat(data) + movies = movies.concat(data); - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return movies -} + return movies; +}; export default async function () { - const year = DateTime.now().year + const year = DateTime.now().year; try { - const movies = await fetchAllMovies() - const favoriteMovies = movies.filter(movie => movie['favorite']) + const movies = await fetchAllMovies(); + const favoriteMovies = movies.filter((movie) => movie["favorite"]); const now = DateTime.now(); - const recentlyWatchedMovies = movies.filter(movie => { - const lastWatched = movie['last_watched'] - return (lastWatched && now.diff(DateTime.fromISO(lastWatched), 'months').months <= 6) - }) + const recentlyWatchedMovies = movies.filter((movie) => { + const lastWatched = movie["last_watched"]; + return ( + lastWatched && + now.diff(DateTime.fromISO(lastWatched), "months").months <= 6 + ); + }); return { movies, - watchHistory: movies.filter(movie => movie['last_watched']), + watchHistory: movies.filter((movie) => movie["last_watched"]), recentlyWatched: recentlyWatchedMovies, - favorites: favoriteMovies.sort((a, b) => a['title'].localeCompare(b['title'])), - feed: movies.filter(movie => movie['feed']), - } + favorites: favoriteMovies.sort((a, b) => + a["title"].localeCompare(b["title"]) + ), + feed: movies.filter((movie) => movie["feed"]), + }; } catch (error) { - console.error('Error fetching and processing movies data:', error) + console.error("Error fetching and processing movies data:", error); return { movies: [], watchHistory: [], recentlyWatched: [], favorites: [], - feed: [] - } + feed: [], + }; } -} \ No newline at end of file +} diff --git a/src/data/music.js b/src/data/music.js index 6ab2069e..e5938ab0 100644 --- a/src/data/music.js +++ b/src/data/music.js @@ -1,35 +1,35 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchDataFromView = async (viewName) => { - let rows = [] - let rangeStart = 0 + let rows = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase .from(viewName) - .select('*') - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .select("*") + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error(`Error fetching data from view ${viewName}:`, error) - break + console.error(`Error fetching data from view ${viewName}:`, error); + break; } - if (data.length === 0) break + if (data.length === 0) break; - rows = [...rows, ...data] + rows = [...rows, ...data]; - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return rows -} + return rows; +}; export default async function fetchMusicData() { try { @@ -44,16 +44,16 @@ export default async function fetchMusicData() { monthAlbums, monthGenres, ] = await Promise.all([ - fetchDataFromView('recent_tracks'), - fetchDataFromView('week_tracks'), - fetchDataFromView('week_artists'), - fetchDataFromView('week_albums'), - fetchDataFromView('week_genres'), - fetchDataFromView('month_tracks'), - fetchDataFromView('month_artists'), - fetchDataFromView('month_albums'), - fetchDataFromView('month_genres'), - ]) + fetchDataFromView("recent_tracks"), + fetchDataFromView("week_tracks"), + fetchDataFromView("week_artists"), + fetchDataFromView("week_albums"), + fetchDataFromView("week_genres"), + fetchDataFromView("month_tracks"), + fetchDataFromView("month_artists"), + fetchDataFromView("month_albums"), + fetchDataFromView("month_genres"), + ]); return { recent: recentTracks, @@ -64,7 +64,7 @@ export default async function fetchMusicData() { genres: weekGenres, totalTracks: weekTracks .reduce((acc, track) => acc + track.plays, 0) - .toLocaleString('en-US'), + .toLocaleString("en-US"), }, month: { tracks: monthTracks, @@ -73,11 +73,11 @@ export default async function fetchMusicData() { genres: monthGenres, totalTracks: monthTracks .reduce((acc, track) => acc + track.plays, 0) - .toLocaleString('en-US'), + .toLocaleString("en-US"), }, - } + }; } catch (error) { - console.error('Error fetching and processing music data:', error) - return {} + console.error("Error fetching and processing music data:", error); + return {}; } -} \ No newline at end of file +} diff --git a/src/data/nav.js b/src/data/nav.js index c52846c5..122d187b 100644 --- a/src/data/nav.js +++ b/src/data/nav.js @@ -1,48 +1,48 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchAllNavigation = async () => { const { data, error } = await supabase - .from('optimized_navigation') - .select('*') + .from("optimized_navigation") + .select("*"); if (error) { - console.error('Error fetching navigation data:', error) - return {} + console.error("Error fetching navigation data:", error); + return {}; } const menu = data.reduce((acc, item) => { const menuItem = { - title: item['title'] || item['page_title'], - permalink: item['permalink'] || item ['page_permalink'], - icon: item['icon'], - sort: item['sort'] - } + title: item["title"] || item["page_title"], + permalink: item["permalink"] || item["page_permalink"], + icon: item["icon"], + sort: item["sort"], + }; - if (!acc[item['menu_location']]) { - acc[item['menu_location']] = [menuItem] + if (!acc[item["menu_location"]]) { + acc[item["menu_location"]] = [menuItem]; } else { - acc[item['menu_location']].push(menuItem) + acc[item["menu_location"]].push(menuItem); } - return acc - }, {}) + return acc; + }, {}); - Object.keys(menu).forEach(location => { - menu[location].sort((a, b) => a['sort'] - b['sort']) - }) + Object.keys(menu).forEach((location) => { + menu[location].sort((a, b) => a["sort"] - b["sort"]); + }); - return menu -} + return menu; +}; export default async function () { try { - return await fetchAllNavigation() + return await fetchAllNavigation(); } catch (error) { - console.error('Error fetching and processing navigation data:', error) - return {} + console.error("Error fetching and processing navigation data:", error); + return {}; } -} \ No newline at end of file +} diff --git a/src/data/nowPlaying.js b/src/data/nowPlaying.js index 90559f1a..e865ebbf 100644 --- a/src/data/nowPlaying.js +++ b/src/data/nowPlaying.js @@ -1,33 +1,35 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); const fetchNowPlaying = async () => { const { data, error } = await supabase - .from('optimized_latest_listen') - .select('*') - .single() + .from("optimized_latest_listen") + .select("*") + .single(); if (error) { - console.error('Error fetching the latest track:', error) - return {} + console.error("Error fetching the latest track:", error); + return {}; } - const genreEmoji = data.genre_emoji - const emoji = data.artist_emoji || genreEmoji + const genreEmoji = data.genre_emoji; + const emoji = data.artist_emoji || genreEmoji; return { - content: `${emoji || '🎧'} ${data.track_name} by ${data.artist_name}`, - } -} + content: `${emoji || "🎧"} ${ + data.track_name + } by ${data.artist_name}`, + }; +}; export default async function () { try { - return await fetchNowPlaying() + return await fetchNowPlaying(); } catch (error) { - console.error('Error fetching and processing now-playing data:', error) - return {} + console.error("Error fetching and processing now-playing data:", error); + return {}; } -} \ No newline at end of file +} diff --git a/src/data/pages.js b/src/data/pages.js index 6fb3e1d4..bfbae8cc 100644 --- a/src/data/pages.js +++ b/src/data/pages.js @@ -1,40 +1,40 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env['SUPABASE_URL'] -const SUPABASE_KEY = process.env['SUPABASE_KEY'] -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 250 +const SUPABASE_URL = process.env["SUPABASE_URL"]; +const SUPABASE_KEY = process.env["SUPABASE_KEY"]; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 250; const fetchAllPages = async () => { - let pages = [] - let page = 0 - let fetchMore = true + let pages = []; + let page = 0; + let fetchMore = true; while (fetchMore) { const { data, error } = await supabase - .from('optimized_pages') - .select('*') - .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1) + .from("optimized_pages") + .select("*") + .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1); if (error) { - console.error('Error fetching pages:', error) - return pages + console.error("Error fetching pages:", error); + return pages; } - if (data.length < PAGE_SIZE) fetchMore = false + if (data.length < PAGE_SIZE) fetchMore = false; - pages = pages.concat(data) - page++ + pages = pages.concat(data); + page++; } - return pages -} + return pages; +}; export default async function () { try { - return await fetchAllPages() + return await fetchAllPages(); } catch (error) { - console.error('Error fetching and processing pages:', error) - return [] + console.error("Error fetching and processing pages:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/posts.js b/src/data/posts.js index 0574dd74..ddb01a08 100644 --- a/src/data/posts.js +++ b/src/data/posts.js @@ -1,41 +1,41 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env['SUPABASE_URL'] -const SUPABASE_KEY = process.env['SUPABASE_KEY'] -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env["SUPABASE_URL"]; +const SUPABASE_KEY = process.env["SUPABASE_KEY"]; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllPosts = async () => { - let posts = [] - let page = 0 - let fetchMore = true + let posts = []; + let page = 0; + let fetchMore = true; while (fetchMore) { const { data, error } = await supabase - .from('optimized_posts') - .select('*') - .order('date', { ascending: false }) - .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1) + .from("optimized_posts") + .select("*") + .order("date", { ascending: false }) + .range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1); if (error) { - console.error('Error fetching posts:', error) - return posts + console.error("Error fetching posts:", error); + return posts; } - if (data.length < PAGE_SIZE) fetchMore = false + if (data.length < PAGE_SIZE) fetchMore = false; - posts = posts.concat(data) - page++ + posts = posts.concat(data); + page++; } - return posts -} + return posts; +}; export default async function () { try { - return await fetchAllPosts() + return await fetchAllPosts(); } catch (error) { - console.error('Error fetching and processing posts:', error) - return [] + console.error("Error fetching and processing posts:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/robots.js b/src/data/robots.js index 5e17b110..be453d73 100644 --- a/src/data/robots.js +++ b/src/data/robots.js @@ -1,38 +1,40 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 500 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 500; const fetchAllRobots = async () => { - let robots = [] - let from = 0 + let robots = []; + let from = 0; while (true) { const { data, error } = await supabase - .from('robots') - .select('user_agent') - .range(from, from + PAGE_SIZE - 1) + .from("robots") + .select("user_agent") + .range(from, from + PAGE_SIZE - 1); if (error) { - console.error('Error fetching robot data:', error) - return [] + console.error("Error fetching robot data:", error); + return []; } - robots = robots.concat(data) - if (data.length < PAGE_SIZE) break - from += PAGE_SIZE + robots = robots.concat(data); + if (data.length < PAGE_SIZE) break; + from += PAGE_SIZE; } - return robots.map(robot => robot['user_agent']).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())) -} + return robots + .map((robot) => robot["user_agent"]) + .sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); +}; export default async function () { try { - return await fetchAllRobots() + return await fetchAllRobots(); } catch (error) { - console.error('Error fetching and processing robot data:', error) - return [] + console.error("Error fetching and processing robot data:", error); + return []; } -} \ No newline at end of file +} diff --git a/src/data/syndication.js b/src/data/syndication.js index 63d3834d..8e92334d 100644 --- a/src/data/syndication.js +++ b/src/data/syndication.js @@ -1,20 +1,20 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); export default async function fetchSyndication() { const { data, error } = await supabase - .from('optimized_syndication') - .select('syndication') + .from("optimized_syndication") + .select("syndication"); if (error) { - console.error('Error fetching search index data:', error) - return [] + console.error("Error fetching search index data:", error); + return []; } - const [{ syndication } = {}] = data + const [{ syndication } = {}] = data; - return syndication?.filter(item => item['syndication'] !== null) || [] -} \ No newline at end of file + return syndication?.filter((item) => item["syndication"] !== null) || []; +} diff --git a/src/data/tv.js b/src/data/tv.js index ccc1f48a..598bca74 100644 --- a/src/data/tv.js +++ b/src/data/tv.js @@ -1,61 +1,65 @@ -import { createClient } from '@supabase/supabase-js' +import { createClient } from "@supabase/supabase-js"; -const SUPABASE_URL = process.env.SUPABASE_URL -const SUPABASE_KEY = process.env.SUPABASE_KEY -const supabase = createClient(SUPABASE_URL, SUPABASE_KEY) -const PAGE_SIZE = 1000 +const SUPABASE_URL = process.env.SUPABASE_URL; +const SUPABASE_KEY = process.env.SUPABASE_KEY; +const supabase = createClient(SUPABASE_URL, SUPABASE_KEY); +const PAGE_SIZE = 1000; const fetchAllShows = async () => { - let shows = [] - let rangeStart = 0 + let shows = []; + let rangeStart = 0; while (true) { const { data, error } = await supabase - .from('optimized_shows') - .select('*') - .range(rangeStart, rangeStart + PAGE_SIZE - 1) + .from("optimized_shows") + .select("*") + .range(rangeStart, rangeStart + PAGE_SIZE - 1); if (error) { - console.error('Error fetching shows:', error) - break + console.error("Error fetching shows:", error); + break; } - shows = shows.concat(data) - if (data.length < PAGE_SIZE) break - rangeStart += PAGE_SIZE + shows = shows.concat(data); + if (data.length < PAGE_SIZE) break; + rangeStart += PAGE_SIZE; } - return shows -} + return shows; +}; export default async function () { try { - const shows = await fetchAllShows() - const watchedShows = shows.filter(show => show['last_watched_at'] !== null) - const episodes = watchedShows.map(show => ({ - title: show['episode']['title'], - year: show['year'], - formatted_episode: show['episode']['formatted_episode'], - url: show['episode']['url'], - image: show['episode']['image'], - backdrop: show['episode']['backdrop'], - last_watched_at: show['episode']['last_watched_at'], - grid: show['grid'], - type: 'tv' - })) + const shows = await fetchAllShows(); + const watchedShows = shows.filter( + (show) => show["last_watched_at"] !== null + ); + const episodes = watchedShows.map((show) => ({ + title: show["episode"]["title"], + year: show["year"], + formatted_episode: show["episode"]["formatted_episode"], + url: show["episode"]["url"], + image: show["episode"]["image"], + backdrop: show["episode"]["backdrop"], + last_watched_at: show["episode"]["last_watched_at"], + grid: show["grid"], + type: "tv", + })); return { shows, recentlyWatched: episodes.slice(0, 125), - favorites: shows.filter(show => show.favorite).sort((a, b) => a.title.localeCompare(b.title)), - } + favorites: shows + .filter((show) => show.favorite) + .sort((a, b) => a.title.localeCompare(b.title)), + }; } catch (error) { - console.error('Error fetching and processing shows data:', error) + console.error("Error fetching and processing shows data:", error); return { shows: [], recentlyWatched: [], favorites: [], - } + }; } -} \ No newline at end of file +}