mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
♻️ Give the team hero and recovery page links a real href (#12708)
* ♻️ Give the Team management link in the team hero a real href "Team management" in the "Team up!" notice of a team's Projects page was an <a> without href. It now links to the team Members page; a plain click still runs the in-app navigation (prevent default), and Ctrl/Cmd-click opens the link in a new tab. New visual test "Shows the Team management link": 0 px of difference at rest and on hover. AI-assisted-by: claude-opus-5-5 * ♻️ Give the Go to login link of the recovery page a real href "Go to login" on the password recovery page was an <a> without href. It now links to the login page; a plain click still runs the in-app navigation (prevent default), and Ctrl/Cmd-click opens the link in a new tab. New visual test "Shows the Go to login link": 0 px of difference at rest and on hover. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
1a355958a4
commit
01ceba34ec
@ -1103,3 +1103,24 @@ test.describe("Team settings organization", () => {
|
||||
await expect(add).toHaveScreenshot(shot);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Team hero link", () => {
|
||||
test("Shows the Team management link", async ({ page }) => {
|
||||
const shot = { maxDiffPixelRatio: 0, threshold: 0 };
|
||||
const dashboardPage = new DashboardPage(page);
|
||||
await dashboardPage.setupDashboardFull();
|
||||
await dashboardPage.mockRPC(
|
||||
`get-projects?team-id=${DashboardPage.secondTeamId}`,
|
||||
"dashboard/get-projects-second-team.json",
|
||||
);
|
||||
await dashboardPage.goToSecondTeamDashboard();
|
||||
await expect(page.getByText("Team Up")).toBeVisible();
|
||||
|
||||
const link = page.getByText("Team management", { exact: true });
|
||||
await page.mouse.move(10, 700);
|
||||
await expect(link).toHaveScreenshot(shot);
|
||||
|
||||
await link.hover();
|
||||
await expect(link).toHaveScreenshot(shot);
|
||||
});
|
||||
});
|
||||
|
||||
@ -108,3 +108,18 @@ test.describe("Login dialog section links", () => {
|
||||
await expect(loginHere).toHaveScreenshot(shot);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Password recovery page", () => {
|
||||
test("Shows the Go to login link", async ({ page }) => {
|
||||
const shot = { maxDiffPixelRatio: 0, threshold: 0 };
|
||||
await page.goto("/?screen=auth-recovery&token=fake-token");
|
||||
|
||||
const link = page.getByText("Go to login", { exact: true });
|
||||
await expect(link).toBeVisible();
|
||||
await page.mouse.move(10, 10);
|
||||
await expect(link).toHaveScreenshot(shot);
|
||||
|
||||
await link.hover();
|
||||
await expect(link).toHaveScreenshot(shot);
|
||||
});
|
||||
});
|
||||
|
||||
@ -10,10 +10,13 @@
|
||||
[app.common.schema :as sm]
|
||||
[app.main.data.notifications :as ntf]
|
||||
[app.main.data.profile :as du]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.router :as rt]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.forms :as fm]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(def ^:private schema:recovery-form
|
||||
@ -88,16 +91,25 @@
|
||||
|
||||
;; --- Recovery Request Page
|
||||
|
||||
(defn- on-go-to-login
|
||||
[event]
|
||||
;; Ctrl/Cmd-click opens the href in a new tab, as any link.
|
||||
(when-not (kbd/mod? event)
|
||||
(dom/prevent-default event)
|
||||
(st/emit! (rt/nav :auth-login))))
|
||||
|
||||
(mf/defc recovery-page*
|
||||
[{:keys [params]}]
|
||||
[:div {:class (stl/css :wrapper)}
|
||||
[:h1 {:class (stl/css :title)} (tr "auth.recovery-request-title")]
|
||||
[:div {:class (stl/css :subtitle)} (tr "auth.recovery-request-subtitle")]
|
||||
[:hr {:class (stl/css :separator)}]
|
||||
[:> recovery-form* {:params params}]
|
||||
(let [router (mf/deref refs/router)]
|
||||
[:div {:class (stl/css :wrapper)}
|
||||
[:h1 {:class (stl/css :title)} (tr "auth.recovery-request-title")]
|
||||
[:div {:class (stl/css :subtitle)} (tr "auth.recovery-request-subtitle")]
|
||||
[:hr {:class (stl/css :separator)}]
|
||||
[:> recovery-form* {:params params}]
|
||||
|
||||
[:div {:class (stl/css :links)}
|
||||
[:div {:class (stl/css :go-back-row)}
|
||||
[:a {:on-click #(st/emit! (rt/nav :auth-login))
|
||||
:class (stl/css :go-back-link)}
|
||||
(tr "profile.recovery.go-to-login")]]]])
|
||||
[:div {:class (stl/css :links)}
|
||||
[:div {:class (stl/css :go-back-row)}
|
||||
[:a {:href (rt/resolve-uri router :auth-login {})
|
||||
:on-click on-go-to-login
|
||||
:class (stl/css :go-back-link)}
|
||||
(tr "profile.recovery.go-to-login")]]]]))
|
||||
|
||||
@ -69,9 +69,16 @@
|
||||
(mf/defc team-hero*
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [team on-close]}]
|
||||
(let [on-nav-members-click
|
||||
(let [router (mf/deref refs/router)
|
||||
members-href (rt/resolve-uri router :dashboard-members {:team-id (:id team)})
|
||||
|
||||
on-nav-members-click
|
||||
(mf/use-fn
|
||||
#(st/emit! (dcm/go-to-dashboard-members)))
|
||||
(fn [event]
|
||||
;; Ctrl/Cmd-click opens the href in a new tab, as any link.
|
||||
(when-not (kbd/mod? event)
|
||||
(dom/prevent-default event)
|
||||
(st/emit! (dcm/go-to-dashboard-members)))))
|
||||
|
||||
on-invite
|
||||
(mf/use-fn
|
||||
@ -95,7 +102,9 @@
|
||||
[:div {:class (stl/css :title)} (tr "dasboard.team-hero.title")]
|
||||
[:div {:class (stl/css :info)}
|
||||
[:span (tr "dasboard.team-hero.text")]
|
||||
[:a {:on-click on-nav-members-click} (tr "dasboard.team-hero.management")]]
|
||||
[:a {:href members-href
|
||||
:on-click on-nav-members-click}
|
||||
(tr "dasboard.team-hero.management")]]
|
||||
[:> button* {:variant "primary"
|
||||
:on-click on-invite}
|
||||
(tr "onboarding.choice.team-up.invite-members")]]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user