Standardize public images on WebP and add conversion tooling
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
This commit is contained in:
parent
75592d7d7a
commit
ca39b76282
883 changed files with 503 additions and 90 deletions
|
|
@ -133,9 +133,9 @@ export function ToolboxIconPicker({ toolbox, onChange, tutorialTarget = "" }) {
|
|||
onChange(path, "");
|
||||
close();
|
||||
}}
|
||||
aria-label={`Utiliser l'icône ${path.split("/").pop().replace(".png", "")}`}
|
||||
aria-label={`Utiliser l'icône ${path.split("/").pop().replace(/\.[^.]+$/, "")}`}
|
||||
aria-pressed={!toolbox.customCover && path === icon}
|
||||
title={path.split("/").pop().replace(".png", "")}
|
||||
title={path.split("/").pop().replace(/\.[^.]+$/, "")}
|
||||
>
|
||||
<img src={path} alt="" aria-hidden="true" loading="lazy" />
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -24,35 +24,35 @@ export { normalizeTimerData } from "./modules/timer.js";
|
|||
|
||||
const TOOLBOX_ICON_BASE = "/static/img/toolbox-icons/";
|
||||
const TOOLBOX_ICON_FILES = [
|
||||
"toolbox.png",
|
||||
"ball.png",
|
||||
"capture.png",
|
||||
"card.png",
|
||||
"city.png",
|
||||
"compass.png",
|
||||
"crash.png",
|
||||
"detective.png",
|
||||
"fire.png",
|
||||
"horror.png",
|
||||
"jump.png",
|
||||
"mining.png",
|
||||
"parachute.png",
|
||||
"puzzle.png",
|
||||
"reflexion.png",
|
||||
"shield.png",
|
||||
"sword.png",
|
||||
"target.png",
|
||||
"tower.png",
|
||||
"wheel.png"
|
||||
"toolbox.webp",
|
||||
"ball.webp",
|
||||
"capture.webp",
|
||||
"card.webp",
|
||||
"city.webp",
|
||||
"compass.webp",
|
||||
"crash.webp",
|
||||
"detective.webp",
|
||||
"fire.webp",
|
||||
"horror.webp",
|
||||
"jump.webp",
|
||||
"mining.webp",
|
||||
"parachute.webp",
|
||||
"puzzle.webp",
|
||||
"reflexion.webp",
|
||||
"shield.webp",
|
||||
"sword.webp",
|
||||
"target.webp",
|
||||
"tower.webp",
|
||||
"wheel.webp"
|
||||
];
|
||||
export const TOOLBOX_ICONS = TOOLBOX_ICON_FILES.map((file) => `${TOOLBOX_ICON_BASE}${file}`);
|
||||
export const DEFAULT_TOOLBOX_ICON = `${TOOLBOX_ICON_BASE}toolbox.png`;
|
||||
export const DEFAULT_TOOLBOX_ICON = `${TOOLBOX_ICON_BASE}toolbox.webp`;
|
||||
export const MAX_TOOLBOX_SPACES = 5;
|
||||
const LEGACY_TOOLBOX_UPDATED_AT = "1970-01-01T00:00:00.000Z";
|
||||
|
||||
export function normalizeToolboxIcon(icon) {
|
||||
const value = String(icon || "").trim();
|
||||
const file = value.replace(TOOLBOX_ICON_BASE, "").split("/").pop();
|
||||
const file = value.replace(TOOLBOX_ICON_BASE, "").split("/").pop().replace(/\.png$/i, ".webp");
|
||||
return TOOLBOX_ICON_FILES.includes(file) ? `${TOOLBOX_ICON_BASE}${file}` : DEFAULT_TOOLBOX_ICON;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue