mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(frontend): add mobile composer tools menu and base branch select
This commit is contained in:
1 parent
fac23b1f1a
commit
4a2e695ec2
21 files changed
+819
-158
No files matched your search
@@ -29,6 +29,7 @@ import { ModelQuickSelect } from '@/components/model/ModelQuickSelect'
|
||||
import { AgentQuickSelect } from '@/components/agent/AgentQuickSelect'
|
||||
import { VoiceStatusOverlay, type VoiceStatusOverlayState } from './VoiceStatusOverlay'
|
||||
import { PermissionModeToggle } from '@/components/session/PermissionModeToggle'
|
||||
import { ComposerToolsMenu } from './ComposerToolsMenu'
|
||||
import { useSessionGoal, useStartSessionGoal } from '@/hooks/useSessionGoals'
|
||||
import { useSessionPermissionMode } from '@/hooks/useSessionPermissionMode'
|
||||
import { detectMentionTrigger, parsePromptToInput, getFilename, filterAgentsByQuery } from '@/lib/promptParser'
|
||||
@@ -201,6 +202,10 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
clearSubmittedPrompt(pending.prompt, pending.files, pending.images)
|
||||
}, [isStreamingResponse, clearSubmittedPrompt])
|
||||
|
||||
const openFilePicker = useCallback(() => {
|
||||
fileInputRef.current?.click()
|
||||
}, [])
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
setPromptValue: (value: string) => {
|
||||
setPrompt(value)
|
||||
@@ -219,13 +224,11 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
}
|
||||
textareaRef.current?.focus()
|
||||
},
|
||||
triggerFileUpload: () => {
|
||||
fileInputRef.current?.click()
|
||||
},
|
||||
triggerFileUpload: openFilePicker,
|
||||
openModelPicker: () => {
|
||||
setIsModelPickerOpen(true)
|
||||
}
|
||||
}), [imageAttachments, clearSTT, isRecording, abortRecording, resetVoiceGestureState])
|
||||
}), [imageAttachments, clearSTT, isRecording, abortRecording, resetVoiceGestureState, openFilePicker])
|
||||
const sessionAgent = useSessionAgent(sessionID, directory)
|
||||
const currentMode = localMode ?? sessionAgent.agent
|
||||
const setStoredAgent = useSessionAgentStore((s) => s.setAgent)
|
||||
@@ -1187,16 +1190,8 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
|
||||
: isGoalArmed
|
||||
? 'Goal mode armed: the next message becomes the objective'
|
||||
: 'Goal mode: the next message becomes the objective'
|
||||
const goalModeButton = directory ? (
|
||||
<IconToggleButton
|
||||
active={isGoalArmed}
|
||||
label={goalButtonLabel}
|
||||
disabled={lockedReason !== null || hasOpenGoal || isBashMode || startGoal.isPending}
|
||||
onClick={() => setIsGoalArmed((value) => !value)}
|
||||
>
|
||||
<Target className="w-5 h-5" />
|
||||
</IconToggleButton>
|
||||
) : null
|
||||
const isGoalModeDisabled = lockedReason !== null || hasOpenGoal || isBashMode || startGoal.isPending
|
||||
const toggleGoalArmed = () => setIsGoalArmed((value) => !value)
|
||||
const voiceFeedbackState: VoiceStatusOverlayState | null = isTogglingRecording
|
||||
? 'starting'
|
||||
: isProcessing
|
||||
@@ -1320,16 +1315,6 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
|
||||
|
||||
return (
|
||||
<div className={`relative backdrop-blur-md bg-background opacity-95 border border-border dark:border-border/30 rounded-xl p-2 md:p-3 mb-4 md:mb-1 w-full transition-all ${hasPendingPermissionForSession ? 'border-highlight/50 ring-1 ring-highlight/30' : ''}`}>
|
||||
{showStopButton && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
className="absolute bottom-full right-0 mb-2 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-destructive hover:bg-destructive/90 text-destructive-foreground border border-destructive/60 shadow-lg shadow-destructive/30"
|
||||
title="Stop"
|
||||
>
|
||||
<SquareFill className="w-5 h-5" />
|
||||
</button>
|
||||
)}
|
||||
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
value={prompt}
|
||||
@@ -1396,8 +1381,6 @@ return (
|
||||
open={isModelPickerOpen}
|
||||
onOpenChange={setIsModelPickerOpen}
|
||||
/>
|
||||
{directory && <PermissionModeToggle sessionID={sessionID} directory={directory} />}
|
||||
{goalModeButton}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -1407,8 +1390,19 @@ return (
|
||||
onAgentChange={handleAgentChange}
|
||||
isBashMode={isBashMode}
|
||||
/>
|
||||
{directory && <PermissionModeToggle sessionID={sessionID} directory={directory} />}
|
||||
{goalModeButton}
|
||||
{directory && !isMobile && (
|
||||
<>
|
||||
<PermissionModeToggle sessionID={sessionID} directory={directory} />
|
||||
<IconToggleButton
|
||||
active={isGoalArmed}
|
||||
label={goalButtonLabel}
|
||||
disabled={isGoalModeDisabled}
|
||||
onClick={toggleGoalArmed}
|
||||
>
|
||||
<Target className="w-5 h-5" />
|
||||
</IconToggleButton>
|
||||
</>
|
||||
)}
|
||||
{isSessionActive && (
|
||||
<div className="px-2.5 py-1.5 md:px-3 md:py-2 rounded-lg text-xs md:text-sm font-medium text-muted-foreground max-w-[120px] md:max-w-[180px]">
|
||||
<SessionStatusIndicator sessionID={sessionID} showLabel />
|
||||
@@ -1421,11 +1415,11 @@ return (
|
||||
>
|
||||
{!isSessionActive && !hideSecondaryButtons && (
|
||||
<button
|
||||
className="px-2.5 py-0.5 md:px-3 min-h-[36px] min-w-0 rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer flex-1 md:flex-initial md:w-auto max-w-[110px] md:max-w-[220px] dark:border-border/30 flex flex-col items-start justify-center overflow-hidden"
|
||||
className="px-2.5 py-0.5 md:px-3 min-h-[36px] min-w-0 rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer flex-1 md:flex-initial md:w-auto md:max-w-[220px] dark:border-border/30 flex flex-col items-start justify-center overflow-hidden"
|
||||
>
|
||||
<span className="truncate w-full text-left">{displayModelName || 'Select model'}</span>
|
||||
{hasVariants && currentVariant && (
|
||||
<span className="text-[10px] text-highlight truncate w-full text-center capitalize">{currentVariant}</span>
|
||||
<span className="text-[10px] text-highlight truncate w-full text-left capitalize">{currentVariant}</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
@@ -1461,12 +1455,23 @@ return (
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
onClick={openFilePicker}
|
||||
className="hidden md:block p-2 rounded-lg bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border border-border"
|
||||
title="Upload image or PDF"
|
||||
>
|
||||
<Upload className="w-5 h-5" />
|
||||
</button>
|
||||
{isMobile && directory && (
|
||||
<ComposerToolsMenu
|
||||
sessionID={sessionID}
|
||||
directory={directory}
|
||||
goalArmed={isGoalArmed}
|
||||
goalDisabled={isGoalModeDisabled}
|
||||
goalLabel={goalButtonLabel}
|
||||
onToggleGoal={toggleGoalArmed}
|
||||
onAttachFile={openFilePicker}
|
||||
/>
|
||||
)}
|
||||
{sttEnabled && sttSupported && (
|
||||
renderVoiceButton('desktop')
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user