🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import type { SwitchProps } from '@lobehub/ui';
import { Switch } from '@lobehub/ui';
import { memo, useState } from 'react';
interface InstantSwitchProps {
disabled?: boolean;
enabled: boolean;
onChange: (enabled: boolean) => Promise<void>;
size?: SwitchProps['size'];
}
const InstantSwitch = memo<InstantSwitchProps>(({ disabled, enabled, onChange, size }) => {
const [value, setValue] = useState(enabled);
const [loading, setLoading] = useState(false);
return (
<Switch
disabled={disabled}
loading={loading}
size={size}
value={value}
onChange={async (enabled) => {
setLoading(true);
setValue(enabled);
await onChange(enabled);
setLoading(false);
}}
/>
);
});
export default InstantSwitch;