import { Language } from "@/components/bazarr"; import { BuildKey } from "@/utilities"; import { useLanguageProfileBy, useProfileItemsToLanguages, } from "@/utilities/languages"; import { faBookmark as farBookmark, faFolder, } from "@fortawesome/free-regular-svg-icons"; import { faBookmark, faClone, faLanguage, faMusic, faStream, faTags, IconDefinition, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { BackgroundImage, Badge, BadgeProps, Box, createStyles, Grid, Group, HoverCard, Image, List, MediaQuery, Stack, Text, Title, } from "@mantine/core"; import { FunctionComponent, useMemo } from "react"; interface Props { item: Item.Base | null; details?: { icon: IconDefinition; text: string }[]; } const useStyles = createStyles((theme) => { return { poster: { maxWidth: "250px", }, col: { maxWidth: "100%", }, group: { maxWidth: "100%", }, }; }); const ItemOverview: FunctionComponent = (props) => { const { item, details } = props; const { classes } = useStyles(); const detailBadges = useMemo(() => { const badges: (JSX.Element | null)[] = []; if (item) { badges.push( {item.path} ); badges.push( ...(details?.map((val, idx) => ( {val.text} )) ?? []) ); if (item.tags.length > 0) { badges.push( {item.tags.join("|")} ); } } return badges; }, [details, item]); const audioBadges = useMemo( () => item?.audio_language.map((v, idx) => ( {v.name} )) ?? [], [item?.audio_language] ); const profile = useLanguageProfileBy(item?.profileId); const profileItems = useProfileItemsToLanguages(profile); const languageBadges = useMemo(() => { const badges: (JSX.Element | null)[] = []; if (profile) { badges.push( {profile.name} ); badges.push( ...profileItems.map((v, idx) => ( )) ); } return badges; }, [profile, profileItems]); return ( <Text inherit color="white"> <Box component="span" mr={12}> <FontAwesomeIcon title={item?.monitored ? "unmonitored" : "monitored"} icon={item?.monitored ? faBookmark : farBookmark} ></FontAwesomeIcon> </Box> {item?.title} </Text> {item?.alternativeTitles.map((v, idx) => ( {v} ))} {detailBadges} {audioBadges} {languageBadges} {item?.overview} ); }; type ItemBadgeProps = Omit & { icon: IconDefinition; title?: string; }; const ItemBadge: FunctionComponent = ({ icon, title, ...props }) => ( } radius="sm" color="dark" size="sm" style={{ textTransform: "none" }} aria-label={title} {...props} > ); export default ItemOverview;