Skip to content

Give crops icons from Fluent Emoji, chosen by crop wranglers - #4837

Merged
CloCkWeRX merged 3 commits into
devfrom
feat/fluent-crop-icons
Sep 22, 2026
Merged

CloCkWeRX merged 3 commits into
devfrom
feat/fluent-crop-icons

Conversation

@Br3nda

@Br3nda Br3nda commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

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

  • Icons: 56 fruit, vegetable, herb, flower, tree and grain icons, in the flat style of Fluent Emoji, are added to 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".
  • The order icons are chosen in: a crop is drawn with its own icon, then the icon OpenFarm had for it, then its parent crop's. Production keeps its OpenFarm icons wherever no new icon has been chosen, and choosing one for "tomato" covers every tomato variety. Everything that shows crop icons goes through Crop#svg_icon, so crop chips, garden cards, the crop pages and /crops/:slug.svg all pick them up with no other changes.
  • rake crops:assign_icons gives 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, and DRY_RUN=true lists 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.icon column.

Deploying

After the migration, run it once, dry run first:

rake crops:assign_icons DRY_RUN=true
rake crops:assign_icons

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

Br3nda and others added 3 commits September 22, 2026 20:36
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]>
Base automatically changed from fix/drop-rails-assets to dev September 22, 2026 09:11
@CloCkWeRX
CloCkWeRX merged commit 3d64118 into dev Sep 22, 2026
16 checks passed
@CloCkWeRX
CloCkWeRX deleted the feat/fluent-crop-icons branch September 22, 2026 09:15
@CloCkWeRX

Copy link
Copy Markdown
Collaborator

Could you chuck some notes into #4825 so neither of us forget to run the rake/db migraiton bits on deploy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants