chore(*): use prettier for formatting
This commit is contained in:
parent
6c659fe1d0
commit
ce869012ef
73 changed files with 1393 additions and 794 deletions
|
@ -1,11 +1,14 @@
|
|||
import ics from "ics";
|
||||
import ics from 'ics';
|
||||
|
||||
export const albumReleasesCalendar = (collection) => {
|
||||
const collectionData = collection.getAll()[0];
|
||||
const { data } = collectionData;
|
||||
const { albumReleases: { all }, globals: { url } } = data;
|
||||
const {
|
||||
albumReleases: { all },
|
||||
globals: { url }
|
||||
} = data;
|
||||
|
||||
if (!all || all.length === 0) return "";
|
||||
if (!all || all.length === 0) return '';
|
||||
|
||||
const events = all
|
||||
.map((album) => {
|
||||
|
@ -13,27 +16,30 @@ export const albumReleasesCalendar = (collection) => {
|
|||
|
||||
if (isNaN(date.getTime())) return null;
|
||||
|
||||
const albumUrl = album.url?.includes("http") ? album.url : `${url}${album.url}`;
|
||||
const artistUrl = album.artist.url?.includes("http") ? album.artust.url : `${url}${album.artist.url}`;
|
||||
const albumUrl = album.url?.includes('http') ? album.url : `${url}${album.url}`;
|
||||
const artistUrl = album.artist.url?.includes('http')
|
||||
? album.artust.url
|
||||
: `${url}${album.artist.url}`;
|
||||
|
||||
return {
|
||||
start: [date.getFullYear(), date.getMonth() + 1, date.getDate()],
|
||||
startInputType: "local",
|
||||
startOutputType: "local",
|
||||
startInputType: 'local',
|
||||
startOutputType: 'local',
|
||||
title: `Release: ${album.artist.name} - ${album.title}`,
|
||||
description: `Check out this new album release: ${albumUrl}. Read more about ${album.artist.name} at ${artistUrl}`,
|
||||
url: albumUrl,
|
||||
uid: `${album.release_timestamp}-${album.artist.name}-${album.title}`,
|
||||
uid: `${album.release_timestamp}-${album.artist.name}-${album.title}`
|
||||
};
|
||||
}).filter((event) => event !== null);
|
||||
})
|
||||
.filter((event) => event !== null);
|
||||
|
||||
const { error, value } = ics.createEvents(events, {
|
||||
calName: "Album releases calendar • coryd.dev",
|
||||
calName: 'Album releases calendar • coryd.dev'
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error("Error creating events: ", error);
|
||||
return "";
|
||||
console.error('Error creating events: ', error);
|
||||
return '';
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue