import isElectron from 'is-electron'; import { useTranslation } from 'react-i18next'; import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { CopyButton } from '/@/shared/components/copy-button/copy-button'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { Text } from '/@/shared/components/text/text'; import { toast } from '/@/shared/components/toast/toast'; import { Tooltip } from '/@/shared/components/tooltip/tooltip'; const util = isElectron() ? window.api.utils : null; export type SongPathProps = { path: null | string; }; 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', }), }); }); }} variant="transparent" /> )} {path} ); };