This commit is contained in:
2025-08-06 15:39:05 +08:00
parent 351a79d54c
commit 6798be3b42
26 changed files with 1243 additions and 469 deletions

View File

@@ -51,6 +51,7 @@ import {
import { cn } from '@/lib/utils';
import { HooksManager } from '@/lib/hooksManager';
import { api } from '@/lib/api';
import { useTranslation } from '@/hooks/useTranslation';
import {
HooksConfiguration,
HookEvent,
@@ -116,6 +117,7 @@ export const HooksEditor: React.FC<HooksEditorProps> = ({
onChange,
hideActions = false
}) => {
const { t } = useTranslation();
const [selectedEvent, setSelectedEvent] = useState<HookEvent>('PreToolUse');
const [showTemplateDialog, setShowTemplateDialog] = useState(false);
const [validationErrors, setValidationErrors] = useState<string[]>([]);
@@ -754,7 +756,7 @@ export const HooksEditor: React.FC<HooksEditorProps> = ({
{/* Header */}
<div className="space-y-2">
<div className="flex items-center justify-between">
<h3 className="text-lg font-semibold">Hooks Configuration</h3>
<h3 className="text-lg font-semibold">{t('hooks.hooksConfiguration')}</h3>
<div className="flex items-center gap-2">
<Badge variant={scope === 'project' ? 'secondary' : scope === 'local' ? 'outline' : 'default'}>
{scope === 'project' ? 'Project' : scope === 'local' ? 'Local' : 'User'} Scope
@@ -789,12 +791,12 @@ export const HooksEditor: React.FC<HooksEditorProps> = ({
</div>
</div>
<p className="text-sm text-muted-foreground">
Configure shell commands to execute at various points in Claude Code's lifecycle.
{scope === 'local' && ' These settings are not committed to version control.'}
{t('hooks.configureShellCommands')}
{scope === 'local' && t('hooks.localSettingsNote')}
</p>
{hasUnsavedChanges && !readOnly && (
<p className="text-sm text-amber-600">
You have unsaved changes. Click Save to persist them.
{t('hooks.unsavedChanges')}
</p>
)}
</div>