Skip to content

Commit

Permalink
feat: minor advanved settings improvements (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiroaisen authored Jan 27, 2024
2 parents 56fff00 + 79c06dc commit f909163
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
6 changes: 3 additions & 3 deletions front/app/src/lib/components/GooglePlayLangField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
export let on_change: ((v: string) => void) | null = null;
export let lang_names: Record<GooglePlayLang, string> = google_play_langs;
$: lang_options = Object.entries(lang_names).map(([ value, label ]) => {
return { value, label: lang_names[value as GooglePlayLang] || label }
}).sort((a, b) => a.label.localeCompare(b.label));
$: lang_options = Object.entries(lang_names).sort((a, b) => a[1].localeCompare(b[1])).map(([ value, label ]) => {
return { value, label: `${lang_names[value as GooglePlayLang] || label}, ${value}` }
})
$: empty = value == null || value === "";
$: options = empty ? [ {label: "", value: ""}, ...lang_options ] : lang_options;
Expand Down
22 changes: 15 additions & 7 deletions front/app/src/lib/components/StationProfile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@
margin: 0 auto;
background: #ccc;
}
.sep-one {
margin: 2rem auto;
}
</style>


Expand Down Expand Up @@ -473,6 +477,14 @@

<div class="fields section-advanced-fields" class:open={advanced_open} use:display_fly_enter={{ show: advanced_open, start: false, duration: 300, y: -25 }}>

<div class="field">
<!-- TODO: locale -->
<GooglePlayLangField
label={"App language for Google Play"}
bind:value={current.user_metadata.mob_app.google_play_lang}
/>
</div>

<div class="field">
<!-- TODO: locale -->
<NullTextField
Expand All @@ -495,20 +507,16 @@

<div class="field">
<NullTextField
icon={mdiGooglePlay}
label={"App description for Google Play"}
multiline={true}
multiline
minrows={5}
bind:value={current.user_metadata.mob_app.google_play_description}
/>
<Validator value={current.user_metadata.mob_app.google_play_description} fn={_string({ maxlen: 4000 })} />
</div>

<div class="field">
<GooglePlayLangField
label={"App language for Google Play"}
bind:value={current.user_metadata.mob_app.google_play_lang}
/>
</div>
<div class="advanced-sep sep-one" />

<div class="field">
<ColorField
Expand Down
15 changes: 12 additions & 3 deletions front/share/src/Form/FieldContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
export let readonly: boolean = false;
export let icon: string | null = null;
export let icon_viewbox: string | undefined = void 0;
export let multiline: boolean = false;
export let btn: { icon: string, action: () => void, label: string, tabindex?: number | undefined } | null = null;
import Icon from "$share/Icon.svelte";
import Icon from "$share/Icon.svelte";
import { ripple } from "$share/ripple";
// let btn_click_token = false;
Expand Down Expand Up @@ -56,10 +58,17 @@
font-size: 1.25rem;
margin-inline-start: 0.5rem;
margin-block-start: 0.45rem;
margin-inline-end: 0.15;
transition: color 250ms ease;
}
.multiline .icon {
align-self: flex-start;
display: flex;
align-items: center;
justify-content: center;
height: 1.75rem;
}
.field-container:not(.disabled):not(.readonly):focus-within > .icon {
color: var(--blue);
}
Expand Down Expand Up @@ -102,7 +111,7 @@
}
</style>

<label class="field-container" class:disabled class:readonly class:with-icon={icon != null}>
<label class="field-container" class:disabled class:readonly class:multiline class:with-icon={icon != null}>
{#if icon != null}
<div class="icon">
<Icon d={icon} viewBox={icon_viewbox} />
Expand Down
2 changes: 1 addition & 1 deletion front/share/src/Form/TextField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import Label from "./Label.svelte";
</script>

<FieldContainer {disabled} {readonly} {icon} {icon_viewbox} {btn}>
<FieldContainer {disabled} {readonly} {multiline} {icon} {icon_viewbox} {btn}>
<Input
type={type}
{autocomplete}
Expand Down

0 comments on commit f909163

Please sign in to comment.