From 8a93300ac43ffd70ca687d71ee8eefdb755e6a58 Mon Sep 17 00:00:00 2001
From: tobi <31960611+tsmethurst@users.noreply.github.com>
Date: Mon, 21 Oct 2024 14:04:50 +0200
Subject: [feature] Add image descriptions for default avatar + header; don't
 allow editing default desc (#3473)

---
 .../settings/components/user-logout-card.tsx       | 27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)

(limited to 'web/source/settings/components/user-logout-card.tsx')

diff --git a/web/source/settings/components/user-logout-card.tsx b/web/source/settings/components/user-logout-card.tsx
index f8eeaf63c..f9acc9698 100644
--- a/web/source/settings/components/user-logout-card.tsx
+++ b/web/source/settings/components/user-logout-card.tsx
@@ -19,6 +19,7 @@
 
 import React from "react";
 import Loading from "./loading";
+import { Error as ErrorC } from "./error";
 import { useVerifyCredentialsQuery, useLogoutMutation } from "../lib/query/oauth";
 import { useInstanceV1Query } from "../lib/query/gts-api";
 
@@ -29,16 +30,20 @@ export default function UserLogoutCard() {
 
 	if (isLoading) {
 		return <Loading />;
-	} else {
-		return (
-			<div className="account-card">
-				<img className="avatar" src={profile.avatar} alt="" />
-				<h3 className="text-cutoff">{profile.display_name?.length > 0 ? profile.display_name : profile.acct}</h3>
-				<span className="text-cutoff">@{profile.username}@{instance?.account_domain}</span>
-				<a onClick={logoutQuery} href="#" aria-label="Log out" title="Log out" className="logout">
-					<i className="fa fa-fw fa-sign-out" aria-hidden="true" />
-				</a>
-			</div>
-		);
 	}
+	
+	if (!profile) {
+		return <ErrorC error={new Error("account was undefined")} />;
+	}
+
+	return (
+		<div className="account-card">
+			<img className="avatar" src={profile.avatar} alt="" />
+			<h3 className="text-cutoff">{profile.display_name?.length > 0 ? profile.display_name : profile.acct}</h3>
+			<span className="text-cutoff">@{profile.username}@{instance?.account_domain}</span>
+			<a onClick={logoutQuery} href="#" aria-label="Log out" title="Log out" className="logout">
+				<i className="fa fa-fw fa-sign-out" aria-hidden="true" />
+			</a>
+		</div>
+	);
 }
\ No newline at end of file
-- 
cgit v1.2.3

