+2
-3
src/webapp/features/semble/components/SembleHeader/SembleHeader.tsx
+2
-3
src/webapp/features/semble/components/SembleHeader/SembleHeader.tsx
···
17
17
import UrlAddedBySummary from '../urlAddedBySummary/UrlAddedBySummary';
18
18
import SembleActions from '../sembleActions/SembleActions';
19
19
import { verifySessionOnServer } from '@/lib/auth/dal.server';
20
+
import GuestSembleActions from '../sembleActions/GusetSembleActions';
20
21
21
22
interface Props {
22
23
url: string;
···
80
81
{session ? (
81
82
<SembleActions url={props.url} />
82
83
) : (
83
-
<Button size="md" component={Link} href={'/login'}>
84
-
Log in to add
85
-
</Button>
84
+
<GuestSembleActions url={props.url} />
86
85
)}
87
86
</Stack>
88
87
</GridCol>
+6
-2
src/webapp/features/semble/components/SembleHeader/Skeleton.SembleHeader.tsx
+6
-2
src/webapp/features/semble/components/SembleHeader/Skeleton.SembleHeader.tsx
···
1
-
import { Stack, Grid, GridCol, Text, Skeleton } from '@mantine/core';
1
+
import { Stack, Grid, GridCol, Text, Skeleton, Group } from '@mantine/core';
2
2
import UrlAddedBySummarySkeleton from '../urlAddedBySummary/Skeleton.UrlAddedBySummary';
3
3
4
4
export default function SembleHeaderSkeleton() {
···
25
25
</Stack>
26
26
</GridCol>
27
27
<GridCol span={{ base: 12, sm: 'content' }}>
28
-
<Stack gap={'sm'} align="start" flex={1}>
28
+
<Stack gap={'sm'} align="center" flex={1}>
29
29
<Skeleton h={150} w={300} maw={'100%'} />
30
30
31
31
{/*<SembleActions />*/}
32
+
<Group gap={'xs'}>
33
+
<Skeleton w={44} h={44} circle />
34
+
<Skeleton w={131} h={44} radius={'xl'} />
35
+
</Group>
32
36
</Stack>
33
37
</GridCol>
34
38
</Grid>
+53
src/webapp/features/semble/components/sembleActions/GusetSembleActions.tsx
+53
src/webapp/features/semble/components/sembleActions/GusetSembleActions.tsx
···
1
+
'use client';
2
+
3
+
import { ActionIcon, Button, CopyButton, Group, Tooltip } from '@mantine/core';
4
+
import Link from 'next/link';
5
+
import { MdIosShare } from 'react-icons/md';
6
+
import { notifications } from '@mantine/notifications';
7
+
8
+
interface Props {
9
+
url: string;
10
+
}
11
+
12
+
export default function GuestSembleActions(props: Props) {
13
+
const shareLink =
14
+
typeof window !== 'undefined'
15
+
? `${window.location.origin}/url?id=${props.url}`
16
+
: '';
17
+
18
+
return (
19
+
<Group gap={'xs'}>
20
+
<CopyButton value={shareLink}>
21
+
{({ copied, copy }) => (
22
+
<Tooltip
23
+
label={copied ? 'Link copied!' : 'Share'}
24
+
withArrow
25
+
position="top"
26
+
>
27
+
<ActionIcon
28
+
variant="light"
29
+
color="gray"
30
+
size={'xl'}
31
+
radius={'xl'}
32
+
onClick={() => {
33
+
copy();
34
+
35
+
if (copied) return;
36
+
notifications.show({
37
+
message: 'Link copied!',
38
+
position: 'top-center',
39
+
id: copied.toString(),
40
+
});
41
+
}}
42
+
>
43
+
<MdIosShare size={22} />
44
+
</ActionIcon>
45
+
</Tooltip>
46
+
)}
47
+
</CopyButton>
48
+
<Button size="md" component={Link} href={'/login'}>
49
+
Log in to add
50
+
</Button>
51
+
</Group>
52
+
);
53
+
}
+37
-2
src/webapp/features/semble/components/sembleActions/SembleActions.tsx
+37
-2
src/webapp/features/semble/components/sembleActions/SembleActions.tsx
···
2
2
3
3
import AddCardToModal from '@/features/cards/components/addCardToModal/AddCardToModal';
4
4
import useGetCardFromMyLibrary from '@/features/cards/lib/queries/useGetCardFromMyLibrary';
5
-
import { Button, Group } from '@mantine/core';
5
+
import { ActionIcon, Button, CopyButton, Group, Tooltip } from '@mantine/core';
6
+
import { notifications } from '@mantine/notifications';
6
7
import { Fragment, useState } from 'react';
7
8
import { FiPlus } from 'react-icons/fi';
8
9
import { IoMdCheckmark } from 'react-icons/io';
10
+
import { MdIosShare } from 'react-icons/md';
9
11
10
12
interface Props {
11
13
url: string;
···
16
18
const isInYourLibrary = cardStatus.data.card?.urlInLibrary;
17
19
const [showAddToModal, setShowAddToModal] = useState(false);
18
20
21
+
const shareLink =
22
+
typeof window !== 'undefined'
23
+
? `${window.location.origin}/url?id=${props.url}`
24
+
: '';
25
+
19
26
if (cardStatus.error) {
20
27
return null;
21
28
}
22
29
23
30
return (
24
31
<Fragment>
25
-
<Group>
32
+
<Group gap={'xs'}>
33
+
<CopyButton value={shareLink}>
34
+
{({ copied, copy }) => (
35
+
<Tooltip
36
+
label={copied ? 'Link copied!' : 'Share'}
37
+
withArrow
38
+
position="top"
39
+
>
40
+
<ActionIcon
41
+
variant="light"
42
+
color="gray"
43
+
size={'xl'}
44
+
radius={'xl'}
45
+
onClick={() => {
46
+
copy();
47
+
48
+
if (copied) return;
49
+
notifications.show({
50
+
message: 'Link copied!',
51
+
position: 'top-center',
52
+
id: copied.toString(),
53
+
});
54
+
}}
55
+
>
56
+
<MdIosShare size={22} />
57
+
</ActionIcon>
58
+
</Tooltip>
59
+
)}
60
+
</CopyButton>
26
61
<Button
27
62
variant={isInYourLibrary ? 'default' : 'filled'}
28
63
size="md"