diff --git a/packages/app/src/Element/User/UserWebsiteLink.css b/packages/app/src/Element/User/UserWebsiteLink.css
new file mode 100644
index 00000000..0f81ef93
--- /dev/null
+++ b/packages/app/src/Element/User/UserWebsiteLink.css
@@ -0,0 +1,13 @@
+.user-profile-link {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.user-profile-link a {
+ text-decoration: none;
+}
+
+.user-profile-link a:hover {
+ text-decoration: underline;
+}
diff --git a/packages/app/src/Element/User/UserWebsiteLink.tsx b/packages/app/src/Element/User/UserWebsiteLink.tsx
new file mode 100644
index 00000000..e5dbbd7a
--- /dev/null
+++ b/packages/app/src/Element/User/UserWebsiteLink.tsx
@@ -0,0 +1,29 @@
+import "./UserWebsiteLink.css";
+import { MetadataCache, UserMetadata } from "@snort/system";
+import Icon from "Icons/Icon";
+
+export function UserWebsiteLink({ user }: { user?: MetadataCache | UserMetadata }) {
+ const website_url =
+ user?.website && !user.website.startsWith("http") ? "https://" + user.website : user?.website || "";
+
+ function tryFormatWebsite(url: string) {
+ try {
+ const u = new URL(url);
+ return `${u.hostname}${u.pathname !== "/" ? u.pathname : ""}`;
+ } catch {
+ // ignore
+ }
+ return url;
+ }
+
+ if (user?.website) {
+ return (
+
+ );
+ }
+}
diff --git a/packages/app/src/Hooks/useTextTransformCache.tsx b/packages/app/src/Hooks/useTextTransformCache.tsx
index 07442043..4c562658 100644
--- a/packages/app/src/Hooks/useTextTransformCache.tsx
+++ b/packages/app/src/Hooks/useTextTransformCache.tsx
@@ -3,11 +3,14 @@ import { ParsedFragment, transformText } from "@snort/system";
const TextCache = new Map
>();
export function transformTextCached(id: string, content: string, tags: Array>) {
- const cached = TextCache.get(id);
- if (cached) return cached;
- const newCache = transformText(content, tags);
- TextCache.set(id, newCache);
- return newCache;
+ if (content.length > 0) {
+ const cached = TextCache.get(id);
+ if (cached) return cached;
+ const newCache = transformText(content, tags);
+ TextCache.set(id, newCache);
+ return newCache;
+ }
+ return [];
}
export function useTextTransformer(id: string, content: string, tags: Array>) {
diff --git a/packages/app/src/Pages/ProfilePage.css b/packages/app/src/Pages/ProfilePage.css
index eb4e3c5e..6c0851eb 100644
--- a/packages/app/src/Pages/ProfilePage.css
+++ b/packages/app/src/Pages/ProfilePage.css
@@ -138,14 +138,6 @@
gap: 8px;
}
-.profile .website a {
- text-decoration: none;
-}
-
-.profile .website a:hover {
- text-decoration: underline;
-}
-
.profile .link svg {
color: var(--highlight);
}
diff --git a/packages/app/src/Pages/ProfilePage.tsx b/packages/app/src/Pages/ProfilePage.tsx
index 5c2501ad..1660f462 100644
--- a/packages/app/src/Pages/ProfilePage.tsx
+++ b/packages/app/src/Pages/ProfilePage.tsx
@@ -59,6 +59,7 @@ import { useStatusFeed } from "Feed/StatusFeed";
import messages from "./messages";
import { SpotlightMediaModal } from "Element/Deck/SpotlightMedia";
+import { UserWebsiteLink } from "Element/User/UserWebsiteLink";
const NOTES = 0;
const REACTIONS = 1;
@@ -135,8 +136,6 @@ export default function ProfilePage() {
const showBadges = login.preferences.showBadges ?? false;
const showStatus = login.preferences.showStatus ?? true;
- const website_url =
- user?.website && !user.website.startsWith("http") ? "https://" + user.website : user?.website || "";
// feeds
const { blocked } = useModeration();
const pinned = usePinnedFeed(id);
@@ -295,28 +294,10 @@ export default function ProfilePage() {
);
}
- function tryFormatWebsite(url: string) {
- try {
- const u = new URL(url);
- return `${u.hostname}${u.pathname !== "/" ? u.pathname : ""}`;
- } catch {
- // ignore
- }
- return url;
- }
-
function links() {
return (
<>
- {user?.website && (
-
- )}
-
+
{lnurl && (
setShowLnQr(true)}>
@@ -433,7 +414,7 @@ export default function ProfilePage() {
setModalImage(user?.picture || "")} className="pointer" />
{renderIcons()}
- {!isMe && id && }
+ {!isMe && id && }
);
diff --git a/packages/app/src/index.css b/packages/app/src/index.css
index 456f4bba..3f498f57 100644
--- a/packages/app/src/index.css
+++ b/packages/app/src/index.css
@@ -113,6 +113,21 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
}
+a {
+ color: inherit;
+ line-height: 1.3em;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.ext {
+ word-break: break-all;
+ white-space: initial;
+}
+
#root {
overflow-x: hidden;
}
@@ -498,21 +513,6 @@ input:disabled {
max-width: -moz-available;
}
-a {
- color: inherit;
- line-height: 1.3em;
- text-decoration: none;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-a.ext {
- word-break: break-all;
- white-space: initial;
-}
-
div.form {
display: grid;
grid-auto-flow: row;
diff --git a/packages/system/src/text.ts b/packages/system/src/text.ts
index 5988b40a..b6aebd7d 100644
--- a/packages/system/src/text.ts
+++ b/packages/system/src/text.ts
@@ -233,7 +233,7 @@ export function transformText(body: string, tags: Array>) {
fragments = fragments
.map(a => {
if (typeof a === "string") {
- if (a.trim().length > 0) {
+ if (a.length > 0) {
return { type: "text", content: a } as ParsedFragment;
}
} else {
diff --git a/yarn.lock b/yarn.lock
index 00f048c7..5f2ef34f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2714,6 +2714,7 @@ __metadata:
"@types/webtorrent": ^0.109.3
"@typescript-eslint/eslint-plugin": ^6.1.0
"@typescript-eslint/parser": ^6.1.0
+ "@uidotdev/usehooks": ^2.3.1
"@void-cat/api": ^1.0.4
"@webbtc/webln-types": ^1.0.10
"@webpack-cli/generators": ^3.0.4
@@ -3852,6 +3853,16 @@ __metadata:
languageName: node
linkType: hard
+"@uidotdev/usehooks@npm:^2.3.1":
+ version: 2.3.1
+ resolution: "@uidotdev/usehooks@npm:2.3.1"
+ peerDependencies:
+ react: ">=18.0.0"
+ react-dom: ">=18.0.0"
+ checksum: a1339b91bdb4176f59fc2dd8273065fccacb17749b7022879982ff874bda8e4e54a3f8d74f126e6224164fb2ad422f1cc40dac8705467960df525b207fcd3a79
+ languageName: node
+ linkType: hard
+
"@void-cat/api@npm:^1.0.4":
version: 1.0.7
resolution: "@void-cat/api@npm:1.0.7"