diff --git a/src/components/FragrancePage.tsx b/src/components/FragrancePage.tsx index f0d56a7..252bd5b 100644 --- a/src/components/FragrancePage.tsx +++ b/src/components/FragrancePage.tsx @@ -12,6 +12,8 @@ import { cache, TTL } from '../services/cache' import { calculateWeightedScore, decodeWeightedScore } from '../utils/reviewUtils' import type { AuthorInfo } from './ReviewCard' import { useUserPreferences } from '../hooks/useUserPreferences' +import { useShareButton } from '../hooks/useShareButton' +import { Button } from './Button' const MICROCOSM_API = "https://ufos-api.microcosm.blue" @@ -25,6 +27,7 @@ interface FragrancePageProps { export function FragrancePage({ handle, rkey, session, userProfile, onLogout }: FragrancePageProps) { const [, setLocation] = useLocation() + const { share } = useShareButton() const [fragranceName, setFragranceName] = useState('Loading Fragrance...') const [houseName, setHouseName] = useState(null) const [houseHandle, setHouseHandle] = useState(null) @@ -188,6 +191,15 @@ export function FragrancePage({ handle, rkey, session, userProfile, onLogout }: } }, [handle, rkey]) + const handleShare = () => { + const link = window.location.href + const house = houseName ? ` by ${houseName}` : '' + const header = `${fragranceName}${house}` + const footer = `#sotd #scentsky #fragrancesky #perfumesky` + const shareText = `${header}\n\n${footer}\n\n${link}` + share(shareText) + } + if (isLoading) { return
Loading Fragrance...
} @@ -211,15 +223,22 @@ export function FragrancePage({ handle, rkey, session, userProfile, onLogout }:

{fragranceName}

- {session && session.sub === fragranceDid && ( - - Edit Fragrance - - )} +
+ {session && ( + + )} + {session && session.sub === fragranceDid && ( + + Edit Fragrance + + )} +
{houseName && houseHandle && houseRkey && (