Add ability to import and bidirectionally sync Zotero reference collections#654
Open
petebachant wants to merge 18 commits into
Open
Add ability to import and bidirectionally sync Zotero reference collections#654petebachant wants to merge 18 commits into
petebachant wants to merge 18 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Zotero-backed reference management to Calkit projects, including importing Zotero collections, syncing (pull) updates, and editing/viewing reference items and notes in the UI, with corresponding backend APIs and generated client updates.
Changes:
- Implement Zotero import/sync endpoints plus reference item + note CRUD (with optional Zotero note/PDF integration).
- Revamp the References page UI to support collection selection, search, item details modal (PDF + notes), and collection/item creation/editing flows.
- Add BibTeX/LaTeX display-cleanup helpers (with tests) and introduce a project-wide Cmd/Ctrl+K command palette.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/routes/_layout/$accountName/$projectName/_layout/references.tsx | New references UI with collection selection, search, modals, and Zotero import entry points |
| frontend/src/routes/_layout/$accountName/$projectName/_layout.tsx | Mount project command palette in the main project layout |
| frontend/src/lib/bibtex.ts | Add helpers to clean/display BibTeX/LaTeX field values |
| frontend/src/lib/bibtex.test.ts | Test coverage for BibTeX display helpers |
| frontend/src/components/References/ReferencesInfoPanel.tsx | Add info/comments panel for a selected references collection + Zotero sync button |
| frontend/src/components/References/ReferenceItemModal.tsx | Full-screen reference item modal with PDF viewer + anchored notes editing |
| frontend/src/components/References/NewReferencesCollection.tsx | Modal to create a new empty .bib references collection |
| frontend/src/components/References/ImportFromZoteroModal.tsx | Modal flow to import from Zotero (whole collection or selected items) |
| frontend/src/components/References/FileViewModal.tsx | Minor import/style adjustment for reference file viewing |
| frontend/src/components/References/EditReferenceItemModal.tsx | Modal to add/edit a BibTeX entry in a collection |
| frontend/src/components/Common/SidebarItems.tsx | Export project nav items for reuse by the command palette |
| frontend/src/components/Common/ProjectCommandPalette.tsx | New Cmd/Ctrl+K project section jump palette |
| frontend/src/client/types.gen.ts | Generated client types for new references/Zotero/note APIs |
| frontend/src/client/sdk.gen.ts | Generated SDK methods for new references/Zotero/note endpoints |
| frontend/src/client/schemas.gen.ts | Generated schemas for new references/Zotero/note models |
| backend/app/zotero.py | Zotero Web API integration + BibTeX formatting + note (de)serialization helpers |
| backend/app/users.py | Add helper to fetch Zotero API key plus Zotero user id |
| backend/app/tests/api/routes/projects/test_core.py | Add extensive API tests for Zotero import/sync, PDF, reference items, and notes |
| backend/app/api/routes/projects/core.py | Add/extend project routes for references collections, items, Zotero import/sync, and notes |
| AGENTS.md | Add troubleshooting guidance for stale frontend client vs backend behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+92
to
+99
| let href: string | undefined | ||
| if (key === "doi") { | ||
| href = value.startsWith("http") | ||
| ? value | ||
| : `https://doi.org/${value}` | ||
| } else if (key === "url") { | ||
| href = value | ||
| } |
Comment on lines
+96
to
+105
| if (entry.has_pdf) { | ||
| setPdfLoading(true) | ||
| const url = | ||
| `${apiUrl}/projects/${ownerName}/${projectName}/zotero/items/` + | ||
| `${encodeURIComponent(entry.key)}/pdf?path=${encodeURIComponent(bibPath)}` | ||
| fetch(url, { | ||
| headers: { | ||
| Authorization: `Bearer ${localStorage.getItem("access_token")}`, | ||
| }, | ||
| }) |
Comment on lines
+681
to
+683
| # Local, gitignored Zotero state under .calkit/zotero/ (like Overleaf's | ||
| # .calkit/overleaf/). The durable link is committed in calkit.yaml; these files | ||
| # hold only local sync bookkeeping and cached item/note metadata. |
Comment on lines
5086
to
+5089
| for ref_collection in ref_collections: | ||
| # Read entries | ||
| path = ref_collection["path"] | ||
| link = ref_collection.get("zotero") |
Comment on lines
+5981
to
+5983
| Notes are serialized to Markdown (one ``# heading`` section per titled note) | ||
| and committed. For a Zotero-linked reference, the notes are also pushed to | ||
| Zotero. |
Comment on lines
+106
to
+107
| enabled: isOpen && mode === "items" && Boolean(library), | ||
| }) |
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.
Resolves #146