Skip to content

Commit 3227d2e

Browse files
committed
fix(auth): improve the last used badge style
1 parent 8b21264 commit 3227d2e

4 files changed

Lines changed: 35 additions & 21 deletions

File tree

app/modules/i18n/locales/en.po

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ msgid "Connected accounts"
165165
msgstr "Connected accounts"
166166

167167
#: app/routes/device/index.tsx:72
168-
#: app/routes/login/index.tsx:355
168+
#: app/routes/login/index.tsx:364
169169
#: app/routes/signup/index.tsx:287
170170
msgid "Continue"
171171
msgstr "Continue"
@@ -186,7 +186,7 @@ msgstr "Couldn't sign in"
186186
msgid "Create a new account"
187187
msgstr "Create a new account"
188188

189-
#: app/routes/login/index.tsx:386
189+
#: app/routes/login/index.tsx:395
190190
#: app/routes/signup/password.tsx:188
191191
msgid "Create account"
192192
msgstr "Create account"
@@ -200,7 +200,7 @@ msgid "Device code"
200200
msgstr "Device code"
201201

202202
#: app/routes/login/index.tsx:182
203-
#: app/routes/login/index.tsx:320
203+
#: app/routes/login/index.tsx:326
204204
#: app/routes/signup/index.tsx:250
205205
#: app/routes/signup/index.tsx:273
206206
msgid "Email"
@@ -210,7 +210,7 @@ msgstr "Email"
210210
msgid "Email code"
211211
msgstr "Email code"
212212

213-
#: app/routes/login/index.tsx:364
213+
#: app/routes/login/index.tsx:373
214214
#: app/routes/login/method.tsx:117
215215
#: app/routes/signup/method.tsx:256
216216
msgid "Email me a sign-in link"
@@ -293,9 +293,9 @@ msgstr "Get started"
293293
msgid "Incorrect credentials. Please try again."
294294
msgstr "Incorrect credentials. Please try again."
295295

296-
#: app/routes/login/index.tsx:269
297-
#: app/routes/login/index.tsx:292
298-
#: app/routes/login/index.tsx:323
296+
#: app/routes/login/index.tsx:272
297+
#: app/routes/login/index.tsx:298
298+
#: app/routes/login/index.tsx:332
299299
msgid "Last used"
300300
msgstr "Last used"
301301

@@ -332,7 +332,7 @@ msgstr "No account was found and sign-up is not available."
332332
msgid "No signed-in accounts."
333333
msgstr "No signed-in accounts."
334334

335-
#: app/routes/login/index.tsx:384
335+
#: app/routes/login/index.tsx:393
336336
msgid "Not registered?"
337337
msgstr "Not registered?"
338338

@@ -344,7 +344,7 @@ msgstr "Not you?"
344344
msgid "Open your authenticator app and enter the 6-digit code."
345345
msgstr "Open your authenticator app and enter the 6-digit code."
346346

347-
#: app/routes/login/index.tsx:302
347+
#: app/routes/login/index.tsx:308
348348
#: app/routes/signup/index.tsx:232
349349
msgid "or"
350350
msgstr "or"
@@ -353,7 +353,7 @@ msgstr "or"
353353
msgid "Or import this URI in your authenticator app"
354354
msgstr "Or import this URI in your authenticator app"
355355

356-
#: app/routes/login/index.tsx:289
356+
#: app/routes/login/index.tsx:292
357357
#: app/routes/login/method.tsx:101
358358
#: app/routes/setup/mfa.tsx:40
359359
msgid "Passkey"
@@ -523,7 +523,7 @@ msgstr "Sign in with LDAP"
523523
msgid "Sign out"
524524
msgstr "Sign out"
525525

526-
#: app/routes/login/index.tsx:374
526+
#: app/routes/login/index.tsx:383
527527
msgid "Sign-in is currently unavailable for this account. Please contact your administrator."
528528
msgstr "Sign-in is currently unavailable for this account. Please contact your administrator."
529529

@@ -619,7 +619,7 @@ msgstr "Unlink"
619619
msgid "Use a passkey"
620620
msgstr "Use a passkey"
621621

