mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-01-06 08:57:20 +03:00
db6c219776
- made Discord RPC preparations made `discord-rpc` cli utility made `DiscordRPC` class to manage it - changed `'` to `"` in every command execution - `Voice.current` field changed to `Voice.installed` - `Voice.selected` field now returns list of selected voice packages - added `Voice.delete()` method to delete voice package - `Voice.isUpdatePredownloaded()` method now can check list of voice packages - fixed ProgressBar's `showTotals` property work - decreased maximal wine prefix creation log size in progress bar - improved `Process.run` command which now finds correct process id - made DropdownCheckboxes component - made voice packages selection system
81 lines
2.4 KiB
Svelte
81 lines
2.4 KiB
Svelte
<script lang="ts">
|
|
import { _ } from 'svelte-i18n';
|
|
|
|
import Configs from '../ts/Configs';
|
|
|
|
export let prop: string = '';
|
|
export let lang: string = '';
|
|
export let tooltip: string = '';
|
|
export let selected: string|undefined;
|
|
export let items = {};
|
|
|
|
export let selectionUpdated: (property: string, value: boolean, list: object) => void = () => {};
|
|
|
|
import Arrow from '../assets/svgs/arrow.svg';
|
|
import Checkmark from '../assets/svgs/checkmark.svg';
|
|
|
|
let selectionOpen = false;
|
|
let selectedValue = selected;
|
|
let selectedValues = {};
|
|
|
|
Object.keys(items).forEach((key) => selectedValues[key] = false);
|
|
Configs.get(prop).then((values) => {
|
|
(values as string[]).forEach((key) => selectedValues[key] = true);
|
|
});
|
|
|
|
const updateCheckbox = (value: string) => {
|
|
selectedValues[value] = !selectedValues[value];
|
|
|
|
let activeVoices: string[] = [];
|
|
|
|
Object.keys(selectedValues).forEach((key) => {
|
|
if (selectedValues[key])
|
|
activeVoices.push(key);
|
|
});
|
|
|
|
Configs.set(prop, activeVoices);
|
|
|
|
selectionUpdated(value, selectedValues[value], selectedValues);
|
|
};
|
|
</script>
|
|
|
|
<div class="select dropdown-checkboxes" class:select-active={selectionOpen}>
|
|
<span>{ $_(lang) }</span>
|
|
|
|
<div class="select-options">
|
|
<ul>
|
|
{#each Object.keys(items) as value}
|
|
<li>
|
|
<div class="checkbox" class:checkbox-active={selectedValues[value]}>
|
|
<span>{ $_(items[value]) }</span>
|
|
|
|
<div class="checkbox-mark" on:click={() => updateCheckbox(value)}>
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
<img src={Checkmark} />
|
|
</div>
|
|
</div>
|
|
</li>
|
|
{/each}
|
|
</ul>
|
|
</div>
|
|
|
|
<div
|
|
class="selected-item"
|
|
class:hint--left={tooltip !== ''}
|
|
class:hint--medium={tooltip !== ''}
|
|
aria-label={$_(tooltip)}
|
|
on:click={() => selectionOpen = !selectionOpen}
|
|
>
|
|
<span>{ selectedValue ? $_(items[selectedValue]) : '' }</span>
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
<img src={Arrow} class:selection-empty={selectedValue === undefined} />
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.dropdown-checkboxes .selected-item img.selection-empty
|
|
{
|
|
margin-left: 0;
|
|
}
|
|
</style>
|