Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from layer5io:master #41

Merged
merged 22 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/custom/CatalogDetail/OverviewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface OverviewSectionProps {
fontFamily?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userProfile?: any;
showShareAction: boolean;
handleShare: () => void;
}

const OverviewSection: React.FC<OverviewSectionProps> = ({
Expand All @@ -37,7 +39,9 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
classes,
handleCopyUrl,
fontFamily,
userProfile
userProfile,
showShareAction,
handleShare
}) => {
return (
<OverviewContainer>
Expand All @@ -58,6 +62,8 @@ const OverviewSection: React.FC<OverviewSectionProps> = ({
title={title}
getUrl={getUrl}
handleCopyUrl={handleCopyUrl}
showShareAction={showShareAction}
handleShare={handleShare}
/>
</div>
<Grid container spacing={2}>
Expand Down
8 changes: 7 additions & 1 deletion src/custom/CatalogDetail/RightPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface RightPanelProps {
technologySVGSubpath: string;
orgName: string;
fetchingOrgError: boolean;
showShareAction: boolean;
handleShare: () => void;
}

const RightPanel: React.FC<RightPanelProps> = ({
Expand All @@ -47,7 +49,9 @@ const RightPanel: React.FC<RightPanelProps> = ({
technologySVGPath,
technologySVGSubpath,
orgName,
fetchingOrgError
fetchingOrgError,
showShareAction,
handleShare
}) => {
const cleanedType = type.replace('my-', '').replace(/s$/, '');
const { data: userProfile } = useGetUserProfileByIdQuery({
Expand All @@ -69,6 +73,8 @@ const RightPanel: React.FC<RightPanelProps> = ({
handleCopyUrl={handleCopyUrl}
fontFamily={fontFamily}
userProfile={userProfile}
showShareAction={showShareAction}
handleShare={handleShare}
/>
{showCaveats && <CaveatsSection details={details} />}
<RelatedDesigns
Expand Down
35 changes: 25 additions & 10 deletions src/custom/CatalogDetail/SocialSharePopper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTheme } from '../../theme';
import { Pattern } from '../CustomCatalog/CustomCard';
import { CustomTooltip } from '../CustomTooltip';
import { ErrorBoundary } from '../ErrorBoundary';
import { CopyShareIconWrapper, VisibilityChip } from './style';
import { ActionButton, CopyShareIconWrapper, VisibilityChip } from './style';

interface SocialSharePopperProps {
details: Pattern;
Expand All @@ -15,6 +15,8 @@ interface SocialSharePopperProps {
title: string;
getUrl: (type: string, id: string) => string;
handleCopyUrl: (type: string, name: string, id: string) => void;
showShareAction: boolean;
handleShare: () => void;
}

const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
Expand All @@ -23,7 +25,9 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
cardId,
title,
getUrl,
handleCopyUrl
handleCopyUrl,
showShareAction,
handleShare
}) => {
const theme = useTheme();
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
Expand All @@ -50,15 +54,26 @@ const SocialSharePopper: React.FC<SocialSharePopperProps> = ({
{details?.visibility}
</VisibilityChip>

{details?.visibility !== 'private' && (
<CustomTooltip title="Copy Link" placement="top" arrow>
<IconButton
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
>
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
</IconButton>
{showShareAction ? (
<CustomTooltip title="Share" placement="top" arrow>
<ActionButton sx={{ borderRadius: '0.2rem', padding: '0.4rem' }} onClick={handleShare}>
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.inverse} />
Share
</ActionButton>
</CustomTooltip>
) : (
<>
{details?.visibility !== 'private' && (
<CustomTooltip title="Copy Link" placement="top" arrow>
<IconButton
sx={{ borderRadius: '0.1rem', padding: '0.5rem' }}
onClick={() => handleCopyUrl(cleanedType, details?.name, details?.id)}
>
<ChainIcon height={'24'} width={'24'} fill={theme.palette.icon.secondary} />
</IconButton>
</CustomTooltip>
)}
</>
)}

{(details?.visibility === 'published' || details?.visibility === 'public') && (
Expand Down
4 changes: 2 additions & 2 deletions src/custom/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { CustomTooltip } from '../CustomTooltip';
interface ModalProps extends DialogProps {
closeModal: () => void;
title: string;
headerIcon: React.ReactNode;
reactNode: React.ReactNode;
headerIcon?: React.ReactNode;
reactNode?: React.ReactNode;
}

interface ModalFooterProps {
Expand Down
Loading
Loading