diff --git a/docs/hero.png b/docs/hero.png index b2d1b10..60ce7c0 100644 Binary files a/docs/hero.png and b/docs/hero.png differ diff --git a/package-lock.json b/package-lock.json index 9e392ed..3de2090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "avicontrol", - "version": "1.14.0", + "version": "1.14.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "avicontrol", - "version": "1.14.0", + "version": "1.14.1", "dependencies": { "@fontsource-variable/fraunces": "^5.3.0", "@fontsource/geist": "^5.3.0", diff --git a/package.json b/package.json index 4053d4c..7152b8c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "avicontrol", "private": true, - "version": "1.14.0", + "version": "1.14.1", "type": "module", "scripts": { "dev": "vite", diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png index 799d102..f974cd2 100644 Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differ diff --git a/public/favicon.svg b/public/favicon.svg index c15d40f..8cc9fd6 100644 --- a/public/favicon.svg +++ b/public/favicon.svg @@ -1,4 +1,7 @@ - - + + + + + diff --git a/public/icon.svg b/public/icon.svg index 9a90057..ef067ea 100644 --- a/public/icon.svg +++ b/public/icon.svg @@ -1,5 +1,17 @@ - - - + + + + + + + + + + + + + + + diff --git a/public/pwa-192.png b/public/pwa-192.png index 950fea9..ea6f07c 100644 Binary files a/public/pwa-192.png and b/public/pwa-192.png differ diff --git a/public/pwa-512.png b/public/pwa-512.png index bc9e761..dcb8d0d 100644 Binary files a/public/pwa-512.png and b/public/pwa-512.png differ diff --git a/public/pwa-maskable-512.png b/public/pwa-maskable-512.png new file mode 100644 index 0000000..20afe96 Binary files /dev/null and b/public/pwa-maskable-512.png differ diff --git a/src/components/icons.tsx b/src/components/icons.tsx index a67308d..b9d0e4a 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -1,4 +1,5 @@ import type { SVGProps } from 'react' +import { ANILLO, POLLITO, RADIO_TEJA, TINTA_MARCA } from '../lib/marca' const base = (props: SVGProps) => ({ width: 24, @@ -131,29 +132,40 @@ export const IconCheck = (p: SVGProps) => ( ) -// Marca «Engorde»: un anillo cuyo grosor va de 22 a 68px a lo largo de 340° — -// día 1 delgado, día 41 grueso. Es un path relleno trazado punto a punto (SVG no -// tiene grosor de trazo variable), con la abertura arriba y el punto del día. -const RING = - 'M 256 97 L 283.7 98.7 L 310.8 105.3 L 336.5 116.5 L 359.9 132.1 L 380.4 151.6 L 397.2 174.5 L 409.9 200 L 417.9 227.5 L 421.1 256 L 419.2 284.8 L 412.4 312.9 L 400.7 339.6 L 384.5 363.9 L 364.3 385 L 340.6 402.5 L 314.1 415.6 L 285.6 423.9 L 256 427.2 L 226.2 425.2 L 197 418.1 L 169.4 406 L 144.2 389.2 L 122.3 368.2 L 104.2 343.6 L 90.7 316.2 L 82.1 286.7 L 78.7 256 L 80.8 225.1 L 88.2 194.9 L 100.7 166.4 L 118.1 140.3 L 139.9 117.6 L 165.3 99 L 193.8 85 A 34 34 0 0 1 217 148.9 L 198.7 156.7 L 181.9 167.6 L 167.1 181.4 L 154.9 197.6 L 145.7 215.9 L 139.7 235.5 L 137.3 256 L 138.4 276.7 L 143.1 297.1 L 151.4 316.4 L 163 334.1 L 177.5 349.5 L 194.6 362.3 L 213.8 372 L 234.4 378.3 L 256 380.8 L 277.8 379.6 L 299.2 374.6 L 319.4 365.8 L 338 353.7 L 354.2 338.4 L 367.6 320.4 L 377.7 300.3 L 384.2 278.6 L 386.9 256 L 385.6 233.2 L 380.3 210.8 L 371.1 189.5 L 358.4 170.1 L 342.3 153.1 L 323.5 139.1 L 302.4 128.5 L 279.7 121.8 L 256 119 Z' - +// La marca: el anillo del ciclo con el pollito de un día adentro. Las formas +// salen de lib/marca, las mismas de public/icon.svg. export function LogoAviControl({ size = 32, tile = false, ...props }: { size?: number; tile?: boolean } & SVGProps) { - const small = size < 40 + // Por debajo de 40 px el ala, el ojo y las patas no se ven: el anillo se + // engrosa y el pollito queda en silueta. + const chico = size < 40 + const t = TINTA_MARCA + const anillo = tile ? t.anillo : 'currentColor' + const pollito = tile ? t.pollito : 'currentColor' return ( - {tile && } + {tile && } - {!small && } + {!chico && + POLLITO.patas.map((p) => ( + + ))} + + + + {tile && !chico && ( + <> + + + + )} ) } diff --git a/src/lib/marca.ts b/src/lib/marca.ts new file mode 100644 index 0000000..fcd8687 --- /dev/null +++ b/src/lib/marca.ts @@ -0,0 +1,31 @@ +// La marca de AviControl: el anillo del ciclo, que engorda del día 1 al 42, +// con el pollito de un día adentro, el que entra al galpón al empezar cada +// pollada. Son las mismas formas de public/icon.svg, en una cuadrícula de 512: +// el logo de Inicio y la imagen que se manda por WhatsApp la dibujan de aquí. + +/** El anillo: grosor de 22 a 68 a lo largo de 340°, abierto arriba. */ +export const ANILLO = + 'M 256 97 L 283.7 98.7 L 310.8 105.3 L 336.5 116.5 L 359.9 132.1 L 380.4 151.6 L 397.2 174.5 L 409.9 200 L 417.9 227.5 L 421.1 256 L 419.2 284.8 L 412.4 312.9 L 400.7 339.6 L 384.5 363.9 L 364.3 385 L 340.6 402.5 L 314.1 415.6 L 285.6 423.9 L 256 427.2 L 226.2 425.2 L 197 418.1 L 169.4 406 L 144.2 389.2 L 122.3 368.2 L 104.2 343.6 L 90.7 316.2 L 82.1 286.7 L 78.7 256 L 80.8 225.1 L 88.2 194.9 L 100.7 166.4 L 118.1 140.3 L 139.9 117.6 L 165.3 99 L 193.8 85 A 34 34 0 0 1 217 148.9 L 198.7 156.7 L 181.9 167.6 L 167.1 181.4 L 154.9 197.6 L 145.7 215.9 L 139.7 235.5 L 137.3 256 L 138.4 276.7 L 143.1 297.1 L 151.4 316.4 L 163 334.1 L 177.5 349.5 L 194.6 362.3 L 213.8 372 L 234.4 378.3 L 256 380.8 L 277.8 379.6 L 299.2 374.6 L 319.4 365.8 L 338 353.7 L 354.2 338.4 L 367.6 320.4 L 377.7 300.3 L 384.2 278.6 L 386.9 256 L 385.6 233.2 L 380.3 210.8 L 371.1 189.5 L 358.4 170.1 L 342.3 153.1 L 323.5 139.1 L 302.4 128.5 L 279.7 121.8 L 256 119 Z' + +/** El pollito: cuerpo y cabeza que se funden, pico corto, ala y patitas. */ +export const POLLITO = { + cuerpo: { cx: 244, cy: 272, r: 60.8 }, + cabeza: { cx: 272.5, cy: 218.8, r: 39.9 }, + pico: 'M 306.7 209.3 L 329.5 218.8 L 306.7 228.3 Z', + ojo: { cx: 285.8, cy: 211.2, r: 6.7 }, + ala: 'M 206 266.3 C 225 254.9, 261.1 260.6, 272.5 283.4 C 253.5 302.4, 219.3 298.6, 206 266.3 Z', + patas: [226.9, 257.3].map((x) => ({ x, y: 321.4, w: 7.6, h: 24.7 })), +} + +export const TINTA_MARCA = { + fondo: '#153F27', + fondoArriba: '#1E5638', + fondoAbajo: '#112F1F', + anillo: '#FBF8F1', + pollito: '#F7C948', + ala: '#E3A72C', + pico: '#E58F2A', +} + +/** La teja de 512, con las esquinas como las de un ícono de iPhone. */ +export const RADIO_TEJA = 114 diff --git a/src/lib/reporte.ts b/src/lib/reporte.ts index 50640b8..67e8c7d 100644 --- a/src/lib/reporte.ts +++ b/src/lib/reporte.ts @@ -2,6 +2,7 @@ import type { Lote } from '../db/schema' import type { LoteMetrics } from './metrics' import { entregarArchivo, nombreArchivo, type ComoSeGuardo } from './archivo' import { COLOR } from './colores' +import { ANILLO, POLLITO, RADIO_TEJA, TINTA_MARCA } from './marca' import { money, num, pct } from './format' export interface KpiReporte { @@ -265,25 +266,36 @@ function recortar(ctx: CanvasRenderingContext2D, texto: string, max: number): st return t + '…' } -// La marca «Engorde»: el anillo cónico, mismo path que public/icon.svg, en el -// verde de la app, con el punto del día en verde claro. -const MARCA_RING = - 'M 256 97 L 283.7 98.7 L 310.8 105.3 L 336.5 116.5 L 359.9 132.1 L 380.4 151.6 L 397.2 174.5 L 409.9 200 L 417.9 227.5 L 421.1 256 L 419.2 284.8 L 412.4 312.9 L 400.7 339.6 L 384.5 363.9 L 364.3 385 L 340.6 402.5 L 314.1 415.6 L 285.6 423.9 L 256 427.2 L 226.2 425.2 L 197 418.1 L 169.4 406 L 144.2 389.2 L 122.3 368.2 L 104.2 343.6 L 90.7 316.2 L 82.1 286.7 L 78.7 256 L 80.8 225.1 L 88.2 194.9 L 100.7 166.4 L 118.1 140.3 L 139.9 117.6 L 165.3 99 L 193.8 85 A 34 34 0 0 1 217 148.9 L 198.7 156.7 L 181.9 167.6 L 167.1 181.4 L 154.9 197.6 L 145.7 215.9 L 139.7 235.5 L 137.3 256 L 138.4 276.7 L 143.1 297.1 L 151.4 316.4 L 163 334.1 L 177.5 349.5 L 194.6 362.3 L 213.8 372 L 234.4 378.3 L 256 380.8 L 277.8 379.6 L 299.2 374.6 L 319.4 365.8 L 338 353.7 L 354.2 338.4 L 367.6 320.4 L 377.7 300.3 L 384.2 278.6 L 386.9 256 L 385.6 233.2 L 380.3 210.8 L 371.1 189.5 L 358.4 170.1 L 342.3 153.1 L 323.5 139.1 L 302.4 128.5 L 279.7 121.8 L 256 119 Z' - +// La marca, la misma de public/icon.svg: el anillo del ciclo con el pollito. function dibujarMarca(ctx: CanvasRenderingContext2D, x: number, y: number, size: number) { - const s = size / 512 + const t = TINTA_MARCA + const circulo = (c: { cx: number; cy: number; r: number }, color: string) => { + ctx.fillStyle = color + ctx.beginPath() + ctx.arc(c.cx, c.cy, c.r, 0, Math.PI * 2) + ctx.fill() + } ctx.save() ctx.translate(x, y) - ctx.scale(s, s) - ctx.fillStyle = COLOR.verdeOscuro + ctx.scale(size / 512, size / 512) + ctx.fillStyle = t.fondo ctx.beginPath() - ctx.roundRect(0, 0, 512, 512, 118) - ctx.fill() - ctx.fillStyle = COLOR.papelAlto - ctx.fill(new Path2D(MARCA_RING)) - ctx.fillStyle = COLOR.verdeClaro - ctx.beginPath() - ctx.arc(230.3, 110.3, 16, 0, Math.PI * 2) + ctx.roundRect(0, 0, 512, 512, RADIO_TEJA) ctx.fill() + ctx.fillStyle = t.anillo + ctx.fill(new Path2D(ANILLO)) + ctx.fillStyle = t.pico + for (const p of POLLITO.patas) { + ctx.beginPath() + ctx.roundRect(p.x, p.y, p.w, p.h, p.w / 2) + ctx.fill() + } + circulo(POLLITO.cuerpo, t.pollito) + circulo(POLLITO.cabeza, t.pollito) + ctx.fillStyle = t.pico + ctx.fill(new Path2D(POLLITO.pico)) + ctx.fillStyle = t.ala + ctx.fill(new Path2D(POLLITO.ala)) + circulo(POLLITO.ojo, t.fondo) ctx.restore() } diff --git a/vite.config.ts b/vite.config.ts index 6017da3..4204cc9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -50,7 +50,8 @@ export default defineConfig({ { src: 'icon.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any' }, { src: 'pwa-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' }, { src: 'pwa-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' }, - { src: 'pwa-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }, + // A sangre y sin esquinas: Android le pone la forma que use el teléfono. + { src: 'pwa-maskable-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }, ], }, }),