Conversation
…ate relationships in junction tables
… use created publication ID
… of DOI for path generation
…icationIndices for static page generation
…or improved querying
…ssref integration
…and normalize DOI handling
…tion metadata by DOI
…h DOI lookup and drag sorting
…in publication management
…st with DOI and actions
…orting and DOI lookup
…ting publications with DOI lookup
…ration and DOI support
…ation.id instead of doi
… index to publication selection
9 tasks
There was a problem hiding this comment.
Pull request overview
Implements a full admin publication management workflow (CRUD + drag-and-drop ordering) and adds DOI metadata lookup via OpenAlex/Crossref, while refactoring the Publication model to use a stable id primary key and an index ordering field.
Changes:
- Added DOI lookup clients/services (OpenAlex + Crossref) with shared normalization/utilities.
- Introduced admin publications UI (list, row, form dialog) and server actions including reorder + distinct-value helpers.
- Refactored publication routing and related queries/utilities to use
indexand to allow nullable DOIs.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/publications/shared.ts | Shared DOI client types/constants + normalization helper. |
| src/lib/publications/openalex.ts | OpenAlex DOI metadata fetch + parsing. |
| src/lib/publications/index.ts | Barrel exports for publication lookup utilities. |
| src/lib/publications/doi-lookup.ts | Unified DOI lookup (OpenAlex first, Crossref fallback). |
| src/lib/publications/crossref.ts | Crossref DOI metadata fetch + parsing. |
| src/lib/metadata.ts | Publication metadata generation updated to use index path + optional DOI. |
| src/lib/db/queries/research.ts | Research stats dedupe updated from DOI to publication ID. |
| src/lib/db/queries/publications.ts | Static params + detail query refactored from DOI to index. |
| src/lib/citation.ts | Citation formatting updated to support nullable DOI and cleaner BibTeX output. |
| src/lib/admin/schemas/index.ts | Added publication + DOI lookup schemas with DOI normalization transforms. |
| src/lib/admin/actions/types.ts | Added PublicationFormData type for admin forms/actions. |
| src/lib/admin/actions/publications.ts | New publications server actions (CRUD, reorder, DOI lookup, distinct journals/authors). |
| src/lib/admin/actions/index.ts | Exported publication actions/types from admin actions entrypoint. |
| src/lib/admin/actions/dashboard.ts | Dashboard “recent publications” now includes id/index and nullable DOI. |
| src/components/publication/publications-by-year.tsx | React key updated to publication id. |
| src/components/publication/publication-card.tsx | Detail routing switched to index; DOI link made conditional; shows index in UI. |
| src/components/admin/shared/tag-input.tsx | New TagInput component with suggestions + keyboard support. |
| src/components/admin/shared/skeletons.tsx | Added publication list skeleton UI. |
| src/components/admin/shared/index.ts | Re-exported TagInput + PublicationListSkeleton. |
| src/components/admin/layout/sidebar-nav.tsx | Added “Publications” entry in admin sidebar nav. |
| src/app/admin/(authenticated)/publications/page.tsx | Admin publications page wiring (fetch list + distinct values). |
| src/app/admin/(authenticated)/publications/loading.tsx | Loading skeleton for admin publications page. |
| src/app/admin/(authenticated)/publications/_components/publication-row.tsx | Sortable row UI for a single publication. |
| src/app/admin/(authenticated)/publications/_components/publication-list.tsx | Main admin list UI with search, DnD reorder, CRUD dialogs. |
| src/app/admin/(authenticated)/publications/_components/publication-form-dialog.tsx | Create/edit dialog with DOI lookup autofill. |
| src/app/admin/(authenticated)/publications/_components/index.ts | Barrel exports for admin publications components. |
| src/app/admin/(authenticated)/_components/stats-grid.tsx | Publications stat card links to /admin/publications. |
| src/app/(public)/publications/[index]/page.tsx | Public publication detail route switched to [index] + static params by index. |
| src/app/(public)/page.tsx | Home “recent publications” list updated to include index and route by index. |
| prisma/seed.ts | Seed now populates index and uses publicationId in junction tables. |
| prisma/schema.prisma | Publication PK changed to CUID id, added unique index, DOI optional unique, updated relations. |
Comments suppressed due to low confidence (1)
src/app/(public)/publications/[index]/page.tsx:50
- Routing publication detail pages by the mutable
index(which is reassigned on reorder/delete) will make public URLs unstable and can break existing links/SEO. Consider routing by the stablePublication.id(or DOI when present) and treatindexstrictly as an ordering field; if you need backward compatibility, add redirects from the old pattern.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Implemented a robust publication management system within the admin panel, featuring drag-and-drop reordering, auto-fill metadata via DOI lookup (OpenAlex/Crossref), and comprehensive list/detail views. This update also refactors the publication data model to support manual ordering via an
indexfield and introduces a unified citation generation utility.Changes:
Refactored Publication Data Model (
prisma/schema.prisma):indexinteger field for custom ordering (replacing simple date-based sorting).idfield for better compatibility with ORM relationships, while keepingdoias a unique optional field.MemberPublicationandPublicationResearchAreato use the newid.indexfield.Implemented Admin Publication Management (
src/app/admin/(authenticated)/publications/):PublicationListusing@dnd-kitto allow drag-and-drop reordering of publications.PublicationFormDialogwith a "DOI Lookup" feature that auto-fills metadata (Title, Authors, Abstract, Journal, etc.) by fetching from OpenAlex or Crossref APIs.createPublication,updatePublication,deletePublication,reorderPublications) with transactional integrity for index updates.Enhanced Public Views:
PublicationCardandPublicationRowto use the new data structure.PublicationDetailPage([doi]->[index]) to route by index for stable URLs even if DOIs change/are missing.PublicationsWithFilterscomponent combining the filter UI with the grouped-by-year list view.Developed Publication Utilities (
src/lib/publications/):doi-lookup.tsservice that orchestrates fetching fromopenalexandcrossref.citation.tsto generate formatted citations (APA, MLA, BibTeX) from publication data.UI Improvements:
TagInputfor managing multi-value fields like Authors and Journals with autocomplete support.MemberPortraitfor consistent avatar display across the app.