feat: fullscreen terminal with iPhone landscape action buttons #57

Merged
jimmy merged 11 commits from dev into main 2026-04-22 01:45:15 +08:00
2 changed files with 62 additions and 18 deletions
Showing only changes of commit 47e4bde622 - Show all commits
+11 -10
View File
@@ -1,16 +1,17 @@
name: Run Tests
on:
push:
branches: [main]
paths:
- 'dashboard/**'
- '.gitea/workflows/test.yml'
pull_request:
branches: [main]
paths:
- 'dashboard/**'
- '.gitea/workflows/test.yml'
workflow_dispatch:
# push:
# branches: [main]
# paths:
# - 'dashboard/**'
# - '.gitea/workflows/test.yml'
# pull_request:
# branches: [main]
# paths:
# - 'dashboard/**'
# - '.gitea/workflows/test.yml'
jobs:
backend-tests:
+45 -2
View File
@@ -35,6 +35,7 @@
let showMenu = $state(false);
let voiceTick = $state(0);
let isDark = $state(false);
let isFullscreen = $state(false);
let tabCounter = 0;
const tabData = new Map();
@@ -459,6 +460,35 @@
function activeVoice() { return voiceTick >= 0 && tabData.get(activeTab)?.voice; }
function toggleFullscreen() {
const elem = document.documentElement;
if (!document.fullscreenElement) {
elem.requestFullscreen().then(() => {
isFullscreen = true;
}).catch(err => {
console.error('Failed to enter fullscreen:', err);
});
} else {
document.exitFullscreen().then(() => {
isFullscreen = false;
}).catch(err => {
console.error('Failed to exit fullscreen:', err);
});
}
}
onMount(() => {
syncTheme();
themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
const requestedHost = new URLSearchParams(window.location.search).get("host");
if (requestedHost && !tabs.length && hostById(requestedHost)) addTab(requestedHost);
// Listen for fullscreen changes
document.addEventListener('fullscreenchange', () => {
isFullscreen = !!document.fullscreenElement;
});
});
onDestroy(() => {
themeObserver.disconnect();
tabData.forEach((d) => {
@@ -536,9 +566,21 @@
</div>
{/if}
</div>
{#if activeTab && tabs.find(t => t.id === activeTab)?.connected && activeVoice()}
{#if activeTab && tabs.find(t => t.id === activeTab)?.connected}
<div class="ml-auto flex items-center gap-1">
<button
class="px-2 py-1 rounded text-sm transition-colors text-surface-600 dark:text-surface-500 hover:text-surface-800 dark:hover:text-surface-300"
title={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'}
onclick={toggleFullscreen}
>
{#if isFullscreen}
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"/></svg>
{:else}
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"/></svg>
{/if}
</button>
{#if activeVoice()}
{@const v = activeVoice()}
<div class="ml-auto">
<button
class="px-2 py-1 rounded text-sm transition-colors {v.voiceMode ? 'text-rose-400' : v.sttAvailable ? 'text-surface-600 dark:text-surface-500 hover:text-surface-800 dark:hover:text-surface-300' : 'text-surface-300 dark:text-surface-700 cursor-not-allowed'}"
title={!v.sttAvailable ? 'STT not supported' : v.voiceMode ? 'Voice mode on' : 'Enter voice mode'}
@@ -547,6 +589,7 @@
>
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"/><path d="M19 10v2a7 7 0 01-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>
</button>
{/if}
</div>
{/if}
</div>