import { ActionIcon, CopyButton, Group } from '@mantine/core'; import isElectron from 'is-electron'; import { useTranslation } from 'react-i18next'; import { RiCheckFill, RiClipboardFill, RiExternalLinkFill } from 'react-icons/ri'; import styled from 'styled-components'; import { toast, Tooltip } from '/@/renderer/components'; const util = isElectron() ? window.api.utils : null; export type SongPathProps = { path: null | string; }; const PathText = styled.div` user-select: all; `; export const SongPath = ({ path }: SongPathProps) => { const { t } = useTranslation(); if (!path) return null; return ( {({ copied, copy }) => ( {copied ? : } )} {util && ( { util.openItem(path).catch((error) => { toast.error({ message: (error as Error).message, title: t('error.openError', { postProcess: 'sentenceCase', }), }); }); }} /> )} {path} ); };