mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Move TTS stop button from App to SessionDetail
This commit is contained in:
1 parent
17a9556c2a
commit
bd3d2b1c86
2 files changed
+18
-10
No files matched your search
@@ -5,10 +5,8 @@ import { Repos } from './pages/Repos'
|
||||
import { RepoDetail } from './pages/RepoDetail'
|
||||
import { SessionDetail } from './pages/SessionDetail'
|
||||
import { SettingsDialog } from './components/settings/SettingsDialog'
|
||||
import { FloatingActionButton } from './components/ui/floating-action-button'
|
||||
import { useSettingsDialog } from './hooks/useSettingsDialog'
|
||||
import { useTheme } from './hooks/useTheme'
|
||||
import { useTTS } from './hooks/useTTS'
|
||||
import { TTSProvider } from './contexts/TTSContext'
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
@@ -22,7 +20,6 @@ const queryClient = new QueryClient({
|
||||
|
||||
function AppContent() {
|
||||
const { isOpen, close } = useSettingsDialog()
|
||||
const { isPlaying, stop } = useTTS()
|
||||
useTheme()
|
||||
|
||||
return (
|
||||
@@ -34,12 +31,6 @@ function AppContent() {
|
||||
|
||||
</Routes>
|
||||
<SettingsDialog open={isOpen} onOpenChange={close} />
|
||||
<FloatingActionButton
|
||||
variant="stop-audio"
|
||||
visible={isPlaying}
|
||||
onClick={stop}
|
||||
position="top-left"
|
||||
/>
|
||||
<Toaster
|
||||
position="bottom-right"
|
||||
expand={false}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { getRepo } from "@/api/repos";
|
||||
import { MessageThread } from "@/components/message/MessageThread";
|
||||
import { PromptInput, type PromptInputHandle } from "@/components/message/PromptInput";
|
||||
import { X } from "lucide-react";
|
||||
import { X, VolumeX } from "lucide-react";
|
||||
import { ModelSelectDialog } from "@/components/model/ModelSelectDialog";
|
||||
import { SessionDetailHeader } from "@/components/session/SessionDetailHeader";
|
||||
import { SessionList } from "@/components/session/SessionList";
|
||||
@@ -22,6 +22,7 @@ import { useSettingsDialog } from "@/hooks/useSettingsDialog";
|
||||
import { usePermissionRequests } from "@/hooks/usePermissionRequests";
|
||||
import { useAutoScroll } from "@/hooks/useAutoScroll";
|
||||
import { useSwipeBack } from "@/hooks/useMobile";
|
||||
import { useTTS } from "@/hooks/useTTS";
|
||||
import { useEffect, useRef, useCallback } from "react";
|
||||
import { MessageSkeleton } from "@/components/message/MessageSkeleton";
|
||||
import { exportSession, downloadMarkdown } from "@/lib/exportSession";
|
||||
@@ -88,6 +89,7 @@ export function SessionDetail() {
|
||||
const { open: openSettings } = useSettingsDialog();
|
||||
const { modelString } = useModelSelection(opcodeUrl, repoDirectory);
|
||||
const isEditingMessage = useUIState((state) => state.isEditingMessage);
|
||||
const { isPlaying, stop } = useTTS();
|
||||
|
||||
useKeyboardShortcuts({
|
||||
openModelDialog: () => setModelDialogOpen(true),
|
||||
@@ -267,6 +269,21 @@ export function SessionDetail() {
|
||||
<span className="text-sm font-medium hidden sm:inline">Clear</span>
|
||||
</button>
|
||||
)}
|
||||
{isPlaying && (
|
||||
<button
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onTouchEnd={(e) => {
|
||||
e.preventDefault()
|
||||
stop()
|
||||
}}
|
||||
onClick={stop}
|
||||
className="absolute -top-12 left-0 md:left-4 z-50 flex items-center justify-center p-2 rounded-full border shadow-lg backdrop-blur-sm transition-all duration-200 active:scale-95 bg-destructive/90 hover:bg-destructive text-destructive-foreground border-destructive"
|
||||
aria-label="Stop Audio"
|
||||
>
|
||||
<VolumeX className="w-6 h-6" />
|
||||
<span className="text-sm font-medium hidden sm:inline">Stop Audio</span>
|
||||
</button>
|
||||
)}
|
||||
<PromptInput
|
||||
ref={promptInputRef}
|
||||
opcodeUrl={opcodeUrl}
|
||||
|
||||
Reference in new issue
Block a user