From 3dcf310a54814fc282da2c95dd64f2557e70c6f8 Mon Sep 17 00:00:00 2001 From: Sukhamjot Singh Date: Tue, 22 Mar 2022 00:43:23 +0530 Subject: [PATCH] added tags --- webui-src/app/mail/mail_important.js | 27 +++++++++++++++++++++++++++ webui-src/app/mail/mail_later.js | 27 +++++++++++++++++++++++++++ webui-src/app/mail/mail_personal.js | 27 +++++++++++++++++++++++++++ webui-src/app/mail/mail_resolver.js | 27 ++++++++++++++++++++++++++- webui-src/app/mail/mail_todo.js | 27 +++++++++++++++++++++++++++ webui-src/app/mail/mail_util.js | 13 ++++++++++++- webui-src/app/mail/mail_work.js | 27 +++++++++++++++++++++++++++ webui-src/app/theme.css | 2 +- webui-src/app/widgets.js | 1 + 9 files changed, 175 insertions(+), 3 deletions(-) create mode 100644 webui-src/app/mail/mail_important.js create mode 100644 webui-src/app/mail/mail_later.js create mode 100644 webui-src/app/mail/mail_personal.js create mode 100644 webui-src/app/mail/mail_todo.js create mode 100644 webui-src/app/mail/mail_work.js diff --git a/webui-src/app/mail/mail_important.js b/webui-src/app/mail/mail_important.js new file mode 100644 index 0000000..77a1389 --- /dev/null +++ b/webui-src/app/mail/mail_important.js @@ -0,0 +1,27 @@ +const m = require('mithril'); +const util = require('mail/mail_util'); + +const Layout = () => { + return { + view: (v) => [ + m('.widget', [ + m('h3', 'Important'), + m('hr'), + m( + util.Table, + m( + 'tbody', + v.attrs.list.map((msg) => + m(util.MessageSummary, { + details: msg, + category: 'important', + }) + ) + ) + ), + ]), + ], + }; +}; + +module.exports = Layout; diff --git a/webui-src/app/mail/mail_later.js b/webui-src/app/mail/mail_later.js new file mode 100644 index 0000000..f686112 --- /dev/null +++ b/webui-src/app/mail/mail_later.js @@ -0,0 +1,27 @@ +const m = require('mithril'); +const util = require('mail/mail_util'); + +const Layout = () => { + return { + view: (v) => [ + m('.widget', [ + m('h3', 'Later'), + m('hr'), + m( + util.Table, + m( + 'tbody', + v.attrs.list.map((msg) => + m(util.MessageSummary, { + details: msg, + category: 'later', + }) + ) + ) + ), + ]), + ], + }; +}; + +module.exports = Layout; diff --git a/webui-src/app/mail/mail_personal.js b/webui-src/app/mail/mail_personal.js new file mode 100644 index 0000000..e84e7d8 --- /dev/null +++ b/webui-src/app/mail/mail_personal.js @@ -0,0 +1,27 @@ +const m = require('mithril'); +const util = require('mail/mail_util'); + +const Layout = () => { + return { + view: (v) => [ + m('.widget', [ + m('h3', 'Personal'), + m('hr'), + m( + util.Table, + m( + 'tbody', + v.attrs.list.map((msg) => + m(util.MessageSummary, { + details: msg, + category: 'personal', + }) + ) + ) + ), + ]), + ], + }; +}; + +module.exports = Layout; diff --git a/webui-src/app/mail/mail_resolver.js b/webui-src/app/mail/mail_resolver.js index aa9701e..ff48e6b 100644 --- a/webui-src/app/mail/mail_resolver.js +++ b/webui-src/app/mail/mail_resolver.js @@ -14,6 +14,11 @@ const Messages = { starred: [], system: [], spam: [], + important: [], + work: [], + personal: [], + todo: [], + later: [], load() { rs.rsJsonApiRequest('/rsMsgs/getMessageSummaries', {}, (data) => { Messages.all = data.msgList; @@ -41,6 +46,21 @@ const Messages = { Messages.spam = Messages.all.filter( (msg) => (msg.msgflags & util.RS_MSG_SPAM) ); + Messages.important = Messages.all.filter( + (msg) => (msg.msgflags & util.RS_MSGTAGTYPE_IMPORTANT) + ); + Messages.work = Messages.all.filter( + (msg) => (msg.msgflags & util.RS_MSGTAGTYPE_WORK) + ); + Messages.personal = Messages.all.filter( + (msg) => (msg.msgflags & util.RS_MSGTAGTYPE_PERSONAL) + ); + Messages.todo = Messages.all.filter( + (msg) => (msg.msgflags & util.RS_MSGTAGTYPE_TODO) + ); + Messages.later = Messages.all.filter( + (msg) => (msg.msgflags & util.RS_MSGTAGTYPE_LATER) + ); }); }, }; @@ -56,6 +76,12 @@ const sectionsquickview = { starred: require('mail/mail_starred'), system: require('mail/mail_system'), spam: require('mail/mail_spam'), + important: require('mail/mail_important'), + work: require('mail/mail_work'), + todo: require('mail/mail_todo'), + later: require('mail/mail_later'), + personal: require('mail/mail_personal'), + }; const tagselect = { showval: 'Tags', @@ -82,7 +108,6 @@ const Layout = { tabs: Object.keys(sections), baseRoute: '/mail/', }), - m('h3', 'quick view'), m(widget.SidebarQuickView, { tabs: Object.keys(sectionsquickview), baseRoute: '/mail/', diff --git a/webui-src/app/mail/mail_todo.js b/webui-src/app/mail/mail_todo.js new file mode 100644 index 0000000..254f3bc --- /dev/null +++ b/webui-src/app/mail/mail_todo.js @@ -0,0 +1,27 @@ +const m = require('mithril'); +const util = require('mail/mail_util'); + +const Layout = () => { + return { + view: (v) => [ + m('.widget', [ + m('h3', 'Todo'), + m('hr'), + m( + util.Table, + m( + 'tbody', + v.attrs.list.map((msg) => + m(util.MessageSummary, { + details: msg, + category: 'todo', + }) + ) + ) + ), + ]), + ], + }; +}; + +module.exports = Layout; diff --git a/webui-src/app/mail/mail_util.js b/webui-src/app/mail/mail_util.js index 1d45034..a24702f 100644 --- a/webui-src/app/mail/mail_util.js +++ b/webui-src/app/mail/mail_util.js @@ -12,6 +12,12 @@ const RS_MSG_NEW = 0x10; const RS_MSG_UNREAD_BY_USER = 0x40; const RS_MSG_STAR = 0x200; const RS_MSG_SPAM = 0x040000; + +const RS_MSGTAGTYPE_IMPORTANT = 1; +const RS_MSGTAGTYPE_WORK = 2; +const RS_MSGTAGTYPE_PERSONAL = 3; +const RS_MSGTAGTYPE_TODO = 4; +const RS_MSGTAGTYPE_LATER = 5; const RS_MSG_USER_REQUEST = 0x000400; const RS_MSG_FRIEND_RECOMMENDATION = 0x000800; const RS_MSG_PUBLISH_KEY = 0x020000; @@ -222,5 +228,10 @@ module.exports = { RS_MSG_STAR, RS_MSG_TRASH, RS_MSG_SYSTEM, - RS_MSG_SPAM + RS_MSG_SPAM, + RS_MSGTAGTYPE_IMPORTANT, + RS_MSGTAGTYPE_LATER, + RS_MSGTAGTYPE_PERSONAL, + RS_MSGTAGTYPE_TODO, + RS_MSGTAGTYPE_WORK }; diff --git a/webui-src/app/mail/mail_work.js b/webui-src/app/mail/mail_work.js new file mode 100644 index 0000000..88e6410 --- /dev/null +++ b/webui-src/app/mail/mail_work.js @@ -0,0 +1,27 @@ +const m = require('mithril'); +const util = require('mail/mail_util'); + +const Layout = () => { + return { + view: (v) => [ + m('.widget', [ + m('h3', 'Work'), + m('hr'), + m( + util.Table, + m( + 'tbody', + v.attrs.list.map((msg) => + m(util.MessageSummary, { + details: msg, + category: 'work', + }) + ) + ) + ), + ]), + ], + }; +}; + +module.exports = Layout; diff --git a/webui-src/app/theme.css b/webui-src/app/theme.css index 2c0a71e..88cd4be 100644 --- a/webui-src/app/theme.css +++ b/webui-src/app/theme.css @@ -444,7 +444,7 @@ a.tab-menu-item { /* Content adjacent to sidebar */ .node-panel { position: relative; - bottom: 140px; + bottom: 400px; margin-left: 200px; animation: fadein 0.5s; } diff --git a/webui-src/app/widgets.js b/webui-src/app/widgets.js index 36d7ec8..028617f 100644 --- a/webui-src/app/widgets.js +++ b/webui-src/app/widgets.js @@ -25,6 +25,7 @@ const SidebarQuickView = () => { view: (v) => m( '.sidebarquickview', + m('h4', 'Quick View'), v.attrs.tabs.map((panelName, index) => m( m.route.Link,