forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/i18n
- Loading branch information
Showing
8 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
(ns frontend.handler.notification | ||
(:require [frontend.state :as state])) | ||
(:require [frontend.state :as state] | ||
[frontend.util :as util])) | ||
|
||
(defn clear! | ||
[e] | ||
(swap! state/state assoc | ||
:notification/show? false | ||
:notification/content nil | ||
:notification/status nil)) | ||
[uid] | ||
(let [contents (state/get-notification-contents)] | ||
(state/set-state! :notification/contents (dissoc contents uid)))) | ||
|
||
(defn show! | ||
([content status] | ||
(show! content status true)) | ||
([content status clear?] | ||
(swap! state/state assoc | ||
:notification/show? true | ||
:notification/content content | ||
:notification/status status) | ||
(let [contents (state/get-notification-contents) | ||
uid (keyword (util/unique-id))] | ||
(state/set-state! :notification/contents (assoc contents | ||
uid {:content content | ||
:status status})) | ||
|
||
(when clear? | ||
(js/setTimeout clear! 3000)))) | ||
(when clear? | ||
(js/setTimeout #(clear! uid) 3000))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters