import * as React from '@theia/core/shared/react'; import { inject, injectable } from '@theia/core/shared/inversify'; import { Widget } from '@theia/core/shared/@phosphor/widgets'; import { Message } from '@theia/core/shared/@phosphor/messaging'; import { clipboard } from 'electron'; import { ReactWidget, DialogProps } from '@theia/core/lib/browser'; import { AbstractDialog } from '../theia/dialogs/dialogs'; import { CreateApi } from '../create/create-api'; import { nls } from '@theia/core/lib/common'; const RadioButton = (props: { id: string; changed: (evt: React.BaseSyntheticEvent) => void; value: string; isSelected: boolean; isDisabled: boolean; label: string; }) => { return (

); }; export const ShareSketchComponent = ({ treeNode, createApi, domain = 'https://create.arduino.cc', }: { treeNode: any; createApi: CreateApi; domain?: string; }): React.ReactElement => { const [loading, setloading] = React.useState(false); const radioChangeHandler = async (event: React.BaseSyntheticEvent) => { setloading(true); const sketch = await createApi.editSketch({ id: treeNode.sketchId, params: { is_public: event.target.value === 'private' ? false : true, }, }); // setPublicVisibility(sketch.is_public); treeNode.isPublic = sketch.is_public; setloading(false); }; const sketchLink = `${domain}/editor/_/${treeNode.sketchId}/preview`; const embedLink = ``; return (

{nls.localize( 'arduino/cloud/chooseSketchVisibility', 'Choose visibility of your Sketch:' )}

{treeNode.isPublic && (

{nls.localize('arduino/cloud/link', 'Link:')}

{nls.localize('arduino/cloud/embed', 'Embed:')}