import { useState } from 'react'; import { SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; import { Checkbox, ClipboardButton, Field, FieldSet, Input, Modal, RadioButtonGroup } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; import { buildBaseUrl } from 'app/features/dashboard/components/ShareModal/utils'; import { PlaylistMode } from './types'; interface Props { playlistUid: string; onDismiss: () => void; } export const ShareModal = ({ playlistUid, onDismiss }: Props) => { const [mode, setMode] = useState(false); const [autoFit, setAutofit] = useState(false); const modes: Array> = [ { label: t('share-playlist.mode-normal', 'Normal'), value: false }, { label: t('share-playlist.mode-kiosk', 'Kiosk'), value: true }, ]; 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={() => { reportInteraction('grafana_kiosk_mode', { action: 'share_playlist', mode: mode, }); }} > Copy } />
); };