From 448cd506eb67cb5e985d7a8c3b160b705a4e17b4 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 15 May 2026 20:21:05 +0200 Subject: [PATCH] fix(frontend): remove dead activeTab state; guard URL hostname parse --- .../components/remote-user-profile/index.tsx | 3 --- .../components/remote-user-profile/profile-card.tsx | 9 ++++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/thoughts-frontend/components/remote-user-profile/index.tsx b/thoughts-frontend/components/remote-user-profile/index.tsx index 2a98a2f..bd8cfc8 100644 --- a/thoughts-frontend/components/remote-user-profile/index.tsx +++ b/thoughts-frontend/components/remote-user-profile/index.tsx @@ -29,8 +29,6 @@ export function RemoteUserProfile({ const [followLoading, setFollowLoading] = useState(false); const { token } = useAuth(); - type ConnectionTab = "posts" | "followers" | "following"; - const [activeTab, setActiveTab] = useState("posts"); const [followersActive, setFollowersActive] = useState(false); const [followingActive, setFollowingActive] = useState(false); @@ -57,7 +55,6 @@ export function RemoteUserProfile({ }; const handleTabChange = (tab: string) => { - setActiveTab(tab as ConnectionTab); if (tab === "followers") setFollowersActive(true); if (tab === "following") setFollowingActive(true); }; diff --git a/thoughts-frontend/components/remote-user-profile/profile-card.tsx b/thoughts-frontend/components/remote-user-profile/profile-card.tsx index 8c83d45..d573211 100644 --- a/thoughts-frontend/components/remote-user-profile/profile-card.tsx +++ b/thoughts-frontend/components/remote-user-profile/profile-card.tsx @@ -12,6 +12,13 @@ interface ProfileCardProps { } export function ProfileCard({ actor, action }: ProfileCardProps) { + let hostname: string | null = null; + try { + if (actor.url) hostname = new URL(actor.url).hostname; + } catch { + hostname = actor.url; + } + return ( <>
@@ -47,7 +54,7 @@ export function ProfileCard({ actor, action }: ProfileCardProps) { className="flex items-center overflow-hidden" > - {new URL(actor.url).hostname} + {hostname}