Skip to content

Commit

Permalink
emails
Browse files Browse the repository at this point in the history
  • Loading branch information
ronan18 committed Apr 24, 2020
1 parent ee6e3b5 commit a9d4bed
Show file tree
Hide file tree
Showing 8 changed files with 437 additions and 21 deletions.
8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"dependencies": {
"core-js": "^3.6.4",
"firebase": "^7.14.1",
"js-search": "^2.0.0",
"minireset.css": "0.0.6",
"moment": "^2.24.0",
"sweetalert": "^2.1.2",
"vue": "^2.6.11",
"vue-router": "^3.1.6",
Expand Down
86 changes: 71 additions & 15 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
<h1 class="heading">Hyphen-Hacks 2020</h1>
</div>
<router-link class="nav__link" :class="{active: $route.path == '/'}" to="/">Statistics</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/review'}" to="/review">Applications in review</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/review'}" to="/review">Applications in review
<span class="notification" v-if="$store.getters.applications.length > 0"><i class="fas fa-bell"></i>{{$store.getters.applications.length}}</span></router-link>
<router-link class="nav__link" :class="{active: $route.path == '/mentors'}" to="/mentors">Mentors</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/attendees'}" to="/attendees">Attendees</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/volunteers'}" to="/volunteers">Volunteers</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/notifications'}" to="/notifications">Notifications</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/schedule'}" to="/schedule">Schedule</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/attendees'}" to="/attendees">Attendees
</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/volunteers'}" to="/volunteers">Volunteers
</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/notifications'}" to="/notifications">
Notifications
</router-link>
<router-link class="nav__link" :class="{active: $route.path == '/schedule'}" to="/schedule">Schedule
</router-link>
<div class="nav__user">
<p class="bold">{{user.displayName}}</p>
<p>{{user.email}}</p>
Expand All @@ -25,9 +31,12 @@
<div class="card">
<h1 class="heading">Login</h1>
<p>Please login to access the Hyphen-Hacks 2020 Admin Dashboard</p>
<p>For security reasons, please use your Hyphen-Hacks email address. If you need help signing in please email Ronan
<p>For security reasons, please use your Hyphen-Hacks email address. If you need help signing in please email
Ronan
<a href="mailto:[email protected]">[email protected]</a></p>
<p>Non Hyphen-Hacks team members need to be authorized directly, please email <a href="mailto:[email protected]">Ronan</a> from the email you would like authorized. (this can take up to 24 hours)</p>
<p>Non Hyphen-Hacks team members need to be authorized directly, please email <a
href="mailto:[email protected]">Ronan</a> from the email you would like authorized. (this can
take up to 24 hours)</p>
<button @click="login" class="btn mt-1"><i class="fa fa-google"></i>Login With Google</button>
</div>

Expand All @@ -51,21 +60,22 @@
</div>
<div class="loader__row">

<p>Something not working right? Get tech support <a href="mailto:[email protected]">[email protected]</a></p>
<p>Something not working right? Get tech support <a href="mailto:[email protected]">[email protected]</a>
</p>
</div>

</div>

