Files
claude code agent 7dc98df2b6 feat(ce): remove BE chrome, routes, upsell banner and shared teaser props
Drop the Upgrade-to-Business banner, BE sidebar items (Licenses, Shared
Credentials, Edge Configurations, Waiting Room, Update & Rollback), BE
branding (BE logo/footer), and BE-only routed views (update-schedules,
EdgeAutoCreateScript, WaitingRoom, TimeWindowDisplay/Picker). Prune the
featureId/feature/BEFeatureID teaser props from shared components
(Switch, SwitchField, BoxSelector, TooltipWithChildren, wizard Option)
and fold isBE in useUser while preserving CE authorization semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 06:33:15 +03:00

72 lines
1.7 KiB
TypeScript

import clsx from 'clsx';
import uuid from 'uuid';
import { ComponentProps, PropsWithChildren, ReactNode, useState } from 'react';
import { AutomationTestingProps } from '@/types';
import { Tooltip } from '@@/Tip/Tooltip';
import styles from './SwitchField.module.css';
import { Switch } from './Switch';
export interface Props extends AutomationTestingProps {
label: string;
checked: boolean;
onChange(value: boolean, index?: number): void;
index?: number;
name?: string;
tooltip?: ComponentProps<typeof Tooltip>['message'];
setTooltipHtmlMessage?: ComponentProps<typeof Tooltip>['setHtmlMessage'];
labelClass?: string;
switchClass?: string;
fieldClass?: string;
disabled?: boolean;
valueExplanation?: ReactNode;
}
export function SwitchField({
tooltip,
checked,
label,
index,
name,
labelClass,
fieldClass,
'data-cy': dataCy,
disabled,
onChange,
switchClass,
setTooltipHtmlMessage,
valueExplanation,
}: PropsWithChildren<Props>) {
const [toggleId] = useState(() => `toggle_${uuid()}`);
const toggleName = name ? `toggle_${name}` : '';
return (
<div className={clsx(styles.root, fieldClass)}>
<label
className={clsx('space-right control-label !p-0 text-left', labelClass)}
htmlFor={toggleId}
>
{label}
{tooltip && (
<Tooltip message={tooltip} setHtmlMessage={setTooltipHtmlMessage} />
)}
</label>
<Switch
className={clsx('space-right', switchClass)}
name={toggleName}
id={toggleId}
checked={checked}
disabled={disabled}
onChange={onChange}
index={index}
data-cy={dataCy}
/>
{valueExplanation && <span>{valueExplanation}</span>}
</div>
);
}