622-
#: app/routes/login/passkey.tsx:73
622+
#: app/routes/login/passkey.tsx:78
623623
msgid "Use your passkey to verify your identity."
624624
msgstr "Use your passkey to verify your identity."
625625

@@ -652,7 +652,7 @@ msgid "Verify and enable"
652652
msgstr "Verify and enable"
653653

654654
#: app/components/webauthn-button/webauthn-button.tsx:163
655-
#: app/routes/login/passkey.tsx:72
655+
#: app/routes/login/passkey.tsx:77
656656
msgid "Verify with passkey"
657657
msgstr "Verify with passkey"
658658

app/routes/login/__tests__/last-used-login-loader.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// last-used-login cookie into its returned data object.
55
//
66
// node env: happy-dom forbids setting the Cookie header (breaks CSRF round-trips).
7-
import { loader } from '@/routes/login/index';
87
import { serializeLastUsedLogin } from '@/modules/auth/session/last-used-login';
8+
import { loader } from '@/routes/login/index';
99
import { describe, it, expect } from 'vitest';
1010

1111
const ORIGIN = 'http://localhost';

app/routes/login/index.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export default function Login() {
246246
) : null}
247247
<Button
248248
size="large"
249-
className="h-13 gap-3"
249+
className="relative h-13 gap-3"
250250
type="quaternary"
251251
theme="outline"
252252
block
@@ -265,7 +265,10 @@ export default function Login() {
265265
}>
266266
<Trans>{idp.name}</Trans>
267267
{lastUsedLogin === `idp:${idp.id}` ? (
268-
<Badge type="secondary" theme="light" className="ml-auto text-xs">
268+
<Badge
269+
type="primary"
270+
theme="solid"
271+
className="absolute -top-3.5 -right-5 rounded-lg text-xs text-white">
269272
<Trans>Last used</Trans>
270273
</Badge>
271274
) : null}
@@ -278,7 +281,7 @@ export default function Login() {
278281
{view.showPasskeyPrompt ? (
279282
<LinkButton
280283
size="large"
281-
className={cn('h-13 gap-3', view.showIdpButtons && 'mt-3')}
284+
className={cn('relative h-13 gap-3', view.showIdpButtons && 'mt-3')}
282285
type="quaternary"
283286
theme="outline"
284287
block
@@ -288,7 +291,10 @@ export default function Login() {
288291
icon={<Icon icon={UserKey} />}>
289292
<Trans>Passkey</Trans>
290293
{lastUsedLogin === 'passkey' ? (
291-
<Badge type="secondary" theme="light" className="ml-auto text-xs">
294+
<Badge
295+
type="primary"
296+
theme="solid"
297+
className="absolute -top-3.5 -right-5 rounded-lg text-xs text-white">
292298
<Trans>Last used</Trans>
293299
</Badge>
294300
) : null}
@@ -310,7 +316,7 @@ export default function Login() {
310316
{!showEmailField ? (
311317
<Button
312318
size="large"
313-
className="h-13 gap-3"
319+
className="relative h-13 gap-3"
314320
type="quaternary"
315321
theme="outline"
316322
block
@@ -319,7 +325,10 @@ export default function Login() {
319325
onClick={() => setShowEmailField(true)}>
320326
<Trans>Email</Trans>
321327
{lastUsedLogin === 'email' ? (
322-
<Badge type="secondary" theme="light" className="ml-auto text-xs">
328+
<Badge
329+
type="primary"
330+
theme="solid"
331+
className="absolute -top-3.5 -right-5 rounded-lg text-xs text-white">
323332
<Trans>Last used</Trans>
324333
</Badge>
325334
) : null}

app/routes/login/passkey.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import {
1212
import { useAuthErrorMessage } from '@/utils/errors/auth-error-messages';
1313
import { Trans } from '@lingui/react/macro';
1414
import { useRef } from 'react';
15-
import { useActionData, useLoaderData, type MetaFunction, type ActionFunctionArgs } from 'react-router';
15+
import {
16+
useActionData,
17+
useLoaderData,
18+
type MetaFunction,
19+
type ActionFunctionArgs,
20+
} from 'react-router';
1621
import { Form as RRForm } from 'react-router';
1722

1823
export const meta: MetaFunction = () => [{ title: 'Verify with passkey' }];

0 commit comments

Comments
 (0)