From 1d3b1ac934e5dacb05d227ddc1ab0cbd8e16e169 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Sat, 2 Mar 2019 16:57:32 +0200
Subject: start working on one tap notifications

---
 src/App.vue | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index acbbeb75..aad84804 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -10,7 +10,6 @@
         <div class='item'>
           <a href="#" class="menu-button" @click.stop.prevent="toggleMobileSidebar()">
             <i class="button-icon icon-menu"></i>
-            <div class="alert-dot" v-if="unseenNotificationsCount"></div>
           </a>
           <router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link>
         </div>
@@ -18,11 +17,18 @@
           <user-finder class="button-icon nav-icon mobile-hidden" @toggled="onFinderToggled"></user-finder>
           <router-link class="mobile-hidden" :to="{ name: 'settings'}"><i class="button-icon icon-cog nav-icon" :title="$t('nav.preferences')"></i></router-link>
           <a href="#" class="mobile-hidden" v-if="currentUser" @click.prevent="logout"><i class="button-icon icon-logout nav-icon" :title="$t('login.logout')"></i></a>
+          <a href="#" class="menu-button" @click.stop.prevent="toggleMobileNotifications()">
+            <i class="button-icon icon-bell-alt"></i>
+            <div class="alert-dot" v-if="unseenNotificationsCount"></div>
+          </a>
         </div>
       </div>
     </nav>
     <div v-if="" class="container" id="content">
       <side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
+      <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
+        <notifications/>
+      </div>
       <div class="sidebar-flexer mobile-hidden">
         <div class="sidebar-bounds">
           <div class="sidebar-scroller">
-- 
cgit v1.2.3-70-g09d2


From c7e180080afd0e255e439030df800f79d33ff5de Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
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.vue')

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 @@
       </div>
     </nav>
     <div v-if="" class="container" id="content">
-      <side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
-      <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-        <notifications/>
+      <div v-if="isMobileLayout">
+        <side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
+        <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
+          <notifications/>
+        </div>
       </div>
-      <div class="sidebar-flexer mobile-hidden">
+      <div class="sidebar-flexer mobile-hidden" v-if="!isMobileLayout">
         <div class="sidebar-bounds">
           <div class="sidebar-scroller">
             <div class="sidebar">
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 53ecc083..ad72ce04 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -5,6 +5,9 @@ import routes from './routes'
 import App from '../App.vue'
 
 const afterStoreSetup = ({ store, i18n }) => {
+  const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
+  store.dispatch('setMobileLayout', width <= 800)
+
   window.fetch('/api/statusnet/config.json')
     .then((res) => res.json())
     .then((data) => {
diff --git a/src/modules/interface.js b/src/modules/interface.js
index 956c9cb3..71554787 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -11,7 +11,8 @@ const defaultState = {
       window.CSS.supports('filter', 'drop-shadow(0 0)') ||
       window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
     )
-  }
+  },
+  mobileLayout: false
 }
 
 const interfaceMod = {
@@ -31,6 +32,9 @@ const interfaceMod = {
     },
     setNotificationPermission (state, permission) {
       state.notificationPermission = permission
+    },
+    setMobileLayout (state, value) {
+      state.mobileLayout = value
     }
   },
   actions: {
@@ -42,6 +46,10 @@ const interfaceMod = {
     },
     setNotificationPermission ({ commit }, permission) {
       commit('setNotificationPermission', permission)
+    },
+    setMobileLayout ({ commit }, value) {
+      console.log('setMobileLayout called')
+      commit('setMobileLayout', value)
     }
   }
 }
-- 
cgit v1.2.3-70-g09d2


From f19284357e94968cdc9d4034c5e33ef9d6f6d9d7 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Thu, 14 Mar 2019 17:46:04 +0200
Subject: make nav bar slide, move mobile post status to mobile nav

