feat: add links to Links field (#5223)

Closes #5115, Closes #5116

<img width="242" alt="image"
src="https://github.com/twentyhq/twenty/assets/3098428/ab78495a-4216-4243-8de3-53720818a09b">

---------

Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
This commit is contained in:
Thaïs
2024-05-07 15:05:18 +02:00
committed by GitHub
parent 8074aae449
commit b0d1cc9dcb
12 changed files with 306 additions and 146 deletions

View File

@ -0,0 +1,9 @@
import { absoluteUrlSchema } from '~/utils/validation-schemas/absoluteUrlSchema';
export const getAbsoluteUrl = (url: string) => {
try {
return absoluteUrlSchema.parse(url);
} catch {
return '';
}
};

View File

@ -1,8 +1,8 @@
import { absoluteUrlSchema } from '~/utils/validation-schemas/absoluteUrlSchema';
import { getAbsoluteUrl } from '~/utils/url/getAbsoluteUrl';
export const getUrlHostName = (url: string) => {
try {
const absoluteUrl = absoluteUrlSchema.parse(url);
const absoluteUrl = getAbsoluteUrl(url);
return new URL(absoluteUrl).hostname.replace(/^www\./i, '');
} catch {
return '';