enrecipes/app/components/Settings/About.vue

117 lines
3 KiB
Vue
Raw Permalink Normal View History

2021-03-21 17:02:04 +00:00
<template>
2021-04-01 10:55:35 +00:00
<Page @loaded="onPageLoad" actionBarHidden="true">
<GridLayout rows="*, auto" columns="auto, *">
<ListView
rowSpan="2"
colSpan="2"
class="options-list"
for="item in items"
>
<v-template if="$index == 0">
<Label class="pageTitle" :text="'About' | L" />
</v-template>
<v-template if="$index == 1">
<StackLayout class="app-info">
<Image
class="icon"
2021-04-23 14:30:50 +00:00
src="res://logo"
2021-04-01 10:55:35 +00:00
stretch="none"
/>
<Label class="name tb tac" :text="'EnRecipes' | L" />
<Label :text="getVersion" class="version tb tac" />
2021-03-21 17:02:04 +00:00
2021-04-01 10:55:35 +00:00
<Label class="info tac tw" :text="'appInfo' | L" />
</StackLayout>
</v-template>
2021-04-12 18:09:48 +00:00
<v-template if="$index == 8">
2021-04-01 10:55:35 +00:00
<StackLayout class="listSpace"> </StackLayout>
</v-template>
2021-03-21 17:02:04 +00:00
<v-template>
<GridLayout
columns="auto, *"
2021-04-01 10:55:35 +00:00
class="option"
@touch="touch($event, item.url)"
2021-03-21 17:02:04 +00:00
>
2021-04-01 10:55:35 +00:00
<Label class="ico" :text="icon[item.icon]" />
2021-03-21 17:02:04 +00:00
<Label col="1" :text="item.title | L" />
</GridLayout>
</v-template>
</ListView>
2021-04-01 10:55:35 +00:00
<GridLayout row="1" class="appbar" rows="*" columns="auto, *">
2021-04-12 18:09:48 +00:00
<Button class="ico" :text="icon.back" @tap="$navigateBack()" />
2021-04-01 10:55:35 +00:00
</GridLayout>
2021-03-21 17:02:04 +00:00
</GridLayout>
</Page>
</template>
<script>
import { Application, Observable, Utils } from "@nativescript/core";
import { mapState } from "vuex";
export default {
computed: {
...mapState(["icon"]),
items() {
return [
2021-04-01 10:55:35 +00:00
{},
{},
2021-03-21 17:02:04 +00:00
{
icon: "gh",
title: "gh",
url: "https://github.com/vishnuraghavb/EnRecipes",
},
2021-04-12 18:09:48 +00:00
{
icon: "tg",
title: "joinTG",
url: "https://t.me/enrecipes",
},
{
icon: "help",
title: "guide",
2021-04-23 14:49:27 +00:00
url: "https://github.com/vishnuraghavb/EnRecipes/wiki/User-Guide",
2021-04-12 18:09:48 +00:00
},
2021-04-01 10:55:35 +00:00
{
icon: "priv",
title: "priv",
url:
"https://github.com/vishnuraghavb/EnRecipes/blob/main/PRIVACY.md",
},
2021-03-21 17:02:04 +00:00
{
icon: "don",
title: "donate",
url: "https://www.vishnuraghav.com/donate",
},
{
icon: "trans",
title: "trnsl",
url: "https://hosted.weblate.org/projects/enrecipes/app-translations",
},
2021-04-01 10:55:35 +00:00
{},
2021-03-21 17:02:04 +00:00
];
},
getVersion() {
let ctx = Application.android.context;
return (
"v" +
ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0)
.versionName
);
},
},
methods: {
onPageLoad(args) {
const page = args.object;
page.bindingContext = new Observable();
},
// HELPERS
openURL(url) {
Utils.openUrl(url);
},
2021-04-01 10:55:35 +00:00
touch({ object, action }, url) {
object.className = action.match(/down|move/) ? "option fade" : "option";
if (action == "up") this.openURL(url);
},
2021-03-21 17:02:04 +00:00
},
};
</script>