From 8b37980da344cadb4f33b65737fa34e5cff8f56f Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Fri, 6 Jan 2023 12:04:25 +0100 Subject: [PATCH 1/2] feat: link to user profile from name --- src/element/ProfileImage.css | 10 +++++++++- src/element/ProfileImage.js | 11 +++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/element/ProfileImage.css b/src/element/ProfileImage.css index 4838fb72..90db64ce 100644 --- a/src/element/ProfileImage.css +++ b/src/element/ProfileImage.css @@ -9,4 +9,12 @@ margin-right: 20px; border-radius: 10px; cursor: pointer; -} \ No newline at end of file +} + +.pfp a { + text-decoration: none; +} + +.pfp a:hover { + text-decoration: underline; +} diff --git a/src/element/ProfileImage.js b/src/element/ProfileImage.js index 6ad60000..e9b3c85c 100644 --- a/src/element/ProfileImage.js +++ b/src/element/ProfileImage.js @@ -1,8 +1,11 @@ -import "./ProfileImage.css"; -import { useNavigate } from "react-router-dom"; +import { useMemo } from "react"; + +import { Link, useNavigate } from "react-router-dom"; + import useProfile from "../feed/ProfileFeed"; import Nostrich from "../nostrich.jpg"; -import { useMemo } from "react"; + +import "./ProfileImage.css"; export default function ProfileImage(props) { const pubkey = props.pubkey; @@ -24,7 +27,7 @@ export default function ProfileImage(props) {
navigate(`/p/${pubkey}`)} />
- {name} + {name} {subHeader ?
{subHeader}
: null}
-- 2.45.2 From 416dc66621849b0369b28785fa3b1beaefdc17d6 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Fri, 6 Jan 2023 12:05:27 +0100 Subject: [PATCH 2/2] feat: clickable links on about page --- src/Text.js | 88 ++++++++++++++++++++++++++++++++++++++++ src/element/Note.js | 88 +--------------------------------------- src/pages/ProfilePage.js | 3 +- 3 files changed, 92 insertions(+), 87 deletions(-) create mode 100644 src/Text.js diff --git a/src/Text.js b/src/Text.js new file mode 100644 index 00000000..7b868732 --- /dev/null +++ b/src/Text.js @@ -0,0 +1,88 @@ +import { Link } from "react-router-dom"; + +import Invoice from "./element/Invoice"; +import { UrlRegex, FileExtensionRegex, MentionRegex, InvoiceRegex } from "./Const"; + +export function extractLinks(fragments) { + return fragments.map(f => { + if (typeof f === "string") { + return f.split(UrlRegex).map(a => { + if (a.startsWith("http")) { + try { + let url = new URL(a); + let ext = url.pathname.toLowerCase().match(FileExtensionRegex); + if (ext) { + switch (ext[1]) { + case "gif": + case "jpg": + case "jpeg": + case "png": + case "bmp": + case "webp": { + return ; + } + case "mp4": + case "mkv": + case "avi": + case "m4v": { + return