diff --git a/Logic/Osm/OsmConnection.ts b/Logic/Osm/OsmConnection.ts index 654a9da9f..dece748dd 100644 --- a/Logic/Osm/OsmConnection.ts +++ b/Logic/Osm/OsmConnection.ts @@ -14,7 +14,7 @@ export default class UserDetails { public name = "Not logged in" public uid: number public csCount = 0 - public img: string + public img?: string public unreadMessages = 0 public totalMessages: number = 0 public home: { lon: number; lat: number } @@ -257,7 +257,6 @@ export class OsmConnection { if (imgEl !== undefined && imgEl[0] !== undefined) { data.img = imgEl[0].getAttribute("href") } - data.img = data.img ?? Img.AsData(Svg.person_img) const description = userInfo.getElementsByTagName("description") if (description !== undefined && description[0] !== undefined) { diff --git a/UI/BigComponents/UserInformation.ts b/UI/BigComponents/UserInformation.ts index 76e89e4fc..455a697cb 100644 --- a/UI/BigComponents/UserInformation.ts +++ b/UI/BigComponents/UserInformation.ts @@ -8,7 +8,7 @@ import { VariableUiElement } from "../Base/VariableUIElement" import Img from "../Base/Img" import { FixedUiElement } from "../Base/FixedUiElement" import Link from "../Base/Link" -import { UIEventSource } from "../../Logic/UIEventSource" +import { Store, UIEventSource } from "../../Logic/UIEventSource" import Loc from "../../Models/Loc" import BaseUIElement from "../BaseUIElement" import Showdown from "showdown" @@ -21,6 +21,9 @@ import { SaveButton } from "../Popup/SaveButton" import { TagUtils } from "../../Logic/Tags/TagUtils" import * as questions from "../../assets/tagRenderings/questions.json" import { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson" +import * as os from "os" +import { LoginToggle } from "../Popup/LoginButton" +import { userInfo } from "os" export class ImportViewerLinks extends VariableUiElement { constructor(osmConnection: OsmConnection) { @@ -54,33 +57,30 @@ class UserInformationMainPanel extends VariableUiElement { const ud = osmConnection.userDetails super( ud.map((ud) => { - if (!ud?.loggedIn) { - // Not logged in - return new SubtleButton(Svg.login_svg(), "Login", { imgSize }).onClick(() => - osmConnection.AttemptLogin() - ) - } - - let img: Img = Svg.person_svg() + let img: BaseUIElement = Svg.person_ui().SetClass("block") if (ud.img !== undefined) { img = new Img(ud.img) } img.SetClass("rounded-full h-12 w-12 m-4") let description: BaseUIElement = undefined + const editLink = osmConnection.Backend() + "/profile/edit" if (ud.description) { const editButton = new Link( Svg.pencil_svg().SetClass("h-4 w-4"), - "https://www.openstreetmap.org/profile/edit", + editLink, true ).SetClass( "absolute block bg-subtle rounded-full p-2 bottom-2 right-2 w-min self-end" ) + const htmlString = new Showdown.Converter() + .makeHtml(ud.description) + .replace(/>/g, ">") + .replace(/</g, "<") + console.log("Before:", ud.description, "after", htmlString) description = new Combine([ - new FixedUiElement( - new Showdown.Converter().makeHtml(ud.description) - ).SetClass("link-underline"), + new FixedUiElement(htmlString).SetClass("link-underline"), editButton, ]).SetClass("relative w-full m-2") } else { @@ -88,6 +88,8 @@ class UserInformationMainPanel extends VariableUiElement { t.noDescription, new SubtleButton(Svg.pencil_svg(), t.noDescriptionCallToAction, { imgSize, + url: editLink, + newTab: true, }), ]).SetClass("w-full m-2") } @@ -177,9 +179,10 @@ class UserInformationMainPanel extends VariableUiElement { export default class UserInformationPanel extends ScrollableFullScreen { constructor( state: { - layoutToUse: LayoutConfig - osmConnection: OsmConnection - locationControl: UIEventSource + readonly layoutToUse: LayoutConfig + readonly osmConnection: OsmConnection + readonly locationControl: UIEventSource + readonly featureSwitchUserbadge: Store }, options?: { isOpened?: UIEventSource @@ -189,17 +192,25 @@ export default class UserInformationPanel extends ScrollableFullScreen { super( () => { return new VariableUiElement( - state.osmConnection.userDetails.map((ud) => "Welcome " + ud.name) - ) - }, - () => { - return new UserInformationMainPanel( - state.osmConnection, - state.locationControl, - state.layoutToUse, - isOpened + state.osmConnection.userDetails.map((ud) => { + if (ud.loggedIn === false) { + return Translations.t.userinfo.titleNotLoggedIn + } + return Translations.t.userinfo.welcome.Subs(ud) + }) ) }, + () => + new LoginToggle( + new UserInformationMainPanel( + state.osmConnection, + state.locationControl, + state.layoutToUse, + isOpened + ), + Translations.t.general.getStartedLogin, + state + ), "userinfo", isOpened ) diff --git a/UI/Popup/LoginButton.ts b/UI/Popup/LoginButton.ts index e5c651fc3..93016aa3f 100644 --- a/UI/Popup/LoginButton.ts +++ b/UI/Popup/LoginButton.ts @@ -17,7 +17,7 @@ class LoginButton extends SubtleButton { }, icon?: BaseUIElement | string ) { - super(icon ?? Svg.osm_logo_ui(), text) + super(icon ?? Svg.login_ui(), text) this.onClick(() => { state.osmConnection.AttemptLogin() }) diff --git a/assets/tagRenderings/questions.json b/assets/tagRenderings/questions.json index 5f83fe6cf..79f785069 100644 --- a/assets/tagRenderings/questions.json +++ b/assets/tagRenderings/questions.json @@ -1799,4 +1799,4 @@ "ca": "El nom de la xarxa és {internet_access:ssid}" } } -} +} \ No newline at end of file diff --git a/langs/de.json b/langs/de.json index cd582f752..9a2d5e6c7 100644 --- a/langs/de.json +++ b/langs/de.json @@ -934,7 +934,7 @@ "newMessages": "Sie haben neue Nachrichten", "noDescription": "Sie haben noch keine Beschreibung in Ihrem Profil", "noDescriptionCallToAction": "Profilbeschreibung hinzufügen", - "welcome": "Willkommen {user}" + "welcome": "Willkommen {name}" }, "validation": { "color": { diff --git a/langs/en.json b/langs/en.json index d279b1d4f..ed329fe08 100644 --- a/langs/en.json +++ b/langs/en.json @@ -938,7 +938,8 @@ "newMessages": "you have new messages", "noDescription": "You don't have a description on your profile yet", "noDescriptionCallToAction": "Add a profile description", - "welcome": "Welcome {user}" + "titleNotLoggedIn": "Welcome", + "welcome": "Welcome {name}" }, "validation": { "color": { diff --git a/langs/nb_NO.json b/langs/nb_NO.json index e320d0641..aeb182343 100644 --- a/langs/nb_NO.json +++ b/langs/nb_NO.json @@ -588,7 +588,7 @@ }, "userinfo": { "noDescriptionCallToAction": "Legg til profilbeskrivelse", - "welcome": "Velkommen {user}" + "welcome": "Velkommen {name}" }, "validation": { "color": { diff --git a/langs/nl.json b/langs/nl.json index 57f083445..d4f254025 100644 --- a/langs/nl.json +++ b/langs/nl.json @@ -934,7 +934,7 @@ "newMessages": "je hebt nieuwe berichten", "noDescription": "Je hebt nog een beschrijving op je profiel", "noDescriptionCallToAction": "Voeg een profielbeschrijving toe", - "welcome": "Welkom {user}" + "welcome": "Welkom {name}" }, "validation": { "color": { diff --git a/langs/pl.json b/langs/pl.json index a21355594..4a3054fd1 100644 --- a/langs/pl.json +++ b/langs/pl.json @@ -200,7 +200,7 @@ "newMessages": "masz nowe wiadomości", "noDescription": "Nie masz jeszcze opisu w swoim profilu", "noDescriptionCallToAction": "Dodaj opis profilu", - "welcome": "Witaj {user}" + "welcome": "Witaj {name}" }, "validation": { "color": { diff --git a/langs/shared-questions/en.json b/langs/shared-questions/en.json index 25168f6f5..31b7273ca 100644 --- a/langs/shared-questions/en.json +++ b/langs/shared-questions/en.json @@ -200,6 +200,23 @@ "phone": { "question": "What is the phone number of {title()}?" }, + "picture-license": { + "mappings": { + "0": { + "then": "No license has been chosen yet" + }, + "1": { + "then": "Pictures you take will be licensed with CC0 and added to the public domain. This means that everyone can use your pictures for any purpose." + }, + "2": { + "then": "Pictures you take will be licensed with CC-BY 4.0 which requires everyone using your picture that they have to attribute you" + }, + "3": { + "then": "Pictures you take will be licensed with CC-BY-SA 4.0 which means that everyone using your picture must attribute you and that derivatives of your picture must be reshared with the same license." + } + }, + "question": "Under what license do you want to publish your pictures?" + }, "service:electricity": { "mappings": { "0": {