import React, {FC, useEffect} from "react"; import {colors} from "./Colors"; import {Color, CurrentColor, request} from "./Color"; import {Card} from "./Card"; import {CardItem} from "./CardItem"; import {__} from "../globals"; import {CardItemSecondaryValue} from "./CardItemSecondaryValue"; import {CardItemMainValue} from "./CardItemMainValue"; import {PopupWindowStateContext, TestablesPopupWindowStateAtom, TreeContextData} from "./atoms"; import {useSetAtom} from "jotai"; import {TestablesSaver} from "./TestablesSaver"; import {useOpenTestablesPopupWindow} from "./useOpenTestablesPopupWindow"; import {getSuggestedScopeForTestable} from "./getSuggestedScopeForTestable"; export type PlaceholderContextProps = { testableCompositeId: string } export const PlaceholderContext: FC = ({testableCompositeId}) => { const color = colors.purple//colors.gray const openTestablePopupWindow = useOpenTestablesPopupWindow(); return
{ const suggestedScope = await getSuggestedScopeForTestable(testableCompositeId); const context = { id: 'context-placeholder', scope: 'tree-node', data: { componentType: 'filter', targetType: 'testableComposite', targetId: testableCompositeId, extraData: { suggestedScope, } } } as PopupWindowStateContext openTestablePopupWindow({ // @ts-ignore context, onClose: (data) => { if (data.status !== 'success' || !data.components) { return } // @ts-ignore const saver = new TestablesSaver(context) // @ts-ignore saver.add(data.components) } }) }}> color.border(20)}}} color={{ color, tint: (color, type, context, path) => { if (path === 'border.light.primary') { return (color as Color).border(90) } } }} > { if (context === 'icon-background') { return (color as Color).background(10) } else if (context === 'icon-color') { return (color as Color).text(90) } else if (context === 'card-background') { return (color as Color).background(80) } } }} position={'single'} cardRenderer={{ icon: ({className}) => , ComputedValue: () => color.text(10) }} > {__('Add another set')} , BelowComputedValue: () =>
{__('Different products, brands, more...')}
}} />
}