Refactor: Extract project color mappings to composable

Co-authored-by: ArthurDanjou <29738535+ArthurDanjou@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-23 23:30:13 +00:00
parent 66fe877499
commit a1dbcdce90
3 changed files with 23 additions and 26 deletions

View File

@@ -0,0 +1,21 @@
export function useProjectColors() {
const statusColors: Record<string, string> = {
'active': 'green',
'completed': 'blue',
'archived': 'gray',
'in-progress': 'amber'
}
const typeColors: Record<string, string> = {
'Personal Project': 'purple',
'Academic Project': 'sky',
'Infrastructure Project': 'emerald',
'Internship Project': 'orange',
'Research Project': 'blue'
}
return {
statusColors,
typeColors
}
}

View File

@@ -30,19 +30,7 @@ useSeoMeta({
twitterCard: 'summary_large_image'
})
const statusColors: Record<string, string> = {
'active': 'green',
'completed': 'blue',
'archived': 'gray',
'in-progress': 'amber'
}
const typeColors: Record<string, string> = {
'Personal Project': 'purple',
'Academic Project': 'sky',
'Infrastructure Project': 'emerald',
'Internship Project': 'orange'
}
const { statusColors, typeColors } = useProjectColors()
const formattedDate = computed(() => {
if (!project.value?.publishedAt) return null

View File

@@ -41,19 +41,7 @@ const filteredProjects = computed(() => {
})
})
const statusColors: Record<string, string> = {
'active': 'green',
'completed': 'blue',
'archived': 'gray',
'in-progress': 'amber'
}
const typeColors: Record<string, string> = {
'Personal Project': 'purple',
'Academic Project': 'sky',
'Infrastructure Project': 'emerald',
'Internship Project': 'orange'
}
const { statusColors, typeColors } = useProjectColors()
function toggleTag(tag: string) {
const index = selectedTags.value.indexOf(tag)