mirror of
https://github.com/penpot/penpot.git
synced 2026-11-23 10:50:49 +00:00
* ♻️ Use DS icons and buttons in the settings sidebar and email modal - The settings sidebar back arrow and "Contact us" icon use the DS icons. The arrow keeps its place; the small DS icon draws 12px inside a 16px box, so the feedback icon sits 2px to the right and its margin shrinks to keep the label in place. - The change email modal close button becomes a ghost DS icon button named "Close"; the class that places it goes on the tooltip wrapper. The form submit buttons of the settings pages stay: they are the shared forms submit button. A visual test covers the settings sidebar and the change email modal. AI-assisted-by: claude-opus-5-5 * ♻️ Move settings sidebar and email modal styles to the DS The settings sidebar no longer imports refactor/: its legacy mixins, sizes and color aliases resolve to DS values and tokens, with logical properties. Its z-index (1) has no DS token and keeps a TODO. The change email modal does the same and keeps refactor/ only for the modal placeholders (%modal-*), which move with the modals refactor. Its legacy uppercase title becomes the DS headline-small typography, which differs only in its size (12px instead of 11px): the modal grows 2px. Two unused selectors are commented out with a TODO. AI-assisted-by: claude-opus-5-5 * 🔥 Remove unused styles from the change email modal The SCSS refactor of the change email modal left rules commented out with a TODO because the module does not use them, or because they target an svg inside a DS icon that is the svg itself. CSS modules scope the classes to this module and no other source uses them, so they go: .select-title, .cancel-button. No visual change. AI-assisted-by: claude-opus-5-5 * ♻️ Tidy the settings sidebar and change email styles The sidebar uses --z-index-panels instead of auto, the change email submit button gets its own class instead of a bare button selector, and the sidebar icons keep the DS stroke width (only the feedback icon line gets thinner). AI-assisted-by: claude-opus-5-5
154 lines
5.9 KiB
Clojure
154 lines
5.9 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.settings.sidebar
|
|
(:require-macros [app.main.style :as stl])
|
|
(:require
|
|
[app.config :as cf]
|
|
[app.main.data.common :as dcm]
|
|
[app.main.data.event :as ev]
|
|
[app.main.data.modal :as modal]
|
|
[app.main.data.team :as dtm]
|
|
[app.main.router :as rt]
|
|
[app.main.store :as st]
|
|
[app.main.ui.dashboard.sidebar :refer [profile-section*]]
|
|
[app.main.ui.ds.foundations.assets.icon :refer [icon*] :as i]
|
|
[app.util.i18n :as i18n :refer [tr]]
|
|
[app.util.keyboard :as kbd]
|
|
[rumext.v2 :as mf]))
|
|
|
|
|
|
;; FIXME: move to common
|
|
(def ^:private go-settings-profile
|
|
#(st/emit! (rt/nav :settings-profile)))
|
|
|
|
(def ^:private go-settings-feedback
|
|
#(st/emit! (rt/nav :settings-feedback)))
|
|
|
|
(def ^:private go-settings-password
|
|
#(st/emit! (rt/nav :settings-password)))
|
|
|
|
(def ^:private go-settings-options
|
|
#(st/emit! (rt/nav :settings-options)))
|
|
|
|
(def ^:private go-settings-subscription
|
|
#(st/emit! (rt/nav :settings-subscription)))
|
|
|
|
(def ^:private go-settings-integrations
|
|
#(st/emit! (rt/nav :settings-integrations)))
|
|
|
|
(def ^:private go-settings-notifications
|
|
#(st/emit! (rt/nav :settings-notifications)))
|
|
|
|
(def ^:private go-settings-shortcuts
|
|
#(st/emit! (rt/nav :settings-shortcuts)))
|
|
|
|
(defn- show-release-notes
|
|
[event]
|
|
(let [version (:main cf/version)]
|
|
(st/emit! (ev/event {::ev/name "show-release-notes" :version version}))
|
|
|
|
(if (and (kbd/alt? event) (kbd/mod? event))
|
|
(st/emit! (modal/show {:type :onboarding}))
|
|
(st/emit! (modal/show {:type :release-notes :version version})))))
|
|
|
|
(mf/defc sidebar-content*
|
|
[{:keys [profile section]}]
|
|
(let [profile? (= section :settings-profile)
|
|
password? (= section :settings-password)
|
|
options? (= section :settings-options)
|
|
feedback? (= section :settings-feedback)
|
|
subscription? (= section :settings-subscription)
|
|
integrations? (= section :settings-integrations)
|
|
notifications? (= section :settings-notifications)
|
|
shortcuts? (= section :settings-shortcuts)
|
|
team-id (or (dtm/get-last-team-id)
|
|
(:default-team-id profile))
|
|
|
|
go-dashboard
|
|
(mf/use-fn
|
|
(mf/deps team-id)
|
|
#(st/emit! (dcm/go-to-dashboard-recent :team-id team-id)))]
|
|
|
|
[:div {:class (stl/css :sidebar-content)}
|
|
[:div {:class (stl/css :sidebar-content-section)}
|
|
[:button {:class (stl/css :back-to-dashboard)
|
|
:on-click go-dashboard}
|
|
[:> icon* {:icon-id i/arrow-left
|
|
:class (stl/css :arrow-icon)}]
|
|
[:span {:class (stl/css :back-text)} (tr "labels.dashboard")]]]
|
|
|
|
[:hr {:class (stl/css :sidebar-separator)}]
|
|
|
|
[:nav {:class (stl/css :sidebar-content-section)
|
|
:aria-label (tr "labels.settings")}
|
|
[:ul {:class (stl/css :sidebar-nav-settings)}
|
|
[:li {:class (stl/css-case :current profile?
|
|
:settings-item true)
|
|
:on-click go-settings-profile}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.profile")]]
|
|
|
|
[:li {:class (stl/css-case :current password?
|
|
:settings-item true)
|
|
:on-click go-settings-password}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.password")]]
|
|
|
|
[:li {:class (stl/css-case :current notifications?
|
|
:settings-item true)
|
|
:on-click go-settings-notifications}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.notifications")]]
|
|
|
|
(when (contains? cf/flags :custom-shortcuts)
|
|
[:li {:class (stl/css-case :current shortcuts?
|
|
:settings-item true)
|
|
:on-click go-settings-shortcuts}
|
|
[:span {:class (stl/css :element-title)} (tr "label.shortcuts")]])
|
|
|
|
[:li {:class (stl/css-case :current options?
|
|
:settings-item true)
|
|
:on-click go-settings-options
|
|
:data-testid "settings-profile"}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.settings")]]
|
|
|
|
(when (or (contains? cf/flags :subscriptions)
|
|
(contains? cf/flags :admin-console))
|
|
[:li {:class (stl/css-case :current subscription?
|
|
:settings-item true)
|
|
:on-click go-settings-subscription
|
|
:data-testid "settings-subscription"}
|
|
[:span {:class (stl/css :element-title)} (tr "subscription.labels")]])
|
|
|
|
(when (or (contains? cf/flags :access-tokens)
|
|
(contains? cf/flags :mcp))
|
|
[:li {:class (stl/css-case :current integrations?
|
|
:settings-item true)
|
|
:on-click go-settings-integrations
|
|
:data-testid "settings-integrations"}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.integrations")]])
|
|
|
|
[:hr {:class (stl/css :sidebar-separator)}]
|
|
|
|
[:li {:on-click show-release-notes :data-testid "release-notes"
|
|
:class (stl/css :settings-item)}
|
|
[:span {:class (stl/css :element-title)} (tr "labels.release-notes")]]
|
|
|
|
(when (contains? cf/flags :user-feedback)
|
|
[:li {:class (stl/css-case :current feedback?
|
|
:settings-item true)
|
|
:on-click go-settings-feedback}
|
|
[:> icon* {:icon-id i/feedback
|
|
:size "s"
|
|
:class (stl/css :feedback-icon)}]
|
|
[:span {:class (stl/css :element-title)} (tr "labels.contact-us")]])]]]))
|
|
|
|
(mf/defc sidebar*
|
|
{::mf/wrap [mf/memo]}
|
|
[{:keys [profile section]}]
|
|
[:aside {:class (stl/css :dashboard-sidebar :settings)}
|
|
[:> sidebar-content* {:profile profile
|
|
:section section}]
|
|
[:> profile-section* {:profile profile}]])
|