forked from MapComplete/MapComplete
Move importViewerLinks into separate class, also show them in the user profile
This commit is contained in:
parent
bf4dc57194
commit
c9f6b93add
2 changed files with 28 additions and 18 deletions
|
@ -12,6 +12,7 @@ import Toggle from "./Input/Toggle"
|
||||||
import { SubtleButton } from "./Base/SubtleButton"
|
import { SubtleButton } from "./Base/SubtleButton"
|
||||||
import { VariableUiElement } from "./Base/VariableUIElement"
|
import { VariableUiElement } from "./Base/VariableUIElement"
|
||||||
import Svg from "../Svg"
|
import Svg from "../Svg"
|
||||||
|
import {ImportViewerLinks} from "./BigComponents/UserInformation";
|
||||||
|
|
||||||
export default class AllThemesGui {
|
export default class AllThemesGui {
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -35,21 +36,7 @@ export default class AllThemesGui {
|
||||||
.onClick(() => state.osmConnection.AttemptLogin()),
|
.onClick(() => state.osmConnection.AttemptLogin()),
|
||||||
state.osmConnection.isLoggedIn
|
state.osmConnection.isLoggedIn
|
||||||
),
|
),
|
||||||
new VariableUiElement(
|
new ImportViewerLinks(state.osmConnection).SetClass("p-4 border-2 border-gray-500 m-4 block"),
|
||||||
state.osmConnection.userDetails.map((ud) => {
|
|
||||||
if (ud.csCount < Constants.userJourney.importHelperUnlock) {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
return new Combine([
|
|
||||||
new SubtleButton(undefined, Translations.t.importHelper.title, {
|
|
||||||
url: "import_helper.html",
|
|
||||||
}),
|
|
||||||
new SubtleButton(Svg.note_svg(), Translations.t.importInspector.title, {
|
|
||||||
url: "import_viewer.html",
|
|
||||||
}),
|
|
||||||
]).SetClass("p-4 border-2 border-gray-500 m-4 block")
|
|
||||||
})
|
|
||||||
),
|
|
||||||
Translations.t.general.aboutMapcomplete
|
Translations.t.general.aboutMapcomplete
|
||||||
.Subs({ osmcha_link: Utils.OsmChaLinkFor(7) })
|
.Subs({ osmcha_link: Utils.OsmChaLinkFor(7) })
|
||||||
.SetClass("link-underline"),
|
.SetClass("link-underline"),
|
||||||
|
|
|
@ -14,6 +14,27 @@ import BaseUIElement from "../BaseUIElement";
|
||||||
import Showdown from "showdown"
|
import Showdown from "showdown"
|
||||||
import LanguagePicker from "../LanguagePicker";
|
import LanguagePicker from "../LanguagePicker";
|
||||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
|
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
|
||||||
|
import Constants from "../../Models/Constants";
|
||||||
|
|
||||||
|
export class ImportViewerLinks extends VariableUiElement {
|
||||||
|
constructor(osmConnection: OsmConnection) {
|
||||||
|
super(
|
||||||
|
osmConnection.userDetails.map((ud) => {
|
||||||
|
if (ud.csCount < Constants.userJourney.importHelperUnlock) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
return new Combine([
|
||||||
|
new SubtleButton(undefined, Translations.t.importHelper.title, {
|
||||||
|
url: "import_helper.html",
|
||||||
|
}),
|
||||||
|
new SubtleButton(Svg.note_svg(), Translations.t.importInspector.title, {
|
||||||
|
url: "import_viewer.html",
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class UserInformationMainPanel extends Combine {
|
class UserInformationMainPanel extends Combine {
|
||||||
constructor(osmConnection: OsmConnection, locationControl: UIEventSource<Loc>, layout: LayoutConfig) {
|
constructor(osmConnection: OsmConnection, locationControl: UIEventSource<Loc>, layout: LayoutConfig) {
|
||||||
|
@ -71,15 +92,16 @@ class UserInformationMainPanel extends Combine {
|
||||||
|
|
||||||
return new Combine([
|
return new Combine([
|
||||||
new Combine([img, description]).SetClass("flex border border-black rounded-md"),
|
new Combine([img, description]).SetClass("flex border border-black rounded-md"),
|
||||||
new LanguagePicker(layout.language, Translations.t.general.pickLanguage.Clone()),
|
new LanguagePicker(layout.language, Translations.t.general.pickLanguage.Clone()),
|
||||||
|
|
||||||
new SubtleButton(Svg.envelope_svg(), new Combine([t.gotoInbox,
|
new SubtleButton(Svg.envelope_svg(), new Combine([t.gotoInbox,
|
||||||
ud.unreadMessages == 0 ? undefined : t.newMessages.SetClass("alert block")
|
ud.unreadMessages == 0 ? undefined : t.newMessages.SetClass("alert block")
|
||||||
]),
|
]),
|
||||||
{imgSize, url: `${ud.backend}/messages/inbox`, newTab: true}),
|
{imgSize, url: `${ud.backend}/messages/inbox`, newTab: true}),
|
||||||
new SubtleButton(Svg.gear_svg(), t.gotoSettings,
|
new SubtleButton(Svg.gear_svg(), t.gotoSettings,
|
||||||
{imgSize, url: `${ud.backend}/user/${encodeURIComponent(ud.name)}/account`, newTab: true}),
|
{imgSize, url: `${ud.backend}/user/${encodeURIComponent(ud.name)}/account`, newTab: true}),
|
||||||
panToHome,
|
panToHome,
|
||||||
|
new ImportViewerLinks(osmConnection),
|
||||||
new SubtleButton(Svg.logout_svg(), Translations.t.general.logout, {imgSize}).onClick(osmConnection.LogOut)
|
new SubtleButton(Svg.logout_svg(), Translations.t.general.logout, {imgSize}).onClick(osmConnection.LogOut)
|
||||||
|
|
||||||
])
|
])
|
||||||
|
@ -94,7 +116,8 @@ class UserInformationMainPanel extends Combine {
|
||||||
export default class UserInformationPanel extends ScrollableFullScreen {
|
export default class UserInformationPanel extends ScrollableFullScreen {
|
||||||
constructor(state: {
|
constructor(state: {
|
||||||
layoutToUse: LayoutConfig;
|
layoutToUse: LayoutConfig;
|
||||||
osmConnection: OsmConnection, locationControl: UIEventSource<Loc> }) {
|
osmConnection: OsmConnection, locationControl: UIEventSource<Loc>
|
||||||
|
}) {
|
||||||
const t = Translations.t.general;
|
const t = Translations.t.general;
|
||||||
super(
|
super(
|
||||||
() => {
|
() => {
|
||||||
|
|
Loading…
Reference in a new issue