Refactored Projects pane - changed into a type

This commit is contained in:
Anis Ahmad
2020-06-09 03:43:18 +06:00
parent a6af1a617a
commit 3cc13ed445
5 changed files with 149 additions and 103 deletions

View File

@@ -8,7 +8,7 @@ import (
)
func prepareProjectDetail() {
deleteBtn := makeButton("Delete Project", deleteCurrentProject)
deleteBtn := makeButton("Delete Project", projectPane.removeActivateProject)
clearBtn := makeButton("Clear Completed Tasks", clearCompletedTasks)
deleteBtn.SetBackgroundColor(tcell.ColorRed)
@@ -23,21 +23,7 @@ func prepareProjectDetail() {
projectDetailPane.SetBorder(true).SetTitle("[::u]A[::-]ctions")
}
func deleteCurrentProject() {
if currentProject != nil && projectRepo.Delete(currentProject) == nil {
for i := range tasks {
_ = taskRepo.Delete(&tasks[i])
}
statusBar.showForSeconds("[lime]Removed Project: "+currentProject.Title, 5)
removeThirdCol()
taskList.Clear()
projectList.Clear()
loadProjectList()
}
}
// @TODO - Move to tasks pane
func clearCompletedTasks() {
count := 0
for i, task := range tasks {