This commit is contained in:
seb
2026-10-07 19:57:02 +02:00
parent 79e67f2be6
commit 7bc7c827fb
3 changed files with 23 additions and 67 deletions

View File

@@ -882,6 +882,7 @@ export default class ChatDrawer extends PureComponent {
spellCheck: false, spellCheck: false,
autoCorrect: 'off', autoCorrect: 'off',
autoCapitalize: 'off', autoCapitalize: 'off',
autoComplete: 'off',
'aria-label': 'Modellslug', 'aria-label': 'Modellslug',
}} }}
sx={{ sx={{
@@ -968,6 +969,11 @@ export default class ChatDrawer extends PureComponent {
onChange={this.handleSelectConversation} onChange={this.handleSelectConversation}
disabled={loadingConversations || conversations.length === 0} disabled={loadingConversations || conversations.length === 0}
sx={{ borderRadius: 2 }} sx={{ borderRadius: 2 }}
MenuProps={{
sx: {
zIndex: (theme) => theme.zIndex.modal + 20,
},
}}
renderValue={(selectedId) => { renderValue={(selectedId) => {
const conv = conversations.find((c) => c.id === selectedId); const conv = conversations.find((c) => c.id === selectedId);
if (!conv) return ''; if (!conv) return '';

View File

@@ -564,6 +564,12 @@ export default class VfsFileExplorer extends PureComponent {
placeholder="VFS durchsuchen…" placeholder="VFS durchsuchen…"
value={searchQuery || ''} value={searchQuery || ''}
onChange={(e) => onSearchChange(e.target.value)} onChange={(e) => onSearchChange(e.target.value)}
inputProps={{
autoComplete: 'off',
autoCorrect: 'off',
autoCapitalize: 'off',
spellCheck: false,
}}
sx={{ fontSize: '0.82rem' }} sx={{ fontSize: '0.82rem' }}
/> />
{loading && <CircularProgress size={14} thickness={4} sx={{ mr: 0.5 }} />} {loading && <CircularProgress size={14} thickness={4} sx={{ mr: 0.5 }} />}
@@ -605,6 +611,7 @@ export default class VfsFileExplorer extends PureComponent {
anchorEl={menuAnchor} anchorEl={menuAnchor}
open={Boolean(menuAnchor)} open={Boolean(menuAnchor)}
onClose={this.handleCloseMenu} onClose={this.handleCloseMenu}
sx={{ zIndex: (theme) => theme.zIndex.modal + 20 }}
PaperProps={{ sx: { borderRadius: 2, minWidth: 180 } }} PaperProps={{ sx: { borderRadius: 2, minWidth: 180 } }}
> >
{isText && ( {isText && (

View File

@@ -4,21 +4,9 @@ import DialogTitle from '@mui/material/DialogTitle';
import DialogContent from '@mui/material/DialogContent'; import DialogContent from '@mui/material/DialogContent';
import DialogActions from '@mui/material/DialogActions'; import DialogActions from '@mui/material/DialogActions';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import Box from '@mui/material/Box';
import Chip from '@mui/material/Chip';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import NoteAddRoundedIcon from '@mui/icons-material/NoteAddRounded'; import NoteAddRoundedIcon from '@mui/icons-material/NoteAddRounded';
import SingleLineTextEdit from 'dashgui/SingleLineTextEdit';
const COMMON_EXTENSIONS = [
{ ext: '.txt', label: 'Text (.txt)' },
{ ext: '.md', label: 'Markdown (.md)' },
{ ext: '.csv', label: 'CSV (.csv)' },
{ ext: '.json', label: 'JSON (.json)' },
{ ext: '.js', label: 'JavaScript (.js)' },
{ ext: '.html', label: 'HTML (.html)' },
{ ext: '.SKILL', label: 'Agent Skill (.SKILL)' },
];
export default class VfsNewFileDialog extends PureComponent { export default class VfsNewFileDialog extends PureComponent {
constructor(props) { constructor(props) {
@@ -27,33 +15,14 @@ export default class VfsNewFileDialog extends PureComponent {
filename: '', filename: '',
error: '', error: '',
}; };
this.inputRef = React.createRef();
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (!prevProps.open && this.props.open) { if (!prevProps.open && this.props.open) {
this.setState({ filename: '', error: '' }, () => { this.setState({ filename: '', error: '' });
setTimeout(() => this.inputRef.current?.focus(), 80);
});
} }
} }
handleExtensionClick = (ext) => {
let name = this.state.filename.trim();
if (!name) {
name = `neue_datei${ext}`;
} else {
// If it already has an extension, replace it
const lastDot = name.lastIndexOf('.');
if (lastDot > 0) {
name = name.slice(0, lastDot) + ext;
} else {
name = name + ext;
}
}
this.setState({ filename: name, error: '' });
};
handleSubmit = (e) => { handleSubmit = (e) => {
e?.preventDefault(); e?.preventDefault();
const clean = this.state.filename.trim().replace(/^[/\\]+/, ''); const clean = this.state.filename.trim().replace(/^[/\\]+/, '');
@@ -78,6 +47,7 @@ export default class VfsNewFileDialog extends PureComponent {
onClose={onClose} onClose={onClose}
maxWidth="xs" maxWidth="xs"
fullWidth fullWidth
sx={{ zIndex: (theme) => theme.zIndex.modal + 20 }}
PaperProps={{ PaperProps={{
sx: { borderRadius: 3, p: 1 }, sx: { borderRadius: 3, p: 1 },
}} }}
@@ -85,50 +55,23 @@ export default class VfsNewFileDialog extends PureComponent {
<DialogTitle sx={{ display: 'flex', alignItems: 'center', gap: 1.2, pb: 1 }}> <DialogTitle sx={{ display: 'flex', alignItems: 'center', gap: 1.2, pb: 1 }}>
<NoteAddRoundedIcon color="primary" /> <NoteAddRoundedIcon color="primary" />
<Typography variant="h6" fontWeight={700}> <Typography variant="h6" fontWeight={700}>
Neue VFS-Datei erstellen Neue Datei erstellen
</Typography> </Typography>
</DialogTitle> </DialogTitle>
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit} noValidate autoComplete="off">
<DialogContent sx={{ pt: 1 }}> <DialogContent sx={{ pt: 1 }}>
<Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}> <SingleLineTextEdit
Dateien werden im virtuellen Dateisystem des aktuellen Mandanten gespeichert. autoFocus
Verwende ggf. Unterordner wie <code>scripts/test.js</code>.
</Typography>
<TextField
inputRef={this.inputRef}
fullWidth fullWidth
size="small" size="small"
label="Dateiname oder Pfad" label=""
placeholder="z.B. rechnung.csv oder docs/info.md"
value={filename} value={filename}
onChange={(e) => this.setState({ filename: e.target.value, error: '' })} onChange={(nextVal) => this.setState({ filename: nextVal, error: '' })}
error={Boolean(error)} error={Boolean(error)}
helperText={error} helperText={error}
autoFocus disabled={isCreating}
spellCheck={false}
autoCapitalize="off"
/> />
<Box sx={{ mt: 2 }}>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block', mb: 1, fontWeight: 600 }}>
Häufige Dateitypen:
</Typography>
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.75 }}>
{COMMON_EXTENSIONS.map((item) => (
<Chip
key={item.ext}
label={item.ext}
size="small"
variant="outlined"
clickable
onClick={() => this.handleExtensionClick(item.ext)}
sx={{ fontSize: '0.75rem', fontFamily: 'monospace', borderRadius: 1.5 }}
/>
))}
</Box>
</Box>
</DialogContent> </DialogContent>
<DialogActions sx={{ px: 3, pb: 2, pt: 1 }}> <DialogActions sx={{ px: 3, pb: 2, pt: 1 }}>