chore: update comments and documentation for clarity and consistency across various files
- Translated comments from Spanish to English in vite.config.ts, docker-compose.yml, attendance-risk.ts, analytics.ts, attendance.ts, attendees.ts, enums.ts, groups.ts, and onboarding.ts. - Improved descriptions for better understanding of code functionality and purpose. - Ensured uniformity in terminology and phrasing throughout the codebase.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Genera el set de iconos PWA desde el isotipo SVG de marca.
|
||||
* Generates the PWA icon set from the brand isotype SVG.
|
||||
*
|
||||
* Uso: bun --filter @gruperly/web icons
|
||||
* Usage: bun --filter @gruperly/web icons
|
||||
*
|
||||
* Las salidas se versionan en `public/`; el build de Vite no las regenera
|
||||
* (sharp es una devDependency y no debe entrar en la imagen de Docker).
|
||||
* Re-correr solo cuando cambia `src/assets/brand/isotipo-y-organica.svg`.
|
||||
* The outputs are versioned in `public/`; the Vite build does not regenerate
|
||||
* them (sharp is a devDependency and must not end up in the Docker image).
|
||||
* Re-run only when `src/assets/brand/isotipo-y-organica.svg` changes.
|
||||
*/
|
||||
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { dirname, join } from 'node:path'
|
||||
@@ -16,30 +16,30 @@ const webDir = dirname(dirname(fileURLToPath(import.meta.url)))
|
||||
const source = join(webDir, 'src/assets/brand/isotipo-y-organica.svg')
|
||||
const publicDir = join(webDir, 'public')
|
||||
|
||||
/** Fondo del tema claro; también sirve de lienzo para los iconos opacos. */
|
||||
/** Light theme background; it also serves as the canvas for opaque icons. */
|
||||
const BACKGROUND = '#ffffff'
|
||||
const TRANSPARENT = { r: 0, g: 0, b: 0, alpha: 0 } as const
|
||||
|
||||
type IconTarget = {
|
||||
file: string
|
||||
size: number
|
||||
/** Rellena el lienzo con `BACKGROUND` en vez de dejar transparencia. */
|
||||
/** Fills the canvas with `BACKGROUND` instead of leaving it transparent. */
|
||||
opaque: boolean
|
||||
/** Fracción del lado que ocupa el logo. 1 = sin padding. */
|
||||
/** Fraction of the side the logo takes up. 1 = no padding. */
|
||||
contentRatio: number
|
||||
}
|
||||
|
||||
const targets: IconTarget[] = [
|
||||
{ file: 'pwa-192x192.png', size: 192, opaque: false, contentRatio: 0.9 },
|
||||
{ file: 'pwa-512x512.png', size: 512, opaque: false, contentRatio: 0.9 },
|
||||
// Android recorta los iconos adaptativos en círculo: el contenido útil
|
||||
// vive en el 80% central del canvas, así que el logo va over white y escalado.
|
||||
// Android crops adaptive icons in a circle: the useful content lives in the
|
||||
// central 80% of the canvas, so the logo goes on white and scaled.
|
||||
{ file: 'pwa-maskable-512x512.png', size: 512, opaque: true, contentRatio: 0.8 },
|
||||
{ file: 'apple-touch-icon-180.png', size: 180, opaque: true, contentRatio: 0.82 },
|
||||
]
|
||||
|
||||
// El viewBox del isotipo no arranca en 0 y deja aire alrededor del glifo:
|
||||
// `trim` recorta ese margen para que el encuadre use el área real del dibujo.
|
||||
// The isotype viewBox does not start at 0 and leaves air around the glyph:
|
||||
// `trim` crops that margin so the framing uses the drawing's real area.
|
||||
const logo = await sharp(await readFile(source), { density: 512 })
|
||||
.trim({ threshold: 1 })
|
||||
.png()
|
||||
|
||||
Reference in New Issue
Block a user