From 321cc7d6602847d91d0272dc3a749ca0fbd318c2 Mon Sep 17 00:00:00 2001 From: Sukhamjot Singh Date: Fri, 4 Feb 2022 21:51:07 +0530 Subject: [PATCH] Added mailcompose, tags, search --- webui-src/app/mail/mail.css | 18 ++++++++++++++++++ webui-src/app/mail/mail_compose.js | 11 +++++++++++ webui-src/app/mail/mail_resolver.js | 19 ++++++++++++++++++- webui-src/app/mail/mail_util.js | 21 ++++++++++++++++++++- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 webui-src/app/mail/mail_compose.js diff --git a/webui-src/app/mail/mail.css b/webui-src/app/mail/mail.css index 63fde9d..307a018 100644 --- a/webui-src/app/mail/mail.css +++ b/webui-src/app/mail/mail.css @@ -57,3 +57,21 @@ iframe.msg { width: 100%; height: 450px; } +#composebtn{ + text-align: center; + width: 200px; + height: 50px; + /* float: left; */ +} +#searchmail{ + float: right; + position: relative; + margin-right: 20px; +} +#tags{ + width: 200px; + text-align: center; + font-size: medium; + margin-left: 20px; + height: 40px; +} \ No newline at end of file diff --git a/webui-src/app/mail/mail_compose.js b/webui-src/app/mail/mail_compose.js new file mode 100644 index 0000000..770f885 --- /dev/null +++ b/webui-src/app/mail/mail_compose.js @@ -0,0 +1,11 @@ +const m = require('mithril'); + +const Layout = () => { + return{ + view: () => [ + m('h2', 'Compose a mail') + ] + }; +}; + +module.exports = Layout(); \ No newline at end of file diff --git a/webui-src/app/mail/mail_resolver.js b/webui-src/app/mail/mail_resolver.js index 8e978c6..32be8ef 100644 --- a/webui-src/app/mail/mail_resolver.js +++ b/webui-src/app/mail/mail_resolver.js @@ -2,6 +2,7 @@ const m = require('mithril'); const rs = require('rswebui'); const util = require('mail/mail_util'); const widget = require('widgets'); +const compose = require('mail/mail_compose') const Messages = { all: [], @@ -34,11 +35,27 @@ const sections = { drafts: require('mail/mail_draftbox'), sent: require('mail/mail_sentbox'), }; - +const tagselect = { + showval: 'Tags', + opts: ['Tags','Important', 'Work', 'Personal'] +} const Layout = { oninit: Messages.load, view: (vnode) => + m('.tab-page', [ + m("button[id=composebtn]", { onclick: () => { widget.popupMessage(m(compose)); } }, "Compose"), + m('select[id=tags]', { + value: tagselect.showval, + onchange: e => { + tagselect.showval = tagselect.opts[e.target.selectedIndex] + } + }, [ + tagselect.opts.map(o => m('option', { value: o }, o.toLocaleString())) + ]), + m(util.SearchBar, { + list: Object.assign({}, {}, {}), + }), m(widget.Sidebar, { tabs: Object.keys(sections), baseRoute: '/mail/', diff --git a/webui-src/app/mail/mail_util.js b/webui-src/app/mail/mail_util.js index f9f0843..30c7f5e 100644 --- a/webui-src/app/mail/mail_util.js +++ b/webui-src/app/mail/mail_util.js @@ -155,11 +155,30 @@ const Table = () => { ]), }; }; - +const SearchBar = () => { + let searchString = ''; + return { + view: (v) => + m('input[type=text][id=searchmail][placeholder=Search Subject].searchbar', { + value: searchString, + oninput: (e) => { + searchString = e.target.value.toLowerCase(); + for (const hash in v.attrs.list) { + if (v.attrs.list[hash].fname.toLowerCase().indexOf(searchString) > -1) { + v.attrs.list[hash].isSearched = true; + } else { + v.attrs.list[hash].isSearched = false; + } + } + }, + }), + }; +}; module.exports = { MessageSummary, MessageView, Table, + SearchBar, RS_MSG_BOXMASK, RS_MSG_INBOX, RS_MSG_SENTBOX,