feat(db): migrate calculator and gallery to mineral_families API#6
Merged
feat(db): migrate calculator and gallery to mineral_families API#6
Conversation
Update all database query functions to use the normalized mineral_families table instead of the denormalized minerals table. This deduplicates results from 108 minerals (with expression variants like beryl-prism, beryl-tabular) to 68 unique mineral families. Changes: - getAllMinerals() and getAllMineralsPaginated() now query mineral_families - findMineralsByRI/SG use mineral_families for unique gem identification - getMineralsWithSG/Dispersion/Hardness return deduplicated results - getMineralsForRefractometer queries families for cleaner tool UX - getMineralsWithPleochroism returns unique family entries - Add new Family/Expression types and query functions - Update Gallery component to use useFamilies hook - Add FamilyCard and FamilyModal components for family-based browsing
d62af18 to
e4bc36b
Compare
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
mineral_familiestableChanges
Database Layer (
src/lib/db.ts,src/lib/db-server.ts)getAllMinerals()andgetAllMineralsPaginated()now querymineral_familiesfindMineralsByRI/SGusemineral_familiesfor unique gem identificationgetMineralsWithSG/Dispersion/Hardnessreturn deduplicated resultsgetMineralsForRefractometerqueries families for cleaner tool UXgetMineralsWithPleochroismreturns unique family entriesMineralFamily,MineralExpression,MineralFamilyWithExpressionstypesgetAllFamilies(),getFamilyById(),getFamilyWithExpressions(), etc.Gallery Components
Gallery.tsxto useuseFamilieshook instead ofuseCrystalDBFamilyCard.tsxfor displaying mineral families with expression countsFamilyModal.tsxfor viewing family details and expressionsGalleryGrid.tsxto render family cardsHooks
useFamilies.tshook for fetching and filtering mineral familiesTest plan