Added counts to each category

Counts update on certain events and show or hide various elements
Fixed various little ui element issues

fixes #6
This commit is contained in:
Max G
2020-02-11 21:11:14 +00:00
parent c903bcbcd1
commit 771b739c37
14 changed files with 169 additions and 39 deletions

View File

@@ -3,21 +3,39 @@
<div class="ui grid" :class="{ 'mush-it-up':showOneColumn() }" ref="content">
<div v-if="!$store.getters.getIsUserOnMobile"
:class="{ 'sixteen wide column':showOneColumn(), 'twelve wide column':!showOneColumn() }">
<div v-if="!$store.getters.getIsUserOnMobile" class="sixteen wide column">
<!-- :class="{ 'sixteen wide column':showOneColumn(), 'sixteen wide column':!showOneColumn() }" -->
<div class="ui grid">
<div class="eight wide column">
<search-input></search-input>
</div>
<div class="eight wide column">
<div class="ui basic button" v-on:click="updateFastFilters(3)" v-if="$store.getters.totals && $store.getters.totals['sharedToNotes'] > 0" style="position: relative;">
<i class="green mail icon"></i>Inbox
<span class="floating ui green label" v-if="$store.getters.totals['unreadNotes'] > 0">
{{ $store.getters.totals['unreadNotes'] }}
</span>
</div>
<div class="ui basic button" v-on:click="updateFastFilters(2)" v-if="$store.getters.totals && $store.getters.totals['archivedNotes'] > 0">
<i class="green archive icon"></i>Archived
<!-- <span>{{ $store.getters.totals['archivedNotes'] }}</span> -->
</div>
</div>
<div class="eight wide column" v-if="showClear">
<!-- <fast-filters /> -->
<span class="ui fluid green button"
v-if="showClear"
@click="reset">
<i class="arrow circle left icon"></i>Back to All Notes
</span>
</div>
</div>
</div>
@@ -64,7 +82,7 @@
<!-- pinned notes -->
<div v-if="containsPinnednotes > 0" class="note-card-section">
<!-- ({{containsPinnednotes}}) -->
<h4><i class="green pin icon"></i>Pinned <span v-if="!working"></span></h4>
<h4><i class="green pin icon"></i>Pinned</h4>
<div class="note-card-display-area">
<note-title-display-card
v-for="note in notes"
@@ -80,7 +98,7 @@
<!-- normal notes -->
<div v-if="containsNormalNotes > 0" class="note-card-section">
<!-- ({{containsNormalNotes}}) -->
<h4><i class="green file icon"></i>Notes <span v-if="!working"></span></h4>
<h4><i class="green file icon"></i>Notes</h4>
<div class="note-card-display-area">
<note-title-display-card
v-for="note in notes"
@@ -194,9 +212,16 @@
this.$parent.loginGateway()
this.$bus.$on('close_active_note', ({position, noteId}) => {
//Update totals for app
this.$store.dispatch('fetchAndUpdateUserTotals')
this.$bus.$on('close_active_note', ({position, noteId, modified}) => {
this.closeNote(position)
this.updateSingleNote(noteId)
this.$store.dispatch('fetchAndUpdateUserTotals')
if(modified){
this.updateSingleNote(noteId)
}
})
this.$bus.$on('note_deleted', (noteId) => {
//Remove deleted note from set, its deleted
@@ -265,6 +290,7 @@
// this.$bus.$off()
},
mounted() {
//Loads initial batch and tags
this.reset()
},
@@ -634,6 +660,31 @@
resolve(data)
})
})
},
updateFastFilters(index){
//clear out tags
this.searchTags = []
//A little hacky, brings user to notes page then filters on click
if(this.$route.name != 'NotesPage'){
this.$router.push('/notes')
setTimeout( () => {
this.updateFastFilters(index)
}, 500 )
}
const options = [
'withLinks', // 'Only Show Notes with Links'
'withTags', // 'Only Show Notes with Tags'
'onlyArchived', //'Only Show Archived Notes'
'onlyShowSharedNotes', //Only show shared notes
]
let filter = {}
filter[options[index]] = 1
this.$bus.$emit('update_fast_filters', filter)
}
}
}