diff --git a/components/Group/GroupList/SkeletonGroupCard.jsx b/components/Group/GroupList/SkeletonGroupCard.jsx index 11002463..152c01c5 100644 --- a/components/Group/GroupList/SkeletonGroupCard.jsx +++ b/components/Group/GroupList/SkeletonGroupCard.jsx @@ -7,9 +7,9 @@ import { StyledText, } from './GroupCard.styled'; -function SkeletonGroupCard({ _id }) { +function SkeletonGroupCard() { return ( - + + + + + + + + + + + + + + + + + {hasNativeShare && ( + + + + )} + + ); +} diff --git a/components/Group/detail/index.jsx b/components/Group/detail/index.jsx index f0b1c53f..40a6c407 100644 --- a/components/Group/detail/index.jsx +++ b/components/Group/detail/index.jsx @@ -1,7 +1,5 @@ import { useRouter } from 'next/navigation'; import { useSelector } from 'react-redux'; -import styled from '@emotion/styled'; -import Button from '@mui/material/Button'; import Box from '@mui/material/Box'; import Skeleton from '@mui/material/Skeleton'; import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew'; @@ -19,6 +17,7 @@ import { StyledMobileEditButton, } from './Detail.styled'; import ContactButton from './Contact'; +import ShareButtonGroup from './ShareButtonGroup'; function GroupDetail({ id, source, isLoading }) { const router = useRouter(); @@ -38,18 +37,26 @@ function GroupDetail({ id, source, isLoading }) { {source?.photoAlt} )} - {isLoading ? ( - + {isLoading ? ( + + ) : source?.isGrouping ? ( + 揪團中 + ) : ( + 已結束 + )} + - ) : source?.isGrouping ? ( - 揪團中 - ) : ( - 已結束 - )} + {isMyGroup ? ( () => window.open(url, '_blank'); + + const nativeShare = () => { + if (!navigator?.share) return; + navigator.share({ title, text, url }); + }; + + const facebookShare = openInNewTab( + `https://www.facebook.com/sharer/sharer.php?u=${url}&source_surface=external_reshare&display=popup&hashtag=${hashtag}`, + ); + + const lineShare = openInNewTab( + `https://social-plugins.line.me/lineit/share?url=${url}`, + ); + + const linkedinShare = openInNewTab( + `https://www.linkedin.com/sharing/share-offsite/?url=${url}&text=${text}`, + ); + + const threadsShare = openInNewTab( + `https://threads.net/intent/post?text=${url}`, + ); + + const xShare = openInNewTab(`https://x.com/intent/tweet?text=${url}`); + + return { + hasNativeShare: !!navigator?.share, + facebookShare, + lineShare, + linkedinShare, + nativeShare, + threadsShare, + xShare, + }; +}