Show toast when enabling auto-approve on non-settings UI
This commit is contained in:
@@ -1,17 +1,25 @@
|
|||||||
import { useSettings } from "@/hooks/useSettings";
|
import { useSettings } from "@/hooks/useSettings";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
|
import { showInfo } from "@/lib/toast";
|
||||||
|
|
||||||
export function AutoApproveSwitch() {
|
export function AutoApproveSwitch({
|
||||||
|
showToast = true,
|
||||||
|
}: {
|
||||||
|
showToast?: boolean;
|
||||||
|
}) {
|
||||||
const { settings, updateSettings } = useSettings();
|
const { settings, updateSettings } = useSettings();
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Switch
|
<Switch
|
||||||
id="auto-approve"
|
id="auto-approve"
|
||||||
checked={settings?.autoApproveChanges}
|
checked={settings?.autoApproveChanges}
|
||||||
onCheckedChange={() =>
|
onCheckedChange={() => {
|
||||||
updateSettings({ autoApproveChanges: !settings?.autoApproveChanges })
|
updateSettings({ autoApproveChanges: !settings?.autoApproveChanges });
|
||||||
}
|
if (!settings?.autoApproveChanges && showToast) {
|
||||||
|
showInfo("You can disable auto-approve in the Settings.");
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Label htmlFor="auto-approve">Auto-approve</Label>
|
<Label htmlFor="auto-approve">Auto-approve</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -323,7 +323,9 @@ function ChatInputActions({
|
|||||||
}: ChatInputActionsProps) {
|
}: ChatInputActionsProps) {
|
||||||
const [autoApprove, setAutoApprove] = useState(false);
|
const [autoApprove, setAutoApprove] = useState(false);
|
||||||
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
||||||
|
if (proposal.type === "tip-proposal") {
|
||||||
|
return <div>Tip proposal</div>;
|
||||||
|
}
|
||||||
if (proposal.type === "action-proposal") {
|
if (proposal.type === "action-proposal") {
|
||||||
return <ActionProposalActions proposal={proposal}></ActionProposalActions>;
|
return <ActionProposalActions proposal={proposal}></ActionProposalActions>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default function SettingsPage() {
|
|||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<AutoApproveSwitch />
|
<AutoApproveSwitch showToast={false} />
|
||||||
<div className="text-sm text-gray-500 dark:text-gray-400">
|
<div className="text-sm text-gray-500 dark:text-gray-400">
|
||||||
This will automatically approve code changes and run them.
|
This will automatically approve code changes and run them.
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user