import React, { useState } from 'react'; import { AppEvents, SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data'; import { Checkbox, ClipboardButton, Field, FieldSet, Icon, Input, Modal, RadioButtonGroup } from '@grafana/ui'; import appEvents from 'app/core/app_events'; import { buildBaseUrl } from '../dashboard/components/ShareModal/utils'; import { PlaylistMode } from './types'; interface ShareModalProps { playlistUid: string; onDismiss: () => void; } export const ShareModal = ({ playlistUid, onDismiss }: ShareModalProps) => { const [mode, setMode] = useState(false); const [autoFit, setAutofit] = useState(false); const modes: Array> = [ { label: 'Normal', value: false }, { label: 'TV', value: 'tv' }, { label: 'Kiosk', value: true }, ]; const onShareUrlCopy = () => { appEvents.emit(AppEvents.alertSuccess, ['Content copied to clipboard']); }; const params: UrlQueryMap = {}; if (mode) { params.kiosk = mode; } if (autoFit) { params.autofitpanels = true; } const shareUrl = urlUtil.renderUrl(`${buildBaseUrl()}/play/${playlistUid}`, params); return (
setAutofit(e.currentTarget.checked)} /> shareUrl} onClipboardCopy={onShareUrlCopy}> Copy } />
); };