mirror of
https://github.com/penpot/penpot.git
synced 2026-11-20 17:11:15 +00:00
Move SPA routing out of the URL fragment into the normal query string. The screen travels in a reserved `screen` key holding the route name (`?screen=workspace&team-id=…`); every other param keeps its name. `rt/nav` and `rt/resolve` keep their signatures. This deletes the fragment-mirroring URL surgery, simplifies link-preview (the server sees everything) and nginx (single path, no SPA fallback rules needed), and migrates OIDC redirects, email links, e2e helpers and plugin test utils to the new format. Legacy `#/…` URLs translate client-side for one Penpot version (`legacy-routes`, marked TODO(next-version)); non-SPA paths are untouched. AI-assisted-by: muse-spark-1.3-contributor
84 lines
2.6 KiB
Clojure
84 lines
2.6 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
|
|
|
(ns app.main.ui.auth
|
|
(:require-macros [app.main.style :as stl])
|
|
(:require
|
|
[app.common.data.macros :as dm]
|
|
[app.main.data.auth :as da]
|
|
[app.main.store :as st]
|
|
[app.main.ui.auth.login :refer [login-page*]]
|
|
[app.main.ui.auth.recovery :refer [recovery-page*]]
|
|
[app.main.ui.auth.recovery-request :refer [recovery-request-page*]]
|
|
[app.main.ui.auth.register :refer [register-page* register-success-page* register-validate-page* terms-service-privacy-policy*]]
|
|
[app.main.ui.ds.foundations.assets.raw-svg :refer [raw-svg*] :as raw-svg]
|
|
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
|
|
[app.util.dom :as dom]
|
|
[app.util.i18n :as i18n :refer [tr]]
|
|
[rumext.v2 :as mf]))
|
|
|
|
(mf/defc auth*
|
|
[{:keys [route]}]
|
|
(let [section
|
|
(dm/get-in route [:data :name])
|
|
|
|
is-register
|
|
(or (= section :auth-register)
|
|
(= section :auth-register-validate)
|
|
(= section :register-validate-page)
|
|
(= section :auth-register-success))
|
|
params
|
|
(:query-params route)
|
|
|
|
error
|
|
(:error params)]
|
|
|
|
(mf/with-effect []
|
|
(dom/set-html-title (tr "title.default")))
|
|
|
|
(mf/with-effect [error]
|
|
(when error
|
|
(st/emit! (da/show-redirect-error error))))
|
|
|
|
[:main {:class (stl/css-case
|
|
:auth-section true
|
|
:register is-register)}
|
|
[:> heading* {:level 1 :typography "title-large" :class (stl/css :logo-container)}
|
|
[:a {:href "/" :title "Penpot" :class (stl/css :logo-btn)}
|
|
[:> raw-svg* {:id raw-svg/penpot-logo
|
|
:class (stl/css :logo)}]]]
|
|
[:div {:class (stl/css :login-illustration)}
|
|
[:img {:src "images/registration-illustration.png"}]]
|
|
|
|
[:section {:class (stl/css :auth-content)}
|
|
(case section
|
|
:auth-register
|
|
[:> register-page* {:params params}]
|
|
|
|
:auth-register-success
|
|
[:> register-success-page* {:params params}]
|
|
|
|
:auth-register-validate
|
|
[:> register-validate-page* {:params params}]
|
|
|
|
:auth-login
|
|
[:> login-page* {:params params}]
|
|
|
|
:auth-recovery-request
|
|
[:> recovery-request-page*]
|
|
|
|
:auth-recovery
|
|
[:> recovery-page* {:params params}])
|
|
|
|
(when (= section :auth-register)
|
|
[:> terms-service-privacy-policy*])]]))
|
|
|
|
|
|
(mf/defc auth-page*
|
|
{::mf/lazy-load true}
|
|
[props]
|
|
[:> auth* props])
|