From ef88964cd023d2a9fc60cc580ebb105375494b95 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 28 Sep 2017 21:59:40 -0500 Subject: [PATCH] interim commit with lots of stuff - conversion from Element UI to Bootstrap 4 in progress (smaller, more flexible) - added Font Awesome for fonts, vue-toast for notifications - added common components to main.js and out of other components - some work on pulling answered requests (#3), added icon for notes (#8) --- README.md | 2 +- src/api/src/db/request.js | 11 ++++ src/api/src/routes/request.js | 5 +- src/app/package.json | 4 +- src/app/src/App.vue | 25 --------- src/app/src/api/index.js | 7 ++- src/app/src/components/Answered.vue | 38 +++++++++++++ src/app/src/components/Home.vue | 7 +-- src/app/src/components/Journal.vue | 23 ++++---- src/app/src/components/Navigation.vue | 28 ++++------ src/app/src/components/common/DateFromNow.vue | 14 ++++- .../src/components/request/EditRequest.vue | 53 ++++++++++-------- .../src/components/request/FullRequest.vue | 19 +++++-- .../components/request/FullRequestHistory.vue | 6 +- src/app/src/components/request/NewRequest.vue | 36 ++++++++---- .../components/request/RequestListItem.vue | 56 +++++++++++-------- src/app/src/components/user/LogOn.vue | 4 -- src/app/src/main.js | 28 ++++++++-- src/app/yarn.lock | 43 ++++++-------- 19 files changed, 244 insertions(+), 165 deletions(-) create mode 100644 src/app/src/components/Answered.vue diff --git a/README.md b/README.md index e31780a..6e885fe 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ Journaling has a long history; it helps people remember what happened, and the a This is borne of out of a personal desire I had to have something that would help me with my prayer life. When it's time to pray, it's not really time to use an app, so the design goal here is to keep it simple and unobtrusive. It will also help eliminate some of the downsides to a paper prayer journal, like not remembering whether you've prayed for a request, or running out of room to write another update on one. -It is still a work-in-progress (WIP). It will eventually be hosted at , and will be available for public use. +It is still a work-in-progress (WIP), but is available for public preview at . diff --git a/src/api/src/db/request.js b/src/api/src/db/request.js index 7e810d5..6a4406f 100644 --- a/src/api/src/db/request.js +++ b/src/api/src/db/request.js @@ -68,6 +68,17 @@ export default function (pool) { }) }, + /** + * Get all answered requests with their text as of the "Answered" status + * @param {string} userId The Id of the user for whom requests should be retrieved + * @return All requests + */ + answered: async (userId) => + (await pool.query(`${currentRequestSql} + WHERE "userId" = $1 + AND "lastStatus" = 'Answered' + ORDER BY "asOf" DESC`)).rows, + /** * Get the "current" version of a request by its Id * @param {string} requestId The Id of the request to retrieve diff --git a/src/api/src/routes/request.js b/src/api/src/routes/request.js index bc9199e..8682ee6 100644 --- a/src/api/src/routes/request.js +++ b/src/api/src/routes/request.js @@ -45,7 +45,10 @@ export default function (checkJwt) { ctx.body = await db.request.oldest(ctx.state.user.sub) await next() }) - + .get('/answered', checkJwt, async (ctx, next) => { + ctx.body = await db.request.answered(ctx.state.user.sub) + await next() + }) return router } diff --git a/src/app/package.json b/src/app/package.json index db6ade4..a7e3d79 100644 --- a/src/app/package.json +++ b/src/app/package.json @@ -16,12 +16,14 @@ "dependencies": { "auth0-js": "^8.10.1", "axios": "^0.16.2", - "element-ui": "^1.4.4", + "bootstrap-vue": "^1.0.0-beta.9", "moment": "^2.18.1", "pug": "^2.0.0-rc.4", "vue": "^2.4.4", + "vue-awesome": "^2.3.3", "vue-progressbar": "^0.7.3", "vue-router": "^2.6.0", + "vue-toast": "^3.1.0", "vuex": "^2.4.0" }, "devDependencies": { diff --git a/src/app/src/App.vue b/src/app/src/App.vue index 1063316..48f2f9f 100644 --- a/src/app/src/App.vue +++ b/src/app/src/App.vue @@ -22,42 +22,17 @@ export default { diff --git a/src/app/src/components/common/DateFromNow.vue b/src/app/src/components/common/DateFromNow.vue index aaf5907..9b4b172 100644 --- a/src/app/src/components/common/DateFromNow.vue +++ b/src/app/src/components/common/DateFromNow.vue @@ -20,8 +20,11 @@ export default { } }, data () { + const dt = moment(this.value) return { - fromNow: moment(this.value).fromNow(), + dt, + fromNow: dt.fromNow(), + actual: dt.format('LLLL'), intervalId: null } }, @@ -34,12 +37,17 @@ export default { }, methods: { updateFromNow () { - let newFromNow = moment(this.value).fromNow() + let newFromNow = this.dt.fromNow() if (newFromNow !== this.fromNow) this.fromNow = newFromNow } }, render (createElement) { - return createElement(this.tag, this.fromNow) + return createElement(this.tag, { + domProps: { + title: this.actual, + innerText: this.fromNow + } + }) } } diff --git a/src/app/src/components/request/EditRequest.vue b/src/app/src/components/request/EditRequest.vue index b0f6533..530ac6c 100644 --- a/src/app/src/components/request/EditRequest.vue +++ b/src/app/src/components/request/EditRequest.vue @@ -1,18 +1,25 @@ - - diff --git a/src/app/src/components/user/LogOn.vue b/src/app/src/components/user/LogOn.vue index eea3b21..62fd1f3 100644 --- a/src/app/src/components/user/LogOn.vue +++ b/src/app/src/components/user/LogOn.vue @@ -7,14 +7,10 @@ article