Skip to content

Commit

Permalink
fix: make invite url copyable through a.href
Browse files Browse the repository at this point in the history
  • Loading branch information
diced committed Feb 4, 2025
1 parent 711e583 commit fff1d82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/pages/invites/InviteCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import RelativeDate from '@/components/RelativeDate';
import { Invite } from '@/lib/db/models/invite';
import { ActionIcon, Card, Group, Menu, Stack, Text } from '@mantine/core';
import { ActionIcon, Anchor, Card, Group, Menu, Stack, Text } from '@mantine/core';
import { IconCopy, IconDots, IconTrashFilled } from '@tabler/icons-react';
import { copyInviteUrl, deleteInvite } from './actions';
import { useClipboard } from '@mantine/hooks';
Expand All @@ -16,7 +16,9 @@ export default function InviteCard({ invite }: { invite: Invite }) {
<Card withBorder shadow='sm' radius='sm'>
<Card.Section withBorder inheritPadding py='xs'>
<Group justify='space-between'>
<Text fw={400}>{invite.code}</Text>
<Anchor href={`/invite/${invite.code}`} target='_blank' fw={400}>
{invite.code}
</Anchor>

<Menu withinPortal position='bottom-end' shadow='sm'>
<Group gap={2}>
Expand Down
7 changes: 6 additions & 1 deletion src/components/pages/invites/views/InviteTableView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import RelativeDate from '@/components/RelativeDate';
import { Response } from '@/lib/api/response';
import { Invite } from '@/lib/db/models/invite';
import { ActionIcon, Box, Group, Tooltip } from '@mantine/core';
import { ActionIcon, Anchor, Box, Group, Tooltip } from '@mantine/core';
import { useClipboard } from '@mantine/hooks';
import { IconCopy, IconTrashFilled } from '@tabler/icons-react';
import { DataTable, DataTableSortStatus } from 'mantine-datatable';
Expand Down Expand Up @@ -52,6 +52,11 @@ export default function InviteTableView() {
{
accessor: 'code',
sortable: true,
render: (invite) => (
<Anchor href={`/invite/${invite.code}`} target='_blank'>
{invite.code}
</Anchor>
),
},
{
accessor: 'inviter.username',
Expand Down

0 comments on commit fff1d82

Please sign in to comment.