mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-14 16:39:54 +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]);
|
}, [initialData]);
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (!name.trim() || !content.trim()) {
|
if (!name.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSave}
|
onClick={handleSave}
|
||||||
disabled={!name.trim() || !content.trim() || saving}
|
disabled={!name.trim() || saving}
|
||||||
>
|
>
|
||||||
{saving ? t("common.saving") : t("common.save")}
|
{saving ? t("common.saving") : t("common.save")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
|||||||
}, [initialData]);
|
}, [initialData]);
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (!name.trim() || !content.trim()) {
|
if (!name.trim()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSave}
|
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"
|
className="bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{saving ? t("common.saving") : t("common.save")}
|
{saving ? t("common.saving") : t("common.save")}
|
||||||
|
|||||||
Reference in New Issue
Block a user