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/components/mobile_nav/mobile_nav.vue | 91 ++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 3 deletions(-)

(limited to 'src/components/mobile_nav/mobile_nav.vue')

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>
-- 
cgit v1.2.3-70-g09d2


From 0a86d39ba9cf48fc0b4fb6d91b0d5eff404b2a66 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Thu, 14 Mar 2019 20:40:56 +0200
Subject: remove notifications from sidebar, make notifications appear on login
 only

---
 src/components/mobile_nav/mobile_nav.js    | 3 +++
 src/components/mobile_nav/mobile_nav.vue   | 6 +++---
 src/components/side_drawer/side_drawer.vue | 5 -----
 3 files changed, 6 insertions(+), 8 deletions(-)

(limited to 'src/components/mobile_nav/mobile_nav.vue')

diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js
index 88fab656..fd373ac1 100644
--- a/src/components/mobile_nav/mobile_nav.js
+++ b/src/components/mobile_nav/mobile_nav.js
@@ -13,6 +13,9 @@ const MobileNav = {
     notificationsOpen: false
   }),
   computed: {
+    currentUser () {
+      return this.$store.state.users.currentUser
+    },
     unseenNotifications () {
       return unseenNotificationsFromStore(this.$store)
     },
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index af2d6d5a..cb1aaa46 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -8,18 +8,18 @@
         <router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link>
       </div>
       <div class='item right'>
-        <a href="#" class="menu-button" @click.stop.prevent="toggleMobileNotifications()">
+        <a v-if="currentUser" 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 class="mobile-notifications-header">
-        <span>Notifications</span>
+        <span>{{$t('notifications.notifications')}}</span>
         <i class="icon-cancel" @click.stop.prevent="toggleMobileNotifications()"/>
       </div>
     </div>
     <SideDrawer ref="sideDrawer" :logout="logout"/>
-    <div class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
+    <div v-if="currentUser" class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
       <Notifications ref="notifications" noHeading="true"/>
     </div>
     <MobilePostStatusModal />
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue
index 95ee21b4..27db12d7 100644
--- a/src/components/side_drawer/side_drawer.vue
+++ b/src/components/side_drawer/side_drawer.vue
@@ -20,11 +20,6 @@
             {{ $t("login.login") }}
           </router-link>
         </li>
-        <li v-if="currentUser" @click="toggleDrawer">
-          <router-link :to="{ name: 'notifications', params: { username: currentUser.screen_name } }">
-            {{ $t("notifications.notifications") }} {{ unseenNotificationsCount > 0 ? `(${unseenNotificationsCount})` : '' }}
-          </router-link>
-        </li>
         <li v-if="currentUser" @click="toggleDrawer">
           <router-link :to="{ name: 'dms', params: { username: currentUser.screen_name } }">
             {{ $t("nav.dms") }}
-- 
cgit v1.2.3-70-g09d2


From f389128e539ffce0ef552e8b67f7b6973e134baf Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Wed, 20 Mar 2019 22:09:29 +0200
Subject: make mobile notifs drawer more like an actual drawer, make mobile nav
 buttons bigger to press, fix alert dot

---
 src/components/mobile_nav/mobile_nav.vue | 97 +++++++++++++++++++-------------
 1 file changed, 59 insertions(+), 38 deletions(-)

(limited to 'src/components/mobile_nav/mobile_nav.vue')

diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index cb1aaa46..514931f0 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -1,26 +1,30 @@
 <template>
   <nav class='nav-bar container asd' id="nav">
-    <div class='inner-nav mobile-inner-nav' @click="scrollToTop()" :class="{ 'shifted': notificationsOpen }">
+    <div class='mobile-inner-nav' @click="scrollToTop()">
       <div class='item'>
-        <a href="#" class="menu-button" @click.stop.prevent="toggleMobileSidebar()">
+        <a href="#" class="mobile-nav-button" @click.stop.prevent="toggleMobileSidebar()">
           <i class="button-icon icon-menu"></i>
         </a>
         <router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link>
       </div>
       <div class='item right'>
-        <a v-if="currentUser" href="#" class="menu-button" @click.stop.prevent="toggleMobileNotifications()">
+        <a class="mobile-nav-button" v-if="currentUser" href="#" @click.stop.prevent="toggleMobileNotifications()">
           <i class="button-icon icon-bell-alt"></i>
           <div class="alert-dot" v-if="unseenNotificationsCount"></div>
         </a>
       </div>
-      <div class="mobile-notifications-header">
-        <span>{{$t('notifications.notifications')}}</span>
-        <i class="icon-cancel" @click.stop.prevent="toggleMobileNotifications()"/>
-      </div>
     </div>
     <SideDrawer ref="sideDrawer" :logout="logout"/>
-    <div v-if="currentUser" class="mobile-notifications" :class="{ 'closed': !notificationsOpen }">
-      <Notifications ref="notifications" noHeading="true"/>
+    <div v-if="currentUser" class="mobile-notifications-drawer" :class="{ 'closed': !notificationsOpen }">
+      <div class="mobile-notifications-header">
+        <span class="title">{{$t('notifications.notifications')}}</span>
+        <a class="mobile-nav-button" @click.stop.prevent="toggleMobileNotifications()">
+          <i class="button-icon icon-cancel"/>
+        </a>
+      </div>
+      <div v-if="currentUser" class="mobile-notifications">
+        <Notifications ref="notifications" noHeading="true"/>
+      </div>
     </div>
     <MobilePostStatusModal />
   </nav>
@@ -32,29 +36,17 @@
 @import '../../_variables.scss';
 
 .mobile-inner-nav {
-  transition: transform 0.25s;
-  &.shifted {
-    transform: translateX(-100%);
-  }
-}
-
-.mobile-notifications-header {
+  width: 100%;
   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 {
+.mobile-nav-button {
+  display: flex;
+  justify-content: center;
+  width: 50px;
   position: relative;
+  cursor: pointer;
 }
 
 .alert-dot {
@@ -70,17 +62,51 @@
   background-color: var(--badgeNotification, $fallback--cRed);
 }
 
-.mobile-notifications {
+.mobile-notifications-drawer {
+  width: 100%;
+  height: 100vh;
+  overflow-x: hidden;
   position: fixed;
+  top: 0;
+  left: 0;
+  box-shadow: 1px 1px 4px rgba(0,0,0,.6);
+  box-shadow: var(--panelShadow);
+  transition-property: transform;
+  transition-duration: 0.25s;
+  transform: translateX(0);
+
+  &.closed {
+    transform: translateX(100%);
+  }
+}
+
+.mobile-notifications-header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  z-index: 1;
+  width: 100%;
+  height: 50px;
+  line-height: 50px;
+  position: absolute;
+  color: var(--topBarText);
+  background-color: $fallback--fg;
+  background-color: var(--topBar, $fallback--fg);
+  box-shadow: 0px 0px 4px rgba(0,0,0,.6);
+  box-shadow: var(--topBarShadow);
+
+  .title {
+    font-size: 1.3em;
+    margin-left: 0.6em;
+  }
+}
+
+.mobile-notifications {
+  margin-top: 50px;
   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);
@@ -88,7 +114,6 @@
   background-color: var(--bg, $fallback--bg);
 
   .notifications {
-    margin: 0;
     padding: 0;
     border-radius: 0;
     box-shadow: none;
@@ -105,10 +130,6 @@
       box-shadow: none;
     }
   }
-
-  &.closed {
-    transform: translate(100%);
-  }
 }
 
 </style>
-- 
cgit v1.2.3-70-g09d2


From 85584021fb1042a8934945d73f7d25b38f1c29d1 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Sat, 23 Mar 2019 22:03:38 +0200
Subject: make notifications close on navigation

---
 src/components/mobile_nav/mobile_nav.js  | 18 +++++++++++++++---
 src/components/mobile_nav/mobile_nav.vue |  4 ++--
 2 files changed, 17 insertions(+), 5 deletions(-)

(limited to 'src/components/mobile_nav/mobile_nav.vue')

diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js
index fd373ac1..c1f5c2a9 100644
--- a/src/components/mobile_nav/mobile_nav.js
+++ b/src/components/mobile_nav/mobile_nav.js
@@ -28,9 +28,14 @@ const MobileNav = {
     toggleMobileSidebar () {
       this.$refs.sideDrawer.toggleDrawer()
     },
-    toggleMobileNotifications () {
-      this.notificationsOpen = !this.notificationsOpen
-      if (!this.notificationsOpen) {
+    openMobileNotifications () {
+      this.notificationsOpen = true
+    },
+    closeMobileNotifications () {
+      if (this.notificationsOpen) {
+        // make sure to mark notifs seen only when the notifs were open and not
+        // from close-calls.
+        this.notificationsOpen = false
         this.markNotificationsAsSeen()
       }
     },
@@ -44,6 +49,13 @@ const MobileNav = {
     markNotificationsAsSeen () {
       this.$refs.notifications.markAsSeen()
     }
+  },
+  watch: {
+    $route () {
+      // handles closing notificaitons when you press any router-link on the
+      // notifications.
+      this.closeMobileNotifications()
+    }
   }
 }
 
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index 514931f0..39622fad 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -8,7 +8,7 @@
         <router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link>
       </div>
       <div class='item right'>
-        <a class="mobile-nav-button" v-if="currentUser" href="#" @click.stop.prevent="toggleMobileNotifications()">
+        <a class="mobile-nav-button" v-if="currentUser" href="#" @click.stop.prevent="openMobileNotifications()">
           <i class="button-icon icon-bell-alt"></i>
           <div class="alert-dot" v-if="unseenNotificationsCount"></div>
         </a>
@@ -18,7 +18,7 @@
     <div v-if="currentUser" class="mobile-notifications-drawer" :class="{ 'closed': !notificationsOpen }">
       <div class="mobile-notifications-header">
         <span class="title">{{$t('notifications.notifications')}}</span>
-        <a class="mobile-nav-button" @click.stop.prevent="toggleMobileNotifications()">
+        <a class="mobile-nav-button" @click.stop.prevent="closeMobileNotifications()">
           <i class="button-icon icon-cancel"/>
         </a>
       </div>
-- 
cgit v1.2.3-70-g09d2


From c06bcf3303d89aa44ddcdad3a9d2f723303ae3d1 Mon Sep 17 00:00:00 2001
From: shpuld <shp@cock.li>
Date: Thu, 28 Mar 2019 22:54:45 +0200
Subject: add gesture to close notifications drawer

---
 src/components/mobile_nav/mobile_nav.js  | 15 +++++++++++++++
 src/components/mobile_nav/mobile_nav.vue |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

(limited to 'src/components/mobile_nav/mobile_nav.vue')

diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js
index c1f5c2a9..bc63d2ba 100644
--- a/src/components/mobile_nav/mobile_nav.js
+++ b/src/components/mobile_nav/mobile_nav.js
@@ -2,6 +2,7 @@ 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'
+import GestureService from '../../services/gesture_service/gesture_service'
 
 const MobileNav = {
   components: {
@@ -10,8 +11,16 @@ const MobileNav = {
     MobilePostStatusModal
   },
   data: () => ({
+    notificationsCloseGesture: undefined,
     notificationsOpen: false
   }),
+  created () {
+    this.notificationsCloseGesture = GestureService.swipeGesture(
+      GestureService.DIRECTION_RIGHT,
+      this.closeMobileNotifications,
+      50
+    )
+  },
   computed: {
     currentUser () {
       return this.$store.state.users.currentUser
@@ -39,6 +48,12 @@ const MobileNav = {
         this.markNotificationsAsSeen()
       }
     },
+    notificationsTouchStart (e) {
+      GestureService.beginSwipe(e, this.notificationsCloseGesture)
+    },
+    notificationsTouchMove (e) {
+      GestureService.updateSwipe(e, this.notificationsCloseGesture)
+    },
     scrollToTop () {
       window.scrollTo(0, 0)
     },
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
index 39622fad..5fa41638 100644
--- a/src/components/mobile_nav/mobile_nav.vue
+++ b/src/components/mobile_nav/mobile_nav.vue
@@ -1,5 +1,5 @@
 <template>
-  <nav class='nav-bar container asd' id="nav">
+  <nav class='nav-bar container' id="nav">
     <div class='mobile-inner-nav' @click="scrollToTop()">
       <div class='item'>
         <a href="#" class="mobile-nav-button" @click.stop.prevent="toggleMobileSidebar()">
@@ -15,7 +15,12 @@
       </div>
     </div>
     <SideDrawer ref="sideDrawer" :logout="logout"/>
-    <div v-if="currentUser" class="mobile-notifications-drawer" :class="{ 'closed': !notificationsOpen }">
+    <div v-if="currentUser"
+      class="mobile-notifications-drawer"
+      :class="{ 'closed': !notificationsOpen }"
+      @touchstart="notificationsTouchStart"
+      @touchmove="notificationsTouchMove"
+    >
       <div class="mobile-notifications-header">
         <span class="title">{{$t('notifications.notifications')}}</span>
         <a class="mobile-nav-button" @click.stop.prevent="closeMobileNotifications()">
-- 
cgit v1.2.3-70-g09d2

