Skip to content

Commit

Permalink
feat: copy all urls button
Browse files Browse the repository at this point in the history
  • Loading branch information
diced committed Mar 27, 2024
1 parent e6a09b5 commit 23463af
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/components/pages/upload/uploadFiles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Response } from '@/lib/api/response';
import { ErrorBody } from '@/lib/response';
import { UploadOptionsStore } from '@/lib/store/uploadOptions';
import { ActionIcon, Anchor, Group, Stack, Table, Title, Tooltip } from '@mantine/core';
import { ActionIcon, Anchor, Button, Group, Stack, Table, Title, Tooltip } from '@mantine/core';
import { useClipboard } from '@mantine/hooks';
import { modals } from '@mantine/modals';
import { notifications } from '@mantine/notifications';
Expand Down Expand Up @@ -61,6 +61,31 @@ export function filesModal(
</Group>
))}
</Stack>
{files.length > 1 && (
<Group justify='right'>
<Tooltip label='Copy all links to clipboard'>
<Button
onClick={() => {
clipboard.copy(files.map((file) => file.url).join('\n'));
notifications.show({
title: 'Copied URLs to clipboard',
message: 'Copied all URLs to clipboard seperated by a new line.',
color: 'blue',
icon: <IconClipboardCopy size='1rem' />,
});
}}
variant='filled'
color='blue'
size='compact-md'
mt='sm'
fullWidth
leftSection={<IconClipboardCopy size='1rem' />}
>
Copy {files.length} URLs to clipboard
</Button>
</Tooltip>
</Group>
)}
</Table>
),
});
Expand Down

0 comments on commit 23463af

Please sign in to comment.