Skip to content

Commit

Permalink
show important update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lok committed Oct 17, 2020
1 parent c55c10b commit 64abf4a
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global __static */

import {app, BrowserWindow, Menu, protocol} from 'electron';
import {createProtocol, installVueDevtools} from 'vue-cli-plugin-electron-builder/lib';
import {createProtocol, } from 'vue-cli-plugin-electron-builder/lib';
import windowRepository from './windowRepository';
import installExtension from 'electron-devtools-installer';

Expand Down Expand Up @@ -94,10 +94,9 @@ app.on('activate', () => {
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
installExtension('nhdogjmejiglipccpnnnanhbledajbpd')
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
createWindow();

});

// Exit cleanly on request from parent process in development mode.
Expand Down
2 changes: 1 addition & 1 deletion src/components/board/BoardContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
if (!item.isDone) {
return true;
}
return this.board.showDone;
return this.board.showDone && this.board.showImportant;
},
scheduleScroll (itemId) {
setTimeout(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/components/board/boardSettingsBar/BoardSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
<div class="board-settings">
<Find-item :isDisabled="isDisabled"/>
<ShowDoneButton :isDisabled="isDisabled"/>
<ShowImportantButton :isDisabled="isDisabled"/>
<ShowProgressBtn :isDisabled="isDisabled"/>
</div>
</template>

<script>
import ShowDoneButton from './ShowDoneButton'
import ShowImportantButton from './ShowImportantButton'
import ShowProgressBtn from './ShowProgressBtn'
import FindItem from './FilterItems'
Expand All @@ -17,6 +19,7 @@
components: {
FindItem,
ShowProgressBtn,
ShowImportantButton,
ShowDoneButton
}
}
Expand Down
39 changes: 39 additions & 0 deletions src/components/board/boardSettingsBar/ShowImportantButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div class="showImportantButton">
<Checkbox :value="showImportant"
:disabled="isDisabled"
size="small"
@on-change="switchShowImportant">
<span>show important</span>
</Checkbox>
</div>

</template>

<script>
export default {
name: 'ShowImportantButton',
props: ['isDisabled'],
methods: {
switchShowImportant () {
this.$store.dispatch('switchShowImportant',
{
boardId: this.$store.state.boards.activeBoard.id,
showImportant: !this.showImportant
});
this.$bus.$emit('focusOnAddItem');
}
},
computed: {
showImportant () {
return this.$store.state.boards.activeBoard.showImportant
}
}
}
</script>

<style scoped>
.showImportantButton {
user-select: none;
}
</style>
4 changes: 1 addition & 3 deletions src/components/board/item/ActionButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
props: ['isImportant'],
data(){
return{
localisImportant: this.isImportant
}
},
methods: {
Expand All @@ -50,11 +50,9 @@
this.moveToBottom();
break;
case "markUnimportant":
this.Important = true;
this.changeToFalse();
break;
case "markImportant":
this.Important = false;
this.changeToTure();
break;
}
Expand Down
18 changes: 18 additions & 0 deletions src/repositories/boardsRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function defaultBoard() {
label: "Default board",
prependNewItem: false,
showDone: false,
showImportant: false,
showProgress: false
};
}
Expand Down Expand Up @@ -74,6 +75,7 @@ export default {
.insert({
label: boardName,
showDone: false,
showImportant: false,
showProgress: false,
prependNewItem: defaults.prependNewItems,
items: [],
Expand Down Expand Up @@ -119,6 +121,7 @@ export default {
.insert({
label: newName,
showDone: false,
showImportant: false,
showProgress: false,
prependNewItem: false,
items,
Expand Down Expand Up @@ -210,6 +213,7 @@ export default {
progress: progressCount(board),
prependNewItem: board.prependNewItem,
showDone: board.showDone,
showImportant: board.showImportant,
showProgress: board.showProgress
};
});
Expand Down Expand Up @@ -357,6 +361,20 @@ export default {
db.set("activeBoard", boardId)
.write();
},
switchShowImportant(boardId, value) {
const board = db
.get("boards")
.find({id: boardId});

const oldBoardVal = board.cloneDeep().value();

const res = board
.assign({showImportant: value})
.write();
const newBoardVal = board.cloneDeep().value();
syncRepository.addToSyncQueue(oldBoardVal, newBoardVal);
return res;
},
switchShowDone(boardId, value) {
const board = db
.get("boards")
Expand Down
7 changes: 7 additions & 0 deletions src/store/modules/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ const mutations = {
SWITCH_SHOW_DONE(state, {showDone}) {
state.activeBoard.showDone = showDone;
},
SWITCH_SHOW_IMPORTANT(state, {showImportant}) {
state.activeBoard.showImportant = showImportant;
},
SWITCH_SHOW_PROGRESS(state, val) {
state.activeBoard.showProgress = val;
}
Expand Down Expand Up @@ -138,6 +141,10 @@ const actions = {
boardsRepository.switchShowDone(boardId, showDone);
commit("SWITCH_SHOW_DONE", {boardId, showDone});
},
switchShowImportant({commit}, {boardId, showImportant}) {
boardsRepository.switchShowImportant(boardId, showImportant);
commit("SWITCH_SHOW_IMPORTANT", {boardId, showImportant});
},
switchShowProgress({commit}, {boardId, val}) {
itemsRepository.switchShowProgress(boardId, val);
commit("SWITCH_SHOW_PROGRESS", val);
Expand Down

0 comments on commit 64abf4a

Please sign in to comment.