From bb20c41002219028f8847842b19bfb00da90ca35 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 7 Dec 2020 03:02:50 +0100 Subject: [PATCH] First version of reviews --- AllTranslationAssets.ts | 3 + Customizations/JSON/TagRenderingConfig.ts | 10 +- Logic/Web/MangroveReviews.ts | 50 ++++++ Svg.ts | 7 +- UI/Popup/TagRenderingQuestion.ts | 7 +- UI/ReviewElement.ts | 65 ++++++++ assets/mangrove_logo.png | Bin 0 -> 14110 bytes assets/svg/star_half.svg | 63 +++++++ assets/translations.json | 14 ++ css/ReviewElement.css | 56 +++++++ customGenerator.html | 3 +- index.css | 2 + index.html | 1 + package-lock.json | 195 ++++++++++++++++++---- package.json | 1 + test.html | 18 +- test.ts | 45 +++++ 17 files changed, 480 insertions(+), 60 deletions(-) create mode 100644 Logic/Web/MangroveReviews.ts create mode 100644 UI/ReviewElement.ts create mode 100644 assets/mangrove_logo.png create mode 100644 assets/svg/star_half.svg create mode 100644 css/ReviewElement.css diff --git a/AllTranslationAssets.ts b/AllTranslationAssets.ts index 3ef54ca..bd826a6 100644 --- a/AllTranslationAssets.ts +++ b/AllTranslationAssets.ts @@ -123,5 +123,8 @@ export default class AllTranslationAssets { favourite: { panelIntro: new Translation( {"en":"

Your personal theme

Activate your favourite layers from all the official themes","ca":"

La teva interfície personal

Activa les teves capes favorites de totes les interfícies oficials","es":"

Tu interficie personal

Activa tus capas favoritas de todas las interficies oficiales","gl":"

O teu tema personalizado

Activa as túas capas favoritas de todos os temas oficiais","de":"

Ihr persönliches Thema

Aktivieren Sie Ihre Lieblingsebenen aus allen offiziellen Themen"} ), loginNeeded: new Translation( {"en":"

Log in

A personal layout is only available for OpenStreetMap users","es":"

Entrar

El diseño personalizado sólo está disponible para los usuarios de OpenstreetMap","ca":"

Entrar

El disseny personalizat només està disponible pels usuaris d' OpenstreetMap","gl":"

Iniciar a sesión

O deseño personalizado só está dispoñíbel para os usuarios do OpenstreetMap","de":"

Anmelden

Ein persönliches Layout ist nur für OpenStreetMap-Benutzer verfügbar"} ), reload: new Translation( {"en":"Reload the data","es":"Recargar datos","ca":"Recarregar dades","gl":"Recargar os datos","de":"Daten neu laden"} ), +}, + reviews: { title: new Translation( {"en":"Reviews","nl":"Beoordelingen"} ), + attribution: new Translation( {"en":"Reviews are powered by Mangrove Reviews and are available under CC-BY 4.0"} ), }, }} \ No newline at end of file diff --git a/Customizations/JSON/TagRenderingConfig.ts b/Customizations/JSON/TagRenderingConfig.ts index 24fdd0b..d6e9a92 100644 --- a/Customizations/JSON/TagRenderingConfig.ts +++ b/Customizations/JSON/TagRenderingConfig.ts @@ -26,7 +26,7 @@ export default class TagRenderingConfig { mappings?: { if: TagsFilter, then: Translation - hideInAnswer: boolean + hideInAnswer: boolean | TagsFilter }[] constructor(json: string | TagRenderingConfigJson, context?: string) { @@ -62,10 +62,16 @@ export default class TagRenderingConfig { if (mapping.then === undefined) { throw "Invalid mapping: if without body" } + let hideInAnswer : boolean | TagsFilter = false; + if(typeof mapping.hideInAnswer === "boolean"){ + hideInAnswer = mapping.hideInAnswer; + }else{ + hideInAnswer = FromJSON.Tag(mapping.hideInAnswer); + } return { if: FromJSON.Tag(mapping.if, `${context}.mapping[${i}]`), then: Translations.T(mapping.then), - hideInAnswer: mapping.hideInAnswer ?? false + hideInAnswer: hideInAnswer }; }); } diff --git a/Logic/Web/MangroveReviews.ts b/Logic/Web/MangroveReviews.ts new file mode 100644 index 0000000..1d8f45b --- /dev/null +++ b/Logic/Web/MangroveReviews.ts @@ -0,0 +1,50 @@ +import * as mangrove from 'mangrove-reviews' +import {UIEventSource} from "../UIEventSource"; + +export default class MangroveReviews { + + constructor() { + } + + /** + * Gives a UIEVentsource with all reviews. + * Note: rating is between 1 and 100 + */ + public static GetReviewsFor(lon: number, lat: number, name: string): UIEventSource<{ + comment?: string, + author: string, + date: Date, + rating: number + }[]> { + + let uri = `geo:${lat},${lon}?u=50`; + if (name !== undefined && name !== null) { + uri += "&q=" + name; + } + const reviewsSource : UIEventSource< { + comment?: string, + author: string, + date: Date, + rating: number + }[]> = new UIEventSource([]); + + mangrove.getReviews({sub: uri}).then( + (data) => { + const reviews = []; + for (const review of data.reviews) { + const r = review.payload; + reviews.push({ + date: new Date(r.iat * 1000), + comment: r.opinion, + author: r.metadata.nickname, + rating: r.rating // percentage points + }) + } + reviewsSource.setData(reviews) + } + ); + return reviewsSource; + } + + +} \ No newline at end of file diff --git a/Svg.ts b/Svg.ts index e49ccaa..5b6bafd 100644 --- a/Svg.ts +++ b/Svg.ts @@ -239,6 +239,11 @@ export default class Svg { public static star_svg() { return new FixedUiElement(Svg.star);} public static star_ui() { return new FixedUiElement(Svg.star_img);} + public static star_half = " Created by potrace 1.15, written by Peter Selinger 2001-2017 image/svg+xml " + public static star_half_img = Img.AsImageElement(Svg.star_half) + public static star_half_svg() { return new FixedUiElement(Svg.star_half);} + public static star_half_ui() { return new FixedUiElement(Svg.star_half_img);} + public static statistics = " Svg Vector Icons : http://www.onlinewebfonts.com/icon " public static statistics_img = Img.AsImageElement(Svg.statistics) public static statistics_svg() { return new FixedUiElement(Svg.statistics);} @@ -264,4 +269,4 @@ export default class Svg { public static wikipedia_svg() { return new FixedUiElement(Svg.wikipedia);} public static wikipedia_ui() { return new FixedUiElement(Svg.wikipedia_img);} -public static All = {"add.svg": Svg.add,"addSmall.svg": Svg.addSmall,"ampersand.svg": Svg.ampersand,"arrow-left-smooth.svg": Svg.arrow_left_smooth,"arrow-right-smooth.svg": Svg.arrow_right_smooth,"bug.svg": Svg.bug,"camera-plus.svg": Svg.camera_plus,"checkmark.svg": Svg.checkmark,"circle.svg": Svg.circle,"clock.svg": Svg.clock,"close.svg": Svg.close,"compass.svg": Svg.compass,"cross_bottom_right.svg": Svg.cross_bottom_right,"crosshair-blue-center.svg": Svg.crosshair_blue_center,"crosshair-blue.svg": Svg.crosshair_blue,"crosshair.svg": Svg.crosshair,"delete_icon.svg": Svg.delete_icon,"direction.svg": Svg.direction,"direction_gradient.svg": Svg.direction_gradient,"down.svg": Svg.down,"envelope.svg": Svg.envelope,"floppy.svg": Svg.floppy,"gear.svg": Svg.gear,"help.svg": Svg.help,"home.svg": Svg.home,"home_white_bg.svg": Svg.home_white_bg,"josm_logo.svg": Svg.josm_logo,"layers.svg": Svg.layers,"layersAdd.svg": Svg.layersAdd,"logo.svg": Svg.logo,"logout.svg": Svg.logout,"mapillary.svg": Svg.mapillary,"no_checkmark.svg": Svg.no_checkmark,"or.svg": Svg.or,"osm-logo-us.svg": Svg.osm_logo_us,"osm-logo.svg": Svg.osm_logo,"pencil.svg": Svg.pencil,"phone.svg": Svg.phone,"pin.svg": Svg.pin,"pop-out.svg": Svg.pop_out,"reload.svg": Svg.reload,"ring.svg": Svg.ring,"search.svg": Svg.search,"send_email.svg": Svg.send_email,"share.svg": Svg.share,"square.svg": Svg.square,"star.svg": Svg.star,"statistics.svg": Svg.statistics,"up.svg": Svg.up,"wikidata.svg": Svg.wikidata,"wikimedia-commons-white.svg": Svg.wikimedia_commons_white,"wikipedia.svg": Svg.wikipedia};} +public static All = {"add.svg": Svg.add,"addSmall.svg": Svg.addSmall,"ampersand.svg": Svg.ampersand,"arrow-left-smooth.svg": Svg.arrow_left_smooth,"arrow-right-smooth.svg": Svg.arrow_right_smooth,"bug.svg": Svg.bug,"camera-plus.svg": Svg.camera_plus,"checkmark.svg": Svg.checkmark,"circle.svg": Svg.circle,"clock.svg": Svg.clock,"close.svg": Svg.close,"compass.svg": Svg.compass,"cross_bottom_right.svg": Svg.cross_bottom_right,"crosshair-blue-center.svg": Svg.crosshair_blue_center,"crosshair-blue.svg": Svg.crosshair_blue,"crosshair.svg": Svg.crosshair,"delete_icon.svg": Svg.delete_icon,"direction.svg": Svg.direction,"direction_gradient.svg": Svg.direction_gradient,"down.svg": Svg.down,"envelope.svg": Svg.envelope,"floppy.svg": Svg.floppy,"gear.svg": Svg.gear,"help.svg": Svg.help,"home.svg": Svg.home,"home_white_bg.svg": Svg.home_white_bg,"josm_logo.svg": Svg.josm_logo,"layers.svg": Svg.layers,"layersAdd.svg": Svg.layersAdd,"logo.svg": Svg.logo,"logout.svg": Svg.logout,"mapillary.svg": Svg.mapillary,"no_checkmark.svg": Svg.no_checkmark,"or.svg": Svg.or,"osm-logo-us.svg": Svg.osm_logo_us,"osm-logo.svg": Svg.osm_logo,"pencil.svg": Svg.pencil,"phone.svg": Svg.phone,"pin.svg": Svg.pin,"pop-out.svg": Svg.pop_out,"reload.svg": Svg.reload,"ring.svg": Svg.ring,"search.svg": Svg.search,"send_email.svg": Svg.send_email,"share.svg": Svg.share,"square.svg": Svg.square,"star.svg": Svg.star,"star_half.svg": Svg.star_half,"statistics.svg": Svg.statistics,"up.svg": Svg.up,"wikidata.svg": Svg.wikidata,"wikimedia-commons-white.svg": Svg.wikimedia_commons_white,"wikipedia.svg": Svg.wikipedia};} diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index 2bf52d7..1cdd805 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -198,9 +198,12 @@ export default class TagRenderingQuestion extends UIElement { private GenerateMappingElement(mapping: { if: TagsFilter, then: Translation, - hideInAnswer: boolean + hideInAnswer: boolean | TagsFilter }): InputElement { - if (mapping.hideInAnswer) { + if (mapping.hideInAnswer === true) { + return undefined; + } + if(typeof(mapping.hideInAnswer) !== "boolean" && mapping.hideInAnswer.matches(this._tags.data)){ return undefined; } return new FixedInputElement( diff --git a/UI/ReviewElement.ts b/UI/ReviewElement.ts new file mode 100644 index 0000000..858c239 --- /dev/null +++ b/UI/ReviewElement.ts @@ -0,0 +1,65 @@ +import {UIElement} from "./UIElement"; +import {UIEventSource} from "../Logic/UIEventSource"; +import Translations from "./i18n/Translations"; +import Combine from "./Base/Combine"; +import {FixedUiElement} from "./Base/FixedUiElement"; +import {Utils} from "../Utils"; + +/** + * Shows the reviews and scoring base on mangrove.reviesw + */ +export default class ReviewElement extends UIElement { + private _reviews: UIEventSource<{ comment?: string; author: string; date: Date; rating: number }[]>; + + constructor(reviews: UIEventSource<{ + comment?: string, + author: string, + date: Date, + rating: number + }[]>) { + super(reviews); + this._reviews = reviews; + } + + InnerRender(): string { + + const elements = []; + + elements.push(Translations.t.reviews.title.SetClass("review-title")); + + elements.push(...this._reviews.data.map(review => { + const stars = Math.round(review.rating / 10) + const fullStars = Math.floor(stars / 2); + const d = review.date; + + return new Combine( + [ + new Combine([ + + new Combine([ + "".repeat(fullStars), + stars % 2 == 1 ? "" : "" + ]).SetClass("review-rating"), + new FixedUiElement(`${d.getFullYear()}-${Utils.TwoDigits(d.getMonth() + 1)}-${Utils.TwoDigits(d.getDate())} ${Utils.TwoDigits(d.getHours())}:${Utils.TwoDigits(d.getMinutes())}`) + .SetClass("review-date"), + ]).SetClass("review-stars-date"), + + new FixedUiElement(review.comment).SetClass("review-comment"), + "
", + new FixedUiElement(review.author).SetClass("review-author"), + + ] + ).SetClass("review-element") + })); + elements.push( + new Combine([ + Translations.t.reviews.attribution, + "" + ]) + + .SetClass("review-attribution")) + + return new Combine(elements).SetClass("review").Render(); + } + +} \ No newline at end of file diff --git a/assets/mangrove_logo.png b/assets/mangrove_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..38f39f8eda52574e21720c1925792308a68669cb GIT binary patch literal 14110 zcmY+LRa9I}u!V7Vch}(V?!hI&Ex1D$V+R0-=qH?2yozMl}>dY1Ox?yg0zH|r_q%mVy4Ox zu~<>0^dm3MyCjzP>eA9QQI!J(7X+3B!<^}Lu^hvq&2u^8as|%@NwzlC+d{$B4wK{DGi>6)v&l^Z2I}Vfrt*bCh?U^?!_(nlnxG$YlC)+3A}oT4PG{)$MdBa(Wl*z zVuQBN#fBa3tbWS#d>tsRe6#y1jgDK{)y6$}a~#yvA=g_S8IxID^yc@6V{WIj-z1cG zynYi|lz~j`x>6BnB`Nf(c-L%5+QmBys$$AJ0e}5?e>KdAD(?8) zh&=vf`dC@e;eJJ>n9hudU_{j_G)J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;~%n0#utj%@;W*M zGO=9`)t}y3G0@T}XPe`*LY=~OE2^>JwSA|erp}6GF8NE(UhJ^lsp~+xnBm>>QN>9#KhXI$53$h@DVd zOYJvXG5H`vjLTF=?*Yp6ySS?}vrNOs(v(e!3*p#)t`JtH5Xlp-NG&nJlMtD~vgVsa z9|iv`hVpJHi`RBC6fBZjCweMo0BB9PSyqfYk|Xi@hp2_q@8I3h z$#ktb&6k9r6zkb~)iLhOviYUQt^YinW19VVrySSZz j8QE$g8066Z@>gtif!}DbK$QlZdxKDrQIW2eGztD623Ha@ literal 0 HcmV?d00001 diff --git a/assets/svg/star_half.svg b/assets/svg/star_half.svg new file mode 100644 index 0000000..db57d41 --- /dev/null +++ b/assets/svg/star_half.svg @@ -0,0 +1,63 @@ + + + + + +Created by potrace 1.15, written by Peter Selinger 2001-2017 + + + image/svg+xml + + + + + + + + diff --git a/assets/translations.json b/assets/translations.json index d5ce8bf..ae6b47d 100644 --- a/assets/translations.json +++ b/assets/translations.json @@ -907,5 +907,19 @@ "gl": "Recargar os datos", "de": "Daten neu laden" } + }, + "reviews": { + "title": { + "en": "Reviews", + "nl": "Beoordelingen" + }, + "no_reviews_yet": { + "en": "There are no reviews yet. Be the first to write one and help open data and the business!", + "nl": "Er zijn nog geen beoordelingen. Wees de eerste om een beoordeling te schrijven en help open data en het bedrijf" + }, + "attribution": { + "en": "Reviews are powered by Mangrove Reviews and are available under CC-BY 4.0", + "nl": "De beoordelingen worden voorzien door Mangrove Reviews en zijn beschikbaar onder deCC-BY 4.0-licentie " + } } } \ No newline at end of file diff --git a/css/ReviewElement.css b/css/ReviewElement.css new file mode 100644 index 0000000..9389fc5 --- /dev/null +++ b/css/ReviewElement.css @@ -0,0 +1,56 @@ +.review-rating img { + max-width: 1em; + height: 1em; +} + +.review-rating { + display: flex; + flex-direction: row; +} + +.review-date { + color: var(--subtle-detail-color-light-contrast); +} + +.review-stars-date { + display: flex; + justify-content: space-between; + margin-bottom: 0.5em; +} + +.review-author { + font-weight: bold; + display: flex; + justify-content: flex-end; +} + +.review-element { + padding: 1em; + margin: 0.5em; + display: block; + border-radius: 1em; + background-color: var(--subtle-detail-color); + color: var(--subtle-detail-color-contrast); +} + +.review-attribution { + display: flex; + color: var(--subtle-detail-color-light-contrast); + justify-content: flex-end; + margin-right: 1em; +} + +.review-attribution span { + width: calc(65% - 3em); + text-align: right; + max-width: 20em; +} + +.review-attribution img { + height: 3em; + margin-left: 0.5em; +} + +.review-title { + font-size: x-large; +} \ No newline at end of file diff --git a/customGenerator.html b/customGenerator.html index a87a8d4..ed8dec7 100644 --- a/customGenerator.html +++ b/customGenerator.html @@ -91,7 +91,8 @@
- 'maindiv' not attached + Loading the MapComplete custom theme builder...
+ If this message persists, make sure javascript is enabled and no script blocker is blocking this.
diff --git a/index.css b/index.css index ac3de5e..8f1cdc0 100644 --- a/index.css +++ b/index.css @@ -1,6 +1,8 @@ :root { --subtle-detail-color: #e5f5ff; --subtle-detail-color-contrast: black; + --subtle-detail-color-light-contrast: lightgrey; + --catch-detail-color: #3a3aeb; --catch-detail-color-contrast: white; --alert-color: #fee4d1; diff --git a/index.html b/index.html index 9692608..c2bae3a 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,7 @@ + diff --git a/package-lock.json b/package-lock.json index b82b3c9..59b5059 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3907,6 +3907,14 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + } + }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -4242,6 +4250,11 @@ "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=" }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -5441,6 +5454,14 @@ "safer-buffer": "^2.1.0" } }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -5825,6 +5846,29 @@ "locate-path": "^2.0.0" } }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -6761,6 +6805,11 @@ } } }, + "jose": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jose/-/jose-3.3.1.tgz", + "integrity": "sha512-dMVfVKnyJyl2d9OBkwu/nvheGh9fbS1khhkJdvbGnINNe8IUfSJ/U+BXJOQvk65BCIJ58lp7xQKJTGQQ5dxrZA==" + }, "jquery": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", @@ -6895,6 +6944,23 @@ "minimist": "^1.2.0" } }, + "jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -6911,6 +6977,53 @@ "resolved": "https://registry.npmjs.org/jsts/-/jsts-1.1.2.tgz", "integrity": "sha1-0gXSzIOTCB2eSErjYoIRBpXtwjA=" }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jwk-to-pem": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/jwk-to-pem/-/jwk-to-pem-2.0.4.tgz", + "integrity": "sha512-4CCK9UBHNWjWtfSHdyu3I6rA8vlN5cWqnVuwY0cOMyXtw6M1tP+yrM8GZpwk+P932Dc3cLag4d35B6CqyIf89A==", + "requires": { + "asn1.js": "^5.3.0", + "elliptic": "^6.5.3", + "safe-buffer": "^5.0.1" + }, + "dependencies": { + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + } + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -7126,11 +7239,46 @@ "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=" }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=" }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -7191,6 +7339,16 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "mangrove-reviews": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/mangrove-reviews/-/mangrove-reviews-0.1.3.tgz", + "integrity": "sha512-uaUMaRI3ZWwBIqudOzoDd3/d2YVp0A1ZbhC8MQ0VNJDjl0yyQ/T/Aq3TQyz+dO7tvIqR+Lq8UGWFnsiGVVKNGw==", + "requires": { + "axios": "^0.19.2", + "jsonwebtoken": "^8.5.1", + "jwk-to-pem": "^2.0.3" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -8099,16 +8257,6 @@ } } }, - "parcel-plugin-static-files-copy": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/parcel-plugin-static-files-copy/-/parcel-plugin-static-files-copy-2.4.3.tgz", - "integrity": "sha512-tUZn54XsZIZ9hhhNQkyaWaHLvjOj2wra8pp4yPjp1b5p1frQ+YEwG6eaNtaQVyA+UvORsZg+Wni7n9gIOBE8eA==", - "dev": true, - "requires": { - "minimatch": "3.0.4", - "path": "0.12.7" - } - }, "parse-asn1": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", @@ -8146,33 +8294,6 @@ "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=" }, - "path": { - "version": "0.12.7", - "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", - "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", - "dev": true, - "requires": { - "process": "^0.11.1", - "util": "^0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", - "dev": true, - "requires": { - "inherits": "2.0.3" - } - } - } - }, "path-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", diff --git a/package.json b/package.json index ca47743..1bed8df 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "leaflet-providers": "^1.10.2", "libphonenumber": "0.0.10", "libphonenumber-js": "^1.7.55", + "mangrove-reviews": "^0.1.3", "moment": "^2.29.0", "opening_hours": "^3.5.0", "osm-auth": "^1.0.2", diff --git a/test.html b/test.html index 521de22..cd57114 100644 --- a/test.html +++ b/test.html @@ -7,28 +7,12 @@ + - -
'maindiv' not attached
-
'extradiv' not attached
diff --git a/test.ts b/test.ts index d04a40d..31382ee 100644 --- a/test.ts +++ b/test.ts @@ -1,4 +1,49 @@ +//* +import MangroveReviews from "./Logic/Web/MangroveReviews"; +import ReviewElement from "./UI/ReviewElement"; + +const review = MangroveReviews.GetReviewsFor(3.22000, 51.21576, "Pietervdvn Software Consultancy") +new ReviewElement(review).AttachTo("maindiv"); /* +mangrove.getReviews({sub: 'geo:,?q=&u=15'}).then( + (data) => { + for (const review of data.reviews) { + console.log(review.payload); + // .signature + // .kid + // .jwt + } + } +);*/ + +/* +mangrove.generateKeypair().then( + keypair => { + mangrove.keypairToJwk(keypair).then(jwk => { + console.log(jwk) + // const restoredKeypair = await mangrove.jwkToKeypair(jwk). +// Sign and submit a review (reviews of this example subject are removed from the database). + mangrove.signAndSubmitReview(keypair, { + // Lat,lon! + sub: "geo:51.21576,3.22000?q=Pietervdvn Software Consultancy&u=15", + rating: 100, + opinion: "Excellent knowledge about OSM", + metadata: { + nickname: "Pietervdvn", + } + }) + }) + } +) +*/ + +/* +// Given by a particular user since certain time. +const userReviews = await getReviews({ + kid: '-----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDo6mN4kY6YFhpvF0u3hfVWD1RnDElPweX3U3KiUAx0dVeFLPAmeKdQY3J5agY3VspnHo1p/wH9hbZ63qPbCr6g==-----END PUBLIC KEY-----', + gt_iat: 1580860800 +})*/ + /*/