2019-12-20 13:04:34 +01:00
< template >
2020-06-25 11:36:35 +02:00
< div >
2022-01-10 15:19:16 +01:00
< breadcrumbs -nav
: links = " [
{ name : RouteName . ADMIN , text : $t ( 'Admin' ) } ,
{ text : $t ( 'Instance settings' ) } ,
] "
/ >
2021-09-29 19:06:57 +02:00
< section v-if ="settingsToWrite" >
2020-06-25 11:36:35 +02:00
< form @submit.prevent ="updateSettings" >
2022-07-12 10:55:28 +02:00
< o -field : label = "$t('Instance Name')" label -for = " instance -name " >
< o -input v -model = " settingsToWrite.instanceName " id = "instance-name" / >
< / o - f i e l d >
2020-06-25 11:36:35 +02:00
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-description" > { {
2020-11-30 10:24:11 +01:00
$t ( "Instance Short Description" )
} } < / label >
2020-06-25 11:36:35 +02:00
< small >
{ {
$t (
"Displayed on homepage and meta tags. Describe what Mobilizon is and what makes this instance special in a single paragraph."
)
} }
< / small >
2022-07-12 10:55:28 +02:00
< o -input
2020-11-30 10:24:11 +01:00
type = "textarea"
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceDescription"
2020-11-30 10:24:11 +01:00
rows = "2"
2021-09-29 19:06:57 +02:00
id = "instance-description"
2020-11-30 10:24:11 +01:00
/ >
2020-06-25 11:36:35 +02:00
< / div >
2020-10-21 17:49:18 +02:00
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-slogan" > { {
$t ( "Instance Slogan" )
} } < / label >
2020-10-21 17:49:18 +02:00
< small >
{ {
$t (
'A short tagline for your instance homepage. Defaults to "Gather ⋅ Organize ⋅ Mobilize"'
)
} }
< / small >
2022-07-12 10:55:28 +02:00
< o -input
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceSlogan"
2020-10-21 17:49:18 +02:00
: placeholder = "$t('Gather ⋅ Organize ⋅ Mobilize')"
2021-09-07 17:52:34 +02:00
id = "instance-slogan"
2020-10-21 17:49:18 +02:00
/ >
< / div >
2020-06-25 11:36:35 +02:00
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-contact" > { {
$t ( "Contact" )
} } < / label >
2020-06-25 11:36:35 +02:00
< small >
{ { $t ( "Can be an email or a link, or just plain text." ) } }
< / small >
2022-07-12 10:55:28 +02:00
< o -input v -model = " settingsToWrite.contact " id = "instance-contact" / >
2020-06-25 11:36:35 +02:00
< / div >
2022-07-12 10:55:28 +02:00
< o -field : label = "$t('Allow registrations')" >
< o -switch v-model ="settingsToWrite.registrationsOpen" >
< p
class = "prose dark:prose-invert"
v - if = "settingsToWrite.registrationsOpen"
>
2020-06-25 11:36:35 +02:00
{ { $t ( "Registration is allowed, anyone can register." ) } }
< / p >
2022-07-12 10:55:28 +02:00
< p class = "prose dark:prose-invert" v-else >
{ { $t ( "Registration is closed." ) } }
< / p >
< / o - s w i t c h >
< / o - f i e l d >
2020-10-07 15:37:23 +02:00
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-languages" > { {
$t ( "Instance languages" )
} } < / label >
2020-10-07 15:37:23 +02:00
< small >
{ { $t ( "Main languages you/your moderators speak" ) } }
< / small >
2022-07-12 10:55:28 +02:00
< o -taginput
2021-03-04 15:49:35 +01:00
v - model = "instanceLanguages"
2020-10-07 15:37:23 +02:00
: data = "filteredLanguages"
autocomplete
: open - on - focus = "true"
field = "name"
icon = "label"
: placeholder = "$t('Select languages')"
@ typing = "getFilteredLanguages"
2021-09-07 17:52:34 +02:00
id = "instance-languages"
2020-10-07 15:37:23 +02:00
>
2022-07-12 10:55:28 +02:00
< template # empty > { { $t ( "No languages found" ) } } < / template >
< / o - t a g i n p u t >
2020-10-07 15:37:23 +02:00
< / div >
2020-06-25 11:36:35 +02:00
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-long-description" > { {
2020-11-30 10:24:11 +01:00
$t ( "Instance Long Description" )
} } < / label >
2020-06-25 11:36:35 +02:00
< small >
{ {
$t (
"A place to explain who you are and the things that set your instance apart. You can use HTML tags."
)
} }
< / small >
2022-07-12 10:55:28 +02:00
< o -input
2020-11-30 10:24:11 +01:00
type = "textarea"
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceLongDescription"
2020-11-30 10:24:11 +01:00
rows = "4"
2021-09-07 17:52:34 +02:00
id = "instance-long-description"
2020-11-30 10:24:11 +01:00
/ >
2020-06-25 11:36:35 +02:00
< / div >
< div class = "field" >
2021-09-07 17:52:34 +02:00
< label class = "label has-help" for = "instance-rules" > { {
$t ( "Instance Rules" )
} } < / label >
2020-06-25 11:36:35 +02:00
< small >
{ {
2020-11-30 10:24:11 +01:00
$t (
"A place for your code of conduct, rules or guidelines. You can use HTML tags."
)
2020-06-25 11:36:35 +02:00
} }
< / small >
2022-07-12 10:55:28 +02:00
< o -input
2021-09-07 17:52:34 +02:00
type = "textarea"
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceRules"
2021-09-07 17:52:34 +02:00
id = "instance-rules"
/ >
2020-06-25 11:36:35 +02:00
< / div >
2022-07-12 10:55:28 +02:00
< o -field : label = "$t('Instance Terms Source')" >
2020-06-25 11:36:35 +02:00
< div class = "columns" >
< div class = "column is-one-third-desktop" >
2021-09-07 17:52:34 +02:00
< fieldset >
< legend >
{ { $t ( "Choose the source of the instance's Terms" ) } }
< / legend >
2022-07-12 10:55:28 +02:00
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceTermsType"
2021-09-07 17:52:34 +02:00
name = "instanceTermsType"
: native - value = "InstanceTermsType.DEFAULT"
2022-07-12 10:55:28 +02:00
> { { $t ( "Default Mobilizon terms" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceTermsType"
2021-09-07 17:52:34 +02:00
name = "instanceTermsType"
: native - value = "InstanceTermsType.URL"
2022-07-12 10:55:28 +02:00
> { { $t ( "Custom URL" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instanceTermsType"
2021-09-07 17:52:34 +02:00
name = "instanceTermsType"
: native - value = "InstanceTermsType.CUSTOM"
2022-07-12 10:55:28 +02:00
> { { $t ( "Custom text" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
2021-09-07 17:52:34 +02:00
< / fieldset >
2020-02-18 08:57:00 +01:00
< / div >
2020-06-25 11:36:35 +02:00
< div class = "column" >
< div
class = "notification"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instanceTermsType ===
InstanceTermsType . DEFAULT
2020-11-30 10:24:11 +01:00
"
2020-06-19 19:27:10 +02:00
>
2020-06-25 11:36:35 +02:00
< b > { { $t ( "Default" ) } } < / b >
2022-07-12 10:55:28 +02:00
< i18n -t
2020-06-25 11:36:35 +02:00
tag = "p"
2022-07-12 10:55:28 +02:00
class = "prose dark:prose-invert"
keypath = "The {default_terms} will be used. They will be translated in the user's language."
2020-06-25 11:36:35 +02:00
>
2022-07-12 10:55:28 +02:00
< template # default_terms >
< a
href = "https://demo.mobilizon.org/terms"
target = "_blank"
rel = "noopener"
> { { $t ( "default Mobilizon terms" ) } } < / a
>
< / template >
< / i 1 8 n - t >
2020-06-25 11:36:35 +02:00
< b > { {
$t (
"NOTE! The default terms have not been checked over by a lawyer and thus are unlikely to provide full legal protection for all situations for an instance admin using them. They are also not specific to all countries and jurisdictions. If you are unsure, please check with a lawyer."
)
} } < / b >
< / div >
< div
class = "notification"
2021-09-29 19:06:57 +02:00
v - if = "
settingsToWrite . instanceTermsType === InstanceTermsType . URL
"
2020-06-19 19:27:10 +02:00
>
2020-06-25 11:36:35 +02:00
< b > { { $t ( "URL" ) } } < / b >
2022-07-12 10:55:28 +02:00
< p class = "prose dark:prose-invert" >
2020-11-30 10:24:11 +01:00
{ { $t ( "Set an URL to a page with your own terms." ) } }
< / p >
2020-06-25 11:36:35 +02:00
< / div >
< div
class = "notification"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instanceTermsType === InstanceTermsType . CUSTOM
2020-11-30 10:24:11 +01:00
"
2020-06-19 19:27:10 +02:00
>
2020-06-25 11:36:35 +02:00
< b > { { $t ( "Custom" ) } } < / b >
2022-07-12 10:55:28 +02:00
< i18n -t
2020-06-25 11:36:35 +02:00
tag = "p"
2022-07-12 10:55:28 +02:00
class = "prose dark:prose-invert"
keypath = "Enter your own terms. HTML tags allowed. The {mobilizon_terms} are provided as template."
2020-06-19 19:27:10 +02:00
>
2022-07-12 10:55:28 +02:00
< template # mobilizon_terms >
< a
href = "https://demo.mobilizon.org/terms"
target = "_blank"
rel = "noopener"
>
{ { $t ( "default Mobilizon terms" ) } } < / a
>
< / template >
< / i 1 8 n - t >
2020-06-25 11:36:35 +02:00
< / div >
2020-06-19 19:27:10 +02:00
< / div >
2020-06-25 11:36:35 +02:00
< / div >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field
2020-06-25 11:36:35 +02:00
: label = "$t('Instance Terms URL')"
2021-09-29 19:06:57 +02:00
label - for = "instanceTermsUrl"
v - if = "settingsToWrite.instanceTermsType === InstanceTermsType.URL"
2020-06-25 11:36:35 +02:00
>
2022-07-12 10:55:28 +02:00
< o -input
2021-09-29 19:06:57 +02:00
type = "URL"
v - model = "settingsToWrite.instanceTermsUrl"
id = "instanceTermsUrl"
/ >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field
2020-06-25 11:36:35 +02:00
: label = "$t('Instance Terms')"
2021-09-29 19:06:57 +02:00
label - for = "instanceTerms"
v - if = "settingsToWrite.instanceTermsType === InstanceTermsType.CUSTOM"
2020-06-25 11:36:35 +02:00
>
2022-07-12 10:55:28 +02:00
< o -input
2021-09-29 19:06:57 +02:00
type = "textarea"
v - model = "settingsToWrite.instanceTerms"
id = "instanceTerms"
/ >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field : label = "$t('Instance Privacy Policy Source')" >
2020-06-25 11:36:35 +02:00
< div class = "columns" >
< div class = "column is-one-third-desktop" >
2021-09-07 17:52:34 +02:00
< fieldset >
< legend >
{ { $t ( "Choose the source of the instance's Privacy Policy" ) } }
< / legend >
2022-07-12 10:55:28 +02:00
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instancePrivacyPolicyType"
2021-09-07 17:52:34 +02:00
name = "instancePrivacyType"
: native - value = "InstancePrivacyType.DEFAULT"
2022-07-12 10:55:28 +02:00
> { { $t ( "Default Mobilizon privacy policy" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instancePrivacyPolicyType"
2021-09-07 17:52:34 +02:00
name = "instancePrivacyType"
: native - value = "InstancePrivacyType.URL"
2022-07-12 10:55:28 +02:00
> { { $t ( "Custom URL" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field >
< o -radio
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instancePrivacyPolicyType"
2021-09-07 17:52:34 +02:00
name = "instancePrivacyType"
: native - value = "InstancePrivacyType.CUSTOM"
2022-07-12 10:55:28 +02:00
> { { $t ( "Custom text" ) } } < / o - r a d i o
2021-09-07 17:52:34 +02:00
>
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
2021-09-07 17:52:34 +02:00
< / fieldset >
2020-06-19 19:27:10 +02:00
< / div >
2020-06-25 11:36:35 +02:00
< div class = "column" >
< div
class = "notification"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instancePrivacyPolicyType ===
2020-11-30 10:24:11 +01:00
InstancePrivacyType . DEFAULT
"
2020-06-19 19:27:10 +02:00
>
2020-06-25 11:36:35 +02:00
< b > { { $t ( "Default" ) } } < / b >
2022-07-12 10:55:28 +02:00
< i18n -t
2020-06-25 11:36:35 +02:00
tag = "p"
2022-07-12 10:55:28 +02:00
class = "prose dark:prose-invert"
keypath = "The {default_privacy_policy} will be used. They will be translated in the user's language."
2020-06-19 19:27:10 +02:00
>
2022-07-12 10:55:28 +02:00
< template # default_privacy_policy >
< a
href = "https://demo.mobilizon.org/privacy"
target = "_blank"
rel = "noopener"
> { { $t ( "default Mobilizon privacy policy" ) } } < / a
>
< / template >
< / i 1 8 n - t >
2020-06-25 11:36:35 +02:00
< / div >
< div
class = "notification"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instancePrivacyPolicyType ===
2020-11-30 10:24:11 +01:00
InstancePrivacyType . URL
"
2020-06-25 11:36:35 +02:00
>
< b > { { $t ( "URL" ) } } < / b >
2022-07-12 10:55:28 +02:00
< p class = "prose dark:prose-invert" >
2020-06-25 11:36:35 +02:00
{ { $t ( "Set an URL to a page with your own privacy policy." ) } }
< / p >
< / div >
< div
class = "notification"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instancePrivacyPolicyType ===
2020-11-30 10:24:11 +01:00
InstancePrivacyType . CUSTOM
"
2020-06-25 11:36:35 +02:00
>
< b > { { $t ( "Custom" ) } } < / b >
2022-07-12 10:55:28 +02:00
< i18n -t
2020-06-25 11:36:35 +02:00
tag = "p"
2022-07-12 10:55:28 +02:00
class = "prose dark:prose-invert"
2020-06-25 11:36:35 +02:00
path = "Enter your own privacy policy. HTML tags allowed. The {mobilizon_privacy_policy} is provided as template."
2020-06-19 19:27:10 +02:00
>
2022-07-12 10:55:28 +02:00
< template # mobilizon_privacy_policy >
< a
href = "https://demo.mobilizon.org/privacy"
target = "_blank"
rel = "noopener"
>
{ { $t ( "default Mobilizon privacy policy" ) } } < / a
>
< / template >
< / i 1 8 n - t >
2020-06-25 11:36:35 +02:00
< / div >
2020-06-19 19:27:10 +02:00
< / div >
< / div >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field
2020-06-25 11:36:35 +02:00
: label = "$t('Instance Privacy Policy URL')"
2021-09-29 19:06:57 +02:00
label - for = "instancePrivacyPolicyUrl"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instancePrivacyPolicyType ===
InstancePrivacyType . URL
2020-11-30 10:24:11 +01:00
"
2020-06-25 11:36:35 +02:00
>
2022-07-12 10:55:28 +02:00
< o -input
2020-11-30 10:24:11 +01:00
type = "URL"
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instancePrivacyPolicyUrl"
id = "instancePrivacyPolicyUrl"
2020-11-30 10:24:11 +01:00
/ >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -field
2020-06-25 11:36:35 +02:00
: label = "$t('Instance Privacy Policy')"
2021-09-29 19:06:57 +02:00
label - for = "instancePrivacyPolicy"
2020-11-30 10:24:11 +01:00
v - if = "
2021-09-29 19:06:57 +02:00
settingsToWrite . instancePrivacyPolicyType ===
2020-11-30 10:24:11 +01:00
InstancePrivacyType . CUSTOM
"
2020-06-25 11:36:35 +02:00
>
2022-07-12 10:55:28 +02:00
< o -input
2020-11-30 10:24:11 +01:00
type = "textarea"
2021-09-29 19:06:57 +02:00
v - model = "settingsToWrite.instancePrivacyPolicy"
id = "instancePrivacyPolicy"
2020-11-30 10:24:11 +01:00
/ >
2022-07-12 10:55:28 +02:00
< / o - f i e l d >
< o -button native -type = " submit " variant = "primary" > { {
2020-11-30 10:24:11 +01:00
$t ( "Save" )
2022-07-12 10:55:28 +02:00
} } < / o - b u t t o n >
2020-06-25 11:36:35 +02:00
< / form >
< / section >
< / div >
2019-12-20 13:04:34 +01:00
< / template >
2022-07-12 10:55:28 +02:00
< script lang = "ts" setup >
2020-11-30 10:24:11 +01:00
import {
ADMIN _SETTINGS ,
SAVE _ADMIN _SETTINGS ,
LANGUAGES ,
} from "@/graphql/admin" ;
2020-11-27 19:27:44 +01:00
import { InstancePrivacyType , InstanceTermsType } from "@/types/enums" ;
2022-07-12 10:55:28 +02:00
import { IAdminSettings , ILanguage } from "@/types/admin.model" ;
import RouteName from "@/router/name" ;
import { useMutation , useQuery } from "@vue/apollo-composable" ;
import { ref , computed , watch , inject } from "vue" ;
import { useI18n } from "vue-i18n" ;
import { useHead } from "@vueuse/head" ;
import { Notifier } from "@/plugins/notifier" ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
const { result : adminSettingsResult } = useQuery < {
adminSettings : IAdminSettings ;
} > ( ADMIN _SETTINGS ) ;
const adminSettings = computed (
( ) =>
adminSettingsResult . value ? . adminSettings ? ? {
instanceName : "" ,
instanceDescription : "" ,
instanceSlogan : "" ,
instanceLongDescription : "" ,
contact : "" ,
instanceTerms : "" ,
instanceTermsType : InstanceTermsType . DEFAULT ,
instanceTermsUrl : null ,
instancePrivacyPolicy : "" ,
instancePrivacyPolicyType : InstanceTermsType . DEFAULT ,
instancePrivacyPolicyUrl : null ,
instanceRules : "" ,
registrationsOpen : false ,
instanceLanguages : [ ] ,
}
) ;
2020-02-18 08:57:00 +01:00
2022-07-12 10:55:28 +02:00
const { result : languageResult } = useQuery < { languages : ILanguage [ ] } > (
LANGUAGES
) ;
const languages = computed ( ( ) => languageResult . value ? . languages ) ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
const { t } = useI18n ( { useScope : "global" } ) ;
useHead ( {
title : computed ( ( ) => t ( "Settings" ) ) ,
} ) ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
const settingsToWrite = ref < IAdminSettings > ( { ... adminSettings } ) ;
2020-07-09 17:24:28 +02:00
2022-07-12 10:55:28 +02:00
watch ( adminSettings , ( ) => {
// settingsToWrite.value = { ...adminSettings.value };
} ) ;
2020-02-18 08:57:00 +01:00
2022-07-12 10:55:28 +02:00
const filteredLanguages = ref < string [ ] > ( [ ] ) ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
const instanceLanguages = computed ( {
get ( ) {
const languageCodes = [ ... adminSettings . value . instanceLanguages ] || [ ] ;
2021-03-04 15:49:35 +01:00
return languageCodes
2022-07-12 10:55:28 +02:00
. map ( ( code ) => languageForCode ( code ) )
2021-03-04 15:49:35 +01:00
. filter ( ( language ) => language ) as string [ ] ;
2022-07-12 10:55:28 +02:00
} ,
set ( newInstanceLanguages : string [ ] ) {
const newFilteredInstanceLanguages = newInstanceLanguages
2021-03-04 15:49:35 +01:00
. map ( ( language ) => {
2022-07-12 10:55:28 +02:00
return codeForLanguage ( language ) ;
2021-03-04 15:49:35 +01:00
} )
. filter ( ( code ) => code !== undefined ) as string [ ] ;
2022-07-12 10:55:28 +02:00
// adminSettings = {
// ...adminSettings,
// instanceLanguages: newInstanceLanguages,
// };
} ,
} ) ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
const notifier = inject < Notifier > ( "notifier" ) ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
const {
mutate : saveAdminSettings ,
onDone : saveAdminSettingsDone ,
onError : saveAdminSettingsError ,
} = useMutation ( SAVE _ADMIN _SETTINGS ) ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
saveAdminSettingsDone ( ( ) => {
notifier ? . success ( t ( "Admin settings successfully saved." ) as string ) ;
} ) ;
saveAdminSettingsError ( ( e ) => {
console . error ( e ) ;
notifier ? . error ( t ( "Failed to save admin settings" ) as string ) ;
} ) ;
const updateSettings = async ( ) : Promise < void > => {
const variables = { ... settingsToWrite } ;
saveAdminSettings ( variables ) ;
} ;
const getFilteredLanguages = ( text : string ) : void => {
filteredLanguages . value = languages . value
? languages . value
. filter ( ( language : ILanguage ) => {
return (
language . name
. toString ( )
. toLowerCase ( )
. indexOf ( text . toLowerCase ( ) ) >= 0
) ;
} )
. map ( ( { name } ) => name )
: [ ] ;
} ;
const codeForLanguage = ( language : string ) : string | undefined => {
if ( languages . value ) {
const lang = languages . value . find ( ( { name } ) => name === language ) ;
if ( lang ) return lang . code ;
2020-10-07 15:37:23 +02:00
}
2022-07-12 10:55:28 +02:00
return undefined ;
} ;
2020-10-07 15:37:23 +02:00
2022-07-12 10:55:28 +02:00
const languageForCode = ( codeGiven : string ) : string | undefined => {
if ( languages . value ) {
const lang = languages . value . find ( ( { code } ) => code === codeGiven ) ;
if ( lang ) return lang . name ;
2020-10-07 15:37:23 +02:00
}
2022-07-12 10:55:28 +02:00
return undefined ;
} ;
2020-02-18 08:57:00 +01:00
< / script >
2020-06-17 15:54:24 +02:00
< style lang = "scss" scoped >
2020-06-19 19:27:10 +02:00
label . label . has - help {
margin - bottom : 0 ;
}
2020-06-17 15:54:24 +02:00
< / style >