@social-mail/social-mail-client 1.2.689 → 1.2.690

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.
Files changed (29) hide show
  1. package/dist/public/channel/ChannelView.d.ts +25 -2
  2. package/dist/public/channel/ChannelView.d.ts.map +1 -1
  3. package/dist/public/channel/ChannelView.js +40 -34
  4. package/dist/public/channel/ChannelView.js.map +1 -1
  5. package/dist/public/channel/ChannelView.pack.js +98 -36
  6. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  7. package/dist/public/channel/ChannelView.pack.min.js +4 -4
  8. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  9. package/dist/public/channel/UrlService.d.ts +2 -1
  10. package/dist/public/channel/UrlService.d.ts.map +1 -1
  11. package/dist/public/channel/UrlService.js +11 -0
  12. package/dist/public/channel/UrlService.js.map +1 -1
  13. package/dist/public/channel/controls/CalendarLink.d.ts +5 -0
  14. package/dist/public/channel/controls/CalendarLink.d.ts.map +1 -0
  15. package/dist/public/channel/controls/CalendarLink.js +22 -0
  16. package/dist/public/channel/controls/CalendarLink.js.map +1 -0
  17. package/dist/public/channel/controls/PostList.js +1 -1
  18. package/dist/public/channel/controls/PostList.js.map +1 -1
  19. package/dist/public/channel/controls/UpcomingEvents.d.ts +9 -0
  20. package/dist/public/channel/controls/UpcomingEvents.d.ts.map +1 -0
  21. package/dist/public/channel/controls/UpcomingEvents.js +42 -0
  22. package/dist/public/channel/controls/UpcomingEvents.js.map +1 -0
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +1 -1
  25. package/src/public/channel/ChannelView.tsx +36 -36
  26. package/src/public/channel/UrlService.ts +11 -1
  27. package/src/public/channel/controls/CalendarLink.tsx +9 -0
  28. package/src/public/channel/controls/PostList.tsx +1 -1
  29. package/src/public/channel/controls/UpcomingEvents.tsx +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.689",
3
+ "version": "1.2.690",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,13 +24,15 @@ import { WebComponents } from "../../site-editor/editor/webComponentsPath";
24
24
  import BlogImageService from "./BlogImageService";
25
25
  import ChannelCalendarView from "./ChannelCalendarView";
26
26
  import { Mailto } from "../../common/Mailto";
27
+ import CalendarLink from "./controls/CalendarLink";
28
+ import UpcomingEvents from "./controls/UpcomingEvents";
27
29
 
28
30
  const { channel, emailID, tag, author, calendar } = UrlService.getParameters();
29
31
 
30
32
  const commentIcon = "💬";
31
33
 
32
34
  @Pack
