2023-12-19 17:41:30 +00:00
|
|
|
(ns legacy.status-im.popover.core
|
2023-10-16 22:03:18 +00:00
|
|
|
(:require
|
|
|
|
[utils.re-frame :as rf]))
|
2019-07-08 11:38:47 +00:00
|
|
|
|
2022-12-26 15:00:17 +00:00
|
|
|
(rf/defn show-popover
|
2019-07-08 11:38:47 +00:00
|
|
|
{:events [:show-popover]}
|
2021-05-24 14:25:05 +00:00
|
|
|
[_ value]
|
2023-03-02 11:41:18 +00:00
|
|
|
(let [delay-ms (or (:delay-ms value) 250)
|
|
|
|
value (dissoc value :delay-ms)]
|
|
|
|
{:show-popover nil
|
|
|
|
;; We should probably refactor to start the animation on mount, so that the
|
|
|
|
;; delay can be removed. See comment for more details:
|
|
|
|
;; https://github.com/status-im/status-mobile/pull/15222#issuecomment-1450162137
|
|
|
|
:dispatch-later [{:ms delay-ms :dispatch [:show-popover-db value]}]
|
|
|
|
:dismiss-keyboard nil}))
|
2019-07-08 11:38:47 +00:00
|
|
|
|
2022-12-26 15:00:17 +00:00
|
|
|
(rf/defn show-popover-db
|
2021-05-24 14:25:05 +00:00
|
|
|
{:events [:show-popover-db]}
|
|
|
|
[{:keys [db]} value]
|
|
|
|
{:db (assoc db :popover/popover value)})
|
|
|
|
|
2022-12-26 15:00:17 +00:00
|
|
|
(rf/defn hide-popover
|
2019-07-08 11:38:47 +00:00
|
|
|
{:events [:hide-popover]}
|
|
|
|
[{:keys [db]}]
|
2022-12-20 14:45:37 +00:00
|
|
|
{:db (dissoc db :popover/popover)
|
2021-06-16 12:00:41 +00:00
|
|
|
:hide-popover nil})
|