---
 src/App.scss                                   | 72 --------------------
 src/App.vue                                    |  7 --
 src/components/mobile_nav/mobile_nav.js        | 14 +++-
 src/components/mobile_nav/mobile_nav.vue       | 91 +++++++++++++++++++++++++-
 src/components/notifications/notifications.js  |  3 +
 src/components/notifications/notifications.vue |  2 +-
 6 files changed, 105 insertions(+), 84 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.scss b/src/App.scss
index 8f727cf8..539c9787 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -484,24 +484,6 @@ nav {
   }
 }
 
-.menu-button {
-  display: none;
-  position: relative;
-}
-
-.alert-dot {
-  border-radius: 100%;
-  height: 8px;
-  width: 8px;
-  position: absolute;
-  left: calc(50% - 4px);
-  top: calc(50% - 4px);
-  margin-left: 6px;
-  margin-top: -6px;
-  background-color: $fallback--cRed;
-  background-color: var(--badgeNotification, $fallback--cRed);
-}
-
 .fade-enter-active, .fade-leave-active {
   transition: opacity .2s
 }
@@ -530,20 +512,6 @@ nav {
   display: none;
 }
 
-.panel-switcher {
-  display: none;
-  width: 100%;
-  height: 46px;
-
-  button {
-    display: block;
-    flex: 1;
-    max-height: 32px;
-    margin: 0.5em;
-    padding: 0.5em;
-  }
-}
-
 @media all and (min-width: 800px) {
   body {
     overflow-y: scroll;
@@ -671,46 +639,6 @@ nav {
   border-radius: var(--inputRadius, $fallback--inputRadius);
 }
 
-.mobile-notifications {
-  position: fixed;
-  width: 100vw;
-  height: 100vh;
-  top: calc(50px - 28px - 1.2em);
-  left: 0;
-  z-index: 999;
-  overflow-x: hidden;
-  overflow-y: scroll;
-  transition-property: transform;
-  transition-duration: 0.25s;
-  transform: translate(0);
-
-  background-color: $fallback--bg;
-  background-color: var(--bg, $fallback--bg);
-
-  .notifications {
-    margin: 0;
-    padding: 0;
-    border-radius: 0;
-    box-shadow: none;
-    .panel {
-      border-radius: 0;
-      margin: 0;
-      box-shadow: none;
-    }
-    .panel:after {
-      border-radius: 0;
-    }
-    .panel .panel-heading {
-      border-radius: 0;
-      box-shadow: none;
-    }
-  }
-
-  &.closed {
-    transform: translate(100%);
-  }
-}
-
 @keyframes modal-background-fadein {
   from {
     background-color: rgba(0, 0, 0, 0);
diff --git a/src/App.vue b/src/App.vue
index 54155831..3b8623ad 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -46,13 +46,6 @@
       <media-modal></media-modal>
     </div>
     <chat-panel :floating="true" v-if="currentUser && chat" class="floating-chat mobile-hidden"></chat-panel>
-    <div v-if="isMobileLayout">
-      <side-drawer ref="sideDrawer" :logout="logout"></side-drawer>
-      <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-        <notifications/>
-      </div>
-    </div>
-    <MobilePostStatusModal />
   </div>
 </template>
 
diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js
index a79aa636..88fab656 100644
--- a/src/components/mobile_nav/mobile_nav.js
+++ b/src/components/mobile_nav/mobile_nav.js
@@ -1,11 +1,13 @@
 import SideDrawer from '../side_drawer/side_drawer.vue'
 import Notifications from '../notifications/notifications.vue'
+import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue'
 import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
 
 const MobileNav = {
   components: {
     SideDrawer,
-    Notifications
+    Notifications,
+    MobilePostStatusModal
   },
   data: () => ({
     notificationsOpen: false
@@ -25,9 +27,19 @@ const MobileNav = {
     },
     toggleMobileNotifications () {
       this.notificationsOpen = !this.notificationsOpen
+      if (!this.notificationsOpen) {
+        this.markNotificationsAsSeen()
+      }
     },
     scrollToTop () {
       window.scrollTo(0, 0)
+    },
+    logout () {
+      this.$router.replace('/main/public')
+      this.$store.dispatch('logout')
+    },
+    markNotificationsAsSeen () {
+      this.$refs.notifications.markAsSeen()
     }
   }
 }
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index 8f682c39..af2d6d5a 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -1,6 +1,6 @@
 <template>
-  <nav class='nav-bar container' @click="scrollToTop()" id="nav">
-    <div class='inner-nav'>
+  <nav class='nav-bar container asd' id="nav">
+    <div class='inner-nav mobile-inner-nav' @click="scrollToTop()" :class="{ 'shifted': notificationsOpen }">
       <div class='item'>
         <a href="#" class="menu-button" @click.stop.prevent="toggleMobileSidebar()">
           <i class="button-icon icon-menu"></i>
@@ -13,17 +13,102 @@
           <div class="alert-dot" v-if="unseenNotificationsCount"></div>
         </a>
       </div>
+      <div class="mobile-notifications-header">
+        <span>Notifications</span>
+        <i class="icon-cancel" @click.stop.prevent="toggleMobileNotifications()"/>
+      </div>
     </div>
     <SideDrawer ref="sideDrawer" :logout="logout"/>
     <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-      <Notifications/>
+      <Notifications ref="notifications" noHeading="true"/>
     </div>
+    <MobilePostStatusModal />
   </nav>
 </template>
 
 <script src="./mobile_nav.js"></script>
 
 <style lang="scss">
+@import '../../_variables.scss';
+
+.mobile-inner-nav {
+  transition: transform 0.25s;
+  &.shifted {
+    transform: translateX(-100%);
+  }
+}
+
+.mobile-notifications-header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  width: calc(100% - 1.6em);
+  height: 100%;
+  margin: 0 0.8em 0 0.8em;
+  position: absolute;
+  font-size: 1.3em;
+  color: $fallback--text;
+  color: var(--text, $fallback--text);
+  top: 0;
+  left: 100%;
+}
+
+.menu-button {
+  position: relative;
+}
+
+.alert-dot {
+  border-radius: 100%;
+  height: 8px;
+  width: 8px;
+  position: absolute;
+  left: calc(50% - 4px);
+  top: calc(50% - 4px);
+  margin-left: 6px;
+  margin-top: -6px;
+  background-color: $fallback--cRed;
+  background-color: var(--badgeNotification, $fallback--cRed);
+}
+
+.mobile-notifications {
+  position: fixed;
+  width: 100vw;
+  height: calc(100vh - 50px);
+  top: 50px;
+  left: 0;
+  overflow-x: hidden;
+  overflow-y: scroll;
+  transition-property: transform;
+  transition-duration: 0.25s;
+  transform: translate(0);
+
+  color: $fallback--text;
+  color: var(--text, $fallback--text);
+  background-color: $fallback--bg;
+  background-color: var(--bg, $fallback--bg);
+
+  .notifications {
+    margin: 0;
+    padding: 0;
+    border-radius: 0;
+    box-shadow: none;
+    .panel {
+      border-radius: 0;
+      margin: 0;
+      box-shadow: none;
+    }
+    .panel:after {
+      border-radius: 0;
+    }
+    .panel .panel-heading {
+      border-radius: 0;
+      box-shadow: none;
+    }
+  }
 
+  &.closed {
+    transform: translate(100%);
+  }
+}
 
 </style>
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index 9fc5e38a..d3db4b29 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -7,6 +7,9 @@ import {
 } from '../../services/notification_utils/notification_utils.js'
 
 const Notifications = {
+  props: [
+    'noHeading'
+  ],
   created () {
     const store = this.$store
     const credentials = store.state.users.currentUser.credentials
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 6f162b62..634a03ac 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="notifications">
     <div class="panel panel-default">
-      <div class="panel-heading">
+      <div v-if="!noHeading" class="panel-heading">
         <div class="title">
           {{$t('notifications.notifications')}}
           <span class="badge badge-notification unseen-count" v-if="unseenCount">{{unseenCount}}</span>
-- 
cgit v1.2.3-70-g09d2

