Skip to content

Commit

Permalink
🩹 NICE-125 event info + skip music api [b] (#2558)
Browse files Browse the repository at this point in the history
Spotify API is kind of like ... not working. So this should be a direct Redis Cache hit in the menatime and something is really making it take forever. We know what the data is. Just set it and forget it until this needs to be dynamic again.
  • Loading branch information
JeromeFitz committed Jun 18, 2024
1 parent 3eb9e88 commit 2f25e1b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
'use client'
import { fetcher } from '@jeromefitz/shared/lib'
/**
* @todo(api) NICE-125 this takes way too long to run
* on what should be a redis cache hit
*/
// import { fetcher } from '@jeromefitz/shared/lib'

import useSWR from 'swr'
// import useSWR from 'swr'

import { INIT, getKey } from '@/utils/getKey'
// import { INIT, getKey } from '@/utils/getKey'

import { CurrentlyItem } from './Currently.Item'
import { CurrentlyWrapper } from './Currently.Item.Wrapper'

const key = getKey(0, { ...INIT, time_range: 'long_term', type: 'top-tracks' })
const options = {}
// const key = getKey(0, { ...INIT, time_range: 'long_term', type: 'top-tracks' })
// const options = {}

function CurrentlyMusicClient({ titleSub, ...c }) {
const { color, href, icon, id, title } = c
const propsParent = { color, href, icon, id, title }
const { data, error, isLoading } = useSWR(key, fetcher, options)
// const { data, error, isLoading } = useSWR(key, fetcher, options)

const hasError = !!error
// const hasError = !!error

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const top = hasError ? {} : data?.items[0]
// const top = hasError ? {} : data?.items[0]

const headline = hasError ? titleSub[0] : top?.artist
const subline = hasError ? titleSub[1] : top?.album?.name
// const headline = hasError ? titleSub[0] : top?.artist
// const subline = hasError ? titleSub[1] : top?.album?.name

const headline = titleSub[0]
const subline = titleSub[1]

const props = {
headline,
id,
isLoading,
isLoading: false,
subline,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const currently = [
id: 'listening',
isActive: true,
title: 'I’m Listening To…',
titleSub: 'Jessica Pratt – Here in the Pitch',
titleSub: 'Cam Chambers, Nice Rec – Check Please',
},
{
apiUrl: '',
Expand Down
15 changes: 12 additions & 3 deletions sites/jeromefitzgerald.com/src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ const siteUrl = 'https://jeromefitzgerald.com'
const lastModified = new Date()

const root = ['']
const currently = ['listening-to', 'reading']
const currently = [
// 'cooking',
'listening-to',
'reading',
]
/**
* @todo(dynamic) start somewhere though
*/
const events = [
'2023/06/01/your-act',
'2023/06/10/the-playlist',
Expand Down Expand Up @@ -44,8 +51,10 @@ const events = [
'2024/03/23/sketch-madness',
'2024/04/13/arcade-hootenanny',
'2024/05/10/the-latchkey-kids',
// '2024/05/18/the-playlist',
'2024/06/15/the-playlist',
'2024/06/06/your-act',
'2024/07/13/arcade-hootenanny',
// '2024/07/18/sketch-comedy-lab-best-of',
// '2024/07/19/sketch-comedy-lab-best-of',
]
const pages = [
'about',
Expand Down
34 changes: 22 additions & 12 deletions sites/jeromefitzgerald.com/src/store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,34 @@ const getDefaultInitialStateStoreMenu = () => ({
titleDescription: 'Including recent past events.',
},
{
href: '/events/2024/05/10/the-latchkey-kids',
href: '/events/2024/07/13/arcade-hootenanny',
icon: TicketIcon,
id: '2024/05/10/the-latchkey-kids',
id: '2024/07/13/arcade-hootenanny',
isActive: true,
isActiveMobile: true,
keywords: ['arcade', 'hootenanny', 'improv'],
title: 'Arcade Hootenanny: SAT 07/13',
titleDescription: '',
},
{
href: '/events/2024/07/18/sketch-comedy-lab-best-of',
icon: TicketIcon,
id: '2024/07/18/sketch-comedy-lab-best-of',
isActive: false,
isActiveMobile: false,
keywords: ['latchkey', 'kids', 'warp', 'zone'],
title: 'Latchkey Kids: SAT 05/10',
titleDescription: 'Psst – Warp Zone are special guests. Pass it on.',
keywords: ['sketch', 'comedy', 'lab'],
title: 'Sketch Comedy Lab: THU 07/18',
titleDescription: '',
},
{
href: '/events/2024/06/06/your-act',
href: '/events/2024/07/19/sketch-comedy-lab-best-of',
icon: TicketIcon,
id: '2024/06/06/your-act',
isActive: true,
isActiveMobile: true,
keywords: ['your', 'act', 'nonsense'],
title: 'Your ACT: THU 06/06',
titleDescription: 'Your ACT with Nonsense',
id: '2024/07/19/sketch-comedy-lab-best-of',
isActive: false,
isActiveMobile: false,
keywords: ['sketch', 'comedy', 'lab'],
title: 'Sketch Comedy Lab: FRI 07/19',
titleDescription: '',
},
],
podcasts: [
Expand Down

0 comments on commit 2f25e1b

Please sign in to comment.