Skip to content

Commit

Permalink
Hide inactive projects and add search field
Browse files Browse the repository at this point in the history
  • Loading branch information
NickHatBoecker committed Nov 17, 2024
1 parent 700049f commit 44d895d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<div id="app">
<navbar @openSettings="showSettingsModal = true" />
<item-list :items="projects" />

<div style="padding: 0 24px; margin-bottom: 12px;">
<input v-model="searchTerm" type="text" placeholder="Search" style="width: 100%;" />
</div>

<item-list :items="filteredProjects" />
<settings-dialog
v-model="showSettingsModal"
:projects-path="projectsPath"
Expand All @@ -26,8 +31,22 @@ export default {
projects: [],
projectsPath: null,
showSettingsModal: false,
searchTerm: '',
}),
computed: {
filteredProjects () {
return this.projects.filter(x => {
if (this.searchTerm) {
const lowerQuery = this.searchTerm.toLowerCase()
if (!x.name.toLowerCase().includes(lowerQuery)) return false
}
return true
})
},
},
async mounted () {
if (localStorage.getItem(STORAGE_PROJECTS_PATH)) {
this.projectsPath = localStorage.getItem(STORAGE_PROJECTS_PATH)
Expand All @@ -52,7 +71,10 @@ export default {
return
}
that.projects = JSON.parse(content)
that.projects = (JSON.parse(content)).filter(x => {
if (typeof x.active === 'undefined') return true
return x.active
})
})
},
Expand Down

0 comments on commit 44d895d

Please sign in to comment.