mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix: remove unused disabled prop, throttle SW update checks, precache icon
This commit is contained in:
1 parent
a56d86e98a
commit
685ee219d8
6 files changed
+14
-17
No files matched your search
@@ -5,7 +5,12 @@ import type { Plugin } from "vite";
|
||||
|
||||
const SW_FILENAME = "sw.js";
|
||||
const PRECACHE_DIR_PREFIXES = ["assets/"];
|
||||
const PRECACHE_ROOT_FILES = ["index.html", "manifest.json", "favicon.svg"];
|
||||
const PRECACHE_ROOT_FILES = [
|
||||
"index.html",
|
||||
"manifest.json",
|
||||
"favicon.svg",
|
||||
"icons/icon-192x192.png",
|
||||
];
|
||||
|
||||
async function collectFiles(dir: string, base = dir): Promise<string[]> {
|
||||
const entries = await readdir(dir, { withFileTypes: true });
|
||||
|
||||
@@ -17,7 +17,6 @@ interface AgentQuickSelectProps {
|
||||
currentAgent: string
|
||||
onAgentChange: (agent: string) => void
|
||||
isBashMode?: boolean
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
interface AgentInfo {
|
||||
@@ -55,7 +54,6 @@ export function AgentQuickSelect({
|
||||
currentAgent,
|
||||
onAgentChange,
|
||||
isBashMode = false,
|
||||
disabled = false,
|
||||
}: AgentQuickSelectProps) {
|
||||
const { data: agents = [] } = useAgents(opcodeUrl, directory)
|
||||
|
||||
@@ -79,7 +77,6 @@ export function AgentQuickSelect({
|
||||
const buttonContent = (
|
||||
<button
|
||||
data-toggle-mode
|
||||
disabled={disabled}
|
||||
style={styleVars as React.CSSProperties}
|
||||
className="px-2 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border min-w-[56px] max-w-[80px] md:max-w-[100px] flex-shrink-0 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md text-[var(--agent-color-light)] dark:text-[var(--agent-color-dark)] bg-[var(--agent-bg-light)] dark:bg-[var(--agent-bg-dark)] border-[var(--agent-border-light)] dark:border-[var(--agent-border-dark)] hover:bg-[var(--agent-bg-hover-light)] dark:hover:bg-[var(--agent-bg-hover-dark)] hover:border-[var(--agent-border-hover-light)] dark:hover:border-[var(--agent-border-hover-dark)] shadow-[var(--agent-shadow-light)] dark:shadow-[var(--agent-shadow-dark)] hover:shadow-[var(--agent-shadow-hover-light)] dark:hover:shadow-[var(--agent-shadow-hover-dark)]"
|
||||
>
|
||||
@@ -89,7 +86,7 @@ export function AgentQuickSelect({
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild disabled={disabled}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
{buttonContent}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-64">
|
||||
|
||||
@@ -139,7 +139,6 @@ describe('PromptInput STT Gesture Tests', () => {
|
||||
directory: '/test',
|
||||
sessionID: 'test-session',
|
||||
repoId: 1,
|
||||
disabled: false,
|
||||
showScrollButton: false,
|
||||
isSessionActive: false,
|
||||
isStreamingResponse: false,
|
||||
|
||||
@@ -65,7 +65,6 @@ interface PromptInputProps {
|
||||
opcodeUrl: string
|
||||
directory?: string
|
||||
sessionID: string
|
||||
disabled?: boolean
|
||||
showScrollButton?: boolean
|
||||
isSessionActive?: boolean
|
||||
isStreamingResponse?: boolean
|
||||
@@ -81,7 +80,6 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
opcodeUrl,
|
||||
directory,
|
||||
sessionID,
|
||||
disabled,
|
||||
showScrollButton,
|
||||
isSessionActive = false,
|
||||
isStreamingResponse = false,
|
||||
@@ -275,7 +273,6 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
const addUserBashCommand = useUserBash((s) => s.addUserBashCommand)
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (disabled) return
|
||||
if (!prompt.trim() && imageAttachments.length === 0) return
|
||||
|
||||
pendingVoiceAutoSubmitRef.current = false
|
||||
@@ -572,7 +569,7 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
}
|
||||
|
||||
const handleVoicePointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {
|
||||
if ((event.pointerType === 'mouse' && event.button !== 0) || disabled || isProcessing || !isRecording) {
|
||||
if ((event.pointerType === 'mouse' && event.button !== 0) || isProcessing || !isRecording) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1196,7 +1193,7 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleVoiceClick}
|
||||
disabled={disabled || isProcessing}
|
||||
disabled={isProcessing}
|
||||
className={buttonClassName}
|
||||
title={voiceButtonTitle}
|
||||
>
|
||||
@@ -1245,7 +1242,6 @@ return (
|
||||
{showStopButton && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
disabled={disabled}
|
||||
className="border fixed bottom-19 right-0 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 shadow-lg shadow-red-500/30"
|
||||
title="Stop"
|
||||
>
|
||||
@@ -1267,7 +1263,6 @@ return (
|
||||
? "Enter bash command..."
|
||||
: "Send a message..."
|
||||
}
|
||||
disabled={disabled}
|
||||
className={`w-full bg-muted/50 pl-2 md:pl-3 pr-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-muted/70 resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg [field-sizing:content] ${
|
||||
isBashMode
|
||||
? 'border-purple-500/50 bg-purple-500/5 focus:bg-purple-500/10'
|
||||
@@ -1324,7 +1319,6 @@ return (
|
||||
currentAgent={currentMode}
|
||||
onAgentChange={handleAgentChange}
|
||||
isBashMode={isBashMode}
|
||||
disabled={disabled}
|
||||
/>
|
||||
{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]">
|
||||
@@ -1363,7 +1357,6 @@ return (
|
||||
{showStopButton && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
disabled={disabled}
|
||||
className="hidden md:block p-1.5 px-5 md:p-2 md:px-6 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 hover:border-red-400 shadow-md shadow-red-500/30 hover:shadow-red-500/40 ring-1 ring-red-500/20 hover:ring-red-500/30"
|
||||
title="Stop"
|
||||
>
|
||||
@@ -1394,7 +1387,7 @@ return (
|
||||
<button
|
||||
data-submit-prompt
|
||||
onClick={hasPendingPermissionForSession ? () => setShowDialog(true) : handleSubmit}
|
||||
disabled={hasPendingPermissionForSession ? false : ((!prompt.trim() && imageAttachments.length === 0) || disabled || (isPromptSubmitPending && !isStreamingResponse))}
|
||||
disabled={hasPendingPermissionForSession ? false : ((!prompt.trim() && imageAttachments.length === 0) || (isPromptSubmitPending && !isStreamingResponse))}
|
||||
className={`px-4 md:px-5 py-1.5 md:py-2 rounded-lg text-sm font-medium transition-colors dark:border flex-shrink-0 min-w-[52px] ${
|
||||
hasPendingPermissionForSession
|
||||
? 'bg-orange-500 hover:bg-orange-600 border-orange-400 text-primary-foreground ring-orange-500/20'
|
||||
|
||||
@@ -535,7 +535,6 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
|
||||
return [...old, { info: response.info, parts: response.parts }];
|
||||
},
|
||||
);
|
||||
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -60,7 +60,11 @@ export function registerServiceWorker(): void {
|
||||
});
|
||||
});
|
||||
|
||||
let lastUpdateCheck = 0;
|
||||
const checkForUpdate = () => {
|
||||
const now = Date.now();
|
||||
if (now - lastUpdateCheck < UPDATE_CHECK_INTERVAL_MS) return;
|
||||
lastUpdateCheck = now;
|
||||
registration.update().catch(() => {});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user