refactor: use serde-dynamo
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
</script>
|
||||
|
||||
<div class="h-14 w-full bg-[#292e42] sm:p-2">
|
||||
<div class="mx-auto flex h-full max-w-[78rem] items-center justify-between">
|
||||
<div class="mx-auto flex h-full max-w-312 items-center justify-between">
|
||||
<Button.Root onclick={() => goto('/')}>
|
||||
<h1 class="header-title font-light">Project Host</h1>
|
||||
</Button.Root>
|
||||
|
||||
@@ -18,27 +18,9 @@
|
||||
staleTime: 60000
|
||||
}));
|
||||
|
||||
const projectsQuery = createQuery<Project[]>(() => ({
|
||||
queryKey: ['projects', reposQuery.data],
|
||||
queryFn: async () => {
|
||||
const repos = reposQuery.data ?? [];
|
||||
const projects = await Promise.all(
|
||||
repos.map(async (repo: RepoDefinition) => {
|
||||
const project = await resolveProjectData(repo);
|
||||
return project;
|
||||
})
|
||||
);
|
||||
return projects;
|
||||
},
|
||||
enabled: !!reposQuery.data && reposQuery.data.length > 0,
|
||||
staleTime: 60000
|
||||
}));
|
||||
|
||||
const projects = $derived(projectsQuery.data ?? []);
|
||||
const isLoading = $derived(
|
||||
reposQuery.isPending || (projectsQuery.isPending && projectsQuery.isEnabled)
|
||||
);
|
||||
const hasError = $derived(reposQuery.isError || projectsQuery.isError);
|
||||
const projects = $derived(reposQuery.data ?? []);
|
||||
const isLoading = $derived(reposQuery.isPending);
|
||||
const hasError = $derived(reposQuery.isError);
|
||||
const isEmpty = $derived(!isLoading && !hasError && projects.length === 0);
|
||||
</script>
|
||||
|
||||
@@ -63,7 +45,7 @@
|
||||
<div class="relative aspect-video overflow-hidden">
|
||||
<Image
|
||||
src={'https://picsum.photos/seed/yama/400/225'}
|
||||
alt={project.name}
|
||||
alt={project.full_name}
|
||||
class="min-h-56.5 w-full min-w-100 object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
|
||||
@@ -84,7 +66,7 @@
|
||||
</div>
|
||||
|
||||
<div class="p-4">
|
||||
<h3 class="text-lg font-semibold text-white">{project.name}</h3>
|
||||
<h3 class="text-lg font-semibold text-white">{project.full_name}</h3>
|
||||
<p class="mt-1 text-sm text-gray-400">{project.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,4 +9,5 @@ export type Project = {
|
||||
export type RepoDefinition = {
|
||||
id: string;
|
||||
full_name: string;
|
||||
description: string
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user