✨ Add skills page with category grouping (Story 2.4)
- Enhance Skill model with getCurrentLevel() and ordered scope - Update SkillController to group by category with translated labels - Add level and project_count to SkillResource - Create skill.ts types (Skill, SkillCategory, SkillsResponse) - Create useFetchSkills composable - Create SkillCard component with animated progress bar - Implement competences.vue with: - Responsive grid (2/3/4 columns) - Category sections with icons - Stagger animations (respects prefers-reduced-motion) - Loading/error/empty states - Placeholder for vis.js skill tree (Epic 3) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
83
frontend/app/components/feature/SkillCard.vue
Normal file
83
frontend/app/components/feature/SkillCard.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
class="skill-card group w-full text-left bg-sky-text/5 rounded-xl p-4 hover:bg-sky-text/10 transition-colors cursor-pointer border border-sky-text/10"
|
||||
@click="emit('click', skill)"
|
||||
>
|
||||
<div class="flex items-center gap-3 mb-3">
|
||||
<!-- Icon -->
|
||||
<div class="w-10 h-10 flex items-center justify-center bg-sky-dark/50 rounded-lg shrink-0">
|
||||
<span v-if="skill.icon" class="text-2xl">{{ skill.icon }}</span>
|
||||
<span v-else class="text-sky-text/40 text-lg">💻</span>
|
||||
</div>
|
||||
|
||||
<!-- Name and project count -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<h3 class="font-ui font-medium text-sky-text truncate group-hover:text-sky-accent transition-colors">
|
||||
{{ skill.name }}
|
||||
</h3>
|
||||
<p v-if="skill.project_count" class="text-xs text-sky-text/50">
|
||||
{{ skill.project_count }} {{ skill.project_count > 1 ? $t('skills.projects') : $t('skills.project') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Progress bar -->
|
||||
<div class="relative h-2 bg-sky-dark/50 rounded-full overflow-hidden">
|
||||
<div
|
||||
class="skill-progress absolute left-0 top-0 h-full bg-gradient-to-r from-sky-accent to-sky-accent/80 rounded-full"
|
||||
:style="{ '--target-width': `${progressPercent}%` }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Level display -->
|
||||
<div class="flex justify-between items-center mt-2">
|
||||
<span class="text-xs text-sky-text/40 font-ui">{{ $t('skills.level') }}</span>
|
||||
<span class="text-sm font-ui font-medium text-sky-accent">
|
||||
{{ skill.level }}/{{ skill.max_level }}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Skill } from '~/types/skill'
|
||||
|
||||
const props = defineProps<{
|
||||
skill: Skill
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
click: [skill: Skill]
|
||||
}>()
|
||||
|
||||
const progressPercent = computed(() =>
|
||||
Math.round((props.skill.level / props.skill.max_level) * 100),
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.skill-card:focus-visible {
|
||||
outline: 2px solid var(--color-sky-accent, #38bdf8);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.skill-progress {
|
||||
width: 0;
|
||||
animation: fillProgress 0.8s ease-out forwards;
|
||||
animation-delay: var(--animation-delay, 0ms);
|
||||
}
|
||||
|
||||
@keyframes fillProgress {
|
||||
to {
|
||||
width: var(--target-width, 0%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.skill-progress {
|
||||
animation: none;
|
||||
width: var(--target-width, 0%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
14
frontend/app/composables/useFetchSkills.ts
Normal file
14
frontend/app/composables/useFetchSkills.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { SkillsResponse } from '~/types/skill'
|
||||
|
||||
export function useFetchSkills() {
|
||||
const config = useRuntimeConfig()
|
||||
const { locale } = useI18n()
|
||||
|
||||
return useFetch<SkillsResponse>('/skills', {
|
||||
baseURL: config.public.apiUrl as string,
|
||||
headers: {
|
||||
'X-API-Key': config.public.apiKey as string,
|
||||
'Accept-Language': locale.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,16 +1,153 @@
|
||||
<template>
|
||||
<div class="min-h-screen p-8">
|
||||
<h1 class="text-3xl font-narrative text-sky-text">{{ $t('pages.skills.title') }}</h1>
|
||||
<p class="mt-4 text-sky-text/70">{{ $t('pages.skills.description') }}</p>
|
||||
<div class="max-w-7xl mx-auto px-4 py-8 md:py-12">
|
||||
<h1 class="text-3xl md:text-4xl font-ui font-bold text-sky-text mb-8">
|
||||
{{ $t('skills.title') }}
|
||||
</h1>
|
||||
|
||||
<!-- Loading state -->
|
||||
<div v-if="pending" class="space-y-10">
|
||||
<div v-for="i in 4" :key="i">
|
||||
<div class="bg-sky-text/5 h-7 rounded w-32 mb-4" />
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||
<div v-for="j in 4" :key="j" class="bg-sky-text/5 rounded-xl h-28 animate-pulse" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Error state -->
|
||||
<div v-else-if="error" class="text-center py-16">
|
||||
<p class="text-sky-text/60 font-narrative mb-6">
|
||||
{{ $t('skills.load_error') }}
|
||||
</p>
|
||||
<button
|
||||
class="px-6 py-3 bg-sky-accent text-sky-dark font-ui font-semibold rounded-lg hover:opacity-90 transition-opacity"
|
||||
@click="refresh()"
|
||||
>
|
||||
{{ $t('common.retry') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Skills by category -->
|
||||
<div v-else class="space-y-12">
|
||||
<section
|
||||
v-for="(category, categoryIndex) in categories"
|
||||
:key="category.category"
|
||||
class="category-section"
|
||||
:style="{ '--category-delay': `${categoryIndex * 150}ms` }"
|
||||
>
|
||||
<h2 class="text-xl font-ui font-semibold text-sky-text mb-5 flex items-center gap-2">
|
||||
<span class="text-sky-accent">{{ getCategoryIcon(category.category) }}</span>
|
||||
{{ category.category_label }}
|
||||
</h2>
|
||||
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||
<FeatureSkillCard
|
||||
v-for="(skill, skillIndex) in category.skills"
|
||||
:key="skill.id"
|
||||
:skill="skill"
|
||||
class="skill-card-animated"
|
||||
:style="{ '--animation-delay': `${categoryIndex * 150 + skillIndex * 60}ms` }"
|
||||
@click="handleSkillClick"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Empty state -->
|
||||
<div v-if="categories.length === 0" class="text-center py-16">
|
||||
<p class="text-sky-text/60 font-narrative">
|
||||
{{ $t('skills.no_skills') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Placeholder for vis.js skill tree (Epic 3) - Desktop only -->
|
||||
<div class="hidden lg:block mt-12 p-8 border-2 border-dashed border-sky-text/10 rounded-xl text-center">
|
||||
<p class="text-sky-text/40 font-narrative">
|
||||
{{ $t('skills.skill_tree_placeholder') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { setPageMeta } = useSeo()
|
||||
const { t } = useI18n()
|
||||
import type { Skill } from '~/types/skill'
|
||||
import { useProgressionStore } from '~/stores/progression'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { setPageMeta } = useSeo()
|
||||
const store = useProgressionStore()
|
||||
|
||||
const { data, pending, error, refresh } = await useFetchSkills()
|
||||
|
||||
const categories = computed(() => data.value?.data ?? [])
|
||||
|
||||
// SEO
|
||||
setPageMeta({
|
||||
title: t('pages.skills.title'),
|
||||
description: t('pages.skills.description'),
|
||||
title: t('skills.page_title'),
|
||||
description: t('skills.page_description'),
|
||||
})
|
||||
|
||||
// Category icons
|
||||
const categoryIcons: Record<string, string> = {
|
||||
frontend: '🎨',
|
||||
backend: '⚙️',
|
||||
tools: '🛠️',
|
||||
soft_skills: '💡',
|
||||
}
|
||||
|
||||
function getCategoryIcon(category: string): string {
|
||||
return categoryIcons[category.toLowerCase()] ?? '📚'
|
||||
}
|
||||
|
||||
// Handle skill click (preparation for Story 2.5)
|
||||
function handleSkillClick(skill: Skill) {
|
||||
// Will be implemented in Story 2.5 - modal with related projects
|
||||
console.log('Skill clicked:', skill.slug)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
store.visitSection('competences')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.category-section {
|
||||
animation: fadeIn 0.5s ease-out forwards;
|
||||
animation-delay: var(--category-delay, 0ms);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.skill-card-animated {
|
||||
animation: fadeInUp 0.4s ease-out forwards;
|
||||
animation-delay: var(--animation-delay, 0ms);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.category-section,
|
||||
.skill-card-animated {
|
||||
animation: none;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
30
frontend/app/types/skill.ts
Normal file
30
frontend/app/types/skill.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
export interface Skill {
|
||||
id: number
|
||||
slug: string
|
||||
name: string
|
||||
description: string | null
|
||||
icon: string | null
|
||||
category: string
|
||||
level: number
|
||||
max_level: number
|
||||
display_order: number
|
||||
project_count?: number
|
||||
pivot?: {
|
||||
level_before: number
|
||||
level_after: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface SkillCategory {
|
||||
category: string
|
||||
category_label: string
|
||||
skills: Skill[]
|
||||
}
|
||||
|
||||
export interface SkillsResponse {
|
||||
data: SkillCategory[]
|
||||
meta: {
|
||||
lang: string
|
||||
total: number
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,17 @@
|
||||
"previous": "Previous project",
|
||||
"next": "Next project"
|
||||
},
|
||||
"skills": {
|
||||
"title": "My Skills",
|
||||
"page_title": "Skills | Skycel",
|
||||
"page_description": "Discover the technical skills and soft skills of C\u00e9lian, full-stack web developer.",
|
||||
"load_error": "Unable to load skills...",
|
||||
"no_skills": "No skills yet",
|
||||
"skill_tree_placeholder": "Interactive skill tree (coming soon)",
|
||||
"level": "Level",
|
||||
"project": "project",
|
||||
"projects": "projects"
|
||||
},
|
||||
"pages": {
|
||||
"projects": {
|
||||
"title": "Projects",
|
||||
|
||||
@@ -94,14 +94,25 @@
|
||||
"previous": "Projet pr\u00e9c\u00e9dent",
|
||||
"next": "Projet suivant"
|
||||
},
|
||||
"skills": {
|
||||
"title": "Mes Comp\u00e9tences",
|
||||
"page_title": "Comp\u00e9tences | Skycel",
|
||||
"page_description": "D\u00e9couvrez les comp\u00e9tences techniques et soft skills de C\u00e9lian, d\u00e9veloppeur web full-stack.",
|
||||
"load_error": "Impossible de charger les comp\u00e9tences...",
|
||||
"no_skills": "Aucune comp\u00e9tence pour le moment",
|
||||
"skill_tree_placeholder": "Arbre de comp\u00e9tences interactif (bient\u00f4t disponible)",
|
||||
"level": "Niveau",
|
||||
"project": "projet",
|
||||
"projects": "projets"
|
||||
},
|
||||
"pages": {
|
||||
"projects": {
|
||||
"title": "Projets",
|
||||
"description": "Découvrez mes projets et réalisations"
|
||||
"description": "D\u00e9couvrez mes projets et r\u00e9alisations"
|
||||
},
|
||||
"skills": {
|
||||
"title": "Compétences",
|
||||
"description": "Mes compétences techniques et humaines"
|
||||
"title": "Comp\u00e9tences",
|
||||
"description": "Mes comp\u00e9tences techniques et humaines"
|
||||
},
|
||||
"testimonials": {
|
||||
"title": "Témoignages",
|
||||
|
||||
Reference in New Issue
Block a user