Verified Commit 9563c3e6 authored by Adam Parák's avatar Adam Parák 💬
Browse files

Merge remote-tracking branch 'origin' into unholy-matrinomy

parents 25436853 2ec50401
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -11,6 +11,9 @@ packageExtensions:
      '@babel/core': 7.26.0
      graphql: 16.10.0
      graphql-tag: 2.12.6
  '@react-pdf/pdfkit@*':
    dependencies:
      'pako': '*'

supportedArchitectures:
  cpu:
+28 −18
Original line number Diff line number Diff line
@@ -38,18 +38,17 @@ const getIcon = (logType: ActionLogFragment['type']) => {
    case 'INJECT':
    case 'CUSTOM_INJECT':
    case 'TOOL':
    case 'FORM_SUBMISSION':
    case 'FORM':
      return (
        <Icon icon='full-circle' color={actionTypeColor(logType.toString())} />
      )
    case 'EMAIL':
      return <Icon icon='envelope' />
    default:
      throw new Error(`unknown actionLog type: ${logType}`)
  }
}

const getContent = (actionLog: ActionLogFragment) => {
const getContent = (actionLog: ActionLogFragment): string => {
  switch (actionLog.details.__typename) {
    case 'InjectDetailsType':
      return textFromRenderedContent(actionLog.details.content.rendered)
@@ -67,8 +66,10 @@ const getContent = (actionLog: ActionLogFragment) => {
        .join(', ')
      return `${senderAddress}${recipients}: ${textFromRenderedContent(actionLog.details.content.rendered)}`
    }
    default:
      throw new Error(`unknown actionLog type`)
    case 'QuestionnaireSubmissionType': {
      const { teamQuestionnaireState } = actionLog.details
      return `${teamQuestionnaireState.questionnaire.displayName} submitted by ${teamQuestionnaireState.team.name}`
    }
  }
}

@@ -78,6 +79,7 @@ type ActionLogItem = {
  text: string
  timestamp: string | null
  handleClick: () => void
  teamId: string
}

interface ActionLogProps {
@@ -98,11 +100,10 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
        case 'CUSTOM_INJECT':
        case 'TOOL':
        case 'FORM':
        case 'FORM_SUBMISSION':
          return selectedDispatch({ type: 'selectActions', actionLog })
        case 'EMAIL':
          return selectedDispatch({ type: 'selectEmails', actionLog })
        default:
          throw new Error(`unknown actionLog type: ${actionLog.type}`)
      }
    },
    [selectedDispatch]
@@ -124,6 +125,7 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
      text: getContent(actionLog),
      timestamp: actionLog.timestamp,
      handleClick: getHandleClick(actionLog),
      teamId: actionLog.team.id,
    }))

    milestoneStates
@@ -132,8 +134,9 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
          milestoneState.reached && milestoneState.timestampReached
      )
      .forEach(milestoneState =>
        milestoneState.teamIds.forEach(teamId =>
          items.push({
          id: `milestone:${milestoneState.id}`,
            id: `milestone:${milestoneState.id}-actionlog`,
            icon: <Icon icon='flag' />,
            text:
              `milestone "${milestoneState.milestone.displayName}" reached, ` +
@@ -141,8 +144,10 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
            timestamp: milestoneState.timestampReached,
            handleClick: () =>
              selectedDispatch({ type: 'selectMilestones', milestoneState }),
            teamId,
          })
        )
      )

    return items.sort(
      (a, b) =>
@@ -184,7 +189,12 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
                  textAlign: 'center',
                }}
              >
                <StyledTag content={formatTimestamp(item.timestamp)} />
                <StyledTag
                  content={formatTimestamp({
                    timestamp: item.timestamp,
                    teamId: item.teamId,
                  })}
                />
              </td>
              <td className={td}>{item.text}</td>
            </tr>
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ export const ExerciseSelector: FC<ExerciseSelectorProps> = ({
        title='Select an exercise'
      >
        <DialogBody className={dialogBody}>
          {/* TODO: add loading to the Select button when switching exercises */}
          <ExerciseList
            className={className}
            isSelected={isSelected}
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ export const MilestoneTable = () => {
    milestones.map((_milestone, i) => i < 5)
  )

  const [isTimeRelative, setIsTimeRelative] = useState(false)
  const [isTimeRelative, setIsTimeRelative] = useState(true)

  const milestoneFirstReachedTime: { [milestoneId: string]: number } = {}

@@ -76,7 +76,7 @@ export const MilestoneTable = () => {

        const value = state && state.reached ? state.timestampReached : null
        if (value === null) return 'not reached'
        return formatTimestamp(value)
        return formatTimestamp({ timestamp: value, teamId: team.id })
      },
      sortingFunction: (a: Team, b: Team) => {
        const stateA = milestoneStates
+6 −1
Original line number Diff line number Diff line
@@ -20,12 +20,14 @@ interface MilestoneCardProps {
  isSelected?: boolean
  milestoneState: MilestoneState
  selectedDispatch: Dispatch<selectedReducerActionProps>
  teamId: string
}

const MilestoneCard: FC<MilestoneCardProps> = ({
  isSelected,
  milestoneState,
  selectedDispatch,
  teamId,
}) => {
  const formatTimestamp = useFormatTimestamp()

@@ -55,7 +57,10 @@ const MilestoneCard: FC<MilestoneCardProps> = ({
        content={
          milestoneState.reached
            ? milestoneState.timestampReached
              ? formatTimestamp(milestoneState.timestampReached)
              ? formatTimestamp({
                  timestamp: milestoneState.timestampReached,
                  teamId,
                })
              : 'Initial'
            : 'Not reached'
        }
Loading