forked from MapComplete/MapComplete
		
	Added pietervdv's bike shop questions
This commit is contained in:
		
							parent
							
								
									8978ecdae3
								
							
						
					
					
						commit
						6424c75c96
					
				
					 6 changed files with 118 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -8,22 +8,37 @@ import ShopRetail from "../Questions/bike/ShopRetail";
 | 
			
		|||
import ShopPump from "../Questions/bike/ShopPump";
 | 
			
		||||
import ShopRental from "../Questions/bike/ShopRental";
 | 
			
		||||
import ShopRepair from "../Questions/bike/ShopRepair";
 | 
			
		||||
import ShopDiy from "../Questions/bike/ShopDiy";
 | 
			
		||||
import ShopName from "../Questions/bike/ShopName";
 | 
			
		||||
import ShopSecondHand from "../Questions/bike/ShopSecondHand";
 | 
			
		||||
import { TagRenderingOptions } from "../TagRendering";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default class BikeShops extends LayerDefinition {
 | 
			
		||||
    private readonly sellsBikes = new Tag("service:bicycle:retail", "yes")
 | 
			
		||||
    private readonly repairsBikes = new Tag("service:bicycle:repair", "yes")
 | 
			
		||||
 | 
			
		||||
    constructor() {
 | 
			
		||||
        super();
 | 
			
		||||
        this.name = Translations.t.cylofix.shop.name.txt;
 | 
			
		||||
        this.icon = "./assets/bike/shop.svg";
 | 
			
		||||
        this.overpassFilter = new Tag("shop", "bicycle");
 | 
			
		||||
        super()
 | 
			
		||||
        this.name = Translations.t.cylofix.shop.name.txt
 | 
			
		||||
        this.icon = "./assets/bike/repair_shop.svg"
 | 
			
		||||
        this.overpassFilter = new Tag("shop", "bicycle")
 | 
			
		||||
        this.newElementTags = [
 | 
			
		||||
            new Tag("shop", "bicycle"),
 | 
			
		||||
        ];
 | 
			
		||||
        this.maxAllowedOverlapPercentage = 10;
 | 
			
		||||
        ]
 | 
			
		||||
        this.maxAllowedOverlapPercentage = 10
 | 
			
		||||
 | 
			
		||||
        this.minzoom = 13;
 | 
			
		||||
        this.style = this.generateStyleFunction();
 | 
			
		||||
        this.title = new FixedText(Translations.t.cylofix.shop.title.txt)
 | 
			
		||||
        this.minzoom = 13
 | 
			
		||||
        this.style = this.generateStyleFunction()
 | 
			
		||||
        this.title = new TagRenderingOptions({
 | 
			
		||||
            mappings: [
 | 
			
		||||
                {k: this.sellsBikes, txt: "Bicycle shop"},
 | 
			
		||||
                {k: new Tag("service:bicycle:retail", "no"), txt: Translations.t.cylofix.shop.titleRepair.txt},
 | 
			
		||||
                {k: new Tag("service:bicycle:retail", ""), txt: Translations.t.cylofix.shop.title.txt},
 | 
			
		||||
            ]
 | 
			
		||||
        })
 | 
			
		||||
        
 | 
			
		||||
        new FixedText(Translations.t.cylofix.shop.title.txt)
 | 
			
		||||
        this.elementsToShow = [
 | 
			
		||||
            new ImageCarouselWithUploadConstructor(),
 | 
			
		||||
            //new ParkingOperator(),
 | 
			
		||||
| 
						 | 
				
			
			@ -31,20 +46,29 @@ export default class BikeShops extends LayerDefinition {
 | 
			
		|||
            new ShopRental(),
 | 
			
		||||
            new ShopRepair(),
 | 
			
		||||
            new ShopPump(),
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
            new ShopDiy(),
 | 
			
		||||
            new ShopName(),
 | 
			
		||||
            new ShopSecondHand()
 | 
			
		||||
        ]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private generateStyleFunction() {
 | 
			
		||||
        const self = this;
 | 
			
		||||
        return function (properties: any) {
 | 
			
		||||
        return function (tags: any) {
 | 
			
		||||
            let icon = "assets/bike/repair_shop.svg";
 | 
			
		||||
 | 
			
		||||
            if (self.sellsBikes.matchesProperties(tags)) {
 | 
			
		||||
                icon = "assets/bike/shop.svg";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return {
 | 
			
		||||
                color: "#00bb00",
 | 
			
		||||
                icon: L.icon({
 | 
			
		||||
                    iconUrl: self.icon,
 | 
			
		||||
                    iconSize: [50, 50]
 | 
			
		||||
                    iconSize: [50, 50],
 | 
			
		||||
                    iconAnchor: [25, 50]
 | 
			
		||||
                })
 | 
			
		||||
            };
 | 
			
		||||
        };
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										19
									
								
								Customizations/Questions/bike/ShopDiy.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Customizations/Questions/bike/ShopDiy.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
import {TagRenderingOptions} from "../../TagRendering";
 | 
			
		||||
import {Tag} from "../../../Logic/TagsFilter";
 | 
			
		||||
import Translations from "../../../UI/i18n/Translations";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default class ShopPump extends TagRenderingOptions {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        const key = 'service:bicycle:diy'
 | 
			
		||||
        const to = Translations.t.cylofix.shop.diy
 | 
			
		||||
        super({
 | 
			
		||||
            priority: 5,
 | 
			
		||||
            question: to.question.Render(),
 | 
			
		||||
            mappings: [
 | 
			
		||||
                {k: new Tag(key, "yes"), txt: to.yes.Render()},
 | 
			
		||||
                {k: new Tag(key, "no"), txt: to.no.Render()},
 | 
			
		||||
            ]
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								Customizations/Questions/bike/ShopName.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Customizations/Questions/bike/ShopName.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
import {TagRenderingOptions} from "../../TagRendering";
 | 
			
		||||
import Translations from "../../../UI/i18n/Translations";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default class ShopPump extends TagRenderingOptions {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        const to = Translations.t.cylofix.shop.qName
 | 
			
		||||
        super({
 | 
			
		||||
            priority: 5,
 | 
			
		||||
            question: to.question.Render(),
 | 
			
		||||
            freeform: {
 | 
			
		||||
                key: "name",
 | 
			
		||||
                renderTemplate: to.render.txt,
 | 
			
		||||
                template: to.template.txt
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -12,6 +12,8 @@ export default class ShopRepair extends TagRenderingOptions {
 | 
			
		|||
            question: to.question.Render(),
 | 
			
		||||
            mappings: [
 | 
			
		||||
                {k: new Tag(key, "yes"), txt: to.yes.Render()},
 | 
			
		||||
                {k: new Tag(key, "only_sold"), txt: to.sold.Render()},
 | 
			
		||||
                {k: new Tag(key, "brand"), txt: to.brand.Render()},
 | 
			
		||||
                {k: new Tag(key, "no"), txt: to.no.Render()},
 | 
			
		||||
            ]
 | 
			
		||||
        });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								Customizations/Questions/bike/ShopSecondHand.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Customizations/Questions/bike/ShopSecondHand.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
import {TagRenderingOptions} from "../../TagRendering";
 | 
			
		||||
import {Tag} from "../../../Logic/TagsFilter";
 | 
			
		||||
import Translations from "../../../UI/i18n/Translations";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default class ShopPump extends TagRenderingOptions {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        const key = 'service:bicycle:second_hand'
 | 
			
		||||
        const to = Translations.t.cylofix.shop.secondHand
 | 
			
		||||
        super({
 | 
			
		||||
            priority: 5,
 | 
			
		||||
            question: to.question.Render(),
 | 
			
		||||
            mappings: [
 | 
			
		||||
                {k: new Tag(key, "yes"), txt: to.yes.Render()},
 | 
			
		||||
                {k: new Tag(key, "no"), txt: to.no.Render()},
 | 
			
		||||
                {k: new Tag(key, "only"), txt: to.only.Render()},
 | 
			
		||||
            ]
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +88,8 @@ export default class Translations {
 | 
			
		|||
            },
 | 
			
		||||
            shop: {
 | 
			
		||||
                name: new T({en: 'bike shop', nl: 'fietswinkel', fr: 'TODO: fr'}),
 | 
			
		||||
                title: new T({en: 'Bike shop', nl: 'Fietswinkel', fr: 'TODO: fr'}),
 | 
			
		||||
                title: new T({en: 'Bike repair/shop', nl: 'Fietswinkel/herstelling', fr: 'TODO: fr'}),
 | 
			
		||||
                titleRepair: new T({en: 'Bike shop', nl: 'Fietswinkel', fr: 'TODO: fr'}),
 | 
			
		||||
                retail: {
 | 
			
		||||
                    question: new T({en: 'Does this shop sell bikes?', nl: 'Verkoopt deze winkel fietsen?', fr: 'TODO: fr'}),
 | 
			
		||||
                    yes: new T({en: 'This shop sells bikes', nl: 'Deze winkel verkoopt fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +98,8 @@ export default class Translations {
 | 
			
		|||
                repair: {
 | 
			
		||||
                    question: new T({en: 'Does this shop repair bikes?', nl: 'Verkoopt deze winkel fietsen?', fr: 'TODO: fr'}),
 | 
			
		||||
                    yes: new T({en: 'This shop repairs bikes', nl: 'Deze winkel herstelt fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
                    sold: new T({en: 'This shop only repairs bikes bought here', nl: 'Deze winkel herstelt enkel fietsen die hier werden gekocht', fr: 'TODO: fr'}),
 | 
			
		||||
                    brand: new T({en: 'This shop only repairs bikes of a certain brand', nl: 'Deze winkel herstelt enkel fietsen van een bepaald merk', fr: 'TODO: fr'}),
 | 
			
		||||
                    no: new T({en: 'This shop doesn\'t repair bikes', nl: 'Deze winkel herstelt geen fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
                },
 | 
			
		||||
                rental: {
 | 
			
		||||
| 
						 | 
				
			
			@ -108,6 +111,22 @@ export default class Translations {
 | 
			
		|||
                    question: new T({en: 'Does this shop offer a bike pump for use by anyone?', nl: 'Biedt deze winkel een fietspomp aan voor iedereen?', fr: 'TODO: fr'}),
 | 
			
		||||
                    yes: new T({en: 'This shop offers a bike pump for anyone', nl: 'Deze winkel biedt geen fietspomp aan voor eender wie', fr: 'TODO: fr'}),
 | 
			
		||||
                    no: new T({en: 'This shop doesn\'t offer a bike pump for anyone', nl: 'Deze winkel biedt een fietspomp aan voor iedereen', fr: 'TODO: fr'}),
 | 
			
		||||
                },
 | 
			
		||||
                qName: {
 | 
			
		||||
                    question: new T({en: 'What is the name of this bicycle shop?', nl: 'Wat is de naam van deze fietswinkel?', fr: 'TODO: fr'}),
 | 
			
		||||
                    render: new T({en: 'This bicycle shop is called {name}', nl: 'Deze fietswinkel heet {name}', fr: 'TODO: fr'}),
 | 
			
		||||
                    template: new T({en: 'This bicycle shop is called: $$$', nl: 'Deze fietswinkel heet: $$$', fr: 'TODO: fr'})
 | 
			
		||||
                },
 | 
			
		||||
                secondHand: {
 | 
			
		||||
                    question: new T({en: 'Does this shop sell second-hand bikes?', nl: 'Verkoopt deze winkel tweedehands fietsen?', fr: 'TODO: fr'}),
 | 
			
		||||
                    yes: new T({en: 'This shop sells second-hand bikes', nl: 'Deze winkel verkoopt tweedehands fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
                    no: new T({en: 'This shop doesn\'t sell second-hand bikes', nl: 'Deze winkel verkoopt geen tweedehands fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
                    only: new T({en: 'This shop only sells second-hand bikes', nl: 'Deze winkel verkoopt enkel tweedehands fietsen', fr: 'TODO: fr'}),
 | 
			
		||||
                },
 | 
			
		||||
                diy: {
 | 
			
		||||
                    question: new T({en: 'Are there tools here to repair your own bike?', nl: 'Biedt deze winkel gereedschap aan om je fiets zelf te herstellen?', fr: 'TODO: fr'}),
 | 
			
		||||
                    yes: new T({en: 'This shop offers tools for DIY repair', nl: 'Deze winkel biedt gereedschap aan om je fiets zelf te herstellen', fr: 'TODO: fr'}),
 | 
			
		||||
                    no: new T({en: 'This shop doesn\'t offer tools for DIY repair', nl: 'Deze winkel biedt geen gereedschap aan om je fiets zelf te herstellen', fr: 'TODO: fr'}),
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue