mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 07:59:42 +02:00
feat(ui): improve respawn duration with preset buttons
Replace the simple number input for respawn duration with a preset button group (30m, 1h, 2h, 4h, 8h, ∞, Custom). Move duration to be the first option in the Respawn Controller settings. - Add duration preset buttons with visual highlighting for selection - ∞ (unlimited) is selected by default - Custom option reveals a number input for arbitrary values - Reset to default when modal opens Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+42
-2
@@ -1302,20 +1302,60 @@ class ClaudemanApp {
|
||||
respawnSection.style.display = 'none';
|
||||
}
|
||||
|
||||
// Reset duration presets to default (unlimited)
|
||||
this.selectDurationPreset('');
|
||||
|
||||
document.getElementById('sessionOptionsModal').classList.add('active');
|
||||
|
||||
// Focus the name input
|
||||
setTimeout(() => document.getElementById('sessionNameInput').focus(), 100);
|
||||
}
|
||||
|
||||
// Handle duration preset selection
|
||||
selectDurationPreset(value) {
|
||||
// Remove active from all buttons
|
||||
document.querySelectorAll('.duration-preset-btn').forEach(btn => btn.classList.remove('active'));
|
||||
|
||||
// Find and activate the clicked button
|
||||
const btn = document.querySelector(`.duration-preset-btn[data-minutes="${value}"]`);
|
||||
if (btn) btn.classList.add('active');
|
||||
|
||||
// Show/hide custom input
|
||||
const customInput = document.querySelector('.duration-custom-input');
|
||||
const durationInput = document.getElementById('modalRespawnDuration');
|
||||
|
||||
if (value === 'custom') {
|
||||
customInput.classList.add('visible');
|
||||
durationInput.focus();
|
||||
} else {
|
||||
customInput.classList.remove('visible');
|
||||
durationInput.value = ''; // Clear custom value when using preset
|
||||
}
|
||||
}
|
||||
|
||||
// Get selected duration from preset buttons or custom input
|
||||
getSelectedDuration() {
|
||||
const customInput = document.querySelector('.duration-custom-input');
|
||||
const durationInput = document.getElementById('modalRespawnDuration');
|
||||
|
||||
if (customInput.classList.contains('visible')) {
|
||||
// Custom mode - use input value
|
||||
return durationInput.value ? parseInt(durationInput.value) : null;
|
||||
} else {
|
||||
// Preset mode - get from active button
|
||||
const activeBtn = document.querySelector('.duration-preset-btn.active');
|
||||
const minutes = activeBtn?.dataset.minutes;
|
||||
return minutes ? parseInt(minutes) : null;
|
||||
}
|
||||
}
|
||||
|
||||
// Get respawn config from modal inputs
|
||||
getModalRespawnConfig() {
|
||||
const updatePrompt = document.getElementById('modalRespawnPrompt').value;
|
||||
const sendClear = document.getElementById('modalRespawnSendClear').checked;
|
||||
const sendInit = document.getElementById('modalRespawnSendInit').checked;
|
||||
const kickstartPrompt = document.getElementById('modalRespawnKickstart').value.trim() || undefined;
|
||||
const durationStr = document.getElementById('modalRespawnDuration').value;
|
||||
const durationMinutes = durationStr ? parseInt(durationStr) : null;
|
||||
const durationMinutes = this.getSelectedDuration();
|
||||
|
||||
// Auto-compact settings
|
||||
const autoCompactEnabled = document.getElementById('modalAutoCompactEnabled').checked;
|
||||
|
||||
Reference in New Issue
Block a user