2023-01-06 03:46:10 +01:00
|
|
|
import Combine from "../Base/Combine"
|
|
|
|
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
2023-01-11 05:01:48 +01:00
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
2023-01-06 03:46:10 +01:00
|
|
|
import { BBox } from "../../Logic/BBox"
|
|
|
|
import Loc from "../../Models/Loc"
|
|
|
|
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
|
|
|
import Translations from "../i18n/Translations"
|
|
|
|
import { SubtleButton } from "../Base/SubtleButton"
|
|
|
|
import Svg from "../../Svg"
|
|
|
|
import { Utils } from "../../Utils"
|
|
|
|
import { MapillaryLink } from "./MapillaryLink"
|
|
|
|
import { OpenIdEditor, OpenJosm } from "./CopyrightPanel"
|
2023-01-11 05:01:48 +01:00
|
|
|
import Toggle from "../Input/Toggle"
|
2023-02-09 02:45:19 +01:00
|
|
|
import ScrollableFullScreen from "../Base/ScrollableFullScreen"
|
|
|
|
import { DefaultGuiState } from "../DefaultGuiState"
|
2023-01-11 05:01:48 +01:00
|
|
|
|
|
|
|
export class BackToThemeOverview extends Toggle {
|
|
|
|
constructor(
|
|
|
|
state: {
|
|
|
|
readonly featureSwitchMoreQuests: Store<boolean>
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
imgSize: string
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
const t = Translations.t.general
|
|
|
|
const button = new SubtleButton(Svg.add_ui(), t.backToIndex, options).onClick(() => {
|
|
|
|
const path = window.location.href.split("/")
|
|
|
|
path.pop()
|
|
|
|
path.push("index.html")
|
|
|
|
window.location.href = path.join("/")
|
|
|
|
})
|
|
|
|
|
|
|
|
super(button, undefined, state.featureSwitchMoreQuests)
|
|
|
|
}
|
|
|
|
}
|
2023-01-06 03:46:10 +01:00
|
|
|
|
|
|
|
export class ActionButtons extends Combine {
|
|
|
|
constructor(state: {
|
|
|
|
readonly layoutToUse: LayoutConfig
|
|
|
|
readonly currentBounds: Store<BBox>
|
|
|
|
readonly locationControl: Store<Loc>
|
|
|
|
readonly osmConnection: OsmConnection
|
2023-01-11 05:01:48 +01:00
|
|
|
readonly featureSwitchMoreQuests: Store<boolean>
|
2023-01-06 03:46:10 +01:00
|
|
|
}) {
|
|
|
|
const imgSize = "h-6 w-6"
|
|
|
|
const iconStyle = "height: 1.5rem; width: 1.5rem"
|
|
|
|
const t = Translations.t.general.attribution
|
|
|
|
|
|
|
|
super([
|
2023-01-11 05:01:48 +01:00
|
|
|
new BackToThemeOverview(state, { imgSize }),
|
|
|
|
|
2023-01-06 03:46:10 +01:00
|
|
|
new SubtleButton(Svg.liberapay_ui(), t.donate, {
|
|
|
|
url: "https://liberapay.com/pietervdvn/",
|
|
|
|
newTab: true,
|
|
|
|
imgSize,
|
|
|
|
}),
|
|
|
|
new SubtleButton(Svg.bug_ui(), t.openIssueTracker, {
|
|
|
|
url: "https://github.com/pietervdvn/MapComplete/issues",
|
|
|
|
newTab: true,
|
|
|
|
imgSize,
|
|
|
|
}),
|
|
|
|
new SubtleButton(
|
|
|
|
Svg.statistics_ui(),
|
|
|
|
t.openOsmcha.Subs({ theme: state.layoutToUse.title }),
|
|
|
|
{
|
|
|
|
url: Utils.OsmChaLinkFor(31, state.layoutToUse.id),
|
|
|
|
newTab: true,
|
|
|
|
imgSize,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
new SubtleButton(Svg.mastodon_ui(), t.followOnMastodon, {
|
|
|
|
url: "https://en.osm.town/@MapComplete",
|
|
|
|
newTab: true,
|
|
|
|
imgSize,
|
|
|
|
}),
|
|
|
|
new OpenIdEditor(state, iconStyle),
|
|
|
|
new MapillaryLink(state, iconStyle),
|
|
|
|
new OpenJosm(state, iconStyle).SetClass("hidden-on-mobile"),
|
2023-02-09 02:45:19 +01:00
|
|
|
new SubtleButton(
|
|
|
|
Svg.translate_ui().SetStyle(iconStyle),
|
|
|
|
Translations.t.translations.activateButton
|
|
|
|
).onClick(() => {
|
|
|
|
ScrollableFullScreen.collapse()
|
|
|
|
DefaultGuiState.state.userInfoIsOpened.setData(true)
|
|
|
|
DefaultGuiState.state.userInfoFocusedQuestion.setData("translation-mode")
|
|
|
|
}),
|
2023-01-06 03:46:10 +01:00
|
|
|
])
|
|
|
|
this.SetClass("block w-full link-no-underline")
|
|
|
|
}
|
|
|
|
}
|