Facebook links: display profile instead of full url (#16414)
Like we do for LinkedIn/Twitter --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
committed by
GitHub
parent
d36d0d49d1
commit
7f50486de5
@@ -1,5 +1,6 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { LinkType, RoundedLink, SocialLink } from 'twenty-ui/navigation';
|
||||
import { checkUrlType } from '~/utils/checkUrlType';
|
||||
|
||||
type LinkDisplayProps = {
|
||||
value: { url: string; label?: string | null };
|
||||
@@ -22,13 +23,13 @@ export const LinkDisplay = ({ value }: LinkDisplayProps) => {
|
||||
? value.label
|
||||
: url?.replace(/^http[s]?:\/\/(?:[w]+\.)?/gm, '').replace(/^[w]+\./gm, '');
|
||||
|
||||
const type = displayedValue.startsWith('linkedin.')
|
||||
? LinkType.LinkedIn
|
||||
: displayedValue.startsWith('twitter.')
|
||||
? LinkType.Twitter
|
||||
: LinkType.Url;
|
||||
const type = checkUrlType(absoluteUrl);
|
||||
|
||||
if (type === LinkType.LinkedIn || type === LinkType.Twitter) {
|
||||
if (
|
||||
type === LinkType.LinkedIn ||
|
||||
type === LinkType.Twitter ||
|
||||
type === LinkType.Facebook
|
||||
) {
|
||||
return <SocialLink href={absoluteUrl} type={type} label={displayedValue} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ export const LinksDisplay = ({ value, onLinkClick }: LinksDisplayProps) => {
|
||||
return (
|
||||
<ExpandableList>
|
||||
{links.map(({ url, label, type }, index) =>
|
||||
type === LinkType.LinkedIn || type === LinkType.Twitter ? (
|
||||
type === LinkType.LinkedIn ||
|
||||
type === LinkType.Twitter ||
|
||||
type === LinkType.Facebook ? (
|
||||
<SocialLink
|
||||
key={index}
|
||||
href={url}
|
||||
|
||||
@@ -23,7 +23,11 @@ export const URLDisplay = ({ value }: URLDisplayProps) => {
|
||||
|
||||
const type = checkUrlType(absoluteUrl);
|
||||
|
||||
if (type === LinkType.LinkedIn || type === LinkType.Twitter) {
|
||||
if (
|
||||
type === LinkType.LinkedIn ||
|
||||
type === LinkType.Twitter ||
|
||||
type === LinkType.Facebook
|
||||
) {
|
||||
return (
|
||||
<EllipsisDisplay>
|
||||
<SocialLink
|
||||
|
||||
Reference in New Issue
Block a user