Files
App/src/hooks/use-caption.ts
Violet Caulfield bdf8a1eb6c 793 bug cant delete playlist inside jellify (#806)
* Ad ability to long press and delete a playlist

also can delete a playlist within the playlist screen itself

adds some more fun loading messages and "pull to refresh" text
2025-12-09 07:09:14 -06:00

31 lines
900 B
TypeScript

import { useQuery } from '@tanstack/react-query'
import { INFO_CAPTIONS } from '../configs/info.config'
import { ONE_HOUR } from '../constants/query-client'
import { pickRandomItemFromArray } from '../utils/random'
import { LOADING_CAPTIONS } from '../configs/loading.config'
enum CaptionQueryKeys {
InfoCaption,
LoadingCaption,
}
export const useInfoCaption = () =>
useQuery({
queryKey: [CaptionQueryKeys.InfoCaption],
queryFn: () => `${pickRandomItemFromArray(INFO_CAPTIONS)}`,
staleTime: ONE_HOUR,
initialData: 'Live and in stereo',
refetchOnMount: 'always',
refetchOnWindowFocus: 'always',
})
export const useLoadingCaption = () =>
useQuery({
queryKey: [CaptionQueryKeys.LoadingCaption],
queryFn: () => `${pickRandomItemFromArray(LOADING_CAPTIONS)}`,
staleTime: 0,
initialData: 'Reticulating splines',
refetchOnMount: 'always',
refetchOnWindowFocus: 'always',
})