Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions src/components/views/CustomizeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ export class CustomizeView extends LitElement {
font-size: var(--font-size-sm);
}

.keybind-clear {
background: none;
border: 1px solid var(--border);
color: var(--text-secondary);
cursor: pointer;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
opacity: 0.7;
transition: opacity 0.15s;
}
.keybind-clear:hover {
opacity: 1;
color: var(--text-primary);
}
.keybind-input {
width: 140px;
text-align: center;
Expand Down Expand Up @@ -461,6 +476,10 @@ export class CustomizeView extends LitElement {
e.target.blur();
}

clearKeybind(action) {
this.handleKeybindChange(action, '');
}

async resetKeybinds() {
this.keybinds = this.getDefaultKeybinds();
await cheatingDaddy.storage.setKeybinds(null);
Expand Down Expand Up @@ -580,9 +599,9 @@ export class CustomizeView extends LitElement {
<option value="both">Both Speaker and Microphone</option>
</select>
</div>
${this.audioMode !== 'speaker_only' ? html`
<div class="warning-callout">May cause unexpected behavior. Only change this if you know what you're doing.</div>
` : ''}
${this.audioMode !== 'speaker_only'
? html` <div class="warning-callout">May cause unexpected behavior. Only change this if you know what you're doing.</div> `
: ''}
<div class="form-group">
<label class="form-label">Image Quality</label>
<select class="control" .value=${this.selectedImageQuality} @change=${this.handleImageQualitySelect}>
Expand Down Expand Up @@ -662,20 +681,33 @@ export class CustomizeView extends LitElement {
return html`
<section class="surface">
<div class="surface-title">Keyboard Shortcuts</div>
${this.getKeybindActions().map(action => html`
<div class="keybind-row">
<span class="keybind-name">${action.name}</span>
<input
type="text"
class="control keybind-input"
.value=${this.keybinds[action.key]}
data-action=${action.key}
@keydown=${this.handleKeybindInput}
@focus=${this.handleKeybindFocus}
readonly
/>
</div>
`)}
${this.getKeybindActions().map(
action => html`
<div class="keybind-row">
<span class="keybind-name">${action.name}</span>
<div style="display:flex;gap:4px;align-items:center;">
<input
type="text"
class="control keybind-input"
.value=${this.keybinds[action.key] || ''}
placeholder=${this.keybinds[action.key] ? '' : 'Unbound'}
data-action=${action.key}
@keydown=${this.handleKeybindInput}
@focus=${this.handleKeybindFocus}
readonly
/>
<button
class="keybind-clear"
title="Unbind"
style="visibility:${this.keybinds[action.key] ? 'visible' : 'hidden'}"
@click=${() => this.clearKeybind(action.key)}
>
×
</button>
</div>
</div>
`
)}
<div style="margin-top: var(--space-sm);">
<button class="control" style="width:auto;padding:8px 10px;" @click=${this.resetKeybinds}>Reset to defaults</button>
</div>
Expand All @@ -695,9 +727,9 @@ export class CustomizeView extends LitElement {
${this.isClearing ? 'Clearing...' : 'Delete all data'}
</button>
</div>
${this.clearStatusMessage ? html`
<div class="status ${this.clearStatusType === 'success' ? 'success' : 'error'}">${this.clearStatusMessage}</div>
` : ''}
${this.clearStatusMessage
? html` <div class="status ${this.clearStatusType === 'success' ? 'success' : 'error'}">${this.clearStatusMessage}</div> `
: ''}
</section>
`;
}
Expand All @@ -707,10 +739,7 @@ export class CustomizeView extends LitElement {
<div class="unified-page">
<div class="unified-wrap">
<div class="page-title">Settings</div>
${this.renderAudioSection()}
${this.renderLanguageSection()}
${this.renderAppearanceSection()}
${this.renderKeyboardSection()}
${this.renderAudioSection()} ${this.renderLanguageSection()} ${this.renderAppearanceSection()} ${this.renderKeyboardSection()}
${this.renderPrivacySection()}
</div>
</div>
Expand Down