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:
Juanfran 2026-05-27 14:29:47 +02:00
parent dd7d5bb113
commit 4c8b33691a
4 changed files with 23 additions and 27 deletions

View File

@ -281,18 +281,25 @@
[:name ::sm/text]
[:slug ::sm/text]
[: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
[cfg {:keys [profile-id] :as params}]
(let [baseuri (cf/get :nitrate-backend-uri)]
(request-to-nitrate cfg :get
(str baseuri
"/api/users/"
profile-id
"/owned-organizations-summary")
[:vector schema:org-summary-counts]
params)))
(let [baseuri (cf/get :nitrate-backend-uri)
orgs (request-to-nitrate cfg :get
(str baseuri
"/api/users/"
profile-id
"/owned-organizations-summary")
[:vector schema:org-summary-counts]
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
[cfg {:keys [profile-id] :as params}]

View File

@ -537,7 +537,10 @@
[:name ::sm/text]
[:slug ::sm/text]
[: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
[:vector schema:owned-organization-summary])

View File

@ -13,6 +13,7 @@
[app.main.data.profile :as du]
[app.main.repo :as rp]
[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.icons :as deprecated-icon]
[app.main.ui.notifications.context-notification :refer [context-notification]]
@ -85,10 +86,9 @@
:expanded expanded?)}]]
(when expanded?
[: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}
[:div {:class (stl/css :org-avatar)}
(when (seq name) (subs name 0 1))]
[:> org-avatar* {:org org :size "xxl"}]
[:div {:class (stl/css :org-info)}
[:span {:class (stl/css :org-name)} name]
[:div {:class (stl/css :org-counts)}

View File

@ -100,20 +100,6 @@
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 {
display: flex;
flex-direction: column;