feat: refactor LocalAuthLogin and UserMenu components for improved readability
This commit is contained in:
@@ -8,9 +8,10 @@ const setLocalAuthTokenMock = vi.hoisted(() => vi.fn());
|
||||
const fetchMock = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock("@/auth/localAuth", async () => {
|
||||
const actual = await vi.importActual<typeof import("@/auth/localAuth")>(
|
||||
"@/auth/localAuth",
|
||||
);
|
||||
const actual =
|
||||
await vi.importActual<typeof import("@/auth/localAuth")>(
|
||||
"@/auth/localAuth",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
setLocalAuthToken: setLocalAuthTokenMock,
|
||||
|
||||
@@ -132,7 +132,12 @@ export function LocalAuthLogin({ onAuthenticated }: LocalAuthLoginProps) {
|
||||
Token must be at least {LOCAL_AUTH_TOKEN_MIN_LENGTH} characters.
|
||||
</p>
|
||||
)}
|
||||
<Button type="submit" className="w-full" size="lg" disabled={isValidating}>
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full"
|
||||
size="lg"
|
||||
disabled={isValidating}
|
||||
>
|
||||
{isValidating ? "Validating..." : "Continue"}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -44,8 +44,10 @@ export function UserMenu({
|
||||
const avatarLabelSource =
|
||||
displayNameFromDb ?? (localMode ? "Local User" : user?.id) ?? "U";
|
||||
const avatarLabel = avatarLabelSource.slice(0, 1).toUpperCase();
|
||||
const displayName = displayNameFromDb ?? (localMode ? "Local User" : "Account");
|
||||
const displayEmail = displayEmailFromDb ?? (localMode ? "local@localhost" : "");
|
||||
const displayName =
|
||||
displayNameFromDb ?? (localMode ? "Local User" : "Account");
|
||||
const displayEmail =
|
||||
displayEmailFromDb ?? (localMode ? "local@localhost" : "");
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
|
||||
Reference in New Issue
Block a user