mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Add mobileFullscreen to settings dialogs and fix button layout (#163)
* Add mobileFullscreen to settings dialogs and fix button layout * Improve responsive layout in settings UI components * Fix null safety in SessionDetail
This commit is contained in:
1 parent
2e634b5362
commit
cbd0ee2958
8 files changed
+26
-23
No files matched your search
@@ -179,7 +179,7 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleClose}>
|
||||
<DialogContent className="max-w-3xl max-h-[90vh] sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogContent mobileFullscreen className="sm:max-w-3xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0">
|
||||
<DialogTitle>Add MCP Server</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -366,12 +366,13 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe
|
||||
</div>
|
||||
|
||||
<DialogFooter className="p-3 sm:p-4 border-t gap-2">
|
||||
<Button variant="outline" onClick={handleClose}>
|
||||
<Button variant="outline" onClick={handleClose} className="flex-1 sm:flex-none">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleAdd}
|
||||
disabled={!serverId || isPending}
|
||||
className="flex-1 sm:flex-none"
|
||||
>
|
||||
{isPending && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
|
||||
Add MCP Server
|
||||
|
||||
@@ -176,7 +176,7 @@ export function AgentDialog({ open, onOpenChange, onSubmit, editingAgent }: Agen
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="max-w-2xl max-h-[90vh] sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0">
|
||||
<DialogTitle>{editingAgent ? 'Edit Agent' : 'Create Agent'}</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -522,12 +522,13 @@ export function AgentDialog({ open, onOpenChange, onSubmit, editingAgent }: Agen
|
||||
</div>
|
||||
|
||||
<DialogFooter className="p-3 sm:p-4 border-t gap-2">
|
||||
<Button variant="outline" onClick={() => handleOpenChange(false)}>
|
||||
<Button variant="outline" onClick={() => handleOpenChange(false)} className="flex-1 sm:flex-none">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => form.handleSubmit(handleSubmit)()}
|
||||
disabled={!form.formState.isValid}
|
||||
className="flex-1 sm:flex-none"
|
||||
>
|
||||
{editingAgent ? 'Update' : 'Create'}
|
||||
</Button>
|
||||
|
||||
@@ -84,13 +84,13 @@ export function AgentsMdEditor() {
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||
<div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Global instructions for AI agents. This file is merged with repository-specific AGENTS.md files.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<div className="flex gap-2 flex-shrink-0">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -122,7 +122,7 @@ export function AgentsMdEditor() {
|
||||
<Textarea
|
||||
value={content}
|
||||
onChange={(e) => handleContentChange(e.target.value)}
|
||||
className="font-mono md:text-sm min-h-[300px] resize-y"
|
||||
className="font-mono text-xs sm:text-sm min-h-[300px] resize-y"
|
||||
placeholder="# Agent Instructions Add global instructions for AI agents here..."
|
||||
/>
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ export function CommandDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="max-w-3xl max-h-[90vh] sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogContent mobileFullscreen className="sm:max-w-3xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
|
||||
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0">
|
||||
<DialogTitle>
|
||||
{editingCommand ? "Edit Command" : "Create Command"}
|
||||
@@ -251,10 +251,10 @@ export function CommandDialog({
|
||||
</div>
|
||||
|
||||
<DialogFooter className="p-3 sm:p-4 border-t gap-2">
|
||||
<Button variant="outline" onClick={() => handleOpenChange(false)}>
|
||||
<Button variant="outline" onClick={() => handleOpenChange(false)} className="flex-1 sm:flex-none">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={() => form.handleSubmit(handleSubmit)()} disabled={!form.formState.isValid}>
|
||||
<Button onClick={() => form.handleSubmit(handleSubmit)()} disabled={!form.formState.isValid} className="flex-1 sm:flex-none">
|
||||
{editingCommand ? "Update" : "Create"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -104,7 +104,7 @@ export function CreateConfigDialog({ isOpen, onOpenChange, onCreate, isUpdating
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-2xl max-h-[90vh] sm:max-h-[85vh] flex flex-col">
|
||||
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] flex flex-col">
|
||||
<DialogHeader className="flex-shrink-0">
|
||||
<DialogTitle>Create OpenCode Config</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -160,14 +160,15 @@ export function CreateConfigDialog({ isOpen, onOpenChange, onCreate, isUpdating
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2 flex-shrink-0 pt-4 border-t">
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
<div className="flex flex-row sm:flex-row justify-end gap-2 flex-shrink-0 pt-4 border-t">
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)} className="flex-1 sm:flex-none">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={(e) => handleSubmit(e)}
|
||||
disabled={isUpdating || !name.trim() || !content.trim()}
|
||||
className="flex-1 sm:flex-none"
|
||||
>
|
||||
{isUpdating && <Loader2 className="h-4 w-4 mr-2 animate-spin" />}
|
||||
Create
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Loader2, Plus, Trash2, Edit, StarOff, Download, RotateCcw, FileText, ArrowUpCircle, History } from 'lucide-react'
|
||||
import { Loader2, Plus, Trash2, Edit, StarOff, Download, RotateCcw, FileText, ArrowUpCircle, History, ChevronDown } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Label } from '@/components/ui/label'
|
||||
@@ -477,7 +477,7 @@ export function OpenCodeConfigManager() {
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<CardTitle className="text-base">{config.name}</CardTitle>
|
||||
<CardTitle className="text-sm sm:text-base">{config.name}</CardTitle>
|
||||
{config.isDefault && (
|
||||
<Badge variant="default" className="text-green-500 bg-green-500/10">
|
||||
Current
|
||||
@@ -572,7 +572,7 @@ export function OpenCodeConfigManager() {
|
||||
<FileText className="h-4 w-4 text-blue-500" />
|
||||
<h4 className="text-sm font-medium truncate">Global Agent Instructions (AGENTS.md)</h4>
|
||||
</div>
|
||||
<Edit className={`h-4 w-4 transition-transform ${expandedSections.agentsMd ? 'rotate-90' : ''}`} />
|
||||
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.agentsMd ? 'rotate-90' : ''}`} />
|
||||
</button>
|
||||
<div className={`${expandedSections.agentsMd ? 'block' : 'hidden'} border-t border-border`}>
|
||||
<div className="p-4">
|
||||
@@ -581,7 +581,7 @@ export function OpenCodeConfigManager() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 className="text-lg font-semibold mb-4">Configure Commands, Agents & MCP Servers</h3>
|
||||
<h3 className="text-base sm:text-lg font-semibold mb-4">Configure Commands, Agents & MCP Servers</h3>
|
||||
<p className="text-sm text-muted-foreground mb-6">
|
||||
Add custom commands, agents, and MCP servers to your OpenCode configurations. Select a configuration below to edit its settings.
|
||||
</p>
|
||||
@@ -589,7 +589,7 @@ export function OpenCodeConfigManager() {
|
||||
{configs.length > 0 && (
|
||||
<div className="space-y-6">
|
||||
<div className='px-1'>
|
||||
<Label className="text-base font-medium">Select Configuration to Edit</Label>
|
||||
<Label className="text-sm sm:text-base font-medium">Select Configuration to Edit</Label>
|
||||
<Select
|
||||
onValueChange={(value) => {
|
||||
const config = configs.find(c => c.name === value)
|
||||
@@ -632,7 +632,7 @@ export function OpenCodeConfigManager() {
|
||||
{Object.keys((selectedConfig.content?.command as Record<string, Command> | undefined) ?? {}).length} configured
|
||||
</span>
|
||||
</div>
|
||||
<Edit className={`h-4 w-4 transition-transform ${expandedSections.commands ? 'rotate-90' : ''}`} />
|
||||
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.commands ? 'rotate-90' : ''}`} />
|
||||
</button>
|
||||
<div className={`${expandedSections.commands ? 'block' : 'hidden'} border-t border-border`}>
|
||||
<div className="p-1 sm:p-4 max-h-[50vh] overflow-y-auto">
|
||||
@@ -669,7 +669,7 @@ export function OpenCodeConfigManager() {
|
||||
{Object.keys((selectedConfig.content?.agent as Record<string, Agent> | undefined) ?? {}).length} configured
|
||||
</span>
|
||||
</div>
|
||||
<Edit className={`h-4 w-4 transition-transform ${expandedSections.agents ? 'rotate-90' : ''}`} />
|
||||
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.agents ? 'rotate-90' : ''}`} />
|
||||
</button>
|
||||
<div className={`${expandedSections.agents ? 'block' : 'hidden'} border-t border-border`}>
|
||||
<div className="p-4 max-h-[50vh] overflow-y-auto">
|
||||
@@ -706,7 +706,7 @@ export function OpenCodeConfigManager() {
|
||||
{Object.keys((selectedConfig.content?.mcp as Record<string, unknown> | undefined) ?? {}).length} configured
|
||||
</span>
|
||||
</div>
|
||||
<Edit className={`h-4 w-4 transition-transform ${expandedSections.mcp ? 'rotate-90' : ''}`} />
|
||||
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.mcp ? 'rotate-90' : ''}`} />
|
||||
</button>
|
||||
<div className={`${expandedSections.mcp ? 'block' : 'hidden'} border-t border-border`}>
|
||||
<div className="p-4 max-h-[50vh] overflow-y-auto">
|
||||
|
||||
@@ -99,7 +99,7 @@ const DialogFooter = ({
|
||||
}: React.HTMLAttributes<HTMLDivElement>) => (
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
||||
"flex flex-row sm:flex-row sm:justify-end sm:space-x-2 gap-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -138,7 +138,7 @@ export function SessionDetail() {
|
||||
const sessionStatus = useSessionStatusForSession(sessionId);
|
||||
const isSessionActive = sessionStatus.type === 'busy' || sessionStatus.type === 'retry';
|
||||
const lastAssistantMessage = messages?.filter(m => m.info.role === 'assistant').at(-1);
|
||||
const lastAssistantText = lastAssistantMessage?.parts.filter(p => p.type === 'text').map(p => p.text).join('\n\n') || '';
|
||||
const lastAssistantText = (lastAssistantMessage?.parts ?? []).filter(p => p.type === 'text').map(p => p.text).join('\n\n') || '';
|
||||
const hasIncompleteMessages = lastAssistantMessage ? !('completed' in lastAssistantMessage.info.time && lastAssistantMessage.info.time.completed) : false;
|
||||
const hasActiveStream = hasIncompleteMessages && isSessionActive;
|
||||
|
||||
|
||||
Reference in new issue
Block a user