Skip to content

Commit cfcd583

Browse files
committed
Minor Fixes
1 parent 8f19db3 commit cfcd583

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

features/popup/popup-app.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ export default function App() {
104104
const needsLogin = loggedIn === false && audits.length === 0;
105105
// An authenticated empty history is a valid state, even if an older sync cached an error.
106106
const hasAuthenticatedEmptyHistory = loggedIn === true && audits.length === 0;
107+
// Only the empty state depends on auth (Login vs. empty); with cached audits we
108+
// can render immediately. So wait for auth ONLY when there's nothing to show yet.
109+
const resolvingLogin = loggedIn === null && audits.length === 0;
107110

108111
return (
109112
<div className="w-[438px] h-full min-h-[300px] max-h-[600px] bg-background font-sans overflow-hidden flex flex-col border border-gray-100">
@@ -126,7 +129,11 @@ export default function App() {
126129
className="rounded-md"
127130
onClick={needsLogin ? handleLogin : handleRerunAudit}
128131
>
129-
{needsLogin ? (
132+
{resolvingLogin ? (
133+
<div className="flex items-center space-x-2">
134+
<SpinnerIcon size={24} className="animate-spin-slow" />
135+
</div>
136+
) : needsLogin ? (
130137
<div className="flex items-center space-x-2">
131138
<SignInIcon size={24} />
132139
<p className="text-lg font-bold">Login</p>
@@ -142,6 +149,7 @@ export default function App() {
142149
<p className="text-lg font-bold">Run New Audit</p>
143150
</div>
144151
)}
152+
145153
</Button>
146154
</div>
147155
</header>
@@ -166,22 +174,16 @@ export default function App() {
166174

167175
{loading ? (
168176
<div className="flex flex-col gap-2 items-center justify-center text-center mb-6 py-8">
169-
<p className="text-base text-dap-gray-light">
170-
Loading audit history...
171-
</p>
177+
<p className="text-base text-dap-gray-light">Syncing...</p>
172178
</div>
173179
) : needsLogin ? (
174180
<div className="flex flex-col gap-2 items-center justify-center text-center mb-6 py-8">
175181
<p className="text-base text-dap-gray-light tracking-[0.32px] max-w-[300px]">
176182
Log in to UT Direct, then visit the Degree Audit page to load your
177183
audits.
178184
</p>
179-
<p className="text-[14.22px] font-medium text-dap-dark max-w-[300px]">
180-
If this is your first time using Degree Audit Plus, visiting that
181-
page starts the initial audit sync.
182-
</p>
183185
</div>
184-
) : error && !hasAuthenticatedEmptyHistory ? (
186+
) : error ? (
185187
<div className="flex flex-col gap-2 items-center justify-center text-center mb-6 py-8">
186188
<p className="text-base text-red-600 max-w-[250px]">
187189
Error loading audits: {error}

0 commit comments

Comments
 (0)