Repository navigation
Give crops icons from Fluent Emoji, chosen by crop wranglers - #4837
Merged
Merged
Conversation
56 fruit, vegetable, herb, flower, tree and grain icons, in the flat style of Fluent Emoji, for crops to be drawn with. They're MIT licensed, so unlike the Icons8 set they can live in this public, AGPL repository; the licence and where they came from are in the folder. Crop icons came from OpenFarm, which is gone, so crops added since have none, and none can be added. Co-Authored-By: Claude Opus 5 <[email protected]>
crops.icon names one of the icons in app/assets/images/crops, chosen on the crop form beside the parent crop. A crop is drawn with its own icon, else the one OpenFarm had, else its parent crop's, so choosing one for tomato covers every tomato. Everything that shows crop icons goes through Crop#svg_icon, so crop chips, garden cards and /crops/:slug.svg all pick them up. Co-Authored-By: Claude Opus 5 <[email protected]>
Matches crops to icons by name, including other names they go by (aubergine, capsicum) and herbs to the herb icon. A crop with no parent is also matched on the end of its name, so "cherry tomato" gets the tomato, with named chillies listed so "habanero pepper" isn't a bell pepper; a variety with a parent follows it instead. It only fills in crops without an icon, never replacing one a wrangler chose, and DRY_RUN=true lists what it would do. Co-Authored-By: Claude Opus 5 <[email protected]>
Collaborator
|
Could you chuck some notes into #4825 so neither of us forget to run the rake/db migraiton bits on deploy? |
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.
Gives crops icons again, from Microsoft's Fluent Emoji, and lets crop wranglers choose them.
Stacked on #4836, so its CI can install gems. Once that's merged, this retargets to
dev.Why
Crop icons came from OpenFarm, which is gone. Its fetching code was removed as defunct, so the icons production has are a frozen snapshot: crops added since have none, and there's no way to add one. Any crop without an icon is drawn as the same generic sprout, which makes plantings hard to tell apart on the garden cards and the new garden layout.
What changes
app/assets/images/crops/. They're MIT licensed, which allows them to be redistributed from this public, AGPL-licensed repository. The licence and the source commit are recorded alongside them.crops.icon: names one of those icons. Crop wranglers choose it on the crop form, next to "Parent crop".Crop#svg_icon, so crop chips, garden cards, the crop pages and/crops/:slug.svgall pick them up with no other changes.rake crops:assign_iconsgives existing crops icons by name. It knows other names crops go by (aubergine, capsicum) and sends herbs to the herb icon. A crop with no parent is also matched on the end of its name, so "cherry tomato" gets the tomato. Named chillies are listed, so "habanero pepper" isn't drawn as a bell pepper. It only fills in crops without an icon, never replacing one a wrangler has chosen, andDRY_RUN=truelists what it would do.Why not Icons8
The app's existing interface icons, in
app/assets/images/icons/, are from Icons8. They were added in 2019 with Icons8's permission (fcf4e0f15, "Icons from icon8, used with permission"), and they stay as they are.For crop icons we'd need a much larger set, a hundred or more, to live in this public repository. Rather than stretch that original permission to cover it, this uses an openly licensed set, which settles the question outright. Icons8 icons could still fill gaps later, with permission that covers them, through the same
crops.iconcolumn.Deploying
After the migration, run it once, dry run first:
On a development copy of 68 crops it tagged 52. The rest are crops with no matching emoji (fig, ackee, achiote, beet, ginger), which wranglers can set by hand.
Checked
The crop model, matcher, crop icon request and garden card serializer specs pass: 122 examples. They cover the choice order, validation, name matching and dry run, the SVG endpoint, and a wrangler setting an icon on the form.
🤖 Generated with Claude Code