-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
70 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script lang="ts" setup> | ||
const createNewProject = useCreateNewProject(); | ||
const { data: projects, isFetching } = useProjectListQuery(); | ||
const filter = ref(''); | ||
const filteredProjects = useArrayFilter(projects, (p) => | ||
p.name.toLowerCase().includes(filter.value.toLowerCase()), | ||
); | ||
const openProject = useOpenProject(); | ||
const deleteProject = useDeleteProject(); | ||
</script> | ||
|
||
<template> | ||
<ul class="flex flex-col gap-2"> | ||
<li> | ||
<UInput | ||
v-model="filter" | ||
placeholder="Filter projects..." | ||
icon="i-heroicons-magnifying-glass" | ||
/> | ||
</li> | ||
<ProjectListItem | ||
v-for="project of filteredProjects" | ||
:key="project.id" | ||
:project | ||
@open="openProject" | ||
@delete="deleteProject" | ||
/> | ||
<li v-if="isFetching" class="flex justify-center"> | ||
<UButton | ||
class="pointer-events-none" | ||
loading | ||
variant="ghost" | ||
color="white" | ||
disabled | ||
> | ||
Loading... | ||
</UButton> | ||
</li> | ||
<li v-else-if="filteredProjects.length === 0" class="text-center py-16"> | ||
No projects, | ||
<ULink variant="link" @click="createNewProject">add one</ULink> | ||
</li> | ||
<slot /> | ||
</ul> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default function () { | ||
const account = useAccountService(); | ||
return computed(() => account.value.id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { useQuery } from '@tanstack/vue-query'; | ||
|
||
export default function () { | ||
const account = useAccountService(); | ||
const accountId = useAccountServiceId(); | ||
const user = useCurrentUser(); | ||
return useQuery({ | ||
queryKey: ['projects', accountId], | ||
queryFn: () => account.value.listProjects(), | ||
initialData: [], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters