Skip to content

Commit

Permalink
Nouveaux icônes
Browse files Browse the repository at this point in the history
  • Loading branch information
laem committed Jan 20, 2025
1 parent b3a4f14 commit 2ff6a54
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 14 deletions.
3 changes: 2 additions & 1 deletion app/QuickFeatureSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
SpinningDiscBorder,
} from './QuickFeatureSearchUI'
import categories from './categories.yaml'
import moreCategories from './moreCategories.yaml'
import { filteredMoreCategories } from '@/components/categories'
const moreCategories = filteredMoreCategories
import categoryIconUrl from '@/components/categoryIconUrl'

export function initializeFuse(categories) {
Expand Down
2 changes: 1 addition & 1 deletion app/effects/fetchOverpassRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import categories from '@/app/categories.yaml'
import moreCategories from '@/app/moreCategories.yaml'
import { filteredMoreCategories as moreCategories } from '@/components/categories'
import {
enrichOsmFeatureWithPolyon,
overpassRequestSuffix,
Expand Down
19 changes: 10 additions & 9 deletions app/moreCategories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,38 +280,38 @@
- charcuterie
- charcutier
query: '[shop=butcher]'
icon: butcher
icon: meat

- name: Café
- name: Boutique de café
category: Alimentation
dictionary:
- torréfacteur
query: '[shop=coffee]'
icon: coffee
icon: cafe

- name: Caviste
category: Alimentation
dictionary:
- vin
- bouteille
query: '[shop=wine]'
icon: wine
icon: bottle

- name: Confiserie
category: Alimentation
dictionary:
- bonbon
- sucrerie
query: '[shop=confectionery]'
icon: confectionery
icon: candy

- name: Chocolatier
category: Alimentation
dictionary:
- chocolat
- tablette
query: '[shop=chocolate]'
icon: mx_chocolate
icon: chocolate

- name: Épicerie fine
category: Alimentation
Expand All @@ -334,10 +334,11 @@
- glace
- sorbet
query: '[shop=ice_cream]'
icon: ice_cream
icon: ice-cream

- name: Miellerie
category: Alimentation
inactive: Very specific; needs icon
dictionary:
- miel
- propolis
Expand All @@ -361,15 +362,15 @@
- crustacé
- fruits de mer
query: '[shop=seafood]'
icon: mx_shop_seafood
icon: fish

- name: Primeur
category: Alimentation
dictionary:
- fruits
- légumes
query: '[shop=greengrocer]'
icon: greengrocer
icon: grapes

- name: Produits de la ferme
category: Alimentation
Expand Down
16 changes: 14 additions & 2 deletions app/svgo/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ const fromSvgToImgSrc = (imageText, background) => {
})
*/

const svgSize = svg.getAttribute('width'), // Icons must be square !
xyr = svgSize / 2
let svgSize = svg.getAttribute('width') // Icons must be square !

if (!svgSize) {
const viewBox = svg.getAttribute('viewBox')
const dimensions = viewBox.split(' ')
const startsAtZero = dimensions[0] === dimensions[1] && dimensions[0] == 0
const sameExtend = dimensions[2] === dimensions[3]
if (!startsAtZero || !sameExtend)
throw new Error(
'The SVG should have width and height attributes and a corresponding viewBox'
)
svgSize = dimensions[2]
}

const xyr = svgSize / 2
const backgroundDisk = `<circle
style="fill:${encodeURIComponent(background)};fill-rule:evenodd"
cx="${xyr}"
Expand Down
6 changes: 5 additions & 1 deletion components/categories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import baseCategories from '@/app/categories.yaml'
import moreCategories from '@/app/moreCategories.yaml'

export const categories = [...baseCategories, ...moreCategories]
export const filteredMoreCategories = moreCategories.filter(
(cat) => !cat.inactive
)

export const categories = [...baseCategories, ...filteredMoreCategories]

// use this to complete categoryColors.yaml

Expand Down
52 changes: 52 additions & 0 deletions public/icons/candy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/chocolate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/icons/farm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions public/icons/fish.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions public/icons/grapes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/icons/ice-cream.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/meat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ff6a54

Please sign in to comment.