Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 49x 5964x 5964x 1x 5912x | import { defineCommand } from "just-search-it";
import { Flag } from "lucide-react";
import { FeatureFlag, useFeatureFlag } from "../lib/featureFlags";
import { RegisterCommand } from "./CommandProvider";
const FeatureFlagCommand = defineCommand<[flag: FeatureFlag], void>(
"toggleFeatureFlag",
);
function FeatureFlagToggle({ flag }: { flag: FeatureFlag }) {
const [enabled, setEnabled] = useFeatureFlag(flag);
return (
<RegisterCommand
key={flag}
command={FeatureFlagCommand}
args={[flag]}
name={`${enabled ? "Disable" : "Enable"} ${flag} feature`}
description={`${enabled ? "Disable" : "Enable"} the beta ${flag} feature. Note this is unstable and your flowsheet may break in the future.`}
group="Feature Flags"
icon={<Flag className="icon-ls" />}
action={() => setEnabled(!enabled)}
/>
);
}
export function FeatureFlagCommands() {
return (
<>
<FeatureFlagToggle
key={FeatureFlag.CUSTOM_PROPERTY_PACKAGES}
flag={FeatureFlag.CUSTOM_PROPERTY_PACKAGES}
/>
</>
);
}
|