Refactor: snake_case → camelCase dans blueprints, templates et vues
- Blueprints : renommage des champs (member_name, related_articles, background_video, play_links, images_gallery, external_links) et des noms de sections - Templates JSON PHP : clés de sortie et appels ->method() en camelCase - Vues Svelte (Play, Portfolio) : accès aux données alignés Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d8a0fde34c
commit
69859cc60f
19 changed files with 63 additions and 76 deletions
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
$specificData = [
|
||||
'intro' => [
|
||||
'title' => $page->intro_title()->value(),
|
||||
'text' => $page->intro_text()->value()
|
||||
'title' => $page->introTitle()->value(),
|
||||
'text' => $page->introText()->value()
|
||||
],
|
||||
'mission' => [
|
||||
'title' => $page->mission_title()->value(),
|
||||
'text' => $page->mission_text()->toBlocks()
|
||||
'title' => $page->missionTitle()->value(),
|
||||
'text' => $page->missionText()->toBlocks()
|
||||
],
|
||||
'manifesto' => [
|
||||
'title' => $page->manifesto_title()->value(),
|
||||
'text' => $page->manifesto_text()->toBlocks()
|
||||
'title' => $page->manifestoTitle()->value(),
|
||||
'text' => $page->manifestoText()->toBlocks()
|
||||
],
|
||||
'team' => [
|
||||
'title' => $page->team_title()->value(),
|
||||
'members' => $page->team_members()->toStructure()->map(function($member) {
|
||||
'title' => $page->teamTitle()->value(),
|
||||
'members' => $page->teamMembers()->toStructure()->map(function($member) {
|
||||
return [
|
||||
'name' => $member->name()->value(),
|
||||
'role' => $member->role()->value(),
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
|
||||
$related = $page->related_articles()->toPages();
|
||||
$related = $page->relatedArticles()->toPages();
|
||||
if ($related->isEmpty()) {
|
||||
$related = $page->siblings()->listed()->not($page)->shuffle()->limit(3);
|
||||
}
|
||||
|
||||
$specificData = [
|
||||
'date' => $page->date()->toDate('Y-m-d'),
|
||||
'date_formatted' => $page->date()->toDate('d/m/Y'),
|
||||
'dateFormatted' => $page->date()->toDate('d/m/Y'),
|
||||
'intro' => $page->intro()->value(),
|
||||
'author' => [
|
||||
'name' => $page->author_name()->value(),
|
||||
'role' => $page->author_role()->value(),
|
||||
'photo' => $page->author_photo()->toFile()?->url()
|
||||
'name' => $page->authorName()->value(),
|
||||
'role' => $page->authorRole()->value(),
|
||||
'photo' => $page->authorPhoto()->toFile()?->url()
|
||||
],
|
||||
'cover' => $page->cover()->toFile()?->url(),
|
||||
'content' => $page->article_content()->toBlocks(),
|
||||
'content' => $page->articleContent()->toBlocks(),
|
||||
'tags' => $page->tags()->split(),
|
||||
'related' => $related->map(function($rec) {
|
||||
return [
|
||||
|
|
@ -25,7 +25,7 @@ $specificData = [
|
|||
'cover' => $rec->cover()->toFile()?->thumb(['width' => 400])->url()
|
||||
];
|
||||
})->values(),
|
||||
'parent_url' => $page->parent()->url()
|
||||
'parentUrl' => $page->parent()->url()
|
||||
];
|
||||
|
||||
$pageData = array_merge($genericData, $specificData);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
$specificData = [
|
||||
'intro' => [
|
||||
'title' => $page->intro_title()->value(),
|
||||
'text' => $page->intro_text()->value()
|
||||
'title' => $page->introTitle()->value(),
|
||||
'text' => $page->introText()->value()
|
||||
],
|
||||
'articles' => $page->children()->listed()->sortBy('date', 'desc')->map(function($article) {
|
||||
return [
|
||||
|
|
@ -11,11 +11,11 @@ $specificData = [
|
|||
'slug' => $article->slug(),
|
||||
'url' => $article->url(),
|
||||
'date' => $article->date()->toDate('Y-m-d'),
|
||||
'date_formatted' => $article->date()->toDate('d/m/Y'),
|
||||
'dateFormatted' => $article->date()->toDate('d/m/Y'),
|
||||
'intro' => $article->intro()->excerpt(200),
|
||||
'cover' => $article->cover()->toFile()?->url(),
|
||||
'author_name' => $article->author_name()->value(),
|
||||
'author_photo' => $article->author_photo()->toFile()?->url()
|
||||
'authorName' => $article->authorName()->value(),
|
||||
'authorPhoto' => $article->authorPhoto()->toFile()?->url()
|
||||
];
|
||||
})->values()
|
||||
];
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
$specificData = [
|
||||
'description' => $page->description()->value(),
|
||||
'rules' => $page->rules()->toBlocks(),
|
||||
'game_status' => $page->game_status()->value(),
|
||||
'is_embedded' => $page->is_embedded()->toBool(),
|
||||
'play_link' => $page->play_link()->value(),
|
||||
'gameStatus' => $page->gameStatus()->value(),
|
||||
'isEmbedded' => $page->isEmbedded()->toBool(),
|
||||
'playLink' => $page->playLink()->value(),
|
||||
'cover' => $page->cover()->toFile()?->url(),
|
||||
'parent_url' => $page->parent()->url()
|
||||
'parentUrl' => $page->parent()->url()
|
||||
];
|
||||
|
||||
$pageData = array_merge($genericData, $specificData);
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
$specificData = [
|
||||
'hero' => [
|
||||
'title' => $page->hero_title()->value(),
|
||||
'title_highlight' => $page->hero_title_highlight()->value(),
|
||||
'subtitle' => $page->hero_subtitle()->value(),
|
||||
'title' => $page->heroTitle()->value(),
|
||||
'titleHighlight' => $page->heroTitleHighlight()->value(),
|
||||
'subtitle' => $page->heroSubtitle()->value(),
|
||||
'ctaText' => $page->ctaText()->value(),
|
||||
'ctaPath' => $page->ctaLink()->toPage()?->id() ?? '#',
|
||||
'image' => $page->hero_image()->toFile()?->url()
|
||||
'image' => $page->heroImage()->toFile()?->url()
|
||||
],
|
||||
'background_video' => $page->background_video()->toFile()?->url(),
|
||||
'floating_bubbles' => $page->floating_bubbles()->toStructure()->map(function($bubble) {
|
||||
'backgroundVideo' => $page->backgroundVideo()->toFile()?->url(),
|
||||
'floatingBubbles' => $page->floatingBubbles()->toStructure()->map(function($bubble) {
|
||||
return [
|
||||
'text' => $bubble->text()->value(),
|
||||
'position' => $bubble->position()->value()
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ $specificData = [
|
|||
'lettering' => $game->lettering()->toFile()?->url(),
|
||||
'description' => $game->description()->value(),
|
||||
'thumbnail' => $game->thumbnail()->toFile()?->url(),
|
||||
'background_image' => $game->background_image()->toFile()?->url(),
|
||||
'play_links' => $game->play_links()->toStructure()->map(fn($l) => [
|
||||
'backgroundImage' => $game->backgroundImage()->toFile()?->url(),
|
||||
'playLinks' => $game->playLinks()->toStructure()->map(fn($l) => [
|
||||
'label' => $l->label()->value(),
|
||||
'url' => $l->url()->value(),
|
||||
])->values(),
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
<?php
|
||||
|
||||
$specificData = [
|
||||
'background_image' => $page->backgroundImage()->toFile()?->url(),
|
||||
'backgroundImage' => $page->backgroundImage()->toFile()?->url(),
|
||||
'projects' => $page->children()->listed()->map(function($project) {
|
||||
return [
|
||||
'title' => $project->title()->value(),
|
||||
'slug' => $project->slug(),
|
||||
'catchphrase' => $project->catchphrase()->value(),
|
||||
'catchPhrase' => $project->catchPhrase()->value(),
|
||||
'description' => $project->description()->value(),
|
||||
'thumbnail' => $project->thumbnail()->toFile()?->url(),
|
||||
'images_gallery' => $project->images_gallery()->toFiles()->map(fn($f) => [
|
||||
'imagesGallery' => $project->imagesGallery()->toFiles()->map(fn($f) => [
|
||||
'src' => $f->url(),
|
||||
'srcset' => $f->srcset('gallery'),
|
||||
'webp' => $f->srcset('gallery-webp'),
|
||||
])->values(),
|
||||
'mockup' => $project->mockup()->toFile()?->url(),
|
||||
'gallery_background_color' => $project->galleryBackgroundColor()->value(),
|
||||
'galleryBackgroundColor' => $project->galleryBackgroundColor()->value(),
|
||||
'keywords' => $project->keywords()->toStructure()->map(fn($i) => [
|
||||
'label' => $i->label()->value(),
|
||||
'text' => $i->text()->value(),
|
||||
])->values(),
|
||||
'external_links' => $project->external_links()->toStructure()->map(fn($i) => [
|
||||
'externalLinks' => $project->externalLinks()->toStructure()->map(fn($i) => [
|
||||
'label' => $i->label()->value(),
|
||||
'url' => $i->url()->value(),
|
||||
])->values(),
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ $specificData = [
|
|||
'impact' => $page->impact()->split(','),
|
||||
'category' => $page->category()->value(),
|
||||
'platforms' => $page->platforms()->split(','),
|
||||
'client_name' => $page->client_name()->value(),
|
||||
'apple_link' => $page->apple_link()->value(),
|
||||
'android_link' => $page->android_link()->value(),
|
||||
'web_link' => $page->web_link()->value(),
|
||||
'clientName' => $page->clientName()->value(),
|
||||
'appleLink' => $page->appleLink()->value(),
|
||||
'androidLink' => $page->androidLink()->value(),
|
||||
'webLink' => $page->webLink()->value(),
|
||||
'prev' => $page->prev() ? [
|
||||
'title' => $page->prev()->title()->value(),
|
||||
'url' => $page->prev()->url()
|
||||
|
|
@ -22,7 +22,7 @@ $specificData = [
|
|||
'title' => $page->next()->title()->value(),
|
||||
'url' => $page->next()->url()
|
||||
] : null,
|
||||
'parent_url' => $page->parent()->url()
|
||||
'parentUrl' => $page->parent()->url()
|
||||
];
|
||||
|
||||
$pageData = array_merge($genericData, $specificData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue