Merge remote-tracking branch 'kieran/main'

This commit is contained in:
Martti Malmi
2023-10-09 19:12:22 +03:00
65 changed files with 1157 additions and 215 deletions

View File

@ -51,6 +51,7 @@ import ProfileTab, {
ZapsProfileTab,
} from "Pages/Profile/ProfileTab";
import DisplayName from "../../Element/User/DisplayName";
import { UserWebsiteLink } from "Element/User/UserWebsiteLink";
interface ProfilePageProps {
id?: string;
@ -80,8 +81,6 @@ export default function ProfilePage({ id: propId }: ProfilePageProps) {
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);
@ -167,28 +166,10 @@ export default function ProfilePage({ id: propId }: ProfilePageProps) {
);
}
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 && (
<div className="link website f-ellipsis">
<Icon name="link-02" size={16} />
<a href={website_url} target="_blank" rel="noreferrer">
{tryFormatWebsite(user.website)}
</a>
</div>
)}
<UserWebsiteLink user={user} />
{lnurl && (
<div className="link lnurl f-ellipsis" onClick={() => setShowLnQr(true)}>
<Icon name="zapCircle" size={16} />
@ -305,7 +286,7 @@ export default function ProfilePage({ id: propId }: ProfilePageProps) {
<Avatar pubkey={id ?? ""} user={user} onClick={() => setModalImage(user?.picture || "")} className="pointer" />
<div className="profile-actions">
{renderIcons()}
{!isMe && id && <FollowButton className="primary" pubkey={id} />}
{!isMe && id && <FollowButton pubkey={id} />}
</div>
</div>
);