mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Fix error on select
This commit is contained in:
parent
10180d1776
commit
539107283f
@ -23,13 +23,11 @@
|
|||||||
[app.main.ui.ds.controls.checkbox :refer [checkbox*]]
|
[app.main.ui.ds.controls.checkbox :refer [checkbox*]]
|
||||||
[app.main.ui.ds.controls.select :refer [select*]]
|
[app.main.ui.ds.controls.select :refer [select*]]
|
||||||
[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.ds.foundations.assets.raw-svg :as rsvg :refer [raw-svg*]]
|
|
||||||
[app.main.ui.ds.foundations.typography :as t]
|
[app.main.ui.ds.foundations.typography :as t]
|
||||||
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
|
[app.main.ui.ds.foundations.typography.heading :refer [heading*]]
|
||||||
[app.main.ui.ds.foundations.typography.text :refer [text*]]
|
[app.main.ui.ds.foundations.typography.text :refer [text*]]
|
||||||
[app.main.ui.ds.notifications.context-notification :refer [context-notification*]]
|
[app.main.ui.ds.notifications.context-notification :refer [context-notification*]]
|
||||||
[app.main.ui.ds.product.loader :refer [loader*]]
|
[app.main.ui.ds.product.loader :refer [loader*]]
|
||||||
[app.main.ui.hooks :as hooks]
|
|
||||||
[app.main.ui.icons :as deprecated-icon]
|
[app.main.ui.icons :as deprecated-icon]
|
||||||
[app.main.worker :as mw]
|
[app.main.worker :as mw]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
@ -408,7 +406,7 @@
|
|||||||
(doseq [{:keys [id candidates]} candidates]
|
(doseq [{:keys [id candidates]} candidates]
|
||||||
(when-not (contains? selection id)
|
(when-not (contains? selection id)
|
||||||
(when-let [first-c (first candidates)]
|
(when-let [first-c (first candidates)]
|
||||||
(on-select id (:id first-c))))))
|
(on-select id (str (:id first-c)))))))
|
||||||
|
|
||||||
[:div {:class (stl/css :library-resolution)}
|
[:div {:class (stl/css :library-resolution)}
|
||||||
[:> text* {:class (stl/css :library-resolution-message)
|
[:> text* {:class (stl/css :library-resolution-message)
|
||||||
@ -495,7 +493,10 @@
|
|||||||
(when (seq pending)
|
(when (seq pending)
|
||||||
[:div {:class (stl/css :summary-section)}
|
[:div {:class (stl/css :summary-section)}
|
||||||
[:div {:class (stl/css :summary-section-header)}
|
[:div {:class (stl/css :summary-section-header)}
|
||||||
|
;; TODO: Add translation for this string
|
||||||
|
|
||||||
[:> text* {:as "span"
|
[:> text* {:as "span"
|
||||||
|
:class (stl/css :summary-section-title)
|
||||||
:typography t/headline-small}
|
:typography t/headline-small}
|
||||||
"linked manually"]]
|
"linked manually"]]
|
||||||
[:ul {:class (stl/css :summary-list)}
|
[:ul {:class (stl/css :summary-list)}
|
||||||
@ -509,7 +510,7 @@
|
|||||||
(for [{:keys [id name] :as cand} pending]
|
(for [{:keys [id name] :as cand} pending]
|
||||||
(let [selected-id (get selection id)
|
(let [selected-id (get selection id)
|
||||||
selected-c (when selected-id
|
selected-c (when selected-id
|
||||||
(d/seek #(= (:id %) selected-id) (:candidates cand)))]
|
(d/seek #(= (str (:id %)) (str selected-id)) (:candidates cand)))]
|
||||||
[:li {:class (stl/css :summary-list-item)
|
[:li {:class (stl/css :summary-list-item)
|
||||||
:key (dm/str id)}
|
:key (dm/str id)}
|
||||||
[:span {:class (stl/css :summary-item-name)} name]
|
[:span {:class (stl/css :summary-item-name)} name]
|
||||||
@ -821,7 +822,7 @@
|
|||||||
(mf/deps resolution selection on-finish-import)
|
(mf/deps resolution selection on-finish-import)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(let [selection @selection*]
|
(let [slc selection]
|
||||||
;; For each file with pending candidates, link it to the selected libraries
|
;; For each file with pending candidates, link it to the selected libraries
|
||||||
(->> (rx/from (seq resolution))
|
(->> (rx/from (seq resolution))
|
||||||
(rx/merge-map
|
(rx/merge-map
|
||||||
@ -829,7 +830,7 @@
|
|||||||
(->> (rx/from (:pending resolution-file))
|
(->> (rx/from (:pending resolution-file))
|
||||||
(rx/merge-map
|
(rx/merge-map
|
||||||
(fn [{:keys [id]}]
|
(fn [{:keys [id]}]
|
||||||
(when-let [selected-lib (get selection id)]
|
(when-let [selected-lib (get slc id)]
|
||||||
(link-files-to-library! [file-id] selected-lib)))))))
|
(link-files-to-library! [file-id] selected-lib)))))))
|
||||||
(rx/subs! (constantly nil)
|
(rx/subs! (constantly nil)
|
||||||
(constantly nil)
|
(constantly nil)
|
||||||
@ -892,7 +893,13 @@
|
|||||||
auto-linked-count
|
auto-linked-count
|
||||||
(if (some? resolution)
|
(if (some? resolution)
|
||||||
(count-auto-linked resolution)
|
(count-auto-linked resolution)
|
||||||
0)]
|
0)
|
||||||
|
|
||||||
|
manage-on-select
|
||||||
|
(mf/use-fn
|
||||||
|
(mf/deps selection)
|
||||||
|
(fn [old-lib-id candidate-id]
|
||||||
|
(swap! selection* assoc old-lib-id candidate-id)))]
|
||||||
|
|
||||||
(mf/with-effect [visited unresolved-files]
|
(mf/with-effect [visited unresolved-files]
|
||||||
(when (and (seq unresolved-files)
|
(when (and (seq unresolved-files)
|
||||||
@ -960,8 +967,7 @@
|
|||||||
[:> import-library-resolution-stage*
|
[:> import-library-resolution-stage*
|
||||||
{:current-unresolved-file current-unresolved-file
|
{:current-unresolved-file current-unresolved-file
|
||||||
:selection selection
|
:selection selection
|
||||||
:on-select (fn [old-lib-id candidate-id]
|
:on-select manage-on-select
|
||||||
(swap! selection* assoc old-lib-id candidate-id))
|
|
||||||
:visited visited
|
:visited visited
|
||||||
:all-visited? all-visited?
|
:all-visited? all-visited?
|
||||||
:on-wizard-prev on-wizard-prev
|
:on-wizard-prev on-wizard-prev
|
||||||
|
|||||||
@ -348,6 +348,14 @@
|
|||||||
border-bottom: $b-1 solid var(--color-background-quaternary);
|
border-bottom: $b-1 solid var(--color-background-quaternary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.summary-section-title {
|
||||||
|
color: var(--color-foreground-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-linked-arrow {
|
||||||
|
color: var(--color-foreground-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
.summary-file-icon {
|
.summary-file-icon {
|
||||||
color: var(--color-foreground-secondary);
|
color: var(--color-foreground-secondary);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user