Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "avicontrol",
"private": true,
"version": "1.14.0",
"version": "1.14.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
Binary file modified public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/pwa-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/pwa-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/pwa-maskable-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 26 additions & 14 deletions src/components/icons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SVGProps } from 'react'
import { ANILLO, POLLITO, RADIO_TEJA, TINTA_MARCA } from '../lib/marca'

const base = (props: SVGProps<SVGSVGElement>) => ({
width: 24,
Expand Down Expand Up @@ -131,29 +132,40 @@ export const IconCheck = (p: SVGProps<SVGSVGElement>) => (
</svg>
)

// 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<SVGSVGElement>) {
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 (
<svg width={size} height={size} viewBox="0 0 512 512" fill="none" aria-hidden {...props}>
{tile && <rect width="512" height="512" rx="118" fill="#153F27" />}
{tile && <rect width="512" height="512" rx={RADIO_TEJA} fill={t.fondo} />}
<path
d={RING}
fill={tile ? '#FFFEFA' : 'currentColor'}
{...(small
? { stroke: tile ? '#FFFEFA' : 'currentColor', strokeWidth: 20, strokeLinejoin: 'round' as const }
: {})}
d={ANILLO}
fill={anillo}
{...(chico ? { stroke: anillo, strokeWidth: 16, strokeLinejoin: 'round' as const } : {})}
/>
{!small && <circle cx="230.3" cy="110.3" r="16" fill={tile ? '#4FA968' : 'currentColor'} />}
{!chico &&
POLLITO.patas.map((p) => (
<rect key={p.x} x={p.x} y={p.y} width={p.w} height={p.h} rx={p.w / 2} fill={tile ? t.pico : 'currentColor'} />
))}
<circle {...POLLITO.cuerpo} fill={pollito} />
<circle {...POLLITO.cabeza} fill={pollito} />
<path d={POLLITO.pico} fill={tile ? t.pico : 'currentColor'} />
{tile && !chico && (
<>
<path d={POLLITO.ala} fill={t.ala} />
<circle {...POLLITO.ojo} fill={t.fondo} />
</>
)}
</svg>
)
}
31 changes: 31 additions & 0 deletions src/lib/marca.ts
Original file line number Diff line number Diff line change
@@ -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
42 changes: 27 additions & 15 deletions src/lib/reporte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
}
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
},
}),
Expand Down
Loading