@social-mail/social-mail-client 1.2.546 → 1.2.548

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 (80) hide show
  1. package/content/images/svg/logo/logo-orange.svg +57 -0
  2. package/dist/admin/AdminAppIndex.pack.js +2 -1
  3. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  4. package/dist/admin/AdminAppIndex.pack.min.js +1 -1
  5. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  6. package/dist/common/cache/CacheTTL.d.ts +1 -0
  7. package/dist/common/cache/CacheTTL.d.ts.map +1 -1
  8. package/dist/common/cache/CacheTTL.js +2 -1
  9. package/dist/common/cache/CacheTTL.js.map +1 -1
  10. package/dist/common/toBase36.d.ts +4 -0
  11. package/dist/common/toBase36.d.ts.map +1 -1
  12. package/dist/common/toBase36.js +33 -1
  13. package/dist/common/toBase36.js.map +1 -1
  14. package/dist/public/channel/BlogImageService.d.ts.map +1 -1
  15. package/dist/public/channel/BlogImageService.js +5 -2
  16. package/dist/public/channel/BlogImageService.js.map +1 -1
  17. package/dist/public/channel/BlogService.d.ts +4 -5
  18. package/dist/public/channel/BlogService.d.ts.map +1 -1
  19. package/dist/public/channel/BlogService.js +26 -10
  20. package/dist/public/channel/BlogService.js.map +1 -1
  21. package/dist/public/channel/ChannelMessage.d.ts +0 -12
  22. package/dist/public/channel/ChannelMessage.d.ts.map +1 -1
  23. package/dist/public/channel/ChannelMessage.js +3 -137
  24. package/dist/public/channel/ChannelMessage.js.map +1 -1
  25. package/dist/public/channel/ChannelMessageList.d.ts +0 -12
  26. package/dist/public/channel/ChannelMessageList.d.ts.map +1 -1
  27. package/dist/public/channel/ChannelMessageList.js +3 -127
  28. package/dist/public/channel/ChannelMessageList.js.map +1 -1
  29. package/dist/public/channel/ChannelView.d.ts +15 -3
  30. package/dist/public/channel/ChannelView.d.ts.map +1 -1
  31. package/dist/public/channel/ChannelView.js +169 -11
  32. package/dist/public/channel/ChannelView.js.map +1 -1
  33. package/dist/public/channel/ChannelView.pack.js +902 -884
  34. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  35. package/dist/public/channel/ChannelView.pack.min.js +155 -142
  36. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  37. package/dist/public/channel/PostSummary.d.ts +6 -0
  38. package/dist/public/channel/PostSummary.d.ts.map +1 -0
  39. package/dist/public/channel/PostSummary.js +61 -0
  40. package/dist/public/channel/PostSummary.js.map +1 -0
  41. package/dist/public/channel/UrlService.d.ts +3 -1
  42. package/dist/public/channel/UrlService.d.ts.map +1 -1
  43. package/dist/public/channel/UrlService.js +30 -4
  44. package/dist/public/channel/UrlService.js.map +1 -1
  45. package/dist/public/channel/controls/BlogHeader.d.ts +6 -0
  46. package/dist/public/channel/controls/BlogHeader.d.ts.map +1 -0
  47. package/dist/public/channel/controls/BlogHeader.js +42 -0
  48. package/dist/public/channel/controls/BlogHeader.js.map +1 -0
  49. package/dist/public/channel/controls/PostList.d.ts.map +1 -1
  50. package/dist/public/channel/controls/PostList.js +32 -9
  51. package/dist/public/channel/controls/PostList.js.map +1 -1
  52. package/dist/public/channel/controls/TagCloud.d.ts.map +1 -1
  53. package/dist/public/channel/controls/TagCloud.js +18 -5
  54. package/dist/public/channel/controls/TagCloud.js.map +1 -1
  55. package/dist/public/channel/styles/channelViewStyle.d.ts.map +1 -1
  56. package/dist/public/channel/styles/channelViewStyle.js +28 -16
  57. package/dist/public/channel/styles/channelViewStyle.js.map +1 -1
  58. package/dist/public/store/Store.pack.js +33 -1
  59. package/dist/public/store/Store.pack.js.map +1 -1
  60. package/dist/public/store/Store.pack.min.js +1 -1
  61. package/dist/public/store/Store.pack.min.js.map +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/dist/web/AppIndex.pack.js +2 -1
  64. package/dist/web/AppIndex.pack.js.map +1 -1
  65. package/dist/web/AppIndex.pack.min.js +1 -1
  66. package/dist/web/AppIndex.pack.min.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/common/cache/CacheTTL.ts +2 -1
  69. package/src/common/toBase36.ts +36 -0
  70. package/src/public/channel/BlogImageService.ts +3 -0
  71. package/src/public/channel/BlogService.ts +19 -5
  72. package/src/public/channel/ChannelMessage.tsx +113 -117
  73. package/src/public/channel/ChannelMessageList.tsx +110 -106
  74. package/src/public/channel/ChannelView.tsx +153 -7
  75. package/src/public/channel/PostSummary.tsx +46 -0
  76. package/src/public/channel/UrlService.ts +23 -4
  77. package/src/public/channel/controls/BlogHeader.tsx +29 -0
  78. package/src/public/channel/controls/PostList.tsx +32 -5
  79. package/src/public/channel/controls/TagCloud.tsx +18 -4
  80. package/src/public/channel/styles/channelViewStyle.ts +28 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.546",