</div>
</template>
<script>
let focus, blur, tokenRefresh
export default {
name: "App Container",
name: "AppContainer",
data() {
return {
version: require("../package").version,
firebaseLoaded: false,
version: require("../package").version,
firebaseLoaded: false,
noAccess: false
}
},
Expand All @@ -75,6 +85,24 @@ firebaseLoaded: false,
}
},
methods: {
loadBasicData() {
if (this.$route.path != "/review") {
fetch(this.$store.getters.api + "/api/v1/admin/applications", {
method: "get",
headers: {
"Authorization": this.$store.getters.token
}
}).then(async res => {
let json = await res.json()
console.log(json, res.status)
if (json.applicants) {
this.$store.commit("applications", json.applicants)
}
})
}
},
login() {
var provider = new this.$firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({
Expand All @@ -87,16 +115,43 @@ firebaseLoaded: false,
}
},
mounted() {
this.$firebase.auth().onAuthStateChanged((user) =>{
this.firebaseLoaded = true
let getToken = (trig) => {
console.log('token trigger', trig)
if (this.$firebase.currentUser) {
this.$firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then((idToken) => {
this.$store.commit("token", idToken)
})
}
}
this.$firebase.auth().onAuthStateChanged((user) => {
if (user) {
// User is signed in.
let email = user.email
console.log(email.endsWith("hyphen-hacks.com"))
if (email.endsWith("hyphen-hacks.com")) {
this.$store.commit("user", user)
this.$firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then((idToken) => {
// Send token to your backend via HTTPS
// ...
this.$store.commit("user", user)
this.$store.commit("token", idToken)
this.firebaseLoaded = true
tokenRefresh = window.setInterval(getToken("interval"), 900000)
focus = window.addEventListener("focus", getToken("focus"), false);
blur = window.addEventListener("blur", getToken("blur"), false);
this.loadBasicData()
}).catch(function (error) {
// Handle error
});
} else {
this.$store.commit("user", false)
this.firebaseLoaded = true
this.noAccess = true
console.log("no acess")
this.$swal({
Expand All @@ -107,6 +162,7 @@ firebaseLoaded: false,
}
} else {
this.$store.commit("user", false)
this.firebaseLoaded = true
// No user is signed in.
}
});
Expand Down
132 changes: 130 additions & 2 deletions src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@ html, body, #app, .app__container {

.nav__link {
@include transition;

color: $text;
font-weight: bold;
display: block;
display: flex;
padding: $spacing;
text-decoration: none;

&:hover {
background: $bg--hover;
}

.notification {
margin-left: auto;
color: $brand;

i {
margin-right: 0.5rem;
}
}
}

.nav__link.active {
Expand All @@ -63,14 +73,17 @@ html, body, #app, .app__container {

}
}

.columns {
display: grid;
grid-template-columns: auto 25rem;

.column {
@include shadow;
background: $bg;
}
}

.page {
padding: $spacing;
height: 100vh;
Expand All @@ -81,9 +94,11 @@ html, body, #app, .app__container {
display: flex;
justify-content: center;
align-items: center;

.card {
max-width: 500px;
}

h1 {
margin-bottom: 1rem;
}
Expand All @@ -103,6 +118,7 @@ html, body, #app, .app__container {
}
}
}

.loader--full {
position: fixed;
width: 100vw;
Expand All @@ -111,13 +127,125 @@ html, body, #app, .app__container {
display: grid;
z-index: 99999999;
grid-template-rows: 1fr 1fr 1fr;

.loader__row {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.sk-cube-grid {
margin-bottom: 1rem;
}
}
}

.searchBox {
@include card;

.searchRow {
display: flex;

input {
width: 100%;
margin-right: 1rem;
}

select {
padding-right: 2vw;
}
}

.reviewHeader {
display: grid;
padding-top: 2rem;
grid-template-columns: 2fr 1.75fr 1fr 1fr;

.right {
text-align: right;
}

}

}

.people {
height: 87%;
width: 100%;
overflow-y: scroll;
}

.appliedPerson {
@include card;
@include transition;
margin: 1rem 0;
display: grid;
grid-template-columns: 2fr 1.75fr 1fr 1fr;

.right {
text-align: right;
}
}

.appliedPerson:hover {
@include card--hover;
}

.column {
display: flex;
flex-direction: column;
padding: $spacing;
height: 100vh;
overflow-y: hidden;
scroll-behavior: smooth;

.name {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 2rem;
padding-bottom: $spacing;
border-bottom: 1px solid $text;
}

.sectionTitle {
margin-top: 2rem;
font-weight: bold;
}

.appData {
overflow-y: scroll;
}

.info {
margin: 0.5rem 0;
span {
font-weight: bold;
}
}

.question {
margin: 0.5rem 0;
span {
font-weight: bold;
display: block;
}
}

.actions {
margin-top: auto;

button {
margin-top: 1rem;
width: 100%;
}

}
}

.column.empty {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
Loading

0 comments on commit a9d4bed

Please sign in to comment.