Commit bdf1d7c8 authored by Marek Veselý's avatar Marek Veselý
Browse files

Merge branch '920-ui-bug-in-trainees-view-exercise-not-running-alert-overflow' into 'main'

920-fix: remove second scrollbar after alerts

Closes #920

See merge request inject/frontend!821
parents 537ea5f9 6ff9c040
Loading
Loading
Loading
Loading
+13 −33
Original line number Diff line number Diff line
import { Button, Callout, Classes, Collapse, Colors } from '@blueprintjs/core'
import { css } from '@emotion/css'
import { Intent, OverlayToaster, Toast2 } from '@blueprintjs/core'
import { useExerciseStatus } from '@inject/graphql'
import { useTranslationFrontend } from '@inject/locale'
import type { FC } from 'react'
@@ -9,14 +8,6 @@ import { useEffect, useState } from 'react'

// TODO: remove? trainee sees the exercise status in the sidebar already

const bg = css`
  background-color: ${Colors.LIGHT_GRAY5};

  .${Classes.DARK} & {
    background-color: ${Colors.DARK_GRAY4};
  }
`

interface StopAnnounceProps {
  teamId: string
  exerciseId: string
@@ -37,30 +28,19 @@ const StopAnnounce: FC<StopAnnounceProps> = ({ teamId, exerciseId }) => {
  }, [status])

  return (
    <Collapse isOpen={open}>
      <div className={bg}>
        <Callout
          intent='warning'
    <>
      {open && (
        <OverlayToaster>
          <Toast2
            icon='warning-sign'
          className={css`
            display: flex;
          `}
        >
          <span>{t('exerciseNotRunning')}</span>
          <Button
            icon='cross'
            style={{
              minHeight: '1rem',
              minWidth: '1rem',
              padding: 0,
              marginLeft: 'auto',
            }}
            minimal
            onClick={() => setOpen(false)}
            message={t('exerciseNotRunning')}
            intent={Intent.WARNING}
            onDismiss={() => setOpen(false)}
            timeout={0}
          />
        </Callout>
      </div>
    </Collapse>
        </OverlayToaster>
      )}
    </>
  )
}

+2 −6
Original line number Diff line number Diff line
@@ -20,9 +20,8 @@ import { ExerciseStatus, ExitButton } from '../../components'
import TraineeEmailFormOverlay from '../../email/EmailFormOverlay/TraineeEmailFormOverlay'
import useMailToRef from '../../hooks/useMailToRef'
import { RootRoute } from '../../routes/__root'
import { TraineeEmailThreadPageRoute } from '../../routes/_protected/trainee/$exerciseId/$teamId/email/$tab/$threadId'

import { TraineeDriveRoute } from '../../routes/_protected/trainee/$exerciseId/$teamId/drive'
import { TraineeEmailThreadPageRoute } from '../../routes/_protected/trainee/$exerciseId/$teamId/email/$tab/$threadId'
import ChannelButton from '../ChannelButton'
import { OpenSearchAccessButton } from './OpenSearchAccessButton'
import { OverviewButton } from './OverviewButton'
@@ -165,10 +164,7 @@ export const TraineeView: FC<TraineeViewProps> = ({
        <div id='toolPanel' />

        <div className={contentClass} ref={contentRef}>
          {/* TODO: improve layout of StopAnnounce */}
          <div style={{ position: 'sticky', top: '0', zIndex: '10' }}>
          {teamId && <StopAnnounce teamId={teamId} exerciseId={exerciseId} />}
          </div>
          <Suspense fallback={<CenteredSpinner />}>{children}</Suspense>
        </div>