3
+ "version": "1.2.548",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@ export const CacheTTL = {
2
2
  seconds: {
3
3
  oneHour: 60*60,
4
4
  oneDay: 60*60*24,
5
- oneMonth: 60*60*24*30
5
+ oneMonth: 60*60*24*30,
6
+ fifteenMinutes: 15 * 60
6
7
  }
7
8
  };
@@ -1,3 +1,39 @@
1
1
  export const toBase36 = (n: any) => BigInt(n).toString(36);
2
2
 
3
3
  declare let BigInt: (a: any) => number;
4
+
5
+
6
+ const parseBigInt = (numberString, throwOnFail = true) => {
7
+ if (!numberString) {
8
+ return;
9
+ }
10
+ if (numberString.startsWith("$")) {
11
+ return;
12
+ }
13
+ const keySpace = "0123456789abcdefghijklmnopqrstuvwxyz";
14
+ let result = BigInt(0);
15
+ const keySpaceLength = BigInt(keySpace.length);
16
+ for (const iterator of numberString) {
17
+ const value = keySpace.indexOf(iterator);
18
+ if (value === -1) {
19
+ if (throwOnFail) {
20
+ throw new Error("invalid string");
21
+ }
22
+ return;
23
+ }
24
+ result = result * keySpaceLength + BigInt(value);
25
+ }
26
+ return result;
27
+ };
28
+
29
+ export class Base36 {
30
+
31
+ static encode(n: number | bigint) {
32
+ return BigInt(n).toString(36);
33
+ }
34
+
35
+ static decode(n: string, throwOnFail = true) {
36
+ // pg might not accept bigint
37
+ return parseBigInt(n, throwOnFail)?.toString();
38
+ }
39
+ }
@@ -5,6 +5,7 @@ import { Sql } from "../../common/Sql";
5
5
  import { IMailboxEmail, AppFile, IEmail } from "../../model/model";
6
6
  import { CacheTTL } from "../../common/cache/CacheTTL";
7
7
  import { apiPath } from "../../common/apiPath";
8
+ import orangeLogo from "@social-mail/social-mail-client/content/images/svg/logo/logo-orange.svg";
8
9
 
9
10
  const cacheVersion = "1a";
10
11
 
@@ -30,5 +31,7 @@ export default class BlogImageService {
30
31
  if (file) {
31
32
  return apiPath(`/api/channel/file/webp(100)/${channelID}/${email.emailID}/${file.appFileID}/${file.name}/${file.name}.100.webp`);
32
33
  }
34
+
35
+ return orangeLogo;
33
36
  }
34
37
  }
@@ -8,11 +8,14 @@ import EmailContentDownloader from "../../services/email/EmailContentDownloader"
8
8
  import EngagementService from "../../web/page/mails/service/EngagementService";
9
9
  import SocialMailApp from "../../common/SocialMailApp";
10
10
  import { apiPath } from "../../common/apiPath";
11
+ import { CacheTTL } from "../../common/cache/CacheTTL";
12
+
13
+ const cacheVersion = "1a";
11
14
 
