Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(login): cleanup login button
Elian Doran8c0d512f0461
diff --git a/apps/client/src/login_page.css b/apps/client/src/login_page.cssindex d375986740..1c170b6583 100644--- a/apps/client/src/login_page.css+++ b/apps/client/src/login_page.css@@ -6,31 +6,15 @@ body.setup .setup-container.login-container {--size: 162px;}- .google-login-btn {- display: flex;- align-items: center;- justify-content: center;- background-color: var(--input-background-color);- color: var(--main-text-color);- border: 1px solid var(--main-border-color);- border-radius: 4px;- padding: 1.25em 4em;- font-size: 14px;+ .oidc-login {+ padding: 1.25rem 4rem;font-weight: 500;- cursor: pointer;- margin-bottom: 20px;- text-decoration: none;- transition: background-color 0.3s;margin: auto;- }-- .google-login-btn:hover {- background-color: var(--hover-item-background-color);- }- .google-login-btn img {- margin-inline-end: 10px;- width: 18px;- height: 18px;+ img {+ margin-inline-end: 10px;+ width: 18px;+ height: 18px;+ }}}diff --git a/apps/client/src/login_page.tsx b/apps/client/src/login_page.tsxindex b394ac04ba..44053ddfcb 100644--- a/apps/client/src/login_page.tsx+++ b/apps/client/src/login_page.tsx@@ -42,24 +42,22 @@ function App() {return (<div class="setup-container login-container"><SetupPage className="login" title={t("login.heading")} illustration={illustration} error={error} errorId={errorId}>- {/* Server route that initiates the OpenID round-trip. A global anchor-click- handler (link.ts, pulled in transitively) preventDefaults every link and- only navigates note/http links, so a plain server route would do nothing on- click. Navigate explicitly and keep the event from reaching that handler. */}- <a- href="/authenticate"- class="google-login-btn"- onClick={(e) => {- e.preventDefault();- e.stopPropagation();- window.location.href = "/authenticate";- }}- >- {config.ssoIssuerIcon- ? <img src={config.ssoIssuerIcon} alt="" onError={(e) => (e.currentTarget as HTMLImageElement).remove()} />- : null}- {t("login.sign_in_with_sso", { ssoIssuerName: config.ssoIssuerName ?? "" })}- </a>+ {/* A <button>, not an <a>, on purpose: link.ts installs a global anchor-click+ handler that preventDefaults every link and only navigates note/http links,+ so an <a> to a plain server route gets swallowed. A button sidesteps it and+ just navigates to the route that starts the OpenID round-trip. */}+ <Button+ className="oidc-login"+ onClick={() => { window.location.href = "/authenticate"; }}+ text={(+ <>+ {config.ssoIssuerIcon+ ? <img src={config.ssoIssuerIcon} alt="" onError={(e) => (e.currentTarget as HTMLImageElement).remove()} />+ : null}+ {t("login.sign_in_with_sso", { ssoIssuerName: config.ssoIssuerName ?? "" })}+ </>+ )}+ /></SetupPage></div>);diff --git a/apps/client/src/widgets/react/Button.tsx b/apps/client/src/widgets/react/Button.tsxindex 95601a9228..07b70c2133 100644--- a/apps/client/src/widgets/react/Button.tsx+++ b/apps/client/src/widgets/react/Button.tsx@@ -12,7 +12,7 @@ export interface ButtonProps {name?: string;/** Reference to the button element. Mostly useful for requesting focus. */buttonRef?: RefObject<HTMLButtonElement>;- text: string;+ text: string | ComponentChildren;className?: string;icon?: string;keyboardShortcut?: string;