Show local co-op icon in settings

This commit is contained in:
redphx 2025-01-04 18:43:24 +07:00
parent b3697df8dc
commit 488b0dfef2
7 changed files with 98 additions and 82 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -190,6 +190,12 @@
margin-bottom: 0 !important;
flex: 1;
svg {
width: 20px;
height: 20px;
margin-inline-end: 8px;
}
+ * {
margin: 0 0 0 auto;
}

View File

@ -1008,6 +1008,7 @@ export class SettingsDialog extends NavigationDialog {
const $row = createSettingRow(label, !prefDefinition?.unsupported && $control, {
$note,
multiLines: setting.multiLines,
icon: prefDefinition?.labelIcon,
});
if (pref) {
$row.htmlFor = `bx_setting_${escapeCssSelector(pref)}`;

View File

@ -20,6 +20,7 @@ interface BaseSettingDefinition {
default: any;
label?: string;
labelIcon?: BxIconRaw,
note?: string | (() => HTMLElement) | HTMLElement;
experimental?: boolean;
unsupported?: boolean;

View File

@ -54,6 +54,7 @@ export type BxButtonOptions = Partial<{
}>;
export type SettingsRowOptions = Partial<{
icon: BxIconRaw,
multiLines: boolean;
$note: HTMLElement;
}>;
@ -210,6 +211,7 @@ export function createSettingRow(label: string, $control: HTMLElement | false |
const $row = CE('label', { class: 'bx-settings-row' },
$label = CE('span', { class: 'bx-settings-label' },
options.icon && createSvgIcon(options.icon),
label,
options.$note,
),

View File

@ -13,6 +13,7 @@ import { MkbMappingDefaultPresetId } from "../local-db/mkb-mapping-presets-table
import { KeyboardShortcutDefaultId } from "../local-db/keyboard-shortcuts-table";
import { GhPagesUtils } from "../gh-pages";
import { BxEventBus } from "../bx-event-bus";
import { BxIcon } from "../bx-icon";
function getSupportedCodecProfiles() {
@ -338,6 +339,7 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
[PrefKey.LOCAL_CO_OP_ENABLED]: {
requiredVariants: 'full',
label: t('enable-local-co-op-support'),
labelIcon: BxIcon.LOCAL_CO_OP,
default: false,
note: () => CE('div', false,
CE('a', {