Sign-in: hide the inbuxa wordmark under a custom logo #123

Merged
jcoffey-dev merged 1 commits from fix/122-custom-logo-hides-wordmark into main 2026-11-19 17:52:01 +00:00
12 changed files with 139 additions and 11 deletions

No files matched your search

+1
View File
@@ -861,6 +861,7 @@ export const catalog: Catalog = {
"connected": "verbunden",
"reconnecting…": "Verbindung wird wiederhergestellt…",
"AGPL-3.0 source": "AGPL-3.0-Quellcode",
"Powered by {product} v{version}": "Betrieben mit {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Identitäten & Signaturen",
+1
View File
@@ -858,6 +858,7 @@ export const catalog: Catalog = {
"connected": "conectado",
"reconnecting…": "reconectando…",
"AGPL-3.0 source": "Código fuente AGPL-3.0",
"Powered by {product} v{version}": "Con la tecnología de {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Identidades y firmas",
+1
View File
@@ -864,6 +864,7 @@ export const catalog: Catalog = {
"connected": "connecté",
"reconnecting…": "reconnexion…",
"AGPL-3.0 source": "Code source AGPL-3.0",
"Powered by {product} v{version}": "Propulsé par {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Identités et signatures",
+1
View File
@@ -858,6 +858,7 @@ export const catalog: Catalog = {
"connected": "接続済み",
"reconnecting…": "再接続中…",
"AGPL-3.0 source": "AGPL-3.0 ソース",
"Powered by {product} v{version}": "{product} v{version} で動作",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "差出人と署名",
+1
View File
@@ -859,6 +859,7 @@ export const catalog: Catalog = {
"connected": "verbonden",
"reconnecting…": "opnieuw verbinden…",
"AGPL-3.0 source": "AGPL-3.0 broncode",
"Powered by {product} v{version}": "Mogelijk gemaakt door {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Identiteiten en handtekeningen",
+1
View File
@@ -861,6 +861,7 @@ export const catalog: Catalog = {
"connected": "conectado",
"reconnecting…": "reconectando…",
"AGPL-3.0 source": "Código-fonte AGPL-3.0",
"Powered by {product} v{version}": "Desenvolvido com {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Identidades e assinaturas",
+1
View File
@@ -861,6 +861,7 @@ export const catalog: Catalog = {
"connected": "подключено",
"reconnecting…": "переподключение…",
"AGPL-3.0 source": "Исходный код AGPL-3.0",
"Powered by {product} v{version}": "Работает на {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Профили отправителя и подписи",
+1
View File
@@ -59,6 +59,7 @@ export const catalog: Catalog = {
"A tenant needs a name.": "Bir kiracının bir ada ihtiyacı vardır.",
"A to Z": "A'dan Z'ye",
"AGPL-3.0 source": "AGPL-3.0 kaynak kodu",
"Powered by {product} v{version}": "{product} v{version} ile çalışır",
"AGPL-3.0-or-later · {source}": "AGPL-3.0-or-later · {source}",
"About": "Hakkında",
"About {app}": "{app} Hakkında",
+1
View File
@@ -855,6 +855,7 @@ export const catalog: Catalog = {
"connected": "підключено",
"reconnecting…": "перепідключення…",
"AGPL-3.0 source": "Вихідний код AGPL-3.0",
"Powered by {product} v{version}": "Працює на {product} v{version}",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "Профілі відправника та підписи",
+1
View File
@@ -857,6 +857,7 @@ export const catalog: Catalog = {
"connected": "已连接",
"reconnecting…": "正在重新连接…",
"AGPL-3.0 source": "AGPL-3.0 源代码",
"Powered by {product} v{version}": "由 {product} v{version} 提供支持",
// ── Identities, templates, filters ─────────────────────────────────
"Identities & signatures": "发件身份与签名",
+51 -11
View File
@@ -8,7 +8,7 @@ import { APP_VERSION } from "@/lib/version";
import { DEFAULT_SOURCE_URL } from "@/lib/source";
import { DEFAULT_APP_NAME, brandImage } from "@/lib/brand";
import { useServerLogo } from "@/lib/serverLogo";
import { t } from "@/lib/i18n";
import { t, tNode } from "@/lib/i18n";
import { InbuxaWordmark } from "@/ui/InbuxaWordmark";
export function LoginPage() {
@@ -110,10 +110,26 @@ export function LoginPage() {
/>
)}
{/* A product name, not a word: not translated, and not guessed at
from the page it is on. INBUXA's is its wordmark. */}
<h1 className="notranslate" translate="no">
{appName === DEFAULT_APP_NAME ? <InbuxaWordmark height={34} /> : appName}
</h1>
from the page it is on. INBUXA's is its wordmark.
Under an administrator's own logo the wordmark is a second logo
fighting the first for the card (#122), so it goes, and inbuxa
is credited in the footer instead. The heading stays for screen
readers. A name the administrator set themselves stays: they
chose to show it. While the logo is still being asked for, the
wordmark is held unseen like the image above, so it doesn't
flash up and vanish. */}
{appName === DEFAULT_APP_NAME && serverLogo.status === "custom" ? (
<h1 className="sr-only notranslate" translate="no">{appName}</h1>
) : (
<h1
className="notranslate"
translate="no"
style={appName === DEFAULT_APP_NAME && serverLogo.status === "loading" ? { visibility: "hidden" } : undefined}
>
{appName === DEFAULT_APP_NAME ? <InbuxaWordmark height={34} /> : appName}
</h1>
)}
<p className="tagline">{t("Fast, friendly webmail. Your mailbox, your way.")}</p>
</div>
{error && (
@@ -178,12 +194,36 @@ export function LoginPage() {
One <p> with a break rather than two: .foot carries a 20px
margin-top, which a second paragraph would repeat as a gap.
*/}
{/* ihasmail-inbuxa: this build is INBUXA's webmail, and its site is INBUXA's. */}
<span className="notranslate" translate="no">inbuxa webmail v{APP_VERSION}</span>
<br />
<a href="https://inbuxa.org" target="_blank" rel="noopener noreferrer" className="notranslate" translate="no">inbuxa.org</a>
{" · "}
<a href={sourceUrl} target="_blank" rel="noopener noreferrer">{t("AGPL-3.0 source")}</a>
{/* ihasmail-inbuxa: this build is INBUXA's webmail, and its site is INBUXA's.
Under an administrator's own logo the footer is where inbuxa is
credited (#122): "Powered by", with the name as the link to
inbuxa.org, reads as what it is; a bare "inbuxa.org" under
somebody else's logo read as a stray URL. */}
{serverLogo.status === "custom" ? (
<>
{tNode(
"Powered by {product} v{version}",
{
product: (
<a href="https://inbuxa.org" target="_blank" rel="noopener noreferrer" className="notranslate" translate="no">
inbuxa Webmail
</a>
),
},
{ version: APP_VERSION },
)}
<br />
<a href={sourceUrl} target="_blank" rel="noopener noreferrer">{t("AGPL-3.0 source")}</a>
</>
) : (
<>
<span className="notranslate" translate="no">inbuxa Webmail v{APP_VERSION}</span>
<br />
<a href="https://inbuxa.org" target="_blank" rel="noopener noreferrer" className="notranslate" translate="no">inbuxa.org</a>
{" · "}
<a href={sourceUrl} target="_blank" rel="noopener noreferrer">{t("AGPL-3.0 source")}</a>
</>
)}
</p>
</form>
</div>
@@ -0,0 +1,78 @@
import { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ServerLogo } from "@/lib/serverLogo";
let logo: ServerLogo = { status: "default" };
vi.mock("@/lib/serverLogo", async (importActual) => ({
...(await importActual<typeof import("@/lib/serverLogo")>()),
useServerLogo: () => logo,
}));
import { LoginPage } from "../Login";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
/**
* #122: under an administrator's own logo the inbuxa wordmark sat directly
* beneath it, two logos crowding the card. With a custom logo the wordmark
* goes and the footer credits inbuxa as "Powered by inbuxa Webmail".
*/
describe("Sign-in page with a custom logo", () => {
let host: HTMLDivElement;
let root: Root;
const render = async () => {
await act(async () => {
root.render(<LoginPage />);
});
};
const heading = () => host.querySelector("h1")!;
const foot = () => host.querySelector(".foot")!;
beforeEach(() => {
vi.stubGlobal("fetch", vi.fn(() => Promise.resolve(new Response("{}", { status: 200 }))));
host = document.createElement("div");
document.body.appendChild(host);
root = createRoot(host);
});
afterEach(async () => {
await act(async () => root.unmount());
host.remove();
vi.unstubAllGlobals();
});
it("shows the wordmark and the plain footer without one", async () => {
logo = { status: "default" };
await render();
expect(heading().classList.contains("sr-only")).toBe(false);
expect(heading().querySelector("svg, img")).not.toBeNull();
expect(foot().textContent).toContain("inbuxa Webmail v");
expect(foot().textContent).not.toContain("Powered by");
expect([...foot().querySelectorAll("a")].map((a) => a.textContent)).toEqual(["inbuxa.org", "AGPL-3.0 source"]);
});
it("hides the wordmark under a custom logo, keeping the heading for screen readers", async () => {
logo = { status: "custom", url: "/api/logo" };
await render();
expect(host.querySelector("img.server-logo")).not.toBeNull();
expect(heading().classList.contains("sr-only")).toBe(true);
expect(heading().textContent).toBe("inbuxa");
});
it("credits inbuxa in the footer under a custom logo, and keeps the source link", async () => {
logo = { status: "custom", url: "/api/logo" };
await render();
expect(foot().textContent).toMatch(/^Powered by inbuxa Webmail v\S+AGPL-3\.0 source$/);
const links = [...foot().querySelectorAll("a")];
expect(links.map((a) => a.textContent)).toEqual(["inbuxa Webmail", "AGPL-3.0 source"]);
expect(links[0]!.getAttribute("href")).toBe("https://inbuxa.org");
});
it("holds the wordmark unseen while the logo is still being asked for", async () => {
logo = { status: "loading" };
await render();
expect(heading().style.visibility).toBe("hidden");
});
});