@using Sidekick.Common.Settings
@using Sidekick.Modules.Settings.Localization
@using Sidekick.Modules.Settings.Components

<KeybindEditor Value="@KeyOpen"
               ValueChanged="KeyChanged"
               Label="@Resources.Wiki_Key_Open"/>

@inject SettingsResources Resources
@inject ISettingsService SettingsService

@code {

    private string? KeyOpen { get; set; }

    protected override async Task OnInitializedAsync()
    {
        KeyOpen = await SettingsService.GetString(SettingKeys.KeyOpenWiki);
        await base.OnInitializedAsync();
    }

    private async Task KeyChanged(string? value)
    {
        KeyOpen = value;
        await SettingsService.Set(SettingKeys.KeyOpenWiki, value);
    }

}
