Skip to content

Commit

Permalink
chore(game): add Afro samurai + tweak planing (#77)
Browse files Browse the repository at this point in the history
* chore(game): add Afro samurai + tweak planing

* Apply automatic changes

* fix: optional fields for planning

* Apply automatic changes

Co-authored-by: jy95 <[email protected]>
  • Loading branch information
jy95 and jy95 authored May 22, 2022
1 parent 1472f1a commit 2069434
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 10 deletions.
Binary file modified public/covers/NZiAc-mIJuQ/cover.webp
Binary file not shown.
Binary file modified public/covers/PLRfhDHeBTBJ4GoSaMs-BqHumiPqUHU3OX/cover.webp
Binary file not shown.
Binary file not shown.
25 changes: 16 additions & 9 deletions src/actions/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,22 @@ export const get_scheduled_games = () => {
"status": scheduledGame.status || (scheduledGame.hasOwnProperty("endAt") ? "RECORDED" : "PENDING")
};

const releaseDate = scheduledGame?.availableAt.toString();
if ( releaseDate.match(intergerDateRegex)) {
const { year, month, day } = intergerDateRegex.exec(releaseDate).groups;
return {
...common,
"releaseDate": new Date(+year, month - 1, +day)
}
} else {
return common;
// optional date fields
const optional = [
["releaseDate", scheduledGame?.availableAt?.toString()],
["endDate", scheduledGame?.endAt?.toString()]
]
.filter( field => !!field[1] && field[1].match(intergerDateRegex) )
.reduce( (acc, curr) => {
const [key, value] = curr;
const { year, month, day } = intergerDateRegex.exec(value).groups;
acc[key] = new Date(+year, month - 1, +day);
return acc;
}, {});

return {
...common,
...optional
}
});

Expand Down
14 changes: 13 additions & 1 deletion src/components/Planning/PlanningColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,23 @@ const planningColumns = (t, date_options, language) => [
headerAlign: 'center',
renderCell: (params) => (
<>
{params.value.toLocaleDateString(language, date_options)}
{params?.value?.toLocaleDateString(language, date_options)}
</>
),
width: 220
},
{
field: "endDate",
headerName: t("planning.columns.endDate"),
headerAlign: 'center',
renderCell: (params) => (
<>
{params?.value?.toLocaleDateString(language, date_options)}
</>
),
width: 220,
hide: true
},
{
field: "status",
headerName: t("planning.columns.status"),
Expand Down
14 changes: 14 additions & 0 deletions src/data/games.json
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,20 @@
"availableAt":20230714,
"endAt":20230714,
"coverFile": "cover.webp"
},
{
"title": "Afro Samurai",
"playlistId": "PLRfhDHeBTBJ6PHF-BH9dFug86rb877o2y",
"releaseDate": "27/03/2009",
"duration": "04:46:22",
"genres": [
"Action",
"Fighting"
],
"platform": "PS3",
"availableAt":20230717,
"endAt":20230802,
"coverFile": "cover.webp"
}
]
}
1 change: 1 addition & 0 deletions src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"columns": {
"title": "Title",
"releaseDate": "Release Date",
"endDate": "End Date",
"status": "Status",
"platform": "Platform"
}
Expand Down
1 change: 1 addition & 0 deletions src/translations/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"columns": {
"title": "Titre",
"releaseDate": "Date de sortie",
"endDate": "Date de fin",
"status": "Statut",
"platform": "Plateforme"
}
Expand Down

0 comments on commit 2069434

Please sign in to comment.