@rpcbase/client 0.213.0 → 0.214.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  {
2
+ "toggle_notifications": "Toggle Notifications",
3
+ "notifications_settings": "Notifications Settings",
2
4
  "search_anything": {
3
5
  "placeholder": "Search Anything..."
4
6
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.213.0",
3
+ "version": "0.214.0",
4
4
  "scripts": {
5
5
  "build": "../../node_modules/.bin/wireit",
6
6
  "test": "../../node_modules/.bin/wireit"
@@ -23,9 +23,6 @@ export const ExpandableFloatView = ({
23
23
 
24
24
  const [animatedVals, setAnimatedVals] = useState({})
25
25
 
26
- // eslint-disable-next-line no-use-before-define
27
- const {showBackdrop} = useBackdrop(isOpen, onToggle)
28
-
29
26
  const getRect = () => {
30
27
  const boundingRect = containerRef.current.getBoundingClientRect()
31
28
  const rect = {
@@ -39,6 +36,7 @@ export const ExpandableFloatView = ({
39
36
  }
40
37
 
41
38
  const onOpen = () => {
39
+ // eslint-disable-next-line no-use-before-define
42
40
  showBackdrop()
43
41
 
44
42
  isOpen.current = true
@@ -89,6 +87,8 @@ export const ExpandableFloatView = ({
89
87
  }
90
88
  }
91
89
 
90
+ const {showBackdrop} = useBackdrop(isOpen, onToggle)
91
+
92
92
  useImperativeHandle(ref, () => {
93
93
  return {
94
94
  open: () => {
@@ -0,0 +1,52 @@
1
+ import Form from "react-bootstrap/Form"
2
+ import {useTranslation} from "react-i18next"
3
+
4
+ import {useStoredValue} from "../../../helpers/useStoredValue"
5
+ import {useHashState} from "../../../hashState"
6
+
7
+ import * as MorphingDropdown from "../MorphingDropdown"
8
+
9
+ import "./notifications-dropdown.scss"
10
+
11
+
12
+ export const NotificationsDropdown = ({id}) => {
13
+ const {t} = useTranslation("rb.nav")
14
+
15
+ const [isEnabled, setIsEnabled] = useStoredValue("has_notifications_enabled", "yes")
16
+
17
+ const {serializeHashState} = useHashState()
18
+
19
+ const onToggleNotifications = (e) => {
20
+ setIsEnabled(e.target.checked ? "yes" : "no")
21
+ }
22
+
23
+ const onClickNotificationsSettings = () => {
24
+ serializeHashState({
25
+ showNotificationsSettingsModal: true,
26
+ })
27
+ }
28
+
29
+ return (
30
+ <MorphingDropdown.Menu id={id} style={{minWidth: 300}}>
31
+ <div className="text-light px-3">
32
+ <Form.Check
33
+ type="switch"
34
+ id="toggle-notifications-switch"
35
+ label={t("toggle_notifications")}
36
+ data-bs-theme="dark"
37
+ checked={isEnabled === "yes"}
38
+ onChange={onToggleNotifications}
39
+ />
40
+ </div>
41
+ <div className="list-group" data-bs-theme="dark">
42
+ <button
43
+ className="list-group-item list-group-item-action"
44
+ onClick={onClickNotificationsSettings}
45
+ >
46
+ {t("notifications_settings")}
47
+ </button>
48
+ <button className="list-group-item list-group-item-action">List item23.. ..</button>
49
+ </div>
50
+ </MorphingDropdown.Menu>
51
+ )
52
+ }
@@ -0,0 +1,5 @@
1
+ @import "helpers";
2
+
3
+ #toggle-notifications-switch + label {
4
+ cursor: pointer;
5
+ }
@@ -0,0 +1,54 @@
1
+ import {useRef, useEffect} from "react"
2
+
3
+ import LottiePlayer from "../../LottiePlayer"
4
+
5
+ import notifAnimation from "./notification-animation.json"
6
+
7
+
8
+ export const NotificationsGlyph = () => {
9
+ const playerRef = useRef(null)
10
+
11
+ const play = () => {
12
+ playerRef.current?.setSeeker(0, true)
13
+ playerRef.current?.play()
14
+ }
15
+
16
+ useEffect(() => {
17
+ const onPlay = () => {
18
+ play()
19
+ }
20
+
21
+ document.body.addEventListener("PLAY_NOTIF_ANIMATION", onPlay)
22
+
23
+ return () => {
24
+ document.body.removeEventListener("PLAY_NOTIF_ANIMATION", onPlay)
25
+ }
26
+ }, [])
27
+
28
+ const onPlayerMouseEnter = () => {
29
+ play()
30
+ }
31
+
32
+ return (
33
+ <div
34
+ className="player-wrapper h-100 d-flex align-items-center"
35
+ onMouseEnter={onPlayerMouseEnter}
36
+ >
37
+ <LottiePlayer
38
+ id="notifications-glyph-player"
39
+ ref={playerRef}
40
+ autoplay={false}
41
+ loop={false}
42
+ // speed={2}
43
+ keepLastFrame={true}
44
+ src={notifAnimation}
45
+ style={{
46
+ marginTop: -1,
47
+ height: "23px",
48
+ // width: "21px",
49
+ }}
50
+ // onEvent={this.onPlayerEvent}
51
+ />
52
+ </div>
53
+ )
54
+ }
@@ -0,0 +1,12 @@
1
+ import * as MorphingDropdown from "../MorphingDropdown"
2
+
3
+ import {NotificationsGlyph} from "./NotificationsGlyph"
4
+
5
+ import "./notifications-toggle.scss"
6
+
7
+
8
+ export const NotificationsToggle = ({onClick}) => (
9
+ <MorphingDropdown.Toggle id="notifications" className="px-2">
10
+ <NotificationsGlyph />
11
+ </MorphingDropdown.Toggle>
12
+ )
@@ -0,0 +1 @@
1
+ {"v":"5.6.5","fr":24,"ip":0,"op":28,"w":30,"h":30,"nm":"bell","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"bell2 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":3,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[11]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[-12]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":16,"s":[5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19,"s":[-7]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[3]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[14.93,4.945,0],"ix":2},"a":{"a":0,"k":[14.93,4.945,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.553,0],[0,0],[0,-0.553],[-0.552,0],[0,0],[0,0.553]],"o":[[0,0],[-0.552,0],[0,0.553],[0,0],[0.553,0],[0,-0.553]],"v":[[10,-1],[-10,-1],[-11,0],[-10,1],[10,1],[11,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,23],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,1.59],[0,0],[3.448,0.89],[0,0],[1.105,0],[0,-1.105],[0,0],[0,-3.726],[0,0],[0.609,-1.453],[0,0]],"o":[[0,0],[0,-3.726],[0,0],[0,-1.105],[-1.105,0],[0,0],[-3.448,0.89],[0,0],[0,1.59],[0,0],[-0.609,-1.452]],"v":[[8,3.894],[8,1.5],[2,-6.238],[2,-6.5],[0,-8.5],[-2,-6.5],[-2,-6.238],[-8,1.5],[-8,3.894],[-8.935,8.5],[8.935,8.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,11.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"mask","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":3,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[11]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[-12]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":16,"s":[5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19,"s":[-7]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[3]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[14.938,5,0],"ix":2},"a":{"a":0,"k":[14.938,5,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.553,0],[0,0],[0,1.585],[0,0],[4.418,0],[0,-4.418],[0,0],[1.15,-1.893],[0,0],[0,-0.553],[-0.552,0],[0,0],[0,0.553]],"o":[[0,0],[-1.518,-2.129],[0,0],[0,-4.418],[-4.418,0],[0,0],[0,1.585],[0,0],[-0.552,0],[0,0.553],[0,0],[0.553,0],[0,-0.553]],"v":[[10,7.5],[9.923,7.5],[8,0.894],[8,-1.5],[0,-9.5],[-8,-1.5],[-8,0.894],[-9.925,7.5],[-10,7.5],[-11,8.5],[-9.938,9.313],[10.063,9.313],[11,8.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,14.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"tongue Outlines","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":11,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14,"s":[-19]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":17,"s":[8]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":20,"s":[-14]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":23,"s":[6]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[15,5.188,0],"ix":2},"a":{"a":0,"k":[3.25,-16.563,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.657,0],[0,-1.657],[-1.657,0],[0,1.657]],"o":[[-1.657,0],[0,1.657],[1.657,0],[0,-1.657]],"v":[[0,-3],[-3,0],[0,3],[3,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[3.25,3.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0}],"markers":[]}
@@ -0,0 +1,26 @@
1
+ @import "helpers";
2
+
3
+ #notifications-glyph-player {
4
+ position: relative;
5
+
6
+ path {
7
+ fill: $gray-200;
8
+ }
9
+
10
+ &:hover {
11
+ path {
12
+ fill: $white;
13
+ }
14
+ }
15
+
16
+ &::after {
17
+ content: "";
18
+ position: absolute;
19
+ top: 50%;
20
+ left: 0;
21
+ right: -2px;
22
+ height: 2px;
23
+ background: $red-500;
24
+ transform: rotate(45deg);
25
+ }
26
+ }
package/ui/nav/index.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export * from "./AccountsDropdown"
2
2
  export * from "./AccountsToggle"
3
+ export * from "./ContentView"
3
4
  export * from "./HeaderContainer"
5
+ export * from "./NotificationsDropdown"
6
+ export * from "./NotificationsToggle"
4
7
  export * from "./SidebarContainer"
5
8
  export * from "./SlideoutContainer"
6
- export * from "./ContentView"
7
9
 
8
10
  import * as MorphingDropdown from "./MorphingDropdown"
9
11