Skip to content

Commit 285a0d6

Browse files
committed
feat: refresh projects + misc improvements
1 parent 35258c3 commit 285a0d6

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

autoproject/src/lib/components/ProjectSelectionModal.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@
6565
>
6666
<div class="flex items-start justify-center pt-24 p-4">
6767
<div
68-
class="w-full max-w-xl bg-gray-900/95 rounded-lg shadow-2xl border border-gray-800/50"
68+
class="w-full max-w-xl bg-zinc-900/95 rounded-lg shadow-2xl border border-zinc-800/50"
6969
transition:fly={{ y: -20, duration: 300, easing: cubicOut }}
7070
>
71-
<div class="flex items-center justify-between p-4 border-b border-gray-800/50">
71+
<div class="flex items-center justify-between p-4 border-b border-zinc-800/50">
7272
<h2 class="text-lg font-medium text-white">Select Project</h2>
7373
<button
74-
class="text-gray-400 hover:text-white transition-all duration-200 transform hover:scale-110"
74+
class="text-zinc-400 hover:text-white transition-all duration-200 transform hover:scale-110"
7575
aria-label="close modal"
7676
onclick={handleClose}
7777
>
@@ -87,7 +87,7 @@
8787
value={searchTerm}
8888
oninput={handleInput}
8989
placeholder="Search projects..."
90-
class="w-full px-3 py-2 text-white bg-gray-800/50 border border-gray-700/50 rounded-md focus:ring-1 focus:ring-purple-500 focus:border-transparent text-sm transition-all duration-200"
90+
class="w-full px-3 py-2 text-white bg-zinc-800/50 border border-zinc-700/50 rounded-md focus:ring-1 focus:ring-purple-500 focus:border-transparent text-sm transition-all duration-200"
9191
/>
9292
</div>
9393

@@ -97,23 +97,23 @@
9797
<div class="animate-spin rounded-full h-6 w-6 border-2 border-purple-500 border-t-transparent"></div>
9898
</div>
9999
{:else if filteredProjects.length === 0}
100-
<div class="text-center py-6 text-gray-400 text-sm">
100+
<div class="text-center py-6 text-zinc-400 text-sm">
101101
No projects found
102102
</div>
103103
{:else}
104104
<div class="space-y-2">
105-
{#each filteredProjects as project (project.name)}
105+
{#each filteredProjects as project (project.id)}
106106
<button
107-
class="w-full flex items-center p-3 bg-gray-800/30 rounded-md hover:bg-gray-700/50 transition-all duration-200 text-left group hover:translate-x-1"
107+
class="w-full flex items-center p-3 bg-zinc-800/30 rounded-md hover:bg-zinc-700/50 transition-all duration-200 text-left group hover:translate-x-1"
108108
onclick={() => handleProjectSelect(project)}
109109
>
110110
<div class="flex-1 min-w-0">
111111
<h3 class="text-sm font-medium text-white truncate group-hover:text-purple-400 transition-colors duration-200">
112112
{project.name}
113113
</h3>
114-
<p class="text-xs text-gray-400 mt-0.5 truncate">{project.description}</p>
114+
<p class="text-xs text-zinc-400 mt-0.5 truncate">{project.description}</p>
115115
</div>
116-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-400 group-hover:text-purple-400 transition-all duration-200 transform group-hover:translate-x-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
116+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-zinc-400 group-hover:text-purple-400 transition-all duration-200 transform group-hover:translate-x-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
117117
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
118118
</svg>
119119
</button>

autoproject/src/routes/projects/+page.svelte

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
import { appState } from '$lib/state.svelte'
33
import { notificationStore } from '$lib/store'
44
import { marked } from 'marked'
5-
6-
let selectedProjectId = $state<number | null>(null)
7-
let searchQuery = $state('')
5+
import { page } from '$app/state'
6+
import { goto } from '$app/navigation'
7+
8+
let selectedProjectId = $derived<string | null>(
9+
page.url.searchParams.get('id') ? String(page.url.searchParams.get('id')) : null
10+
)
11+
let searchQuery = $state('') as string
812
let expandedIssueId = $state<number | null>(null)
913
let updatingIssues = $state<Set<number>>(new Set())
1014
let deletingIssues = $state<Set<number>>(new Set())
@@ -46,7 +50,7 @@
4650
}
4751
4852
const selectProject = (id: number) => {
49-
selectedProjectId = id
53+
goto('/projects?id=' + id)
5054
expandedIssueId = null // Reset expanded issue when switching projects
5155
showDeleteConfirm = null // Reset delete confirmation
5256
completedInSession.clear() // Reset completed in session when switching projects
@@ -312,7 +316,7 @@
312316
</h4>
313317
</button>
314318
<div class="flex items-center gap-3">
315-
<span class="text-xs text-zinc-600 font-mono whitespace-nowrap">
319+
<span class="text-sm text-zinc-600 font-mono whitespace-nowrap">
316320
{formatDate(issue.updatedAt)}
317321
</span>
318322

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const ssr = false
2+
3+
const loadProjects = async () => {
4+
const { appState } = await import("$lib/state.svelte")
5+
try {
6+
const tool = appState.settings.tool
7+
const projectData = await fetch(`/api/project?tool=${tool}`, {
8+
method: 'GET',
9+
})
10+
const projectJson = await projectData.json()
11+
appState.projects = projectJson.data
12+
} catch (error) {
13+
appState.isLoading = false
14+
throw error
15+
}
16+
}
17+
18+
export const load = async () => {
19+
// Fire and forget - won't block page load
20+
loadProjects()
21+
return {}
22+
}

autoproject/svelte.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ const config = {
66
preprocess: vitePreprocess({ script: true }),
77
kit: {
88
adapter: adapter()
9+
},
10+
compilerOptions: {
11+
experimental: {
12+
async: true
13+
}
914
}
1015
}
1116

0 commit comments

Comments
 (0)