Преглед изворни кода

Added WhatIsNew Component with localStorage capabilities. Discussion needed to figure out how we call the newModal.

theflametrooper пре 8 година
родитељ
комит
cceb495108
3 измењених фајлова са 105 додато и 2 уклоњено
  1. 5 1
      frontend/App.vue
  2. 99 0
      frontend/components/WhatIsNew.vue
  3. 1 1
      frontend/components/pages/Home.vue

+ 5 - 1
frontend/App.vue

@@ -1,10 +1,13 @@
 <template>
 	<div>
 		<router-view></router-view>
+		<what-is-new></what-is-new>
 	</div>
 </template>
 
 <script>
+	import WhatIsNew from './components/WhatIsNew.vue';
+
 	export default {
 		replace: false,
 		data() {
@@ -82,6 +85,7 @@
 					//this.stations.find(station => station.id === id).users = result.userCount;
 				});
 			}
-		}
+		},
+		components: { WhatIsNew }
 	}
 </script>

+ 99 - 0
frontend/components/WhatIsNew.vue

@@ -0,0 +1,99 @@
+<template>
+	<div class="modal" :class="{ 'is-active': isModalActive }">
+		<div class="modal-background"></div>
+		<div class="modal-card">
+			<header class="modal-card-head">
+				<p class="modal-card-title"><strong>What's new</strong> (Nov 23, 2016)</p>
+				<button class="delete" @click="toggleModal()"></button>
+			</header>
+			<section class="modal-card-body">
+				<div class="sect">
+					<div class="sect-head-success">Improvements</div>
+					<ul class="sect-body">
+						<li>Lorem ipsum dolor sit amet, consectetur adipisicing.</li>
+						<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium cum molestias minima saepe, iure aperiam quo necessitatibus quod?</li>
+						<li>Lorem ipsum dolor sit amet, consectetur.</li>
+					</ul>
+				</div>
+				<div class="sect">
+					<div class="sect-head-bugs">Bugs Smashed</div>
+					<ul class="sect-body">
+						<li>Lorem ipsum dolor sit amet, consectetur adipisicing.</li>
+						<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium cum molestias minima saepe, iure aperiam quo necessitatibus quod?</li>
+						<li>Lorem ipsum dolor sit amet, consectetur.</li>
+					</ul>
+				</div>
+			</section>
+		</div>
+	</div>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				isModalActive: false
+			}
+		},
+		ready: function () {
+			// TODO: Setup so we can call this modal from anywhere and we can specify the values of everything when calling it. This should also get the improvements, bugs, date etc. to include in the modal.
+			// In future we will receive a date, if that date is newer than the one stored in localStorage, we will show modal, and then save that date to localStorage (how we keep track of which modal has been showed)
+			const data = {
+				date: 1479935887670
+			};
+
+			if (localStorage.getItem("whatIsNew")) {
+				if (localStorage.getItem("whatIsNew") < data.date) this.isModalActive = true;
+			} else {
+				localStorage.setItem("whatIsNew", data.date);
+				this.isModalActive = true;
+			}
+		},
+		methods: {
+			toggleModal: function () {
+				this.isModalActive = !this.isModalActive;
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.modal-card-head {
+		border-bottom: none;
+		background-color: ghostwhite;
+		padding: 15px;
+	}
+
+	.modal-card-title {
+		font-size: 14px;
+	}
+
+	.delete {
+		background: transparent;
+		&:hover { background: transparent; }
+
+		&:before, &:after {
+			background-color: #bbb;
+		}
+	}
+
+	.sect {
+		div[class^='sect-head'], div[class*=' sect-head']{
+			padding: 15px;
+			text-transform: uppercase;
+			font-weight: bold;
+			color: #fff;
+		}
+
+		.sect-head-success { background-color: seagreen; }
+		.sect-head-bugs { background-color: brown; }
+
+		.sect-body {
+			padding: 25px;
+
+			li {
+				list-style-type: disc;
+			}
+		}
+	}
+</style>

+ 1 - 1
frontend/components/pages/Home.vue

@@ -142,7 +142,7 @@
 
 	@import 'theme.scss';
 
-	* { box-sizing: border-box; font-family: Roboto, sans-serif; }
+	* { box-sizing: border-box; }
 
 	html {
 		width: 100%;