Skip to content

Commit df871a5

Browse files
refactor: improve code formatting and readability in ProfileSettings and UserProfileMenu components
- Adjust formatting of JSX elements for better readability in ProfileSettings and UserProfileMenu. - Update event listener cleanup function for consistency. - Enhance the layout of loading and subscription messages for improved clarity.
1 parent b921b10 commit df871a5

3 files changed

Lines changed: 20 additions & 9 deletions

File tree

components/ProfileSettings.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ export function ProfileSettings() {
138138
void refreshAuthState();
139139
const onAuthChanged = () => void refreshAuthState();
140140
window.addEventListener("auth-state-changed", onAuthChanged);
141-
return () => window.removeEventListener("auth-state-changed", onAuthChanged);
141+
return () =>
142+
window.removeEventListener("auth-state-changed", onAuthChanged);
142143
}, [refreshAuthState]);
143144

144145
useEffect(() => {
@@ -260,7 +261,9 @@ export function ProfileSettings() {
260261

261262
if (loading) {
262263
return (
263-
<p className="text-sm text-gray-500 dark:text-gray-400">Loading profile…</p>
264+
<p className="text-sm text-gray-500 dark:text-gray-400">
265+
Loading profile…
266+
</p>
264267
);
265268
}
266269

@@ -291,7 +294,9 @@ export function ProfileSettings() {
291294
</h1>
292295
<p className="text-sm text-gray-600 dark:text-gray-300">{user.email}</p>
293296
{user.name && (
294-
<p className="text-sm text-gray-500 dark:text-gray-400">{user.name}</p>
297+
<p className="text-sm text-gray-500 dark:text-gray-400">
298+
{user.name}
299+
</p>
295300
)}
296301
</header>
297302

@@ -319,7 +324,8 @@ export function ProfileSettings() {
319324
</dl>
320325
{subscription.cancelAtPeriodEnd && hasPaidPlan && (
321326
<p className="text-sm text-amber-700 dark:text-amber-300">
322-
Your subscription is set to cancel at the end of this billing period.
327+
Your subscription is set to cancel at the end of this billing
328+
period.
323329
</p>
324330
)}
325331
<div className="flex flex-wrap gap-2 pt-1">
@@ -369,8 +375,8 @@ export function ProfileSettings() {
369375
</div>
370376
{!hasAiTier && (
371377
<p className="text-sm text-amber-700 dark:text-amber-300/90 rounded-md border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 px-3 py-2">
372-
AI explanations unlock on Local AI, BYOK, or Hosted AI plans. Ads-free
373-
and Free tiers do not include server-side AI.
378+
AI explanations unlock on Local AI, BYOK, or Hosted AI plans.
379+
Ads-free and Free tiers do not include server-side AI.
374380
</p>
375381
)}
376382
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">

components/UserProfileMenu.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export function UserProfileMenu() {
5353
void refreshAuthState();
5454
const onAuthChanged = () => void refreshAuthState();
5555
window.addEventListener("auth-state-changed", onAuthChanged);
56-
return () => window.removeEventListener("auth-state-changed", onAuthChanged);
56+
return () =>
57+
window.removeEventListener("auth-state-changed", onAuthChanged);
5758
}, []);
5859

5960
useEffect(() => {
@@ -157,7 +158,9 @@ export function UserProfileMenu() {
157158
onClick={(event) => event.stopPropagation()}
158159
>
159160
<div className="px-4 py-3 border-b border-gray-200 dark:border-gray-700">
160-
<p className="text-xs text-gray-500 dark:text-gray-400">Signed in as</p>
161+
<p className="text-xs text-gray-500 dark:text-gray-400">
162+
Signed in as
163+
</p>
161164
<p className="mt-0.5 text-sm font-medium text-gray-900 dark:text-gray-100 break-all">
162165
{user.email}
163166
</p>

lib/explanation-provider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export function isProviderAllowedForTier(
7474
);
7575
}
7676

77-
export function getDefaultProviderForTier(tier: Tier): ExplanationProvider | null {
77+
export function getDefaultProviderForTier(
78+
tier: Tier
79+
): ExplanationProvider | null {
7880
const allowed = PROVIDER_OPTIONS.filter((p) => p.allowedTiers.includes(tier));
7981
return allowed[0]?.id ?? null;
8082
}

0 commit comments

Comments
 (0)