"use client"; import Link from "next/link"; import { AnimatePresence, motion } from "framer-motion"; import { useMemo, useState, useSyncExternalStore } from "react"; import { useI18n } from "@/lib/i18n"; import { useAppReducedMotion as useReducedMotion } from "@/lib/motion-pref"; import { deletePodcast, podcastMinutes, podcastStore, renamePodcast, sortPodcasts, upsertPodcast } from "@/lib/podcasts"; import { showToast } from "@/lib/toast"; import { EmptyState } from "@/components/ui"; import { ClockIcon, EllipsisIcon, MusicIcon, PlayIcon } from "@/components/icons"; import { cn } from "@/lib/utils"; /** * The library's podcasts tab: short episode cards with listen / rename / * delete, the same interaction language as the homework cards. */ export function PodcastList() { const { t, plural } = useI18n(); const reduceMotion = useReducedMotion(); const episodes = useSyncExternalStore( podcastStore.subscribe, podcastStore.getSnapshot, podcastStore.getServerSnapshot, ); const sorted = useMemo(() => sortPodcasts(episodes), [episodes]); const [menuFor, setMenuFor] = useState(null); const [renaming, setRenaming] = useState(null); const [draft, setDraft] = useState(""); if (sorted.length === 0) { return ( {t("podcast.library.new")} } > {t("podcast.library.emptyBody")} ); } return ( ); }