mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 23:48:26 -04:00
* more translation keys * added i18n keys for future ObjectKindEnum translation * more keys * added more keys * synced all new translation keys with all languages, translated keys on Belarusian and Russian * added translation for objectkinds in overview * added translation function for objectkinds * added more keys to german locale * renamed 'asc' and 'desc' keys * rolled back changes * added missed key * there are much more keys, than you can imagine * fixed misspelling * removed console.log * removed function "pluralize", added required plural words keys for each language * fixed condition, which could've lead to undefined value * hide filter description for boolean filters
37 lines
892 B
TypeScript
37 lines
892 B
TypeScript
import { ClipboardText } from '@phosphor-icons/react';
|
|
import { toast } from '@sd/ui';
|
|
import { Menu } from '~/components/Menu';
|
|
import { useLocale } from '~/hooks';
|
|
|
|
export const CopyAsPathBase = (
|
|
props: { path: string } | { getPath: () => Promise<string | null> }
|
|
) => {
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
<Menu.Item
|
|
label={t('copy_as_path')}
|
|
icon={ClipboardText}
|
|
onClick={async () => {
|
|
try {
|
|
const path = 'path' in props ? props.path : await props.getPath();
|
|
{
|
|
/* 'path' in props
|
|
? props.path
|
|
: await libraryClient.query(['files.getPath', props.filePath.id]); */
|
|
}
|
|
|
|
if (path == null) throw new Error('No file path available');
|
|
|
|
navigator.clipboard.writeText(path);
|
|
} catch (error) {
|
|
toast.error({
|
|
title: t('failed_to_copy_file_path'),
|
|
body: t('error_message', { error })
|
|
});
|
|
}
|
|
}}
|
|
/>
|
|
);
|
|
};
|