From 1d3b1ac934e5dacb05d227ddc1ab0cbd8e16e169 Mon Sep 17 00:00:00 2001 From: shpuld Date: Sat, 2 Mar 2019 16:57:32 +0200 Subject: start working on one tap notifications --- src/App.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/App.js') diff --git a/src/App.js b/src/App.js index 214e0f48..5e5b6eea 100644 --- a/src/App.js +++ b/src/App.js @@ -26,6 +26,7 @@ export default { }, data: () => ({ mobileActivePanel: 'timeline', + notificationsOpen: false, finderHidden: true, supportsMask: window.CSS && window.CSS.supports && ( window.CSS.supports('mask-size', 'contain') || @@ -101,6 +102,9 @@ export default { }, toggleMobileSidebar () { this.$refs.sideDrawer.toggleDrawer() + }, + toggleMobileNotifications () { + this.notificationsOpen = !this.notificationsOpen } } } -- cgit v1.2.3-70-g09d2 From c7e180080afd0e255e439030df800f79d33ff5de Mon Sep 17 00:00:00 2001 From: shpuld Date: Sun, 3 Mar 2019 16:33:40 +0200 Subject: more work with notifications drawer --- src/App.js | 14 +++++++++++++- src/App.scss | 2 +- src/App.vue | 10 ++++++---- src/boot/after_store.js | 3 +++ src/modules/interface.js | 10 +++++++++- 5 files changed, 32 insertions(+), 7 deletions(-) (limited to 'src/App.js') diff --git a/src/App.js b/src/App.js index 5e5b6eea..b6234a08 100644 --- a/src/App.js +++ b/src/App.js @@ -39,6 +39,10 @@ export default { created () { // Load the locale from the storage this.$i18n.locale = this.$store.state.config.interfaceLanguage + window.addEventListener('resize', this.updateMobileState) + }, + destroyed () { + window.removeEventListener('resize', this.updateMobileState) }, computed: { currentUser () { return this.$store.state.users.currentUser }, @@ -87,7 +91,8 @@ export default { unseenNotificationsCount () { return this.unseenNotifications.length }, - showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel } + showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, + isMobileLayout () { return this.$store.state.interface.mobileLayout } }, methods: { scrollToTop () { @@ -105,6 +110,13 @@ export default { }, toggleMobileNotifications () { this.notificationsOpen = !this.notificationsOpen + }, + updateMobileState () { + const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth + const changed = width <= 800 !== this.isMobileLayout + if (changed) { + this.$store.dispatch('setMobileLayout', width <= 800) + } } } } diff --git a/src/App.scss b/src/App.scss index 3edc41a0..775bc1c8 100644 --- a/src/App.scss +++ b/src/App.scss @@ -667,7 +667,7 @@ nav { height: 100vh; top: 50px; left: 0; - z-index: 1001; + z-index: 9; overflow-x: hidden; overflow-y: scroll; transition-property: transform; diff --git a/src/App.vue b/src/App.vue index aad84804..d83d5dbe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -25,11 +25,13 @@
- -
- +
+ +
+ +
-
diff --git a/src/components/user_reporting_modal/user_reporting_modal.js b/src/components/user_reporting_modal/user_reporting_modal.js new file mode 100644 index 00000000..fb9ea16d --- /dev/null +++ b/src/components/user_reporting_modal/user_reporting_modal.js @@ -0,0 +1,81 @@ + +import Status from '../status/status.vue' +import Checkbox from '../checkbox/checkbox.js' + +const UserReportingModal = { + components: { + Status, + Checkbox + }, + data () { + return { + comment: '', + forward: false, + statusIdsToReport: [] + } + }, + computed: { + isLoggedIn () { + return !!this.$store.state.users.currentUser + }, + isOpen () { + return this.isLoggedIn && this.$store.state.reports.modalActivated + }, + userId () { + return this.$store.state.reports.userId + }, + user () { + return this.$store.getters.findUser(this.userId) + }, + remoteInstance () { + return !this.user.is_local && this.user.screen_name.substr(this.user.screen_name.indexOf('@') + 1) + }, + statuses () { + return this.$store.state.reports.statuses + } + }, + watch: { + userId (value) { + this.statusIdsToReport = [] + } + }, + methods: { + closeModal () { + this.$store.dispatch('closeUserReportingModal') + }, + reportUser () { + const payload = { + comment: this.comment, + forward: this.forward, + statusIdsToReport: this.statusIdsToReport + } + this.$store.dispatch('reportUser', payload) + }, + isChecked (statusId) { + return this.statusIdsToReport.indexOf(statusId) !== -1 + }, + toggleStatus (checked, statusId) { + if (checked === this.isChecked(statusId)) { + return + } + + if (checked) { + this.statusIdsToReport.push(statusId) + } else { + this.statusIdsToReport.splice(this.statusIdsToReport.indexOf(statusId), 1) + } + }, + resize (e) { + const target = e.target || e + if (!(target instanceof window.Element)) { return } + // Auto is needed to make textbox shrink when removing lines + target.style.height = 'auto' + target.style.height = `${target.scrollHeight}px` + if (target.value === '') { + target.style.height = null + } + } + } +} + +export default UserReportingModal diff --git a/src/components/user_reporting_modal/user_reporting_modal.vue b/src/components/user_reporting_modal/user_reporting_modal.vue new file mode 100644 index 00000000..49839da3 --- /dev/null +++ b/src/components/user_reporting_modal/user_reporting_modal.vue @@ -0,0 +1,111 @@ +