33
- class ChannelMessage extends AtomControl {
35
+ export default class ChannelMessage extends AtomControl {
34
36
 
35
37
  @InjectProperty
36
38
  blogService: BlogService;
@@ -73,38 +75,15 @@ class ChannelMessage extends AtomControl {
73
75
  this.element.setAttribute("data-blog-list", "blog-list");
74
76
  this.element.setAttribute("data-layout", "flex-center");
75
77
  this.renderer = <section>
76
- <BlogHeader
78
+ { !calendar && !emailID && <BlogHeader
77
79
  search={search}
78
- channel={this.channel}/>
80
+ channel={this.channel}/>}
79
81
  <section>
80
- { emailID
81
- ? <AtomRepeater
82
- data-items-updated-event="items-updated"
83
- event-items-updated={() => this.itemsUpdated()}
84
- itemRenderer={(x) => <PostView channel={this.channel} email={x} />}
85
- items={this.emails}
86
- />
87
- : <AtomRepeater
88
- data-items-updated-event="items-updated"
89
- event-items-updated={() => this.itemsUpdated()}
90
- data-auto-scroll="false"
91
- itemRenderer={(x) => <PostSummary blogService={this.blogImageService} channel={this.channel} mailboxEmail={x} />}
92
- items={this.emails}
93
- { ... InfiniteRepeater.pagedItems((start) =>
94
- (c, e, cancelToken) =>
95
- this.blogService.getEmails({
96
- channelID: this.channel.mailboxID,
97
- author: this.author,
98
- tag: this.tag,
99
- start,
100
- search: this.search,
101
- cancelToken
102
- })
103
- )}
104
- /> }
82
+ { this.renderBody() }
105
83
  </section>
106
84
  <aside>
107
85
  <TagCloud/>
86
+ <UpcomingEvents channel={this.channel}/>
108
87
  <PopularPosts/>
109
88
  <RecentPosts/>
110
89
  </aside>
@@ -112,6 +91,35 @@ class ChannelMessage extends AtomControl {
112
91
  </section>;
113
92
  }
114
93
 
94
+ private renderBody() {
95
+
96
+ if (calendar) {
97
+ return <ChannelCalendarView/>;
98
+ }
99
+
100
+ return emailID
101
+ ? <AtomRepeater
102
+ data-items-updated-event="items-updated"
103
+ event-items-updated={() => this.itemsUpdated()}
104
+ itemRenderer={(x) => <PostView channel={this.channel} email={x} />}
105
+ items={this.emails} />
106
+ : <AtomRepeater
107
+ data-items-updated-event="items-updated"
108
+ event-items-updated={() => this.itemsUpdated()}
109
+ data-auto-scroll="false"
110
+ itemRenderer={(x) => <PostSummary blogService={this.blogImageService} channel={this.channel} mailboxEmail={x} />}
111
+ items={this.emails}
112
+ {...InfiniteRepeater.pagedItems((start) => (c, e, cancelToken) => this.blogService.getEmails({
113
+ channelID: this.channel.mailboxID,
114
+ author: this.author,
115
+ tag: this.tag,
116
+ start,
117
+ search: this.search,
118
+ cancelToken
119
+ })
120
+ )} />;
121
+ }
122
+
115
123
  itemsUpdated() {
116
124
  (window as any).pageReady = true;
117
125
  }
@@ -175,11 +183,3 @@ class ChannelMessage extends AtomControl {
175
183
  }
176
184
 
177
185
  }
178
-
179
- let view = ChannelMessage as any;
180
-
181
- if (calendar) {
182
- view = ChannelCalendarView;
183
- }
184
-
185
- export default view;
@@ -1,10 +1,20 @@
1
1
  import { Slugger } from "../../common/Slugger";
2
2
  import { AppLocation } from "../../common/TestMode";
3
3
  import { Base36 } from "../../common/toBase36";
4
- import { IMailboxEmail, IMailboxTag } from "../../model/model";
4
+ import { IMailbox, IMailboxEmail, IMailboxTag } from "../../model/model";
5
5
 
6
6
  export const UrlService = {
7
7
 
8
+ toCalendarUrl ({ emailAddress: { emailAddress }}: IMailbox) {
9
+ const cid = "@" + emailAddress.split("@")[0];
10
+
11
+ if (AppLocation.isLocalTesting) {
12
+ return `?detail=${cid}/calendar/`;
13
+ }
14
+
15
+ return `/${cid}/calendar/`;
16
+ },
17
+
8
18
  toBlogUrl ({ emailID, email: { subject }, mailbox: { emailAddress: { emailAddress } } }: Partial<IMailboxEmail>) {
9
19
 
10
20
  const cid = "@" + emailAddress.split("@")[0];
@@ -0,0 +1,9 @@
1
+ import XNode from "@web-atoms/core/dist/core/XNode";
2
+ import { IMailbox } from "../../../model/model";
3
+ import { UrlService } from "../UrlService";
4
+
5
+ export default function CalendarLink({ channel = void 0 as IMailbox}) {
6
+ return <div>
7
+ <a href={UrlService.toCalendarUrl(channel)}>Events</a>
8
+ </div>;
9
+ }
@@ -81,8 +81,8 @@ export default class PostList extends AtomRepeater {
81
81
  async init() {
82
82
 
83
83
 
84
- this.setHeader();
85
84
  this.headerRenderer = (text) => <header text={text}/>;
85
+ this.setHeader();
86
86
  this.itemRenderer = (x: IMailboxEmail) => <div>
87
87
  <img src={Bind.oneTimeAsync(() => this.blogImageService.getImage(x), loaderImage)}/>
88
88
  <a
@@ -0,0 +1,30 @@
1
+ import Query from "@web-atoms/entity/dist/services/Query";
2
+ import { IMailboxEmail } from "../../../model/model";
3
+ import PostList from "./PostList";
4
+ import XNode from "@web-atoms/core/dist/core/XNode";
5
+ import { UrlService } from "../UrlService";
6
+ import DateTime from "@web-atoms/date-time/dist/DateTime";
7
+
8
+ export default class UpcomingEvents extends PostList {
9
+
10
+ channel = null;
11
+
12
+ protected setHeader(): void {
13
+ this.header = "Events";
14
+
15
+ this.headerRenderer = (text) => <header>
16
+ <a href={UrlService.toCalendarUrl(this.channel)}>Events</a>
17
+ </header>;
18
+ }
19
+
20
+ protected query(q: Query<IMailboxEmail>) {
21
+ const { now } = DateTime;
22
+ return q
23
+ .where({ now }, (p) => (x) => x.email.mailboxContactEvents.some((a) => a.startDate > p.now ))
24
+ .orderByDescending((x) => x.datePublished)
25
+ .toPagedList({
26
+ size: 5
27
+ });
28
+
29
+ }
30
+ }