Modified URLs and added button to share on LinkedIn (#5306)
- Removed the env variable and added the current URL in contributor's page - Added button to share on LinkedIn on contributor's profile - Fixed absolute image URL for release API --------- Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
This commit is contained in:
@ -4,7 +4,7 @@ import styled from '@emotion/styled';
|
||||
import { IconDownload } from '@tabler/icons-react';
|
||||
|
||||
import { CardContainer } from '@/app/_components/contributors/CardContainer';
|
||||
import { GithubIcon, XIcon } from '@/app/_components/ui/icons/SvgIcons';
|
||||
import { LinkedInIcon, XIcon } from '@/app/_components/ui/icons/SvgIcons';
|
||||
import { Theme } from '@/app/_components/ui/theme/theme';
|
||||
|
||||
const Container = styled(CardContainer)`
|
||||
@ -48,15 +48,15 @@ const StyledButton = styled.a`
|
||||
`;
|
||||
|
||||
interface ProfileProps {
|
||||
userUrl: string;
|
||||
username: string;
|
||||
}
|
||||
|
||||
export const ProfileSharing = ({ userUrl, username }: ProfileProps) => {
|
||||
const contributorUrl = `${process.env.NEXT_PUBLIC_HOST_URL}/contributors/${username}`;
|
||||
export const ProfileSharing = ({ username }: ProfileProps) => {
|
||||
const baseUrl = `${window.location.protocol}//${window.location.host}`;
|
||||
const contributorUrl = `${baseUrl}/contributors/${username}`;
|
||||
|
||||
const handleDownload = async () => {
|
||||
const imageSrc = `${process.env.NEXT_PUBLIC_HOST_URL}/api/contributors/og-image/${username}`;
|
||||
const imageSrc = `${baseUrl}/api/contributors/og-image/${username}`;
|
||||
try {
|
||||
const response = await fetch(imageSrc);
|
||||
const blob = await response.blob();
|
||||
@ -76,9 +76,12 @@ export const ProfileSharing = ({ userUrl, username }: ProfileProps) => {
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<StyledButton href={userUrl} target="blank">
|
||||
<GithubIcon color="black" size="24px" />
|
||||
Visit Profile
|
||||
<StyledButton
|
||||
href={`https://www.linkedin.com/sharing/share-offsite/?url=${contributorUrl}`}
|
||||
target="blank"
|
||||
>
|
||||
<LinkedInIcon color="black" size="24px" />
|
||||
Share on LinkedIn
|
||||
</StyledButton>
|
||||
<StyledButton onClick={handleDownload}>
|
||||
<IconDownload /> Download Image
|
||||
|
||||
Reference in New Issue
Block a user