From 59af4a2d3bba9036d81b9bb6ca373cbf4ffc46d3 Mon Sep 17 00:00:00 2001 From: Yun Ha Seo <31864715+yb50110@users.noreply.github.com> Date: Mon, 11 Jun 2018 04:57:11 -0500 Subject: [PATCH 1/5] Modal width responsiveness (partial fix for #10267) (#10354) * added responsive scss to allow modals to respond to changing window size * Remove unecessary space * moved scss around * remove unnecessary space * Adjust left and right panels to be more responsive + moved css for buyQuestModal into its respective vue file (startQuestModal css wasn't working in its vue file... I can't figure out why) * removed important to get rid of extra scrollbar * moved css all to one file --- website/client/app.vue | 2 +- website/client/assets/scss/modal.scss | 83 ++++++++++++++++++- .../components/shops/quests/buyQuestModal.vue | 9 +- 3 files changed, 84 insertions(+), 10 deletions(-) diff --git a/website/client/app.vue b/website/client/app.vue index 1cc5d88f34..dcea0ea557 100644 --- a/website/client/app.vue +++ b/website/client/app.vue @@ -106,7 +106,7 @@ div /* @TODO: The modal-open class is not being removed. Let's try this for now */ .modal, .modal-open { - overflow-y: scroll !important; + overflow-y: scroll; } .modal-backdrop.show { diff --git a/website/client/assets/scss/modal.scss b/website/client/assets/scss/modal.scss index b19075aeef..e61bfccb30 100644 --- a/website/client/assets/scss/modal.scss +++ b/website/client/assets/scss/modal.scss @@ -35,5 +35,86 @@ overflow-y: hidden; text-overflow: ellipsis; } - } + +#start-quest-modal, #buy-quest-modal { + @media only screen and (max-width: 1200px) { + .modal-dialog { + max-width: 33%; + + .left-panel { + left: initial; + width: 100%; + right: 100%; + + .col-4 { + width: 100px; + } + } + + .side-panel, .right-sidebar { + left: calc(100% - 10px); + max-width: 100%; + right: initial; + + .questRewards { + width: 90%; + + .reward-item { + width: 100%; + } + } + } + } + } + + @media only screen and (max-width: 1000px) { + .modal-dialog { + max-width: 80%; + width: 80% !important; + + .modal-body { + flex-direction: column; + display: flex; + + div:nth-child(1) { order: 3; } + div:nth-child(2) { order: 1; } + div:nth-child(3) { order: 4; } + div:nth-child(4) { order: 5; } + div:nth-child(5) { order: 2; } + + .left-panel { + border-radius: 8px; + position: static; + right: initial; + margin: 20px 0; + height: auto; + width: 100%; + z-index: 0; + order: 3; + + .col-4 { + max-width: 100px; + } + } + + .side-panel, .right-sidebar { + margin: 20px 0 0 0; + position: static; + box-shadow: none; + height: auto; + width: 100%; + z-index: 0; + order: 2; + left: 0; + + .questRewards { + padding: 0 2em 2em 2em; + width: 100%; + z-index: 0; + } + } + } + } + } +} \ No newline at end of file diff --git a/website/client/components/shops/quests/buyQuestModal.vue b/website/client/components/shops/quests/buyQuestModal.vue index 26a5eae4a5..11217d0912 100644 --- a/website/client/components/shops/quests/buyQuestModal.vue +++ b/website/client/components/shops/quests/buyQuestModal.vue @@ -62,7 +62,6 @@ .content { text-align: center; - overflow-y: scroll; } .item-wrapper { @@ -71,14 +70,12 @@ .inner-content { margin: 33px auto auto; - width: 400px; } .questInfo { width: 70%; - margin: 0 auto; - margin-bottom: 10px; + margin: 0 auto 10px auto; } .right-sidebar { @@ -99,9 +96,7 @@ span.svg-icon.inline.icon-32 { height: 32px; width: 32px; - margin-right: 8px; - vertical-align: middle; } @@ -112,7 +107,6 @@ font-size: 24px; font-weight: bold; line-height: 1.33; - vertical-align: middle; &.gems { @@ -161,7 +155,6 @@ } } - .notEnough { pointer-events: none; opacity: 0.55; From 5e60a05cac872ec25812321176cda6a938555b31 Mon Sep 17 00:00:00 2001 From: Michael Chenevey Date: Mon, 11 Jun 2018 02:58:18 -0700 Subject: [PATCH 2/5] related to 10419 (#10438) Added a 'habitica:update-challenge' call to mirror the 'clone-challenge' call. This properly sets the 'cloning' flag and makes things more consistent. This fixes the a bug related to #10419 described in the #10419 thread --- website/client/components/challenges/challengeDetail.vue | 6 +++--- website/client/components/challenges/challengeModal.vue | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/website/client/components/challenges/challengeDetail.vue b/website/client/components/challenges/challengeDetail.vue index 1df8dadd7b..b3744a7c2f 100644 --- a/website/client/components/challenges/challengeDetail.vue +++ b/website/client/components/challenges/challengeDetail.vue @@ -365,9 +365,9 @@ export default { this.$root.$emit('bv::show::modal', 'close-challenge-modal'); }, edit () { - // @TODO: set working challenge - this.$store.state.challengeOptions.workingChallenge = Object.assign({}, this.$store.state.challengeOptions.workingChallenge, this.challenge); - this.$root.$emit('bv::show::modal', 'challenge-modal'); + this.$root.$emit('habitica:update-challenge', { + challenge: this.challenge, + }); }, // @TODO: view members updatedChallenge (eventData) { diff --git a/website/client/components/challenges/challengeModal.vue b/website/client/components/challenges/challengeModal.vue index bcfc54d958..0b4637505b 100644 --- a/website/client/components/challenges/challengeModal.vue +++ b/website/client/components/challenges/challengeModal.vue @@ -241,6 +241,12 @@ export default { this.$store.state.challengeOptions.workingChallenge = Object.assign({}, this.$store.state.challengeOptions.workingChallenge, data.challenge); this.$root.$emit('bv::show::modal', 'challenge-modal'); }); + this.$root.$on('habitica:update-challenge', (data) => { + if (!data.challenge) return; + this.cloning = false; + this.$store.state.challengeOptions.workingChallenge = Object.assign({}, this.$store.state.challengeOptions.workingChallenge, data.challenge); + this.$root.$emit('bv::show::modal', 'challenge-modal'); + }); }, beforeDestroy () { this.$root.$off('habitica:clone-challenge'); From 65bfd74c93c0f5941c782d6cd278536e07f427dd Mon Sep 17 00:00:00 2001 From: Patricia Beier Date: Mon, 11 Jun 2018 11:59:16 +0200 Subject: [PATCH 3/5] more place for the donate button - for languages with more letters (#10417) --- website/client/components/appFooter.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/client/components/appFooter.vue b/website/client/components/appFooter.vue index e7d85d3a72..8d9db98aff 100644 --- a/website/client/components/appFooter.vue +++ b/website/client/components/appFooter.vue @@ -67,8 +67,8 @@ a.social-circle(href='https://www.facebook.com/Habitica', target='_blank') .social-icon.facebook.svg-icon(v-html='icons.facebook') .row - .col-12.col-md-10 {{ $t('donateText3') }} - .col-12.col-md-2 + .col-12.col-md-8 {{ $t('donateText3') }} + .col-12.col-md-4 button.btn.btn-contribute(@click="donate()", v-if="user") .svg-icon.heart(v-html="icons.heart") .text {{ $t('companyDonate') }} From 44f196080c17599f914ef231f9cb3ce355f6d16b Mon Sep 17 00:00:00 2001 From: Dominic Lee <34794189+dominictwlee@users.noreply.github.com> Date: Mon, 11 Jun 2018 11:00:19 +0100 Subject: [PATCH 4/5] Match tavern sidebar UI to party and guild page changes (#10400) * Match tavern sidebar UI to party and guild page changes * Remove extra space at the top of guild's sidebar --- website/client/components/groups/group.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/client/components/groups/group.vue b/website/client/components/groups/group.vue index 28436ff084..738d732f7e 100644 --- a/website/client/components/groups/group.vue +++ b/website/client/components/groups/group.vue @@ -39,7 +39,7 @@ | {{$t('groupNoNotifications')}} .col-12.col-sm-4.sidebar .row(:class='{"guild-background": !isParty}') - .col-12 + .col-12.buttons-wrapper .button-container button.btn.btn-success(class='btn-success', v-if='isLeader && !group.purchased.active', @click='upgradeGroup()') | {{ $t('upgrade') }} @@ -127,6 +127,10 @@ .sidebar { background-color: $gray-600; padding-bottom: 2em; + + } + + .buttons-wrapper { padding-top: 2.8em; } From f53400f95046eb78b1fda9f26a9d2baf9f475c6c Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Thu, 14 Jun 2018 05:37:29 -0500 Subject: [PATCH 5/5] Report: Subscriber Task Histories (#10439) * WIP(report): subscriber task histories * fix(report): old object ref, return promise, pause/resume * fix(report): handle 0 Habits 0 Dailies Also add data for master total of history entries --- .../20180607_subscriber_histories.js | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 database_reports/20180607_subscriber_histories.js diff --git a/database_reports/20180607_subscriber_histories.js b/database_reports/20180607_subscriber_histories.js new file mode 100644 index 0000000000..3acecacedf --- /dev/null +++ b/database_reports/20180607_subscriber_histories.js @@ -0,0 +1,100 @@ +import max from 'lodash/max'; +import mean from 'lodash/mean'; +import monk from 'monk'; +import round from 'lodash/round'; +import sum from 'lodash/sum'; + +/* + * Output data on subscribers' task histories, formatted for CSV. + * User ID,Count of Dailies,Count of Habits,Total History Size,Max History Size,Mean History Size,Median History Size + */ +const connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE + +let dbUsers = monk(connectionString).get('users', { castIds: false }); +let dbTasks = monk(connectionString).get('tasks', { castIds: false }); + +function usersReport () { + let allHistoryLengths = []; + + console.info('User ID,Count of Dailies,Count of Habits,Total History Size,Max History Size,Mean History Size,Median History Size'); + + dbUsers.find( + { + $and: + [ + {'purchased.plan.planId': {$ne:null}}, + {'purchased.plan.planId': {$ne:''}}, + ], + $or: + [ + {'purchased.plan.dateTerminated': null}, + {'purchased.plan.dateTerminated': ''}, + {'purchased.plan.dateTerminated': {$gt:new Date()}}, + ], + }, + { + fields: {_id: 1}, + } + ).each((user, {close, pause, resume}) => { + let historyLengths = []; + let habitCount = 0; + let dailyCount = 0; + + pause(); + return dbTasks.find( + { + userId: user._id, + $or: + [ + {type: 'habit'}, + {type: 'daily'}, + ], + }, + { + fields: { + type: 1, + history: 1, + }, + } + ).each((task) => { + if (task.type === 'habit') { + habitCount++; + } + if (task.type === 'daily') { + dailyCount++; + } + if (task.history.length > 0) { + allHistoryLengths.push(task.history.length); + historyLengths.push(task.history.length); + } + }).then(() => { + const totalHistory = sum(historyLengths); + const maxHistory = historyLengths.length > 0 ? max(historyLengths) : 0; + const meanHistory = historyLengths.length > 0 ? round(mean(historyLengths)) : 0; + const medianHistory = historyLengths.length > 0 ? median(historyLengths) : 0; + console.info(`${user._id},${dailyCount},${habitCount},${totalHistory},${maxHistory},${meanHistory},${medianHistory}`); + resume(); + }); + }).then(() => { + console.info(`Total Subscriber History Entries: ${sum(allHistoryLengths)}`); + console.info(`Largest History Size: ${max(allHistoryLengths)}`); + console.info(`Mean History Size: ${round(mean(allHistoryLengths))}`); + console.info(`Median History Size: ${median(allHistoryLengths)}`); + return process.exit(0); + }); +} + +function median(values) { // https://gist.github.com/caseyjustus/1166258 + values.sort( function(a,b) {return a - b;} ); + + var half = Math.floor(values.length/2); + + if (values.length % 2) { + return values[half]; + } + else { + return (values[half-1] + values[half]) / 2.0; + } +} + +module.exports = usersReport;