/* * Copyright 2020 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React from "react"; import { Button, Icons, Spinner } from "@drill4j/ui-kit"; import tw, { styled } from "twin.macro"; import { ActiveSession } from "types/active-session"; import { EVENT_LABELS, PLUGIN_EVENT_NAMES, sendPluginEvent } from "common/analytic"; import { useAdminConnection } from "hooks"; import { AnalyticsInfo } from "types"; import { setIsNewSession, useSessionsPaneDispatch, useSessionsPaneState } from "../store"; const Content = styled.div` ${tw`grid gap-4 items-center h-full`} grid-template-columns: max-content max-content max-content; `; interface Props { activeSessions: ActiveSession[]; startSessionDisabled: boolean; onToggle: (value: boolean) => void; handleSubmit: () => void; submitting: boolean; } export const ActionsPanel = ({ activeSessions, onToggle, startSessionDisabled, handleSubmit, submitting, }: Props) => { const dispatch = useSessionsPaneDispatch(); const { isNewSession } = useSessionsPaneState(); const { isAnalyticsDisabled } = useAdminConnection("/api/analytics/info") || {}; return ( { isNewSession ? ( ) : ( )} { activeSessions.length > 0 && isNewSession && ( )} ); };