Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8c4bab0c6 |
@@ -4713,6 +4713,7 @@ login = "Login"
|
||||
magicLinkSent = "Magic link sent to {{email}}! Check your email and click the link to sign in."
|
||||
mfaCode = "Authentication Code"
|
||||
mfaRequired = "Two-factor code required"
|
||||
noAccount = "Don't have an account?"
|
||||
or = "Or"
|
||||
password = "Password"
|
||||
passwordChangedSuccess = "Password changed successfully! Please sign in with your new password."
|
||||
@@ -4737,21 +4738,6 @@ useMagicLink = "Use magic link instead"
|
||||
username = "Username"
|
||||
youAreLoggedIn = "You are logged in!"
|
||||
|
||||
[login.slides.edit]
|
||||
alt = "Edit PDFs"
|
||||
subtitle = "With over a dozen tools to help you redact, sign, read and manipulate PDFs, you will be sure to find what you are looking for."
|
||||
title = "Edit PDFs to display/secure the information you want"
|
||||
|
||||
[login.slides.overview]
|
||||
alt = "Stirling PDF overview"
|
||||
subtitle = "A privacy-first cloud suite for PDFs that lets you convert, sign, redact, and manage documents, along with 50+ other powerful tools."
|
||||
title = "Your one-stop-shop for all your PDF needs."
|
||||
|
||||
[login.slides.secure]
|
||||
alt = "Secure PDFs"
|
||||
subtitle = "Add passwords, redact content, and manage certificates with ease."
|
||||
title = "Protect sensitive information in your PDFs"
|
||||
|
||||
[margin]
|
||||
large = "Large"
|
||||
medium = "Medium"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 717 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 211 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 229 KiB |
@@ -162,34 +162,4 @@ test.describe("1. Authentication and Login", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("1.6 Login Page - Carousel/Slideshow", () => {
|
||||
test("should navigate between carousel slides", async ({ page }) => {
|
||||
// Carousel is hidden on small viewports (< 940px wide), ensure desktop size
|
||||
await page.setViewportSize({ width: 1920, height: 1080 });
|
||||
|
||||
// Starting state: User is logged out; browser on /login
|
||||
await page.goto("/login");
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
|
||||
// Step 1: Verify slide indicator dots are present (carousel uses aria-label "Go to slide N")
|
||||
const slideButtons = page.getByRole("button", { name: /Go to slide/i });
|
||||
const count = await slideButtons.count();
|
||||
test.skip(count === 0, "No carousel slides configured on this instance");
|
||||
|
||||
// Step 2: Click through slides
|
||||
if (count >= 2) {
|
||||
await slideButtons.nth(1).click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
if (count >= 3) {
|
||||
await slideButtons.nth(2).click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
// Step 3: Click back to slide 1
|
||||
await slideButtons.nth(0).click();
|
||||
await page.waitForTimeout(500);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import LoginRightCarousel from "@app/auth/ui/LoginRightCarousel";
|
||||
import buildLoginSlides from "@app/components/shared/loginSlides";
|
||||
import styles from "@app/auth/ui/AuthShell.module.css";
|
||||
import { useLogoVariant } from "@app/hooks/useLogoVariant";
|
||||
import React from "react";
|
||||
import { AuthShell } from "@app/auth/ui/AuthShell";
|
||||
|
||||
interface DesktopAuthLayoutProps {
|
||||
children: React.ReactNode;
|
||||
@@ -12,52 +8,5 @@ interface DesktopAuthLayoutProps {
|
||||
export const DesktopAuthLayout: React.FC<DesktopAuthLayoutProps> = ({
|
||||
children,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const cardRef = useRef<HTMLDivElement | null>(null);
|
||||
const [hideRightPanel, setHideRightPanel] = useState(false);
|
||||
const logoVariant = useLogoVariant();
|
||||
const imageSlides = useMemo(
|
||||
() => buildLoginSlides(logoVariant, t),
|
||||
[logoVariant, t],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const update = () => {
|
||||
// Use viewport to avoid hysteresis when the card is already in single-column mode
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
const cardWidthIfTwoCols = Math.min(1180, viewportWidth * 0.96); // matches min(73.75rem, 96vw)
|
||||
const columnWidth = cardWidthIfTwoCols / 2;
|
||||
const tooNarrow = columnWidth < 470;
|
||||
const tooShort = viewportHeight < 740;
|
||||
setHideRightPanel(tooNarrow || tooShort);
|
||||
};
|
||||
update();
|
||||
window.addEventListener("resize", update);
|
||||
window.addEventListener("orientationchange", update);
|
||||
return () => {
|
||||
window.removeEventListener("resize", update);
|
||||
window.removeEventListener("orientationchange", update);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.authContainer}>
|
||||
<div
|
||||
ref={cardRef}
|
||||
className={`${styles.authCard} ${!hideRightPanel ? styles.authCardTwoColumns : ""}`}
|
||||
>
|
||||
<div className={styles.authLeftPanel}>
|
||||
<div className={styles.authContent}>{children}</div>
|
||||
</div>
|
||||
{!hideRightPanel && (
|
||||
<LoginRightCarousel
|
||||
imageSlides={imageSlides}
|
||||
initialSeconds={5}
|
||||
slideSeconds={8}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return <AuthShell>{children}</AuthShell>;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AuthShell } from "@app/auth/ui/AuthShell";
|
||||
import LoginRightCarousel from "@app/auth/ui/LoginRightCarousel";
|
||||
import { buildDefaultLoginSlides } from "@app/auth/ui/loginSlides";
|
||||
import SpringLoginForm from "@app/auth/ui/SpringLoginForm";
|
||||
import { useSpringLogin } from "@app/auth/ui/useSpringLogin";
|
||||
import { withBasePath } from "@app/constants/app";
|
||||
@@ -12,7 +8,7 @@ import loginHeader from "@app/assets/brand/modern-logo/LoginLightModeHeader.svg"
|
||||
|
||||
/**
|
||||
* Full-screen login shown by the portal's auth gate. Renders the shared
|
||||
* AuthShell + carousel with the Spring form/auth wiring from @app/auth/ui.
|
||||
* AuthShell with the Spring form/auth wiring from @app/auth/ui.
|
||||
*
|
||||
* It follows the user's light/dark theme (AuthShell is theme-aware — the same
|
||||
* screen the editor login uses; passing both logo variants keeps the header
|
||||
@@ -20,23 +16,10 @@ import loginHeader from "@app/assets/brand/modern-logo/LoginLightModeHeader.svg"
|
||||
* needs to collect credentials.
|
||||
*/
|
||||
export function LoginScreen() {
|
||||
const { t } = useTranslation();
|
||||
const login = useSpringLogin();
|
||||
const slides = useMemo(
|
||||
() => buildDefaultLoginSlides((key, fallback) => t(key, fallback)),
|
||||
[t],
|
||||
);
|
||||
|
||||
return (
|
||||
<AuthShell
|
||||
rightPanel={
|
||||
<LoginRightCarousel
|
||||
imageSlides={slides}
|
||||
initialSeconds={5}
|
||||
slideSeconds={8}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<AuthShell>
|
||||
<SpringLoginForm
|
||||
state={login}
|
||||
logoSrc={loginHeader}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { Alert, Stack, Text } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
/**
|
||||
* First-time-setup notice showing the default admin credentials. Rendered
|
||||
* beneath the login form when the backend reports a fresh install.
|
||||
*/
|
||||
export default function AuthDefaultCredentials() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Alert color="blue" variant="light" radius="md" mt="xl">
|
||||
<Stack gap="xs" align="center">
|
||||
<Text
|
||||
size="sm"
|
||||
fw={600}
|
||||
ta="center"
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.defaultCredentials", "Default Login Credentials")}
|
||||
</Text>
|
||||
<Text size="sm" ta="center" style={{ color: "var(--text-primary)" }}>
|
||||
<Text
|
||||
component="span"
|
||||
fw={600}
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.username", "Username")}:
|
||||
</Text>{" "}
|
||||
admin
|
||||
</Text>
|
||||
<Text size="sm" ta="center" style={{ color: "var(--text-primary)" }}>
|
||||
<Text
|
||||
component="span"
|
||||
fw={600}
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.password", "Password")}:
|
||||
</Text>{" "}
|
||||
stirling
|
||||
</Text>
|
||||
<Text
|
||||
size="xs"
|
||||
ta="center"
|
||||
mt="xs"
|
||||
style={{ color: "var(--text-muted)" }}
|
||||
>
|
||||
{t(
|
||||
"login.changePasswordWarning",
|
||||
"Please change your password after logging in for the first time",
|
||||
)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
import { useState } from "react";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { AuthShell } from "@app/auth/ui/AuthShell";
|
||||
import SpringLoginForm from "@app/auth/ui/SpringLoginForm";
|
||||
import AuthSignupPrompt from "@app/auth/ui/AuthSignupPrompt";
|
||||
import AuthDefaultCredentials from "@app/auth/ui/AuthDefaultCredentials";
|
||||
import type { SpringLoginState } from "@app/auth/ui/useSpringLogin";
|
||||
import ErrorMessage from "@app/auth/ui/ErrorMessage";
|
||||
import SignupForm from "@app/routes/signup/SignupForm";
|
||||
import DividerWithText from "@app/components/shared/DividerWithText";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import loginHeader from "@app/assets/brand/modern-logo/LoginLightModeHeader.svg";
|
||||
import "@app/auth/ui/auth-theme.css";
|
||||
import "@app/auth/ui/auth.css";
|
||||
|
||||
const darkLogo = "/modern-logo/LoginDarkModeHeader.svg";
|
||||
|
||||
/** Every provider the OAuth buttons know how to render, for stress testing. */
|
||||
const ALL_PROVIDERS = [
|
||||
"google",
|
||||
"github",
|
||||
"apple",
|
||||
"azure",
|
||||
"keycloak",
|
||||
"cloudron",
|
||||
"authentik",
|
||||
"oidc",
|
||||
];
|
||||
|
||||
type LoginMethod = "all" | "normal" | "oauth2";
|
||||
|
||||
interface LoginArgs {
|
||||
/** OAuth providers to render (stress test the button stack here). */
|
||||
providers: string[];
|
||||
/** all = OAuth + email · normal = email only · oauth2 = SSO only. */
|
||||
loginMethod: LoginMethod;
|
||||
/** Show the "Don't have an account? Sign up" prompt below the form. */
|
||||
showSignupPrompt: boolean;
|
||||
/** Show the first-time-setup default admin credentials card. */
|
||||
showDefaultCredentials: boolean;
|
||||
}
|
||||
|
||||
/** Interactive SpringLoginState without the network/config fetch. */
|
||||
function useFakeSpringLogin(
|
||||
providers: string[],
|
||||
loginMethod: LoginMethod,
|
||||
): SpringLoginState {
|
||||
// Prefill so the submit CTA renders in its enabled (filled) state.
|
||||
const [email, setEmail] = useState("you@company.com");
|
||||
const [password, setPassword] = useState("password");
|
||||
const [mfaCode, setMfaCode] = useState("");
|
||||
const isUserPassAllowed = loginMethod === "all" || loginMethod === "normal";
|
||||
return {
|
||||
email,
|
||||
setEmail,
|
||||
password,
|
||||
setPassword,
|
||||
mfaCode,
|
||||
setMfaCode,
|
||||
requiresMfa: false,
|
||||
error: null,
|
||||
setError: () => {},
|
||||
isSubmitting: false,
|
||||
providers,
|
||||
loginMethod,
|
||||
isUserPassAllowed,
|
||||
hasProviders: providers.length > 0,
|
||||
signInWithEmail: async () => {},
|
||||
signInWithProvider: async () => {},
|
||||
};
|
||||
}
|
||||
|
||||
function LoginPreview({
|
||||
providers,
|
||||
loginMethod,
|
||||
showSignupPrompt,
|
||||
showDefaultCredentials,
|
||||
}: LoginArgs) {
|
||||
const login = useFakeSpringLogin(providers, loginMethod);
|
||||
return (
|
||||
<AuthShell>
|
||||
<SpringLoginForm
|
||||
state={login}
|
||||
logoSrc={loginHeader}
|
||||
logoDarkSrc={darkLogo}
|
||||
showEmailForm={login.isUserPassAllowed}
|
||||
footer={
|
||||
<>
|
||||
{showDefaultCredentials && <AuthDefaultCredentials />}
|
||||
{showSignupPrompt && <AuthSignupPrompt onSignUp={() => {}} />}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
function SignupPreview() {
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [confirmPassword, setConfirmPassword] = useState("");
|
||||
return (
|
||||
<AuthShell>
|
||||
<div className="auth-logo-block">
|
||||
<img
|
||||
src={loginHeader}
|
||||
alt="Stirling PDF"
|
||||
className="auth-logo-header auth-logo-header--light"
|
||||
/>
|
||||
<img
|
||||
src={darkLogo}
|
||||
alt="Stirling PDF"
|
||||
className="auth-logo-header auth-logo-header--dark"
|
||||
/>
|
||||
</div>
|
||||
<ErrorMessage error={null} />
|
||||
<SignupForm
|
||||
email={email}
|
||||
password={password}
|
||||
confirmPassword={confirmPassword}
|
||||
setEmail={setEmail}
|
||||
setPassword={setPassword}
|
||||
setConfirmPassword={setConfirmPassword}
|
||||
onSubmit={() => {}}
|
||||
isSubmitting={false}
|
||||
/>
|
||||
<DividerWithText text="or" respondsToDarkMode={false} opacity={0.4} />
|
||||
<div style={{ textAlign: "center", margin: "0.5rem 0 0.25rem" }}>
|
||||
<Button variant="tertiary" className="auth-link-black">
|
||||
Log In
|
||||
</Button>
|
||||
</div>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The slim single-column auth screens: one narrow card centered on the page.
|
||||
* Uses a fake login state so the full screen renders without a backend. The
|
||||
* Login stories expose provider/login-method controls in the playground so the
|
||||
* OAuth button stack can be stress tested with any number of providers.
|
||||
*/
|
||||
const meta: Meta<LoginArgs> = {
|
||||
title: "Auth/Auth Screens",
|
||||
parameters: { layout: "fullscreen" },
|
||||
argTypes: {
|
||||
providers: {
|
||||
control: "check",
|
||||
options: ALL_PROVIDERS,
|
||||
description: "OAuth providers rendered above the email form",
|
||||
},
|
||||
loginMethod: {
|
||||
control: "inline-radio",
|
||||
options: ["all", "normal", "oauth2"],
|
||||
description:
|
||||
"all = OAuth + email · normal = email only · oauth2 = SSO only",
|
||||
},
|
||||
showSignupPrompt: {
|
||||
control: "boolean",
|
||||
description: "Show the sign-up prompt below the form",
|
||||
},
|
||||
showDefaultCredentials: {
|
||||
control: "boolean",
|
||||
description: "Show the first-time-setup default admin credentials card",
|
||||
},
|
||||
},
|
||||
args: {
|
||||
providers: ["google", "github", "oidc"],
|
||||
loginMethod: "all",
|
||||
showSignupPrompt: true,
|
||||
showDefaultCredentials: false,
|
||||
},
|
||||
};
|
||||
export default meta;
|
||||
type Story = StoryObj<LoginArgs>;
|
||||
|
||||
export const Login: Story = {
|
||||
render: (args) => <LoginPreview {...args} />,
|
||||
};
|
||||
|
||||
export const AllProviders: Story = {
|
||||
args: { providers: ALL_PROVIDERS },
|
||||
render: (args) => <LoginPreview {...args} />,
|
||||
};
|
||||
|
||||
export const LoginSsoOnly: Story = {
|
||||
args: { loginMethod: "oauth2" },
|
||||
render: (args) => <LoginPreview {...args} />,
|
||||
};
|
||||
|
||||
export const LoginEmailOnly: Story = {
|
||||
args: { providers: [] },
|
||||
render: (args) => <LoginPreview {...args} />,
|
||||
};
|
||||
|
||||
export const FirstTimeSetup: Story = {
|
||||
args: { showDefaultCredentials: true },
|
||||
render: (args) => <LoginPreview {...args} />,
|
||||
};
|
||||
|
||||
export const Signup: Story = {
|
||||
render: () => <SignupPreview />,
|
||||
};
|
||||
@@ -13,37 +13,23 @@
|
||||
}
|
||||
|
||||
.authCard {
|
||||
width: min(45rem, 96vw);
|
||||
height: min(50.875rem, 96vh);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
width: min(26rem, 96vw);
|
||||
max-height: 96vh;
|
||||
padding: 2.5rem 2rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-color: var(--auth-card-bg);
|
||||
border-radius: 1.25rem;
|
||||
box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.12);
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.authCardTwoColumns {
|
||||
width: min(73.75rem, 96vw);
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.authLeftPanel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2rem;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.authLeftPanel::-webkit-scrollbar {
|
||||
.authCard::-webkit-scrollbar {
|
||||
display: none; /* WebKit browsers (Chrome, Safari, Edge) */
|
||||
}
|
||||
|
||||
.authContent {
|
||||
max-width: 26.25rem; /* 420px */
|
||||
max-width: 22rem; /* 352px */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -1,56 +1,22 @@
|
||||
import { useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import styles from "@app/auth/ui/AuthShell.module.css";
|
||||
|
||||
export interface AuthShellProps {
|
||||
children: ReactNode;
|
||||
/** Optional panel shown beside the form on wide/tall viewports (the carousel). */
|
||||
rightPanel?: ReactNode;
|
||||
/** Optional fixed footer slot (the editor passes its legal/cookie footer). */
|
||||
footer?: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* The login card shell shared by the editor and the portal: a centered card
|
||||
* that expands to two columns (form + right panel) on wide/tall viewports and
|
||||
* collapses to a single column otherwise. Purely presentational - callers
|
||||
* provide the form (children), the right panel, and an optional footer.
|
||||
* The login card shell shared by the editor and the portal: a single narrow
|
||||
* card centered on the screen. Purely presentational - callers provide the
|
||||
* form (children) and an optional footer.
|
||||
*/
|
||||
export function AuthShell({ children, rightPanel, footer }: AuthShellProps) {
|
||||
const cardRef = useRef<HTMLDivElement | null>(null);
|
||||
const [hideRightPanel, setHideRightPanel] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const update = () => {
|
||||
// Use viewport to avoid hysteresis when the card is already single-column.
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
const cardWidthIfTwoCols = Math.min(1180, viewportWidth * 0.96); // min(73.75rem, 96vw)
|
||||
const columnWidth = cardWidthIfTwoCols / 2;
|
||||
const tooNarrow = columnWidth < 470;
|
||||
const tooShort = viewportHeight < 740;
|
||||
setHideRightPanel(tooNarrow || tooShort);
|
||||
};
|
||||
update();
|
||||
window.addEventListener("resize", update);
|
||||
window.addEventListener("orientationchange", update);
|
||||
return () => {
|
||||
window.removeEventListener("resize", update);
|
||||
window.removeEventListener("orientationchange", update);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const showRightPanel = Boolean(rightPanel) && !hideRightPanel;
|
||||
|
||||
export function AuthShell({ children, footer }: AuthShellProps) {
|
||||
return (
|
||||
<div className={styles.authContainer}>
|
||||
<div
|
||||
ref={cardRef}
|
||||
className={`${styles.authCard} ${showRightPanel ? styles.authCardTwoColumns : ""}`}
|
||||
>
|
||||
<div className={styles.authLeftPanel}>
|
||||
<div className={styles.authContent}>{children}</div>
|
||||
</div>
|
||||
{showRightPanel && rightPanel}
|
||||
<div className={styles.authCard}>
|
||||
<div className={styles.authContent}>{children}</div>
|
||||
</div>
|
||||
{footer && (
|
||||
<div
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import "@app/auth/ui/auth.css";
|
||||
|
||||
interface AuthSignupPromptProps {
|
||||
/** Navigate to the signup screen. */
|
||||
onSignUp: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Don't have an account? Sign up" row shown beneath the login form. The prompt
|
||||
* is muted; the action reads as a brand-coloured link.
|
||||
*/
|
||||
export default function AuthSignupPrompt({ onSignUp }: AuthSignupPromptProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="auth-signup-prompt">
|
||||
<span>{t("login.noAccount", "Don't have an account?")}</span>
|
||||
<Button
|
||||
type="button"
|
||||
variant="quiet"
|
||||
accent="brand"
|
||||
onClick={onSignUp}
|
||||
className="auth-signup-link"
|
||||
>
|
||||
{t("signup.signUp", "Sign up")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -130,7 +130,10 @@ export default function EmailPasswordForm({
|
||||
(requiresMfa && !mfaCode.trim())
|
||||
}
|
||||
fullWidth
|
||||
size="lg"
|
||||
fontSize="sm"
|
||||
loading={isSubmitting}
|
||||
className="auth-submit"
|
||||
// Stirling-red brand CTA; the brand accent sets the colour inline so the
|
||||
// host app's Mantine primaryColor can't win (editor vs portal differ).
|
||||
accent="brand"
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { CarouselDots } from "@app/ui/CarouselDots";
|
||||
import bgDefault from "@app/assets/login/LoginBackgroundPanel.png";
|
||||
|
||||
export type ImageSlide = {
|
||||
src: string;
|
||||
alt?: string;
|
||||
cornerModelUrl?: string;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
followMouseTilt?: boolean;
|
||||
tiltMaxDeg?: number;
|
||||
};
|
||||
|
||||
function LoginRightCarousel({
|
||||
imageSlides = [],
|
||||
showBackground = true,
|
||||
backgroundSrc = bgDefault,
|
||||
initialSeconds = 5,
|
||||
slideSeconds = 8,
|
||||
}: {
|
||||
imageSlides?: ImageSlide[];
|
||||
showBackground?: boolean;
|
||||
/** Background panel image; defaults to the bundled shared asset. */
|
||||
backgroundSrc?: string;
|
||||
initialSeconds?: number;
|
||||
slideSeconds?: number;
|
||||
}) {
|
||||
const totalSlides = imageSlides.length;
|
||||
const [index, setIndex] = useState(0);
|
||||
const mouse = useRef({ x: 0, y: 0 });
|
||||
|
||||
const durationsMs = useMemo(() => {
|
||||
if (imageSlides.length === 0) return [];
|
||||
return imageSlides.map(
|
||||
(_, i) =>
|
||||
(i === 0 ? (initialSeconds ?? slideSeconds) : slideSeconds) * 1000,
|
||||
);
|
||||
}, [imageSlides, initialSeconds, slideSeconds]);
|
||||
|
||||
useEffect(() => {
|
||||
if (totalSlides <= 1) return;
|
||||
const timeout = setTimeout(
|
||||
() => {
|
||||
setIndex((i) => (i + 1) % totalSlides);
|
||||
},
|
||||
durationsMs[index] ?? slideSeconds * 1000,
|
||||
);
|
||||
return () => clearTimeout(timeout);
|
||||
}, [index, totalSlides, durationsMs, slideSeconds]);
|
||||
|
||||
useEffect(() => {
|
||||
const onMove = (e: MouseEvent) => {
|
||||
mouse.current.x = (e.clientX / window.innerWidth) * 2 - 1;
|
||||
mouse.current.y = (e.clientY / window.innerHeight) * 2 - 1;
|
||||
};
|
||||
window.addEventListener("mousemove", onMove);
|
||||
return () => window.removeEventListener("mousemove", onMove);
|
||||
}, []);
|
||||
|
||||
function TiltImage({
|
||||
src,
|
||||
alt,
|
||||
enabled,
|
||||
maxDeg = 6,
|
||||
}: {
|
||||
src: string;
|
||||
alt?: string;
|
||||
enabled: boolean;
|
||||
maxDeg?: number;
|
||||
}) {
|
||||
const imgRef = useRef<HTMLImageElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const el = imgRef.current;
|
||||
if (!el) return;
|
||||
|
||||
let raf = 0;
|
||||
const tick = () => {
|
||||
if (enabled) {
|
||||
const rotY = (mouse.current.x || 0) * maxDeg;
|
||||
const rotX = -(mouse.current.y || 0) * maxDeg;
|
||||
el.style.transform = `translateY(-2rem) rotateX(${rotX.toFixed(2)}deg) rotateY(${rotY.toFixed(2)}deg)`;
|
||||
} else {
|
||||
el.style.transform = "translateY(-2rem)";
|
||||
}
|
||||
raf = requestAnimationFrame(tick);
|
||||
};
|
||||
raf = requestAnimationFrame(tick);
|
||||
return () => cancelAnimationFrame(raf);
|
||||
}, [enabled, maxDeg]);
|
||||
|
||||
return (
|
||||
<img
|
||||
ref={imgRef}
|
||||
src={src}
|
||||
alt={alt ?? "Carousel slide"}
|
||||
style={{
|
||||
maxWidth: "86%",
|
||||
maxHeight: "78%",
|
||||
objectFit: "contain",
|
||||
borderRadius: "18px",
|
||||
background: "transparent",
|
||||
transform: "translateY(-2rem)",
|
||||
transition: "transform 80ms ease-out",
|
||||
willChange: "transform",
|
||||
transformOrigin: "50% 50%",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: "relative",
|
||||
overflow: "hidden",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
}}
|
||||
>
|
||||
{showBackground && (
|
||||
<img
|
||||
src={backgroundSrc}
|
||||
alt="Background panel"
|
||||
style={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Image slides */}
|
||||
{imageSlides.map((s, idx) => (
|
||||
<div
|
||||
key={s.src}
|
||||
style={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
transition: "opacity 600ms ease",
|
||||
opacity: index === idx ? 1 : 0,
|
||||
perspective: "900px",
|
||||
}}
|
||||
>
|
||||
{(s.title || s.subtitle) && (
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
bottom: 24 + 32,
|
||||
left: 0,
|
||||
right: 0,
|
||||
textAlign: "center",
|
||||
padding: "0 2rem",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{s.title && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 800,
|
||||
color: "#ffffff",
|
||||
textShadow: "0 2px 6px rgba(0,0,0,0.25)",
|
||||
marginBottom: 6,
|
||||
}}
|
||||
>
|
||||
{s.title}
|
||||
</div>
|
||||
)}
|
||||
{s.subtitle && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: 13,
|
||||
color: "rgba(255,255,255,0.92)",
|
||||
textShadow: "0 1px 4px rgba(0,0,0,0.25)",
|
||||
}}
|
||||
>
|
||||
{s.subtitle}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<TiltImage
|
||||
src={s.src}
|
||||
alt={s.alt}
|
||||
enabled={index === idx && !!s.followMouseTilt}
|
||||
maxDeg={s.tiltMaxDeg ?? 6}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
{/* Dot navigation */}
|
||||
<CarouselDots
|
||||
tone="onImage"
|
||||
count={totalSlides}
|
||||
activeIndex={index}
|
||||
onSelect={setIndex}
|
||||
label="Slides"
|
||||
style={{
|
||||
position: "absolute",
|
||||
bottom: 16,
|
||||
left: 0,
|
||||
right: 0,
|
||||
justifyContent: "center",
|
||||
zIndex: 2,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(LoginRightCarousel);
|
||||
@@ -120,21 +120,19 @@ export default function SpringLoginForm({
|
||||
{beforeEmailForm}
|
||||
|
||||
{renderEmailForm && (
|
||||
<div style={{ marginTop: hasProviders ? "1rem" : 0 }}>
|
||||
<EmailPasswordForm
|
||||
email={email}
|
||||
password={password}
|
||||
setEmail={setEmail}
|
||||
setPassword={setPassword}
|
||||
mfaCode={mfaCode}
|
||||
setMfaCode={setMfaCode}
|
||||
showMfaField={requiresMfa || Boolean(mfaCode)}
|
||||
requiresMfa={requiresMfa}
|
||||
onSubmit={signInWithEmail}
|
||||
isSubmitting={isSubmitting}
|
||||
submitButtonText={submitLabel}
|
||||
/>
|
||||
</div>
|
||||
<EmailPasswordForm
|
||||
email={email}
|
||||
password={password}
|
||||
setEmail={setEmail}
|
||||
setPassword={setPassword}
|
||||
mfaCode={mfaCode}
|
||||
setMfaCode={setMfaCode}
|
||||
showMfaField={requiresMfa || Boolean(mfaCode)}
|
||||
requiresMfa={requiresMfa}
|
||||
onSubmit={signInWithEmail}
|
||||
isSubmitting={isSubmitting}
|
||||
submitButtonText={submitLabel}
|
||||
/>
|
||||
)}
|
||||
|
||||
{footer}
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem; /* 12px */
|
||||
margin: 0.375rem 0 0.5rem; /* 6px 0 8px */
|
||||
/* Center "or" between the last OAuth button and the input box: the larger top
|
||||
margin balances the field label + input that sit below the smaller bottom
|
||||
margin, so the gap to the button ≈ the gap to the input. */
|
||||
margin: 2.25rem 0 0.75rem; /* 36px top, 12px bottom */
|
||||
}
|
||||
|
||||
.auth-or-divider__rule {
|
||||
@@ -37,6 +40,15 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Normalize the Mantine inputs used by the login/signup forms so they match the
|
||||
OAuth buttons and submit CTA: same height, radius, and font size. */
|
||||
.auth-fields .mantine-Input-input {
|
||||
min-height: 2.625rem; /* 42px */
|
||||
height: 2.625rem;
|
||||
border-radius: 0.625rem; /* 10px */
|
||||
font-size: 0.9375rem; /* 15px */
|
||||
}
|
||||
|
||||
.auth-input {
|
||||
width: 100%;
|
||||
padding: 0.625rem 0.75rem; /* 10px 12px */
|
||||
@@ -182,7 +194,13 @@
|
||||
min-height: 3.5rem; /* 56px */
|
||||
}
|
||||
.oauth-button-fullwidth.sui-btn.mantine-Button-root {
|
||||
border-radius: 100px;
|
||||
border-radius: 0.625rem; /* 10px */
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Match the submit CTA's corners to the OAuth buttons and inputs (10px). */
|
||||
.auth-submit.sui-btn.mantine-Button-root {
|
||||
border-radius: 0.625rem; /* 10px */
|
||||
}
|
||||
|
||||
.oauth-button-icon {
|
||||
@@ -378,6 +396,12 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Fullwidth OAuth rows use a smaller icon so button height matches the inputs. */
|
||||
.oauth-button-fullwidth .oauth-icon-medium {
|
||||
width: 1.25rem; /* 20px */
|
||||
height: 1.25rem; /* 20px */
|
||||
}
|
||||
|
||||
.oauth-icon-tiny {
|
||||
width: 1.25rem; /* 20px */
|
||||
height: 1.25rem; /* 20px */
|
||||
@@ -635,6 +659,25 @@
|
||||
color: var(--auth-text-primary-light-only);
|
||||
}
|
||||
|
||||
/* "Don't have an account? Sign up" row beneath the login form. */
|
||||
.auth-signup-prompt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.375rem; /* 6px */
|
||||
margin-top: 1.5rem; /* 24px */
|
||||
font-size: 0.875rem; /* 14px */
|
||||
color: var(--auth-label-text-light-only);
|
||||
}
|
||||
|
||||
.auth-signup-link.sui-btn.mantine-Button-root {
|
||||
padding: 0;
|
||||
min-height: 0;
|
||||
height: auto;
|
||||
font-size: 0.875rem; /* 14px */
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Email login button - red CTA style matching SaaS version */
|
||||
.auth-cta-button {
|
||||
background-color: #af3434 !important;
|
||||
@@ -663,7 +706,7 @@
|
||||
}
|
||||
|
||||
.auth-logo-header {
|
||||
height: 8rem;
|
||||
height: 6.5rem; /* 104px */
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@@ -736,12 +779,12 @@
|
||||
justify-content: center;
|
||||
/* Vertical padding via the shared Button's --sui-btn-py (beats the Button's
|
||||
own padding-block); horizontal stays in the shorthand. */
|
||||
--sui-btn-py: 1rem; /* 16px (md) */
|
||||
padding: 1rem 1rem; /* 16px */
|
||||
--sui-btn-py: 0.625rem; /* 10px */
|
||||
padding: 0.625rem 1rem; /* 10px 16px */
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 100px;
|
||||
border-radius: 0.625rem; /* 10px */
|
||||
background-color: #ffffff;
|
||||
font-size: 1rem;
|
||||
font-size: 0.9375rem; /* 15px */
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
cursor: pointer;
|
||||
@@ -811,50 +854,3 @@
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.oauth-button-fullwidth {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* Vertical padding via the shared Button's --sui-btn-py (beats the Button's
|
||||
own padding-block); horizontal stays in the shorthand. */
|
||||
--sui-btn-py: 1rem; /* 16px (md) */
|
||||
padding: 1rem 1rem; /* 16px */
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 100px;
|
||||
background-color: #ffffff;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
cursor: pointer;
|
||||
gap: 0.5rem;
|
||||
box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.04);
|
||||
transition:
|
||||
background-color 150ms ease,
|
||||
box-shadow 150ms ease,
|
||||
border-color 150ms ease;
|
||||
}
|
||||
|
||||
.oauth-button-fullwidth:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.oauth-button-fullwidth:hover:not(:disabled) {
|
||||
background-color: #fafafa;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
[data-mantine-color-scheme="dark"] .oauth-button-fullwidth {
|
||||
background-color: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-default);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
[data-mantine-color-scheme="dark"]
|
||||
.oauth-button-fullwidth:hover:not(:disabled) {
|
||||
background-color: var(--bg-raised);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
import { defaultTranslate, type AuthTranslate } from "@app/auth/types";
|
||||
|
||||
export type LoginSlideText = {
|
||||
alt: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Shared carousel copy (i18n-optional, English default). The editor and portal
|
||||
* both build their slides from this so the text stays in sync; only the images
|
||||
* differ (the editor swaps the hero for its logo-variant image). Order matches
|
||||
* buildDefaultLoginSlides: [overview, edit, secure].
|
||||
*
|
||||
* Kept image-free on purpose: the editor imports this without dragging the
|
||||
* bundled slide images into its build.
|
||||
*/
|
||||
export function loginSlideText(
|
||||
translate: AuthTranslate = defaultTranslate,
|
||||
): LoginSlideText[] {
|
||||
return [
|
||||
{
|
||||
alt: translate("login.slides.overview.alt", "Stirling PDF overview"),
|
||||
title: translate(
|
||||
"login.slides.overview.title",
|
||||
"Your one-stop-shop for all your PDF needs.",
|
||||
),
|
||||
subtitle: translate(
|
||||
"login.slides.overview.subtitle",
|
||||
"A privacy-first cloud suite for PDFs that lets you convert, sign, redact, and manage documents, along with 50+ other powerful tools.",
|
||||
),
|
||||
},
|
||||
{
|
||||
alt: translate("login.slides.edit.alt", "Edit PDFs"),
|
||||
title: translate(
|
||||
"login.slides.edit.title",
|
||||
"Edit PDFs to display/secure the information you want",
|
||||
),
|
||||
subtitle: translate(
|
||||
"login.slides.edit.subtitle",
|
||||
"With over a dozen tools to help you redact, sign, read and manipulate PDFs, you will be sure to find what you are looking for.",
|
||||
),
|
||||
},
|
||||
{
|
||||
alt: translate("login.slides.secure.alt", "Secure PDFs"),
|
||||
title: translate(
|
||||
"login.slides.secure.title",
|
||||
"Protect sensitive information in your PDFs",
|
||||
),
|
||||
subtitle: translate(
|
||||
"login.slides.secure.subtitle",
|
||||
"Add passwords, redact content, and manage certificates with ease.",
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { defaultTranslate, type AuthTranslate } from "@app/auth/types";
|
||||
import type { ImageSlide } from "@app/auth/ui/LoginRightCarousel";
|
||||
import { loginSlideText } from "@app/auth/ui/loginSlideText";
|
||||
import firstPage from "@app/assets/login/Firstpage.png";
|
||||
import addToPdf from "@app/assets/login/AddToPDF.png";
|
||||
import securePdf from "@app/assets/login/SecurePDF.png";
|
||||
|
||||
const SLIDE_TILT = { followMouseTilt: true, tiltMaxDeg: 5 } as const;
|
||||
|
||||
/**
|
||||
* Default login carousel slides using bundled images. The portal uses this set;
|
||||
* the editor builds its own (logo-variant hero) from loginSlideText.
|
||||
*/
|
||||
export function buildDefaultLoginSlides(
|
||||
translate: AuthTranslate = defaultTranslate,
|
||||
): ImageSlide[] {
|
||||
const text = loginSlideText(translate);
|
||||
return [firstPage, addToPdf, securePdf].map((src, i) => ({
|
||||
src,
|
||||
...text[i],
|
||||
...SLIDE_TILT,
|
||||
}));
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { BASE_PATH } from "@app/constants/app";
|
||||
import { getLogoFolder } from "@app/constants/logo";
|
||||
import type { LogoVariant } from "@app/services/preferencesService";
|
||||
import type { TFunction } from "i18next";
|
||||
import { loginSlideText } from "@app/auth/ui/loginSlideText";
|
||||
import type { ImageSlide } from "@app/auth/ui/LoginRightCarousel";
|
||||
import addToPdf from "@app/assets/login/AddToPDF.png";
|
||||
import securePdf from "@app/assets/login/SecurePDF.png";
|
||||
|
||||
const SLIDE_TILT = { followMouseTilt: true, tiltMaxDeg: 5 } as const;
|
||||
|
||||
/**
|
||||
* Editor login carousel slides. Copy comes from the shared set (so the editor
|
||||
* and portal carousels stay in sync) and the edit/secure images are the shared
|
||||
* bundled assets; only the hero is the logo-variant image the editor serves
|
||||
* from /public.
|
||||
*/
|
||||
export const buildLoginSlides = (
|
||||
variant: LogoVariant | null | undefined,
|
||||
t: TFunction,
|
||||
): ImageSlide[] => {
|
||||
const folder = getLogoFolder(variant);
|
||||
const text = loginSlideText((key, fallback) => t(key, fallback));
|
||||
const srcs = [`${BASE_PATH}/${folder}/Firstpage.png`, addToPdf, securePdf];
|
||||
return srcs.map((src, i) => ({ src, ...text[i], ...SLIDE_TILT }));
|
||||
};
|
||||
|
||||
export default buildLoginSlides;
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
useNavigate,
|
||||
useSearchParams,
|
||||
} from "react-router-dom";
|
||||
import { Text, Stack, Alert } from "@mantine/core";
|
||||
import { Button } from "@app/ui/Button";
|
||||
import { setPostLoginRedirectPath } from "@app/auth/spring/springAuthClient";
|
||||
import { markLoginLandingPending } from "@app/utils/loginLanding";
|
||||
@@ -22,6 +21,8 @@ import {
|
||||
oauthProviderConfig,
|
||||
} from "@app/auth/ui/OAuthButtons";
|
||||
import SpringLoginForm from "@app/auth/ui/SpringLoginForm";
|
||||
import AuthSignupPrompt from "@app/auth/ui/AuthSignupPrompt";
|
||||
import AuthDefaultCredentials from "@app/auth/ui/AuthDefaultCredentials";
|
||||
import { useSpringLogin } from "@app/auth/ui/useSpringLogin";
|
||||
import LoggedInState from "@app/routes/login/LoggedInState";
|
||||
import loginHeader from "@app/assets/brand/modern-logo/LoginLightModeHeader.svg";
|
||||
@@ -514,59 +515,14 @@ export default function Login() {
|
||||
) : undefined
|
||||
}
|
||||
footer={
|
||||
isFirstTimeSetup && showDefaultCredentials && isUserPassAllowed ? (
|
||||
<Alert color="blue" variant="light" radius="md" mt="xl">
|
||||
<Stack gap="xs" align="center">
|
||||
<Text
|
||||
size="sm"
|
||||
fw={600}
|
||||
ta="center"
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.defaultCredentials", "Default Login Credentials")}
|
||||
</Text>
|
||||
<Text
|
||||
size="sm"
|
||||
ta="center"
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
<Text
|
||||
component="span"
|
||||
fw={600}
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.username", "Username")}:
|
||||
</Text>{" "}
|
||||
admin
|
||||
</Text>
|
||||
<Text
|
||||
size="sm"
|
||||
ta="center"
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
<Text
|
||||
component="span"
|
||||
fw={600}
|
||||
style={{ color: "var(--text-primary)" }}
|
||||
>
|
||||
{t("login.password", "Password")}:
|
||||
</Text>{" "}
|
||||
stirling
|
||||
</Text>
|
||||
<Text
|
||||
size="xs"
|
||||
ta="center"
|
||||
mt="xs"
|
||||
style={{ color: "var(--text-muted)" }}
|
||||
>
|
||||
{t(
|
||||
"login.changePasswordWarning",
|
||||
"Please change your password after logging in for the first time",
|
||||
)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Alert>
|
||||
) : undefined
|
||||
<>
|
||||
{isFirstTimeSetup &&
|
||||
showDefaultCredentials &&
|
||||
isUserPassAllowed && <AuthDefaultCredentials />}
|
||||
{isUserPassAllowed && (
|
||||
<AuthSignupPrompt onSignUp={() => navigate("/signup")} />
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</AuthLayout>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import React, { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import React from "react";
|
||||
import { AuthShell } from "@app/auth/ui/AuthShell";
|
||||
import LoginRightCarousel from "@app/auth/ui/LoginRightCarousel";
|
||||
import buildLoginSlides from "@app/components/shared/loginSlides";
|
||||
import { useLogoVariant } from "@app/hooks/useLogoVariant";
|
||||
import Footer from "@app/components/shared/Footer";
|
||||
|
||||
interface AuthLayoutProps {
|
||||
@@ -11,30 +7,9 @@ interface AuthLayoutProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Editor login layout. The card shell + carousel now live in shared so the
|
||||
* portal renders the identical screen; this wires the editor's logo-variant
|
||||
* slides and legal/cookie footer into that shared shell.
|
||||
* Editor login layout. The card shell lives in shared so the portal renders
|
||||
* the identical screen; this wires the editor's legal/cookie footer into it.
|
||||
*/
|
||||
export default function AuthLayout({ children }: AuthLayoutProps) {
|
||||
const { t } = useTranslation();
|
||||
const logoVariant = useLogoVariant();
|
||||
const imageSlides = useMemo(
|
||||
() => buildLoginSlides(logoVariant, t),
|
||||
[logoVariant, t],
|
||||
);
|
||||
|
||||
return (
|
||||
<AuthShell
|
||||
rightPanel={
|
||||
<LoginRightCarousel
|
||||
imageSlides={imageSlides}
|
||||
initialSeconds={5}
|
||||
slideSeconds={8}
|
||||
/>
|
||||
}
|
||||
footer={<Footer />}
|
||||
>
|
||||
{children}
|
||||
</AuthShell>
|
||||
);
|
||||
return <AuthShell footer={<Footer />}>{children}</AuthShell>;
|
||||
}
|
||||
|
||||
@@ -160,8 +160,11 @@ export default function SignupForm({
|
||||
!confirmPassword ||
|
||||
(showTerms && !agree)
|
||||
}
|
||||
className="auth-button"
|
||||
className="auth-submit"
|
||||
fullWidth
|
||||
size="lg"
|
||||
fontSize="sm"
|
||||
accent="brand"
|
||||
loading={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? t("signup.creatingAccount") : t("signup.signUp")}
|
||||
|
||||
@@ -269,7 +269,7 @@ export default function Login() {
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthLayout isEmailFormExpanded={showEmailForm || showMagicLinkForm}>
|
||||
<AuthLayout>
|
||||
{/* Centered logo */}
|
||||
<div className="auth-logo-block">
|
||||
<img
|
||||
|
||||
@@ -182,7 +182,7 @@ export default function Signup() {
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthLayout isEmailFormExpanded={showEmailForm}>
|
||||
<AuthLayout>
|
||||
{/* Centered logo */}
|
||||
<div className="auth-logo-block">
|
||||
<img
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
.authContainer {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--auth-bg-color-light-only);
|
||||
padding: 1.5rem 1.5rem 0;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Main area above footer: keep card centered even with footer visible */
|
||||
.authMain {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 95vh;
|
||||
}
|
||||
|
||||
.authCard {
|
||||
width: min(45rem, 96vw);
|
||||
height: min(50.875rem, 96vh);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
background-color: var(--auth-card-bg);
|
||||
border-radius: 1.25rem;
|
||||
box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.12);
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
max-height: 96vh;
|
||||
}
|
||||
|
||||
.authCardTwoColumns {
|
||||
width: min(73.75rem, 96vw);
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.authLeftPanel {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 2rem;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.authLeftPanelCentered {
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.authLeftPanelScrollable {
|
||||
align-items: flex-start;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.authLeftPanel::-webkit-scrollbar {
|
||||
display: none; /* WebKit browsers (Chrome, Safari, Edge) */
|
||||
}
|
||||
|
||||
.authContent {
|
||||
max-width: 26.25rem; /* 420px */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.authLeftPanelScrollable .authContent {
|
||||
min-height: 100%;
|
||||
}
|
||||
@@ -1,87 +1,11 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import LoginRightCarousel from "@app/auth/ui/LoginRightCarousel";
|
||||
import buildLoginSlides from "@app/components/shared/loginSlides";
|
||||
import styles from "@app/routes/authShared/AuthLayout.module.css";
|
||||
import { useLogoVariant } from "@app/hooks/useLogoVariant";
|
||||
import { useIsOverflowing } from "@app/hooks/useIsOverflowing";
|
||||
import React from "react";
|
||||
import { AuthShell } from "@app/auth/ui/AuthShell";
|
||||
import Footer from "@app/components/shared/Footer";
|
||||
|
||||
interface AuthLayoutProps {
|
||||
children: React.ReactNode;
|
||||
isEmailFormExpanded?: boolean;
|
||||
}
|
||||
|
||||
export default function AuthLayout({
|
||||
children,
|
||||
isEmailFormExpanded = false,
|
||||
}: AuthLayoutProps) {
|
||||
const { t } = useTranslation();
|
||||
const cardRef = useRef<HTMLDivElement | null>(null);
|
||||
const leftPanelRef = useRef<HTMLDivElement | null>(null);
|
||||
const [hideRightPanel, setHideRightPanel] = useState(false);
|
||||
const logoVariant = useLogoVariant();
|
||||
const imageSlides = useMemo(
|
||||
() => buildLoginSlides(logoVariant, t),
|
||||
[logoVariant, t],
|
||||
);
|
||||
const isOverflowing = useIsOverflowing(leftPanelRef);
|
||||
|
||||
// Use either overflow detection or email form expansion to determine scrollable state
|
||||
const shouldBeScrollable = isOverflowing || isEmailFormExpanded;
|
||||
|
||||
useEffect(() => {
|
||||
const update = () => {
|
||||
// Use viewport to avoid hysteresis when the card is already in single-column mode
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
const cardWidthIfTwoCols = Math.min(1180, viewportWidth * 0.96); // matches min(73.75rem, 96vw)
|
||||
const columnWidth = cardWidthIfTwoCols / 2;
|
||||
const tooNarrow = columnWidth < 470;
|
||||
const tooShort = viewportHeight < 740;
|
||||
setHideRightPanel(tooNarrow || tooShort);
|
||||
};
|
||||
update();
|
||||
window.addEventListener("resize", update);
|
||||
window.addEventListener("orientationchange", update);
|
||||
return () => {
|
||||
window.removeEventListener("resize", update);
|
||||
window.removeEventListener("orientationchange", update);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.authContainer}>
|
||||
<div className={styles.authMain}>
|
||||
<div
|
||||
ref={cardRef}
|
||||
className={`${styles.authCard} ${!hideRightPanel ? styles.authCardTwoColumns : ""}`}
|
||||
>
|
||||
<div
|
||||
ref={leftPanelRef}
|
||||
className={`${styles.authLeftPanel} ${shouldBeScrollable ? styles.authLeftPanelScrollable : styles.authLeftPanelCentered}`}
|
||||
>
|
||||
<div className={styles.authContent}>{children}</div>
|
||||
</div>
|
||||
{!hideRightPanel && (
|
||||
<LoginRightCarousel
|
||||
imageSlides={imageSlides}
|
||||
initialSeconds={5}
|
||||
slideSeconds={8}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "100vw",
|
||||
marginTop: "auto",
|
||||
marginLeft: "-1.5rem",
|
||||
marginRight: "-1.5rem",
|
||||
}}
|
||||
>
|
||||
<Footer analyticsEnabled />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
export default function AuthLayout({ children }: AuthLayoutProps) {
|
||||
return <AuthShell footer={<Footer analyticsEnabled />}>{children}</AuthShell>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user