mirror of
https://github.com/penpot/penpot.git
synced 2026-08-31 00:59:02 +00:00
✨ Use shared org-avatar component in delete account modal
Render owned organizations in the delete-account modal with the same org-avatar* component used across the dashboard, so logo and avatar background are shown consistently and initials are extracted via d/get-initials instead of a raw first-character substring. Extends the get-owned-organizations-summary endpoint and the underlying nitrate API schema to carry :avatar-bg-url and :logo-id, deriving :custom-photo from logo-id with the public uri, matching the pattern already used by set-team-org-api.
This commit is contained in:
parent
dd7d5bb113
commit
4c8b33691a
@ -281,18 +281,25 @@
|
|||||||
[:name ::sm/text]
|
[:name ::sm/text]
|
||||||
[:slug ::sm/text]
|
[:slug ::sm/text]
|
||||||
[:team-count ::sm/int]
|
[:team-count ::sm/int]
|
||||||
[:member-count ::sm/int]])
|
[:member-count ::sm/int]
|
||||||
|
[:avatar-bg-url {:optional true} [:maybe ::sm/uri]]
|
||||||
|
[:logo-id {:optional true} [:maybe ::sm/uuid]]])
|
||||||
|
|
||||||
(defn- get-owned-orgs-summary-api
|
(defn- get-owned-orgs-summary-api
|
||||||
[cfg {:keys [profile-id] :as params}]
|
[cfg {:keys [profile-id] :as params}]
|
||||||
(let [baseuri (cf/get :nitrate-backend-uri)]
|
(let [baseuri (cf/get :nitrate-backend-uri)
|
||||||
(request-to-nitrate cfg :get
|
orgs (request-to-nitrate cfg :get
|
||||||
(str baseuri
|
(str baseuri
|
||||||
"/api/users/"
|
"/api/users/"
|
||||||
profile-id
|
profile-id
|
||||||
"/owned-organizations-summary")
|
"/owned-organizations-summary")
|
||||||
[:vector schema:org-summary-counts]
|
[:vector schema:org-summary-counts]
|
||||||
params)))
|
params)]
|
||||||
|
(mapv (fn [org]
|
||||||
|
(if-let [logo-id (:logo-id org)]
|
||||||
|
(assoc org :custom-photo (str (cf/get :public-uri) "/assets/by-id/" logo-id))
|
||||||
|
org))
|
||||||
|
orgs)))
|
||||||
|
|
||||||
(defn- delete-owned-orgs-api
|
(defn- delete-owned-orgs-api
|
||||||
[cfg {:keys [profile-id] :as params}]
|
[cfg {:keys [profile-id] :as params}]
|
||||||
|
|||||||
@ -537,7 +537,10 @@
|
|||||||
[:name ::sm/text]
|
[:name ::sm/text]
|
||||||
[:slug ::sm/text]
|
[:slug ::sm/text]
|
||||||
[:team-count ::sm/int]
|
[:team-count ::sm/int]
|
||||||
[:member-count ::sm/int]])
|
[:member-count ::sm/int]
|
||||||
|
[:avatar-bg-url {:optional true} [:maybe ::sm/uri]]
|
||||||
|
[:logo-id {:optional true} [:maybe ::sm/uuid]]
|
||||||
|
[:custom-photo {:optional true} [:maybe ::sm/text]]])
|
||||||
|
|
||||||
(def ^:private schema:get-owned-organizations-summary-result
|
(def ^:private schema:get-owned-organizations-summary-result
|
||||||
[:vector schema:owned-organization-summary])
|
[:vector schema:owned-organization-summary])
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
[app.main.data.profile :as du]
|
[app.main.data.profile :as du]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
|
[app.main.ui.components.org-avatar :refer [org-avatar*]]
|
||||||
[app.main.ui.ds.foundations.assets.icon :as i :refer [icon*]]
|
[app.main.ui.ds.foundations.assets.icon :as i :refer [icon*]]
|
||||||
[app.main.ui.icons :as deprecated-icon]
|
[app.main.ui.icons :as deprecated-icon]
|
||||||
[app.main.ui.notifications.context-notification :refer [context-notification]]
|
[app.main.ui.notifications.context-notification :refer [context-notification]]
|
||||||
@ -85,10 +86,9 @@
|
|||||||
:expanded expanded?)}]]
|
:expanded expanded?)}]]
|
||||||
(when expanded?
|
(when expanded?
|
||||||
[:ul {:class (stl/css :org-list)}
|
[:ul {:class (stl/css :org-list)}
|
||||||
(for [{:keys [id name team-count member-count]} orgs]
|
(for [{:keys [id name team-count member-count] :as org} orgs]
|
||||||
[:li {:class (stl/css :org-item) :key id}
|
[:li {:class (stl/css :org-item) :key id}
|
||||||
[:div {:class (stl/css :org-avatar)}
|
[:> org-avatar* {:org org :size "xxl"}]
|
||||||
(when (seq name) (subs name 0 1))]
|
|
||||||
[:div {:class (stl/css :org-info)}
|
[:div {:class (stl/css :org-info)}
|
||||||
[:span {:class (stl/css :org-name)} name]
|
[:span {:class (stl/css :org-name)} name]
|
||||||
[:div {:class (stl/css :org-counts)}
|
[:div {:class (stl/css :org-counts)}
|
||||||
|
|||||||
@ -100,20 +100,6 @@
|
|||||||
gap: var(--sp-s);
|
gap: var(--sp-s);
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-avatar {
|
|
||||||
width: $sz-32;
|
|
||||||
height: $sz-32;
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: var(--modal-section-background-color);
|
|
||||||
color: var(--modal-title-foreground-color);
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.org-info {
|
.org-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user