12
15
  const updateAttachments = (channelID, email: IEmail) => {
13
16
  if (email.attachments) {
14
17
  for (const iterator of email.attachments) {
15
- iterator.url = apiPath(`/api/emails/channel/content/attachment/${channelID}/${email.emailID}/${email.headerMessageID}/${iterator.appFileID}`);
18
+ iterator.url = apiPath(`/api/channel/file/view/${channelID}/${email.emailID}/${iterator.appFileID}/${iterator.name}`);
16
19
  }
17
20
  }
18
21
  };
@@ -55,6 +58,8 @@ export default class BlogService {
55
58
  async getEmails({
56
59
  channelID = 0,
57
60
  parentID = 0,
61
+ authorID = 0,
62
+ tagID = 0,
58
63
  search = "",
59
64
  start = 0,
60
65
  size = 10,
@@ -70,23 +75,29 @@ export default class BlogService {
70
75
  if (search) {
71
76
  q = q.where({ search }, (p) => (x) => Sql.text.includes(x.email.textBody, p.search));
72
77
  }
78
+ if (tagID) {
79
+ q = q.where({ tagID }, (p) => (x) => x.email.emailTags.some((t) => t.tagID === p.tagID));
80
+ }
81
+ if (authorID) {
82
+ q = q.where({ authorID }, (p) => (x) => x.email.senderID === p.authorID);
83
+ }
73
84
  const mailboxEmails = await q
74
85
  .include((x) => [x.email.attachments, x.email.engagements, x.email.emailTags.forEach((t) => t.tag)])
75
86
  .orderByDescending((x) => x.dateUpdated)
76
87
  .toPagedList({ start, size, cancelToken });
77
88
 
78
- const emails = { items: mailboxEmails.items.map((x) => x.email), total: mailboxEmails.total };
89
+ // const emails = { items: mailboxEmails.items.map((x) => x.email), total: mailboxEmails.total };
79
90
 
80
91
  const tasks = [];
81
92
 
82
- for (const email of emails.items) {
93
+ for (const { email } of mailboxEmails.items) {
83
94
  tasks.push(this.downloader.downloadFromUrl(
84
95
  apiPath(`/api/emails/channel/content/html/${channelID}/${email.emailID}/${email.headerMessageID}`)
85
96
  , email));
86
97
  updateAttachments(channelID, email);
87
98
  }
88
99
  await Promise.all(tasks);
89
- return emails;
100
+ return mailboxEmails;
90
101
  }
91
102
 
92
103
  async getChannel(emailAddress?: any,channelID?, d?) {
@@ -98,7 +109,10 @@ export default class BlogService {
98
109
  const c = await q
99
110
  .include((x) => x.emailAddress)
100
111
  .orderByDescending((x) => x.datePublished)
101
- .firstOrDefault();
112
+ .firstOrDefault({
113
+ cacheVersion,
114
+ cacheSeconds: CacheTTL.seconds.oneHour
115
+ });
102
116
  return c;
103
117
  }
104
118
 
@@ -1,117 +1,113 @@
1
- import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
2
- import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
3
- import BlogService from "./BlogService";
4
- import XNode from "@web-atoms/core/dist/core/XNode";
5
- import Action from "@web-atoms/core/dist/view-model/Action";
6
- import EmojiPopup from "./emoji/EmojiPopup";
7
- import "./styles/channelViewStyle";
8
- import PopupService from "@web-atoms/core/dist/web/services/PopupService";
9
- import { IEmail, IMailbox } from "../../model/model";
10
- import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
11
- import PostView from "./PostView";
12
- import CopyIcon from "../../common/controls/buttons/CopyIcon";
13
- import TagCloud from "./controls/TagCloud";
14
- import PopularPosts from "./controls/PostList";
15
- import RecentPosts from "./controls/RecentPosts";
16
-
17
- const url = (window as any).pageUrl as URL ?? new URL(location.href);
18
-
19
- let {1: channelID = url.searchParams.get("cid") , 2: emailID = url.searchParams.get("eid") } = /^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url?.pathname) ?? {} as any;
20
-
21
- channelID = parseInt(channelID, 36);
22
- emailID = parseInt(emailID, 36);
23
-
24
- const commentIcon = "💬";
25
-
26
- export default class ChannelMessage extends AtomControl {
27
-
28
- @InjectProperty
29
- blogService: BlogService;
30
-
31
-
32
- private channel: IMailbox;
33
- private email: IEmail;
34
-
35
- constructor(app, e = document.createElement("section")) {
36
- super(app, e);
37
- this.runAfterInit(() => this.app.runAsync(() => this.init()));
38
- }
39
-
40
- async init() {
41
-
42
- const channel = await this.blogService.getChannel(void 0, channelID, void 0);
43
- this.channel = channel;
44
-
45
- const email = await this.blogService.getEmail({ emailID, channelID });
46
- this.email = email;
47
-
48
- const engagements = email.engagements ?? [];
49
- // this.element.className = channelViewStyle;
50
- this.element.setAttribute("data-blog-list", "blog-list");
51
- this.element.setAttribute("data-layout", "flex-center");
52
- this.renderer = <section>
53
- <header>
54
- <div styler-display="flex" styler-gap="size-default">
55
- <span text={channel.emailAddress.name}/>
56
- <a href={`mailto:subscribe-${channel.emailAddress.emailAddress}?subject=subscribe`}><button>Follow</button></a>
57
- </div>
58
- </header>
59
- <section>
60
- <AtomRepeater
61
- items={[email]}
62
- itemRenderer={(x) => <PostView email={x} />}
63
- />
64
- </section>
65
- <aside>
66
- <TagCloud/>
67
- <PopularPosts/>
68
- <RecentPosts/>
69
- </aside>
70
- <footer></footer>
71
- </section>;
72
- }
73
-
74
- @Action({ onEvent: "react-email"})
75
- async reactEmail(email, ce: CustomEvent) {
76
- const { headerMessageID } = email;
77
- const emoji: string = await EmojiPopup.showControl(ce.target as any, { parentElement: ce.target as any});
78
- const { channel } = this;
79
- const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
80
- await PopupService.alert({
81
- message: <div data-layout="vertical-flex">
82
- To add your emoji to this post, email just the emoji {emoji} with given subject to the channel email address.
83
- <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/> </div>
84
- <div>Subject: {subject} <CopyIcon text={subject}/></div>
85
- <div>Body: {emoji} <CopyIcon text={emoji}/></div>
86
- <br/>
87
- <div>If you have email client configured, you can click on following link.</div>
88
- <div>
89
- <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&body=${emoji}&in-reply-to=${headerMessageID}`}>Email Now</a>
90
- </div>
91
- </div>,
92
- title: "Send Email"
93
- });
94
- }
95
-
96
- @Action({ onEvent: "reply-email"})
97
- async replyEmail(email, ce: CustomEvent) {
98
- const emoji = commentIcon;
99
- const { headerMessageID } = email;
100
- const { channel } = this;
101
- const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
102
- await PopupService.alert({
103
- message: <div data-layout="vertical-flex">
104
- To send comment to this post, email us your comment with given subject to the channel email address.
105
- <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/></div>
106
- <div>Subject: {subject} <CopyIcon text={subject}/></div>
107
- <br/>
108
- <div>If you have email client configured, you can click on following link.</div>
109
- <div>
110
- <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&in-reply-to=${headerMessageID}`}>Email Now</a>
111
- </div>
112
- </div>,
113
- title: "Send Email"
114
- });
115
- }
116
-
117
- }
1
+ // import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
2
+ // import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
3
+ // import BlogService from "./BlogService";
4
+ // import XNode from "@web-atoms/core/dist/core/XNode";
5
+ // import Action from "@web-atoms/core/dist/view-model/Action";
6
+ // import EmojiPopup from "./emoji/EmojiPopup";
7
+ // import "./styles/channelViewStyle";
8
+ // import PopupService from "@web-atoms/core/dist/web/services/PopupService";
9
+ // import { IEmail, IMailbox } from "../../model/model";
10
+ // import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
11
+ // import PostView from "./PostView";
12
+ // import CopyIcon from "../../common/controls/buttons/CopyIcon";
13
+ // import TagCloud from "./controls/TagCloud";
14
+ // import PopularPosts from "./controls/PostList";
15
+ // import RecentPosts from "./controls/RecentPosts";
16
+ // import BlogHeader from "./controls/BlogHeader";
17
+
18
+ // const url = (window as any).pageUrl as URL ?? new URL(location.href);
19
+
20
+ // let {1: channelID = url.searchParams.get("cid") , 2: emailID = url.searchParams.get("eid") } = /^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url?.pathname) ?? {} as any;
21
+
22
+ // channelID = parseInt(channelID, 36);
23
+ // emailID = parseInt(emailID, 36);
24
+
25
+ // const commentIcon = "💬";
26
+
27
+ // export default class ChannelMessage extends AtomControl {
28
+
29
+ // @InjectProperty
30
+ // blogService: BlogService;
31
+
32
+
33
+ // private channel: IMailbox;
34
+ // private email: IEmail;
35
+
36
+ // constructor(app, e = document.createElement("section")) {
37
+ // super(app, e);
38
+ // this.runAfterInit(() => this.app.runAsync(() => this.init()));
39
+ // }
40
+
41
+ // async init() {
42
+
43
+ // const channel = await this.blogService.getChannel(void 0, channelID, void 0);
44
+ // this.channel = channel;
45
+
46
+ // const email = await this.blogService.getEmail({ emailID, channelID });
47
+ // this.email = email;
48
+
49
+ // const engagements = email.engagements ?? [];
50
+ // // this.element.className = channelViewStyle;
51
+ // this.element.setAttribute("data-blog-list", "blog-list");
52
+ // this.element.setAttribute("data-layout", "flex-center");
53
+ // this.renderer = <section>
54
+ // <BlogHeader channel={channel}/>
55
+ // <section>
56
+ // <AtomRepeater
57
+ // items={[email]}
58
+ // itemRenderer={(x) => <PostView email={x} />}
59
+ // />
60
+ // </section>
61
+ // <aside>
62
+ // <TagCloud/>
63
+ // <PopularPosts/>
64
+ // <RecentPosts/>
65
+ // </aside>
66
+ // <footer></footer>
67
+ // </section>;
68
+ // }
69
+
70
+ // @Action({ onEvent: "react-email"})
71
+ // async reactEmail(email, ce: CustomEvent) {
72
+ // const { headerMessageID } = email;
73
+ // const emoji: string = await EmojiPopup.showControl(ce.target as any, { parentElement: ce.target as any});
74
+ // const { channel } = this;
75
+ // const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
76
+ // await PopupService.alert({
77
+ // message: <div data-layout="vertical-flex">
78
+ // To add your emoji to this post, email just the emoji {emoji} with given subject to the channel email address.
79
+ // <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/> </div>
80
+ // <div>Subject: {subject} <CopyIcon text={subject}/></div>
81
+ // <div>Body: {emoji} <CopyIcon text={emoji}/></div>
82
+ // <br/>
83
+ // <div>If you have email client configured, you can click on following link.</div>
84
+ // <div>
85
+ // <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&body=${emoji}&in-reply-to=${headerMessageID}`}>Email Now</a>
86
+ // </div>
87
+ // </div>,
88
+ // title: "Send Email"
89
+ // });
90
+ // }
91
+
92
+ // @Action({ onEvent: "reply-email"})
93
+ // async replyEmail(email, ce: CustomEvent) {
94
+ // const emoji = commentIcon;
95
+ // const { headerMessageID } = email;
96
+ // const { channel } = this;
97
+ // const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
98
+ // await PopupService.alert({
99
+ // message: <div data-layout="vertical-flex">
100
+ // To send comment to this post, email us your comment with given subject to the channel email address.
101
+ // <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/></div>
102
+ // <div>Subject: {subject} <CopyIcon text={subject}/></div>
103
+ // <br/>
104
+ // <div>If you have email client configured, you can click on following link.</div>
105
+ // <div>
106
+ // <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&in-reply-to=${headerMessageID}`}>Email Now</a>
107
+ // </div>
108
+ // </div>,
109
+ // title: "Send Email"
110
+ // });
111
+ // }
112
+
113
+ // }
@@ -1,121 +1,125 @@
1
- import Bind from "@web-atoms/core/dist/core/Bind";
2
- import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
3
- import XNode from "@web-atoms/core/dist/core/XNode";
4
- import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
5
- import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
6
- import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
7
- import InfiniteRepeater from "../../common/controls/repeater/InfiniteRepeater";
8
- import { DateFormats } from "../../common/date/DateFormats";
9
- import { IMailbox, IEmail } from "../../model/model";
10
- import { renderMail } from "../../web/page/mails/service/ConversationService";
11
- import BlogService from "./BlogService";
12
- import "./styles/channelViewStyle";
13
- import { UrlService } from "./UrlService";
14
- import TagCloud from "./controls/TagCloud";
15
- import PopularPosts from "./controls/PostList";
16
- import RecentPosts from "./controls/RecentPosts";
1
+ // import Bind from "@web-atoms/core/dist/core/Bind";
2
+ // import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
3
+ // import XNode from "@web-atoms/core/dist/core/XNode";
4
+ // import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
5
+ // import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
6
+ // import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
7
+ // import InfiniteRepeater from "../../common/controls/repeater/InfiniteRepeater";
8
+ // import { DateFormats } from "../../common/date/DateFormats";
9
+ // import { IMailbox, IEmail } from "../../model/model";
10
+ // import { renderMail } from "../../web/page/mails/service/ConversationService";
11
+ // import BlogService from "./BlogService";
12
+ // import "./styles/channelViewStyle";
13
+ // import { UrlService } from "./UrlService";
14
+ // import TagCloud from "./controls/TagCloud";
15
+ // import PopularPosts from "./controls/PostList";
16
+ // import RecentPosts from "./controls/RecentPosts";
17
+ // import BlogHeader from "./controls/BlogHeader";
17
18
 
18
- export default class ChannelView extends AtomControl {
19
+ // export default class ChannelView extends AtomControl {
19
20
 
20
- @InjectProperty
21
- blogService: BlogService;
21
+ // @InjectProperty
22
+ // blogService: BlogService;
22
23
 
23
- search = "";
24
+ // search = "";
24
25
 
25
- channel: IMailbox;
26
+ // channel: IMailbox;
26
27
 
27
- mails = [] as IEmail[];
28
+ // mails = [] as IEmail[];
28
29
 
29
- constructor(app, e = document.createElement("section")) {
30
- super(app, e);
31
- this.pushInit();
32
- }
30
+ // constructor(app, e = document.createElement("section")) {
31
+ // super(app, e);
32
+ // this.pushInit();
33
+ // }
33
34
 
34
- async init() {
35
+ // async init() {
35
36
 
36
- let { channelID, emailAddress, domainID } = (window as any).socialMail ?? {};
37
+ // let { channelID, emailAddress, domainID } = (window as any).socialMail ?? {};
37
38
 
38
- let args = this.element.getAttribute("data-json-args") as any;
39
- if (args) {
40
- args = JSON.parse(args || "{}");
41
- const d = args.domainID || args.domain;
42
- if (d) {
43
- domainID = d;
44
- }
45
- const c = args.channels || args.channel;
46
- if (c) {
47
- channelID = c;
48
- }
49
- }
39
+ // let args = this.element.getAttribute("data-json-args") as any;
40
+ // if (args) {
41
+ // args = JSON.parse(args || "{}");
42
+ // const d = args.domainID || args.domain;
43
+ // if (d) {
44
+ // domainID = d;
45
+ // }
46
+ // const c = args.channels || args.channel;
47
+ // if (c) {
48
+ // channelID = c;
49
+ // }
50
+ // }
50
51
 
51
- this.element.setAttribute("data-blog-list", "blog-list");
52
+ // this.element.setAttribute("data-blog-list", "blog-list");
52
53
 
53
- this.channel = await this.blogService.getChannel(emailAddress, channelID, domainID);
54
+ // this.channel = await this.blogService.getChannel(emailAddress, channelID, domainID);
54
55
 
55
- channelID = this.channel.mailboxID;
56
- emailAddress = this.channel.emailAddress.emailAddress;
56
+ // channelID = this.channel.mailboxID;
57
+ // emailAddress = this.channel.emailAddress.emailAddress;
57
58
 
58
- this.renderer = <div data-layout="flex-center">
59
- <span text="..."/>
60
- </div>;
59
+ // this.renderer = <div data-layout="flex-center">
60
+ // <span text="..."/>
61
+ // </div>;
61
62
 
62
- // this.element.className = channelViewStyle;
63
- this.renderer = <section>
64
- <header>
65
- <div styler-display="flex" styler-gap="size-default">
66
- <span text={this.channel.emailAddress.name}/>
67
- <a href={`mailto:subscribe-${this.channel.emailAddress.emailAddress}?subject=subscribe`}><button>Follow</button></a>
68
- </div>
69
- <div styler-display="flex" styler-gap="size-default">
70
- <input
71
- placeholder="Search..."
72
- value={Bind.twoWaysImmediate(() => this.search)}/>
73
- </div>
74
- </header>
75
- <section>
76
- <AtomRepeater
77
- items={this.mails}
78
- data-auto-scroll="false"
79
- { ... InfiniteRepeater.pagedItems((start) =>
80
- (c, e, cancelToken) =>
81
- this.blogService.getEmails({
82
- channelID: this.channel.mailboxID,
83
- start,
84
- search: this.search,
85
- cancelToken
86
- })
87
- )}
88
- itemRenderer={(email: IEmail) => {
89
- const engagements = email.engagements ?? [];
90
- return <section data-element="blog-item">
91
- <h4 data-element="title">
92
- <a href={UrlService.toBlogUrl(channelID, email.emailID, email.subject)} text={email.subject}></a>
93
- </h4>
94
- <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
95
- <h5 text={email.senderName}/>
96
- <section
97
- data-element="content">
98
- <LimitedText height={200}>
99
- <section { ... renderMail({ email })}/>
100
- </LimitedText>
101
- </section>
102
- <footer>
103
- { ... engagements.map((x) =>
104
- <span
105
- title={`View all ${x.engagement} ${x.count}`}
106
- text={`${x.engagement} ${x.count}`}/>)}
107
- </footer>
108
- </section>;
109
- }}
110
- />
111
- </section>
112
- <aside>
113
- <TagCloud/>
114
- <PopularPosts/>
115
- <RecentPosts/>
116
- </aside>
117
- <footer></footer>
118
- </section>;
119
- }
63
+ // // this.element.className = channelViewStyle;
64
+ // this.renderer = <section>
65
+ // <BlogHeader
66
+ // search={Bind.twoWaysImmediate(() => this.search)}
67
+ // channel={this.channel}/>
68
+ // {/* <header>
69
+ // <div styler-display="flex" styler-gap="size-default">
70
+ // <span text={this.channel.emailAddress.name}/>
71
+ // <a href={`mailto:subscribe-${this.channel.emailAddress.emailAddress}?subject=subscribe`}><button>Follow</button></a>
72
+ // </div>
73
+ // <div styler-display="flex" styler-gap="size-default">
74
+ // <input
75
+ // placeholder="Search..."
76
+ // value={Bind.twoWaysImmediate(() => this.search)}/>
77
+ // </div>
78
+ // </header> */}
79
+ // <section>
80
+ // <AtomRepeater
81
+ // items={this.mails}
82
+ // data-auto-scroll="false"
83
+ // { ... InfiniteRepeater.pagedItems((start) =>
84
+ // (c, e, cancelToken) =>
85
+ // this.blogService.getEmails({
86
+ // channelID: this.channel.mailboxID,
87
+ // start,
88
+ // search: this.search,
89
+ // cancelToken
90
+ // })
91
+ // )}
92
+ // itemRenderer={(email: IEmail) => {
93
+ // const engagements = email.engagements ?? [];
94
+ // return <section data-element="blog-item">
95
+ // <h4 data-element="title">
96
+ // <a href={UrlService.toBlogUrl(channelID, email.emailID, email.subject)} text={email.subject}></a>
97
+ // </h4>
98
+ // <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
99
+ // <h5 text={email.senderName}/>
100
+ // <section
101
+ // data-element="content">
102
+ // <LimitedText height={200}>
103
+ // <section { ... renderMail({ email })}/>
104
+ // </LimitedText>
105
+ // </section>
106
+ // <footer>
107
+ // { ... engagements.map((x) =>
108
+ // <span
109
+ // title={`View all ${x.engagement} ${x.count}`}
110
+ // text={`${x.engagement} ${x.count}`}/>)}
111
+ // </footer>
112
+ // </section>;
113
+ // }}
114
+ // />
115
+ // </section>
116
+ // <aside>
117
+ // <TagCloud/>
118
+ // <PopularPosts/>
119
+ // <RecentPosts/>
120
+ // </aside>
121
+ // <footer></footer>
122
+ // </section>;
123
+ // }
120
124
 
121
- }
125
+ // }