Skip to content

Commit c93794b

Browse files
Shipped profile share widget to ActivityPub (#24472)
ref PROD-2262 - Implemented shadow effects using PNG images in profile share widget - Worked around html2canvas limitation that doesn't support CSS shadows - Ensured consistent shadow appearance in downloaded profile images - Remove `share` feature flag
1 parent 59d0e54 commit c93794b

File tree

5 files changed

+9
-31
lines changed

5 files changed

+9
-31
lines changed

apps/admin-x-activitypub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tryghost/admin-x-activitypub",
3-
"version": "0.9.9",
3+
"version": "0.9.10",
44
"license": "MIT",
55
"repository": {
66
"type": "git",
88.5 KB
Loading
105 KB
Loading

apps/admin-x-activitypub/src/lib/feature-flags.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {createContext, useContext, useEffect, useState} from 'react';
22
import {useLocation} from '@tryghost/admin-x-framework';
33

44
// Define all available feature flags as string here, e.g. ['flag-1', 'flag-2']
5-
export const FEATURE_FLAGS = ['share'] as const;
5+
export const FEATURE_FLAGS = [] as const;
66

77
// ---
88
export type FeatureFlag = typeof FEATURE_FLAGS[number] | string;

apps/admin-x-activitypub/src/views/Preferences/components/Profile.tsx

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import {memo, useCallback, useEffect, useRef, useState} from 'react';
22

33
import APAvatar from '@src/components/global/APAvatar';
44
import DotsPattern from './DotsPattern';
5+
import ProfileCardShadow from '@assets/images/profile-card-shadow.png';
6+
import ProfileCardShadowSquare from '@assets/images/profile-card-shadow-square.png';
57
import html2canvas from 'html2canvas-objectfit-fix';
68
import {Account} from '@src/api/activitypub';
79
import {Button, H2, LoadingIndicator, LucideIcon, Skeleton, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from '@tryghost/shade';
810
import {imageUrlToDataUrl} from '@src/utils/image';
911
import {toast} from 'sonner';
1012
import {useBrowseSite} from '@tryghost/admin-x-framework/api/site';
11-
import {useFeatureFlags} from '@src/lib/feature-flags';
1213

1314
type ProfileProps = {
1415
account?: Account
@@ -77,8 +78,8 @@ const ProfileCard: React.FC<ProfileCardProps> = memo(({
7778

7879
const cardBackgroundColor = getBackgroundColor();
7980
const textColor = getTextColor();
80-
const margin = isScreenshot ? 'm-4' : 'm-16';
81-
const borderClass = isScreenshot ? backgroundColor === 'light' ? 'border border-gray-200' : '' : 'shadow-xl';
81+
const margin = isScreenshot ? 'm-12' : 'm-16';
82+
const borderClass = isScreenshot ? '' : 'shadow-xl';
8283

8384
const cardWidth = format === 'square' ? 'w-[422px]' : 'w-[316px]';
8485
const cardHeight = 'h-[422px]';
@@ -138,7 +139,6 @@ const ProfileCard: React.FC<ProfileCardProps> = memo(({
138139
ProfileCard.displayName = 'ProfileCard';
139140

140141
const Profile: React.FC<ProfileProps> = ({account, isLoading}) => {
141-
const {isEnabled} = useFeatureFlags();
142142
const {data: siteData} = useBrowseSite();
143143
const accentColor = siteData?.site?.accent_color;
144144
const coverImage = siteData?.site?.cover_image;
@@ -270,27 +270,6 @@ const Profile: React.FC<ProfileProps> = ({account, isLoading}) => {
270270
}
271271
};
272272

273-
if (!isEnabled('share')) {
274-
return (
275-
<div className='flex flex-col items-center'>
276-
<APAvatar
277-
author={
278-
{
279-
icon: {
280-
url: account?.avatarUrl || ''
281-
},
282-
name: account?.name || '',
283-
handle: account?.handle
284-
}
285-
}
286-
size='lg'
287-
/>
288-
<H2 className='mb-0.5 mt-4'>{!isLoading ? account?.name : <Skeleton className='w-32' />}</H2>
289-
<span className='text-[1.5rem] text-gray-700'>{!isLoading ? account?.handle : <Skeleton className='w-full max-w-56' />}</span>
290-
</div>
291-
);
292-
}
293-
294273
return (
295274
<TooltipProvider delayDuration={0}>
296275
<div className='flex flex-col gap-5'>
@@ -395,7 +374,7 @@ const Profile: React.FC<ProfileProps> = ({account, isLoading}) => {
395374
ref={profileCardRef}
396375
className='fixed left-[-9999px] top-0 z-[-1] flex w-fit justify-center overflow-hidden rounded-2xl bg-gray-50'
397376
style={{
398-
width: cardFormat === 'square' ? '454px' : '348px',
377+
width: cardFormat === 'square' ? '518px' : '412px',
399378
fontFamily: 'system-ui'
400379
}}
401380
>
@@ -416,13 +395,12 @@ const Profile: React.FC<ProfileProps> = ({account, isLoading}) => {
416395
<DotsPattern className={`absolute left-[-62.5px] top-[-44px] h-[600px] w-[598px] ${backgroundColor === 'dark' && 'z-10'}`} style={{color: getDotsPatternColor()}} />
417396
}
418397
<div
419-
className='absolute left-0 top-0'
398+
className='absolute left-0 top-0 size-full'
420399
style={{
421-
height: '456px',
422-
width: '456px',
423400
background: getGradient()
424401
}}
425402
/>
403+
<img className='absolute left-1/2 top-12 mt-0.5 max-w-none -translate-x-1/2' src={cardFormat === 'square' ? ProfileCardShadowSquare : ProfileCardShadow} style={{width: cardFormat === 'square' ? '572px' : '466px'}} />
426404
</div>
427405
</div>
428406
</TooltipProvider>

0 commit comments

Comments
 (0)