@planningcenter/topbar 7.1.0-home-alpha.1 → 7.1.0-testing.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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased home]
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased notifications]
4
9
 
5
10
  ### Added
6
- - Add Home to the app switcher dropdown
11
+ - Notification bell, indicator, and dropdown that displayes the current user's read and unread notifications. On initial load, a GET request is sent to the notifications API and its response is used to populate the unread indicator. To use dummy data instead, you can pass `useDummyNotifications={true}` when calling any `Topbar` component.
12
+ - Subscribe to push notifications via Jolt after initial load. This is a naive implementation in that whenever a push event is received, a fresh GET request is sent to the notifications API endpoint to retrieve the current state of ALL of the user's notifications.
13
+ - Set a baseline prettier config
7
14
 
8
15
 
9
16
  ## [7.0.0] - 2021-10-01
@@ -56,6 +63,6 @@ Versions entries to this changelog weren't tracked very well and were presented
56
63
 
57
64
 
58
65
 
59
- [Unreleased home]: https://github.com/ministrycentered/topbar/compare/main..home
66
+ [Unreleased notifications]: https://github.com/ministrycentered/topbar/compare/@planningcenter/topbar@7.0.0..notifications
60
67
  [7.0.0]: https://github.com/ministrycentered/topbar/compare/@planningcenter/topbar@6.0.6..v7.0.0
61
68
  [Previous entries]: CHANGELOG-pre-4.9.0.md
