Add extended preferences: client volume, quality, compact mode, default page, hide online status

This commit is contained in:
root
2026-06-26 20:07:07 +02:00
parent 9c92cd297a
commit 0a16f05d54
3 changed files with 192 additions and 0 deletions
@@ -32,6 +32,11 @@ class PreferencesController extends Controller
'room_invites' => 'sometimes|boolean', 'room_invites' => 'sometimes|boolean',
'email_notifications' => 'sometimes|boolean', 'email_notifications' => 'sometimes|boolean',
'client_open_mode' => 'sometimes|in:same,new_window', 'client_open_mode' => 'sometimes|in:same,new_window',
'client_volume' => 'sometimes|integer|min:0|max:100',
'client_quality' => 'sometimes|in:low,medium,high',
'compact_mode' => 'sometimes|boolean',
'hide_online' => 'sometimes|boolean',
'default_page' => 'sometimes|in:me,hotel,community,shop',
]); ]);
$preferences = array_merge($this->getDefaultPreferences(), $validated); $preferences = array_merge($this->getDefaultPreferences(), $validated);
@@ -51,6 +56,11 @@ class PreferencesController extends Controller
'room_invites' => true, 'room_invites' => true,
'email_notifications' => false, 'email_notifications' => false,
'client_open_mode' => 'same', 'client_open_mode' => 'same',
'client_volume' => 50,
'client_quality' => 'medium',
'compact_mode' => false,
'hide_online' => false,
'default_page' => 'me',
]; ];
} }
} }
@@ -98,6 +98,83 @@
<input type="checkbox" name="client_open_mode" value="new_window" {{ old('client_open_mode', $preferences['client_open_mode'] ?? 'same') === 'new_window' ? 'checked' : '' }} <input type="checkbox" name="client_open_mode" value="new_window" {{ old('client_open_mode', $preferences['client_open_mode'] ?? 'same') === 'new_window' ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);"> class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label> </label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Client volume') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Default volume for the game client') }}</p>
</div>
<div class="flex items-center gap-3">
<span class="text-sm" style="color: var(--color-text-muted);">0</span>
<input type="range" name="client_volume" min="0" max="100" value="{{ old('client_volume', $preferences['client_volume'] ?? 50) }}"
class="w-24 h-2 rounded-full cursor-pointer" style="accent-color: var(--color-primary);">
<span class="text-sm" style="color: var(--color-text-muted);">100</span>
<span class="text-sm font-semibold min-w-[2rem] text-center" id="volume-display" style="color: var(--color-text);">{{ old('client_volume', $preferences['client_volume'] ?? 50) }}%</span>
</div>
</label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Client quality') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Graphics quality for the game client') }}</p>
</div>
<select name="client_quality"
class="border-2 rounded-lg px-3 py-1.5 text-sm font-semibold cursor-pointer" style="background-color: var(--color-background); color: var(--color-text); border-color: var(--input-border-color, var(--color-text-muted)); accent-color: var(--color-primary);">
<option value="low" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'low' ? 'selected' : '' }}>{{ __('Low') }}</option>
<option value="medium" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'medium' ? 'selected' : '' }}>{{ __('Medium') }}</option>
<option value="high" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'high' ? 'selected' : '' }}>{{ __('High') }}</option>
</select>
</label>
</div>
</div>
<hr style="border-color: var(--color-text-muted);">
{{-- Layout Settings --}}
<div>
<h3 class="text-lg font-semibold mb-4" style="color: var(--color-text);">{{ __('Layout Settings') }}</h3>
<div class="space-y-4">
<label class="flex items-center justify-between cursor-pointer p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Compact mode') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Use a more compact layout with tighter spacing') }}</p>
</div>
<input type="hidden" name="compact_mode" value="0">
<input type="checkbox" name="compact_mode" value="1" {{ old('compact_mode', $preferences['compact_mode'] ?? false) ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Default page') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Page to show after logging in') }}</p>
</div>
<select name="default_page"
class="border-2 rounded-lg px-3 py-1.5 text-sm font-semibold cursor-pointer" style="background-color: var(--color-background); color: var(--color-text); border-color: var(--input-border-color, var(--color-text-muted));">
<option value="me" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'me' ? 'selected' : '' }}>{{ __('Me page') }}</option>
<option value="hotel" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'hotel' ? 'selected' : '' }}>{{ __('Hotel') }}</option>
<option value="community" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'community' ? 'selected' : '' }}>{{ __('Community') }}</option>
<option value="shop" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'shop' ? 'selected' : '' }}>{{ __('Shop') }}</option>
</select>
</label>
</div>
</div>
<hr style="border-color: var(--color-text-muted);">
{{-- Privacy Settings --}}
<div>
<h3 class="text-lg font-semibold mb-4" style="color: var(--color-text);">{{ __('Privacy Settings') }}</h3>
<div class="space-y-4">
<label class="flex items-center justify-between cursor-pointer p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Hide online status') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Hide your online status from other users on the site') }}</p>
</div>
<input type="hidden" name="hide_online" value="0">
<input type="checkbox" name="hide_online" value="1" {{ old('hide_online', $preferences['hide_online'] ?? false) ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label>
</div> </div>
</div> </div>
@@ -127,4 +204,18 @@
</form> </form>
</x-content.content-card> </x-content.content-card>
</div> </div>
@push('javascript')
<script>
document.addEventListener('DOMContentLoaded', function() {
var volumeInput = document.querySelector('input[name="client_volume"]');
var volumeDisplay = document.getElementById('volume-display');
if (volumeInput && volumeDisplay) {
volumeInput.addEventListener('input', function() {
volumeDisplay.textContent = this.value + '%';
});
}
});
</script>
@endpush
</x-app-layout> </x-app-layout>
@@ -98,6 +98,83 @@
<input type="checkbox" name="client_open_mode" value="new_window" {{ old('client_open_mode', $preferences['client_open_mode'] ?? 'same') === 'new_window' ? 'checked' : '' }} <input type="checkbox" name="client_open_mode" value="new_window" {{ old('client_open_mode', $preferences['client_open_mode'] ?? 'same') === 'new_window' ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);"> class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label> </label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Client volume') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Default volume for the game client') }}</p>
</div>
<div class="flex items-center gap-3">
<span class="text-sm" style="color: var(--color-text-muted);">0</span>
<input type="range" name="client_volume" min="0" max="100" value="{{ old('client_volume', $preferences['client_volume'] ?? 50) }}"
class="w-24 h-2 rounded-full cursor-pointer" style="accent-color: var(--color-primary);">
<span class="text-sm" style="color: var(--color-text-muted);">100</span>
<span class="text-sm font-semibold min-w-[2rem] text-center" id="volume-display" style="color: var(--color-text);">{{ old('client_volume', $preferences['client_volume'] ?? 50) }}%</span>
</div>
</label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Client quality') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Graphics quality for the game client') }}</p>
</div>
<select name="client_quality"
class="border-2 rounded-lg px-3 py-1.5 text-sm font-semibold cursor-pointer" style="background-color: var(--color-background); color: var(--color-text); border-color: var(--input-border-color, var(--color-text-muted));">
<option value="low" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'low' ? 'selected' : '' }}>{{ __('Low') }}</option>
<option value="medium" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'medium' ? 'selected' : '' }}>{{ __('Medium') }}</option>
<option value="high" {{ old('client_quality', $preferences['client_quality'] ?? 'medium') === 'high' ? 'selected' : '' }}>{{ __('High') }}</option>
</select>
</label>
</div>
</div>
<hr style="border-color: var(--color-text-muted); opacity: 0.3;">
{{-- Layout Settings --}}
<div>
<h3 class="text-lg font-semibold mb-4" style="color: var(--color-text);">{{ __('Layout Settings') }}</h3>
<div class="space-y-4">
<label class="flex items-center justify-between cursor-pointer p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Compact mode') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Use a more compact layout with tighter spacing') }}</p>
</div>
<input type="hidden" name="compact_mode" value="0">
<input type="checkbox" name="compact_mode" value="1" {{ old('compact_mode', $preferences['compact_mode'] ?? false) ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label>
<label class="flex items-center justify-between p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Default page') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Page to show after logging in') }}</p>
</div>
<select name="default_page"
class="border-2 rounded-lg px-3 py-1.5 text-sm font-semibold cursor-pointer" style="background-color: var(--color-background); color: var(--color-text); border-color: var(--input-border-color, var(--color-text-muted));">
<option value="me" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'me' ? 'selected' : '' }}>{{ __('Me page') }}</option>
<option value="hotel" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'hotel' ? 'selected' : '' }}>{{ __('Hotel') }}</option>
<option value="community" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'community' ? 'selected' : '' }}>{{ __('Community') }}</option>
<option value="shop" {{ old('default_page', $preferences['default_page'] ?? 'me') === 'shop' ? 'selected' : '' }}>{{ __('Shop') }}</option>
</select>
</label>
</div>
</div>
<hr style="border-color: var(--color-text-muted); opacity: 0.3;">
{{-- Privacy Settings --}}
<div>
<h3 class="text-lg font-semibold mb-4" style="color: var(--color-text);">{{ __('Privacy Settings') }}</h3>
<div class="space-y-4">
<label class="flex items-center justify-between cursor-pointer p-3 rounded" style="background-color: var(--color-surface);">
<div>
<span class="font-semibold" style="color: var(--color-text);">{{ __('Hide online status') }}</span>
<p class="text-sm" style="color: var(--color-text-muted);">{{ __('Hide your online status from other users on the site') }}</p>
</div>
<input type="hidden" name="hide_online" value="0">
<input type="checkbox" name="hide_online" value="1" {{ old('hide_online', $preferences['hide_online'] ?? false) ? 'checked' : '' }}
class="w-5 h-5 rounded cursor-pointer" style="accent-color: var(--color-primary);">
</label>
</div> </div>
</div> </div>
@@ -127,4 +204,18 @@
</form> </form>
</x-content.content-card> </x-content.content-card>
</div> </div>
@push('javascript')
<script>
document.addEventListener('DOMContentLoaded', function() {
var volumeInput = document.querySelector('input[name="client_volume"]');
var volumeDisplay = document.getElementById('volume-display');
if (volumeInput && volumeDisplay) {
volumeInput.addEventListener('input', function() {
volumeDisplay.textContent = this.value + '%';
});
}
});
</script>
@endpush
</x-app-layout> </x-app-layout>