From 2165d4a976c7cea2b7df132089c11836732ee31f Mon Sep 17 00:00:00 2001 From: Guillermo Arrieta Medina Date: Fri, 6 Mar 2026 17:58:40 -0600 Subject: [PATCH 1/2] =?UTF-8?q?Generaci=C3=B3n=20de=20sugerencias=20y=20pe?= =?UTF-8?q?rsistencia=20en=20BDD=20funcional.=20Falta=20afinar=20detalles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/copilot-instructions.md | 1 + bun.lock | 3 + package.json | 1 + public/csl/locales/locales-es-MX.xml | 757 +++ public/csl/styles/apa.csl | 2273 +++++++++ public/csl/styles/chicago-author-date.csl | 4189 +++++++++++++++++ public/csl/styles/ieee.csl | 519 ++ public/csl/styles/nlm-citation-sequence.csl | 520 ++ .../asignaturas/detalle/BibliographyItem.tsx | 93 +- src/data/api/subjects.api.ts | 66 + .../nueva/NuevaBibliografiaModalContainer.tsx | 1224 +++++ .../$asignaturaId/bibliografia.tsx | 6 +- .../$asignaturaId/bibliografia/index.tsx | 13 + .../$asignaturaId/bibliografia/nueva.tsx | 19 + src/types/citeproc.d.ts | 12 + tsconfig.json | 1 + 16 files changed, 9615 insertions(+), 82 deletions(-) create mode 100644 .github/copilot-instructions.md create mode 100644 public/csl/locales/locales-es-MX.xml create mode 100644 public/csl/styles/apa.csl create mode 100644 public/csl/styles/chicago-author-date.csl create mode 100644 public/csl/styles/ieee.csl create mode 100644 public/csl/styles/nlm-citation-sequence.csl create mode 100644 src/features/bibliografia/nueva/NuevaBibliografiaModalContainer.tsx create mode 100644 src/routes/planes/$planId/asignaturas/$asignaturaId/bibliografia/index.tsx create mode 100644 src/routes/planes/$planId/asignaturas/$asignaturaId/bibliografia/nueva.tsx create mode 100644 src/types/citeproc.d.ts diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..712961b --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +Ignora los problemas de imports de eslint diff --git a/bun.lock b/bun.lock index 7c9d598..f370735 100644 --- a/bun.lock +++ b/bun.lock @@ -30,6 +30,7 @@ "@tanstack/router-plugin": "^1.132.0", "@types/canvas-confetti": "^1.9.0", "canvas-confetti": "^1.9.4", + "citeproc": "^2.4.63", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", @@ -735,6 +736,8 @@ "chownr": ["chownr@3.0.0", "", {}, "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="], + "citeproc": ["citeproc@2.4.63", "", {}, "sha512-68F95Bp4UbgZU/DBUGQn0qV3HDZLCdI9+Bb2ByrTaNJDL5VEm9LqaiNaxljsvoaExSLEXe1/r6n2Z06SCzW3/Q=="], + "class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="], "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], diff --git a/package.json b/package.json index 4c911fc..50c7906 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@tanstack/router-plugin": "^1.132.0", "@types/canvas-confetti": "^1.9.0", "canvas-confetti": "^1.9.4", + "citeproc": "^2.4.63", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", diff --git a/public/csl/locales/locales-es-MX.xml b/public/csl/locales/locales-es-MX.xml new file mode 100644 index 0000000..4d980a5 --- /dev/null +++ b/public/csl/locales/locales-es-MX.xml @@ -0,0 +1,757 @@ + + + + + Juan Ignacio Flores Salgado + https://www.mendeley.com/profiles/juan-ignacio-flores-salgado/ + + This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License + 2025-10-16T03:24:00+00:00 + + + + + + + + + + + + + + + consultado + advance online publication + album + y + et al. + anónimo + en + audio recording + disponible en + de + circa + citado + et al. + film + en preparación + a partir de + henceforth + ibid. + en + en imprenta + internet + carta + loc. cit. + sin fecha + no place + no publisher + on + en línea + op. cit. + obra original publicada en + comunicación personal + podcast + podcast episode + preprint + presentado en + radio broadcast + radio series + radio series episode + + referencia + referencias + + recuperado + review of + escala + special issue + special section + television broadcast + television series + television series episode + video + working paper + + + anón. + c. + s/f + n.p. + n.p. + + ref. + refs. + + rev. of + + + + + preprint + journal article + magazine article + newspaper article + bill + + broadcast + + classic + collection + dataset + document + entry + dictionary entry + encyclopedia entry + event + + graphic + hearing + entrevista + legal case + legislation + manuscript + map + video recording + musical score + pamphlet + conference paper + patent + performance + periodical + comunicación personal + post + blog post + regulation + report + review + book review + software + audio recording + presentation + standard + thesis + treaty + webpage + + + journal art. + mag. art. + newspaper art. + + + doc. + + graph. + interv. + MS + video rec. + rep. + rev. + bk. rev. + audio rec. + + + + testimony of + review of + review of the book + + + + + d. C. + a. C. + BCE + CE + + + + + + + + : + , + ; + + + a + a + o + + + primera + segunda + tercera + cuarta + quinta + sexta + séptima + octava + novena + décima + + + + act + acts + + + appendix + appendices + + + article + articles + + + libro + libros + + + canon + canons + + + capítulo + capítulos + + + columna + columnas + + + location + locations + + + equation + equations + + + figura + figuras + + + folio + folios + + + número + números + + + línea + líneas + + + nota + notas + + + opus + opera + + + página + páginas + + + párrafo + párrafos + + + parte + partes + + + rule + rules + + + scene + scenes + + + sección + secciones + + + sub voce + sub vocibus + + + supplement + supplements + + + table + tables + + + + + + + title + titles + + + verso + versos + + + volumen + volúmenes + + + + + app. + apps. + + + art. + arts. + + + lib. + libs. + + + cap. + caps. + + + col. + cols. + + + loc. + locs. + + + eq. + eqs. + + + fig. + figs. + + + f. + ff. + + + núm. + núms. + + + l. + ls. + + + n. + nn. + + + op. + opp. + + + p. + pp. + + + párr. + párrs. + + + pt. + pts. + + + r. + rr. + + + sc. + scs. + + + sec. + secs. + + + s. v. + s. vv. + + + supp. + supps. + + + tbl. + tbls. + + + + + + + tit. + tits. + + + v. + vv. + + + vol. + vols. + + + + + + + + + § + § + + + + + chapter + chapters + + + citation + citations + + + número + números + + + edición + ediciones + + + reference + references + + + number + numbers + + + página + páginas + + + volume + volumes + + + page + pages + + + printing + printings + + versión + + + + chap. + chaps. + + + cit. + cits. + + + núm. + núms. + + + ed. + eds. + + + ref. + refs. + + + no. + nos. + + + p. + pp. + + + vol. + vols. + + + p. + pp. + + + print. + prints. + + + + + + chair + chairs + + + ed. + eds. + + + compiler + compilers + + + + + contributor + contributors + + + curator + curators + + + director + directores + + + editor + editores + + + editor y traductor + editores y traductores + + + editor y traductor + editores y traductores + + + coordinador + coordinadores + + + executive producer + executive producers + + + guest + guests + + + host + hosts + + + ilustrador + ilustradores + + + + narrator + narrators + + + organizer + organizers + + + + performer + performers + + + producer + producers + + + + + writer + writers + + + series creator + series creators + + + traductor + traductores + + + + + comp. + comps. + + + contrib. + contribs. + + + cur. + curs. + + + dir. + dirs. + + + ed. + eds. + + + ed. y trad. + eds. y trads. + + + ed. y trad. + eds. y trads. + + + coord. + coords. + + + exec. prod. + exec. prods. + + + ilust. + ilusts. + + + narr. + narrs. + + + org. + orgs. + + + perf. + perfs. + + + prod. + prods. + + + writ. + writs. + + + cre. + cres. + + + trad. + trads. + + + + chaired by + edited by + compiled by + de + with + curated by + dirigido por + editado por + editado y traducido por + editado y traducido por + coordinado por + executive produced by + with guest + hosted by + ilustrado por + entrevistado por + narrated by + organized by + performed by + produced by + a + por + written by + created by + traducido por + + + ed. by + comp. by + w. + cur. by + dir. + ed. + ed. y trad. + ed. y trad. + coord. + exec. prod. by + w. guest + hosted by + ilust. + narr. by + org. by + perf. by + prod. by + writ. by + cre. by + trad. + + + enero + febrero + marzo + abril + mayo + junio + julio + agosto + septiembre + octubre + noviembre + diciembre + + + ene. + feb. + mar. + abr. + may + jun. + jul. + ago. + sep. + oct. + nov. + dic. + + + primavera + verano + otoño + invierno + + diff --git a/public/csl/styles/apa.csl b/public/csl/styles/apa.csl new file mode 100644 index 0000000..9bc45ef --- /dev/null +++ b/public/csl/styles/apa.csl @@ -0,0 +1,2273 @@ + + diff --git a/public/csl/styles/chicago-author-date.csl b/public/csl/styles/chicago-author-date.csl new file mode 100644 index 0000000..d29fadb --- /dev/null +++ b/public/csl/styles/chicago-author-date.csl @@ -0,0 +1,4189 @@ + + diff --git a/public/csl/styles/ieee.csl b/public/csl/styles/ieee.csl new file mode 100644 index 0000000..7612c15 --- /dev/null +++ b/public/csl/styles/ieee.csl @@ -0,0 +1,519 @@ + + diff --git a/public/csl/styles/nlm-citation-sequence.csl b/public/csl/styles/nlm-citation-sequence.csl new file mode 100644 index 0000000..958115d --- /dev/null +++ b/public/csl/styles/nlm-citation-sequence.csl @@ -0,0 +1,520 @@ + + diff --git a/src/components/asignaturas/detalle/BibliographyItem.tsx b/src/components/asignaturas/detalle/BibliographyItem.tsx index 2067498..05578fc 100644 --- a/src/components/asignaturas/detalle/BibliographyItem.tsx +++ b/src/components/asignaturas/detalle/BibliographyItem.tsx @@ -1,7 +1,7 @@ /* eslint-disable jsx-a11y/click-events-have-key-events */ -/* eslint-disable jsx-a11y/label-has-associated-control */ + /* eslint-disable jsx-a11y/no-static-element-interactions */ -import { useParams } from '@tanstack/react-router' +import { useNavigate, useParams } from '@tanstack/react-router' import { Plus, Search, BookOpen, Trash2, Library, Edit3 } from 'lucide-react' import { useState } from 'react' @@ -54,7 +54,8 @@ export interface BibliografiaEntry { } export function BibliographyItem() { - const { asignaturaId } = useParams({ + const navigate = useNavigate() + const { planId, asignaturaId } = useParams({ from: '/planes/$planId/asignaturas/$asignaturaId', }) @@ -68,13 +69,9 @@ export function BibliographyItem() { const { mutate: eliminarBibliografia } = useDeleteBibliografia(asignaturaId) // --- 3. Estados de UI (Solo para diálogos y edición) --- - const [isAddDialogOpen, setIsAddDialogOpen] = useState(false) const [isLibraryDialogOpen, setIsLibraryDialogOpen] = useState(false) const [deleteId, setDeleteId] = useState(null) const [editingId, setEditingId] = useState(null) - const [newEntryType, setNewEntryType] = useState<'BASICA' | 'COMPLEMENTARIA'>( - 'BASICA', - ) console.log('Datos actuales en el front:', bibliografia) // --- 4. Derivación de datos (Se calculan en cada render) --- @@ -85,20 +82,6 @@ export function BibliographyItem() { // --- Handlers Conectados a la Base de Datos --- - const handleAddManual = (cita: string) => { - crearBibliografia( - { - asignatura_id: asignaturaId, - tipo: newEntryType, - cita, - tipo_fuente: 'MANUAL', - }, - { - onSuccess: () => setIsAddDialogOpen(false), - }, - ) - } - const handleAddFromLibrary = ( resource: any, tipo: 'BASICA' | 'COMPLEMENTARIA', @@ -179,20 +162,17 @@ export function BibliographyItem() { - - - - - - - - + @@ -364,49 +344,6 @@ function BibliografiaCard({ ) } -function AddManualDialog({ tipo, onTypeChange, onAdd }: any) { - const [cita, setCita] = useState('') - return ( -
- - Referencia Manual - -
- - -
-
- -