diff --git a/html/src/Components/ShareComponent.tsx b/html/src/Components/ShareComponent.tsx index 24fbe93..05f3aab 100644 --- a/html/src/Components/ShareComponent.tsx +++ b/html/src/Components/ShareComponent.tsx @@ -48,6 +48,16 @@ export function ShareComponent(props: {share: Share}) { }) } + const linkify = (text: string) => { + const urlRegex = /[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/ + if (urlRegex.test(text)) { + return {text} + } + else { + return text + } + } + if (deleted) { return } @@ -107,16 +117,16 @@ export function ShareComponent(props: {share: Share}) { } {/* Share informations */} - - - + + + {/* Share name */} - - + + {name} - - {share.options.description?share.options.description + + {share.options.description?linkify(share.options.description) : t("created") + " " + new Date(share.created).toLocaleString(locales,{dateStyle:"long",timeStyle:"short"}) }