mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-03-22 15:08:22 +08:00
fix(prompts): allow saving prompts with empty content
Remove content validation requirement to allow users to save prompts with empty content for placeholder or draft purposes.
This commit is contained in:
@@ -68,7 +68,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
|
||||
}, [initialData]);
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!name.trim() || !content.trim()) {
|
||||
if (!name.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleSave}
|
||||
disabled={!name.trim() || !content.trim() || saving}
|
||||
disabled={!name.trim() || saving}
|
||||
>
|
||||
{saving ? t("common.saving") : t("common.save")}
|
||||
</Button>
|
||||
|
||||
@@ -60,7 +60,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
||||
}, [initialData]);
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!name.trim() || !content.trim()) {
|
||||
if (!name.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleSave}
|
||||
disabled={!name.trim() || !content.trim() || saving}
|
||||
disabled={!name.trim() || saving}
|
||||
className="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{saving ? t("common.saving") : t("common.save")}
|
||||
|
||||
Reference in New Issue
Block a user