@@ -1,5 +1,10 @@
1
+ import { Environment } from "@planningcenter/url";
1
2
  declare global {
2
3
  interface Window {
4
+ railsEnv?: Environment;
5
+ currentPerson?: {
6
+ id: number;
7
+ };
3
8
  Rails?: {
4
9
  csrfToken: () => string;
5
10
  };
@@ -6,7 +6,6 @@ export declare function CheckIns(): JSX.Element[];
6
6
  export declare function ChurchCenter(): JSX.Element[];
7
7
  export declare function Giving(): JSX.Element[];
8
8
  export declare function Groups(): JSX.Element[];
9
- export declare function Home(): JSX.Element[];
10
9
  export declare function People(): JSX.Element[];
11
10
  export declare function Publishing(): JSX.Element[];
12
11
  export declare function Registrations(): JSX.Element[];
@@ -0,0 +1,46 @@
1
+ declare const colors: {
2
+ danger43: string;
3
+ danger45: string;
4
+ danger47: string;
5
+ danger93: string;
6
+ danger97: string;
7
+ darkNeutral07: string;
8
+ darkNeutral12: string;
9
+ darkNeutral15: string;
10
+ darkNeutral17: string;
11
+ darkNeutral19: string;
12
+ darkNeutral24: string;
13
+ darkNeutral32: string;
14
+ darkNeutral50: string;
15
+ darkNeutral68: string;
16
+ darkNeutral88: string;
17
+ darkNeutral98: string;
18
+ interaction45: string;
19
+ interaction50: string;
20
+ interaction55: string;
21
+ interaction66: string;
22
+ interaction91: string;
23
+ interaction93: string;
24
+ lightNeutral100: string;
25
+ lightNeutral12: string;
26
+ lightNeutral24: string;
27
+ lightNeutral45: string;
28
+ lightNeutral62: string;
29
+ lightNeutral81: string;
30
+ lightNeutral88: string;
31
+ lightNeutral93: string;
32
+ lightNeutral95: string;
33
+ lightNeutral97: string;
34
+ lightNeutral98: string;
35
+ success23: string;
36
+ success25: string;
37
+ success27: string;
38
+ success91: string;
39
+ success97: string;
40
+ warning49: string;
41
+ warning55: string;
42
+ warning63: string;
43
+ warning94: string;
44
+ warning97: string;
45
+ };
46
+ export default colors;
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { Notification } from "../interfaces";
3
- declare const NotificationItem: ({ mobile, isLast, onToggleRead, notification: { appName, createdAt, isRead, link, title }, }: {
3
+ declare const NotificationItem: ({ mobile, isLast, onToggleRead, showBottomBorder, notification: { appName, createdAt, isRead, link, title }, }: {
4
4
  mobile?: boolean;
5
5
  isLast?: boolean;
6
6
  onToggleRead: any;
7
+ showBottomBorder?: boolean;
7
8
  notification: Notification;
8
9
  }) => JSX.Element;
9
10
  export default NotificationItem;
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import * as PCO_URL from "@planningcenter/url";
3
3
  import { Notification } from "../interfaces";
4
- declare const NotificationsMenu: ({ env, handleMarkAllAsRead, handleToggleRead, mobile, notifications: { read, unread }, toggle, visible, }: {
4
+ declare const NotificationsMenu: ({ env, handleMarkAllAsRead, handleToggleRead, hasError, isLoading, mobile, notifications: { read, unread }, toggle, visible, }: {
5
5
  env: PCO_URL.Environment;
6
6
  handleMarkAllAsRead: () => any;
7
7
  handleToggleRead: (notification: Notification) => any;
8
+ hasError?: boolean;
9
+ isLoading?: boolean;
8
10
  mobile?: boolean;
9
11
  notifications: {
10
12
  read: Notification[];
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ declare const PopupRoot: ({ style, ...nativeProps }: {
3
+ children?: React.ReactNode;
4
+ style?: object;
5
+ }) => JSX.Element;
6
+ export default PopupRoot;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import "./spinner.css";
3
+ declare const Spinner: (props: any) => JSX.Element;
4
+ export default Spinner;
@@ -1,13 +1,14 @@
1
- import * as JoltLib from "@planningcenter/jolt-client";
2
1
  import * as PCO_URL from "@planningcenter/url";
3
2
  import { Notification } from "../interfaces";
4
- declare const notificationsOrganizer: (notifications: Notification[]) => {
3
+ declare const useNotifications: ({ env, userId, }: {
4
+ env: PCO_URL.Environment;
5
+ userId: string;
6
+ }) => {
7
+ handleMarkAllAsRead: () => any;
8
+ handleToggleRead: (notification: Notification) => any;
9
+ hasError: boolean;
10
+ isLoading: boolean;
5
11
  read: Notification[];
6
12
  unread: Notification[];
7
13
  };
8
- declare const useJoltChannelSubscription: ({ channelName, env, }: {
9
- channelName: string;
10
- env: PCO_URL.Environment;
11
- }) => JoltLib.ChannelSubscription;
12
- declare const buildNotificationFromApiResponse: (resp: any, json: any) => Notification;
13
- export { buildNotificationFromApiResponse, notificationsOrganizer, useJoltChannelSubscription, };
14
+ export default useNotifications;
@@ -1,46 +1,42 @@
1
- import * as React from "react";
1
+ /// <reference types="react" />
2
2
  import * as PCO_URL from "@planningcenter/url";
3
- export declare class Topbar extends React.Component<{
4
- apps: {
5
- attributes: {
6
- name: string;
7
- url: string;
8
- };
9
- }[];
10
- env: PCO_URL.Environment;
11
- appName: string;
12
- routes: any;
13
- colors: any;
14
- userAvatarPath: string;
15
- userId: string;
16
- userName: string;
17
- orgName: string;
18
- connectedPeople: any;
19
- search?: any;
20
- style?: any;
21
- showOrgName?: boolean;
22
- notifications?: any;
23
- requestAppsFetch: any;
24
- requestConnectedPeopleFetch: any;
25
- requestUnlinkConnectedPeople: any;
26
- requestSwitchConnectedPerson: any;
27
- requestClearAppsCache: any;
28
- requestClearConnectedPeopleCache: any;
29
- linkToProfile?: boolean;
30
- }, {
31
- appsMenuVisible: boolean;
32
- routesMenuVisible: boolean;
33
- userMenuVisible: boolean;
34
- }> {
35
- constructor(props: any);
36
- static defaultProps: {
3
+ declare const Topbar: {
4
+ (props: {
5
+ apps: {
6
+ attributes: {
7
+ name: string;
8
+ url: string;
9
+ };
10
+ }[];
11
+ env: PCO_URL.Environment;
12
+ appName: string;
13
+ routes: any;
14
+ colors: any;
15
+ userAvatarPath: string;
16
+ userId: string;
17
+ userName: string;
18
+ orgName: string;
19
+ connectedPeople: any;
20
+ search?: any;
21
+ style?: any;
22
+ showOrgName?: boolean;
23
+ notifications?: any;
24
+ requestAppsFetch: any;
25
+ requestConnectedPeopleFetch: any;
26
+ requestUnlinkConnectedPeople: any;
27
+ requestSwitchConnectedPerson: any;
28
+ requestClearAppsCache: any;
29
+ requestClearConnectedPeopleCache: any;
30
+ linkToProfile?: boolean;
31
+ }): JSX.Element;
32
+ defaultProps: {
37
33
  currentRouteComponent: (props: any) => JSX.Element;
38
34
  };
39
- render(): JSX.Element;
40
- }
41
- export declare const Route: ({ active, style, name, ...props }: {
35
+ };
36
+ declare const Route: ({ active, style, name, ...props }: {
42
37
  [x: string]: any;
43
38
  active: any;
44
39
  style: any;
45
40
  name?: string;
46
41
  }) => JSX.Element;
42
+ export { Route, Topbar };
@@ -31,10 +31,6 @@ export declare function Groups({ color, ...platformProps }: {
31
31
  [x: string]: any;
32
32
  color: any;
33
33
  }): JSX.Element;
34
- export declare function Home({ color, ...platformProps }: {
35
- [x: string]: any;
36
- color: any;
37
- }): JSX.Element;
38
34
  export declare function People({ color, ...platformProps }: {
39
35
  [x: string]: any;
40
36
  color: any;
@@ -29,11 +29,6 @@ export declare function Giving({ color, size, ...platformProps }: {
29
29
  color: any;
30
30
  size?: number;
31
31
  }): JSX.Element;
32
- export declare function Home({ color, size, ...platformProps }: {
33
- [x: string]: any;
34
- color: any;
35
- size?: number;
36
- }): JSX.Element;
37
32
  export declare function Groups({ color, size, ...platformProps }: {
38
33
  [x: string]: any;
39
34
  color: any;
@@ -1,126 +1,47 @@
1
1
  import * as React from "react";
2
2
  import * as PCO_URL from "@planningcenter/url";
3
- export declare class AppsButton extends React.Component<{
4
- appName: string;
5
- colors: any;
6
- expanded: boolean;
7
- style?: object;
8
- onClick: any;
9
- displayIconOnly?: boolean;
10
- }, {
11
- entered: boolean;
12
- down: boolean;
13
- }> {
14
- constructor(props: any);
15
- static defaultProps: {
16
- displayIconOnly: boolean;
17
- };
18
- render(): JSX.Element;
19
- }
20
- export declare class HoverableListItem extends React.Component<{
21
- component?: any;
22
- style?: object;
23
- href?: string;
24
- onClick?: any;
25
- }, {
26
- entered: boolean;
27
- }> {
28
- constructor(props: any);
29
- render(): JSX.Element;
30
- }
31
- export declare class Hoverable extends React.Component<{
32
- component?: any;
33
- style?: object;
34
- hover?: any;
35
- active?: any;
36
- type?: string;
37
- onClick?: any;
38
- }, {
39
- entered: boolean;
40
- down: boolean;
41
- }> {
42
- constructor(props: any);
43
- render(): JSX.Element;
44
- }
45
- export declare const AppsMenu: (props: any) => JSX.Element;
46
- export declare class Outsider extends React.Component<{
47
- component: any;
48
- cleanup: boolean;
49
- onOutsideClick: any;
50
- visible: boolean;
51
- }, {}> {
52
- private container;
53
- constructor(props: any);
54
- componentWillUnmount(): void;
55
- handleOutsideClick(e: any): any;
56
- render(): JSX.Element;
57
- }
58
- export declare class PopupRoot extends React.Component<{
59
- style?: object;
60
- }, {}> {
61
- render(): JSX.Element;
62
- }
63
- export declare const Popup: React.StatelessComponent<{
64
- component?: any;
65
- style?: object;
66
- onOutsideClick?: any;
67
- cleanup?: any;
68
- }>;
69
- export declare class Topbar extends React.Component<{
70
- apps: {
71
- attributes: {
72
- name: string;
73
- url: string;
74
- };
75
- }[];
76
- activeRoute: string;
77
- env: PCO_URL.Environment;
78
- appName: string;
79
- routes: any;
80
- colors: any;
81
- userAvatarPath: string;
82
- userId: string;
83
- userName: string;
84
- orgName: string;
85
- connectedPeople: any;
86
- search?: any;
87
- style?: any;
88
- showOrgName?: boolean;
89
- notifications?: any;
90
- requestAppsFetch: any;
91
- requestConnectedPeopleFetch: any;
92
- requestUnlinkConnectedPeople: any;
93
- requestSwitchConnectedPerson: any;
94
- requestClearAppsCache: any;
95
- requestClearConnectedPeopleCache: any;
96
- linkToProfile?: boolean;
97
- onLinkToProfileClick?: () => any;
98
- }, {
99
- appsMenuVisible: boolean;
100
- userMenuVisible: boolean;
101
- routesVisible: boolean;
102
- }> {
103
- static defaultProps: {
104
- notifications: () => any;
3
+ declare const Topbar: {
4
+ (props: {
5
+ apps: {
6
+ attributes: {
7
+ name: string;
8
+ url: string;
9
+ };
10
+ }[];
11
+ activeRoute: string;
12
+ env: PCO_URL.Environment;
13
+ appName: string;
14
+ routes: any;
15
+ colors: any;
16
+ userAvatarPath: string;
17
+ userId: string;
18
+ userName: string;
19
+ orgName: string;
20
+ connectedPeople: any;
21
+ search?: any;
22
+ style?: any;
23
+ showOrgName?: boolean;
24
+ requestAppsFetch: any;
25
+ requestConnectedPeopleFetch: any;
26
+ requestUnlinkConnectedPeople: any;
27
+ requestSwitchConnectedPerson: any;
28
+ requestClearAppsCache: any;
29
+ requestClearConnectedPeopleCache: any;
30
+ useDummyNotifications?: boolean;
31
+ linkToProfile?: boolean;
32
+ }): JSX.Element;
33
+ defaultProps: {
105
34
  search: () => any;
106
35
  linkToProfile: boolean;
107
36
  showOrgName: boolean;
37
+ useDummyNotifications: boolean;
108
38
  };
109
- constructor(props: any);
110
- hideRoutes(): void;
111
- showRoutes(): void;
112
- getTextColor(): any;
113
- render(): JSX.Element;
114
- }
115
- export declare class Route extends React.Component<{
39
+ };
40
+ declare const Route: ({ active, colors, style, ...nativeProps }: {
116
41
  active: boolean;
42
+ children: React.ReactNode;
117
43
  colors: any;
118
- style?: object;
119
44
  href?: string;
120
- }, {
121
- entered: boolean;
122
- down: boolean;
123
- }> {
124
- constructor(props: any);
125
- render(): JSX.Element;
126
- }
45
+ style?: object;
46
+ }) => JSX.Element;
47
+ export { Topbar, Route };
@@ -1,48 +1,45 @@
1
- import * as React from "react";
1
+ /// <reference types="react" />
2
2
  import * as PCO_URL from "@planningcenter/url";
3
- export declare class Topbar extends React.Component<{
4
- apps: {
5
- attributes: {
6
- name: string;
7
- url: string;
8
- };
9
- }[];
10
- env: PCO_URL.Environment;
11
- appName: string;
12
- routes: any;
13
- colors: any;
14
- userAvatarPath: string;
15
- userId: string;
16
- userName: string;
17
- orgName: string;
18
- connectedPeople: {
19
- id: number;
20
- attributes: {
21
- name: string;
22
- organization_name: string;
23
- };
24
- }[];
25
- style?: any;
26
- currentRouteComponent?: any;
27
- requestAppsFetch: any;
28
- requestConnectedPeopleFetch: any;
29
- requestUnlinkConnectedPeople: any;
30
- requestSwitchConnectedPerson: any;
31
- requestClearAppsCache: any;
32
- requestClearConnectedPeopleCache: any;
33
- notifications?: any;
34
- }, {
35
- routesMenuVisible: boolean;
36
- userMenuVisible: boolean;
37
- }> {
38
- constructor(props: any);
39
- static defaultProps: {
3
+ declare const Topbar: {
4
+ (props: {
5
+ apps: {
6
+ attributes: {
7
+ name: string;
8
+ url: string;
9
+ };
10
+ }[];
11
+ env: PCO_URL.Environment;
12
+ appName: string;
13
+ routes: any;
14
+ colors: any;
15
+ userAvatarPath: string;
16
+ userId: string;
17
+ userName: string;
18
+ orgName: string;
19
+ connectedPeople: {
20
+ id: number;
21
+ attributes: {
22
+ name: string;
23
+ organization_name: string;
24
+ };
25
+ }[];
26
+ style?: any;
27
+ currentRouteComponent?: any;
28
+ requestAppsFetch: any;
29
+ requestConnectedPeopleFetch: any;
30
+ requestUnlinkConnectedPeople: any;
31
+ requestSwitchConnectedPerson: any;
32
+ requestClearAppsCache: any;
33
+ requestClearConnectedPeopleCache: any;
34
+ useDummyNotifications?: boolean;
35
+ notifications?: any;
36
+ }): JSX.Element;
37
+ defaultProps: {
40
38
  currentRouteComponent: (props: any) => JSX.Element;
41
39
  };
42
- componentDidUpdate(): "" | "hidden";
43
- render(): JSX.Element;
44
- }
45
- export declare const Route: ({ active, ...props }: {
40
+ };
41
+ declare const Route: ({ active, ...props }: {
46
42
  [x: string]: any;
47
43
  active: any;
48
44
  }) => JSX.Element;
45
+ export { Route, Topbar };
@@ -1,16 +1,32 @@
1
- import * as React from "react";
2
- export declare const Bell: React.StatelessComponent<{
1
+ /// <reference types="react" />
2
+ export declare const Bell: ({ dot, dotFill, fill, style, ...props }: {
3
3
  dot?: boolean;
4
4
  dotFill?: string;
5
5
  fill?: string;
6
- stroke?: string;
7
6
  style?: object;
8
- }>;
9
- export declare const Spyglass: React.StatelessComponent<{
7
+ }) => JSX.Element;
8
+ export declare const BlankStateIcon: ({ dark, style, ...nativeProps }: {
9
+ dark?: boolean;
10
+ style?: object;
11
+ }) => JSX.Element;
12
+ export declare const DisclosureChevronIcon: ({ colors, style, ...nativeProps }: {
13
+ colors: any;
14
+ style?: object;
15
+ }) => JSX.Element;
16
+ export declare const HelpIcon: ({ colors, style, ...nativeProps }: {
17
+ colors: any;
18
+ style?: object;
19
+ }) => JSX.Element;
20
+ export declare const ExclamationTriangle: ({ fill, size, style, ...nativeProps }: {
21
+ fill?: string;
22
+ size: number;
23
+ style?: object;
24
+ }) => JSX.Element;
25
+ export declare const Spyglass: ({ fill, style, ...nativeProps }: {
10
26
  fill?: string;
11
27
  style?: object;
12
- }>;
13
- export declare const X: React.StatelessComponent<{
28
+ }) => JSX.Element;
29
+ export declare const X: ({ fill, style, ...nativeProps }: {
14
30
  fill?: string;
15
31
  style?: object;
16
- }>;
32
+ }) => JSX.Element;