Commit 52049c7e authored by Marek Veselý's avatar Marek Veselý
Browse files

Backend - v3.23.0: on-demand initiation, team states

parent 0c9007e0
Loading
Loading
Loading
Loading
+21 −11
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ type ActionLogItem = {
  text: string
  timestamp: string | null
  handleClick: () => void
  teamId: string
}

interface ActionLogProps {
@@ -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,6 +134,7 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => {
          milestoneState.reached && milestoneState.timestampReached
      )
      .forEach(milestoneState =>
        milestoneState.teamIds.forEach(teamId =>
          items.push({
            id: `milestone:${milestoneState.id}`,
            icon: <Icon icon='flag' />,
@@ -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}
+1 −1
Original line number Diff line number Diff line
@@ -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'
        }
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ const MilestoneCards: FC<MilestoneCardsProps> = ({
            .map(milestoneState => (
              <MilestoneCard
                key={milestoneState.milestone.id}
                teamId={teamId}
                milestoneState={milestoneState}
                isSelected={selectedState?.id === milestoneState.id}
                selectedDispatch={selectedDispatch}
Loading