Skip to content

Commit 6a3215d

Browse files
committed
enhance loading
1 parent 08db13a commit 6a3215d

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

resources/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</div>
2424
</body>
2525

26-
<script src="js/shared.js"></script>
27-
<script src="js/renderer.js"></script>
26+
<script defer src="js/shared.js"></script>
27+
<script defer src="js/renderer.js"></script>
2828

2929
</html>

src/renderer/app/events.cljs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
{:db app-db}
6868
{::app.effects/clear-local-storage nil}))))
6969

70+
(rf/reg-event-db
71+
::set-loading
72+
(fn [db [_ state]]
73+
(assoc db :loading state)))
74+
7075
(rf/reg-event-fx
7176
::db-loaded
7277
[(rf/inject-cofx ::effects/guid)
@@ -84,13 +89,11 @@
8489
(history.handlers/finalize #(t [:create-doc "Create document"])))
8590

8691
initial-document
87-
(snap.handlers/rebuild-tree)
88-
89-
:always
90-
(assoc :loading false))
92+
(snap.handlers/rebuild-tree))
9193
:fx (into
9294
[[:dispatch [::theme.events/set-document-attr]]
93-
[:dispatch ^:flush-dom [::set-lang-attrs]]
95+
[:dispatch [::set-lang-attrs]]
96+
[:dispatch [::set-loading false]]
9497
;; We need to render once to get the canvas size right.
9598
[:dispatch ^:flush-dom [::window.events/update-focused]]
9699
[::theme.effects/add-native-listener [::theme.events/set-document-attr]]

src/renderer/app/views.cljs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,8 @@
352352
active-tool @(rf/subscribe [::tool.subs/active])
353353
recent-documents @(rf/subscribe [::document.subs/recent])
354354
lang-dir @(rf/subscribe [::app.subs/lang-dir])
355-
loading @(rf/subscribe [::app.subs/loading?])]
356-
(if loading
357-
[:div.loader]
355+
is-app-loading @(rf/subscribe [::app.subs/loading?])]
356+
(when-not is-app-loading
358357
[:> Direction/Provider {:dir lang-dir}
359358
[:> Tooltip/Provider
360359
[:div.flex.flex-col.flex-1.h-dvh.overflow-hidden.justify-between

src/renderer/components.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@
274274

275275
&:after,
276276
&:before {
277-
@apply absolute top-0 left-0;
277+
@apply absolute top-0 left-0 bg-white;
278278
content: '';
279279
width: 24px;
280280
height: 24px;
281-
border: 2px solid var(--font-color);
281+
border: 1px solid gray;
282282
animation: rotationBreak 3s ease-in-out infinite alternate;
283283
}
284284

0 commit comments

Comments
 (0)