Loading analyst/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/analyst", "version": "3.1.0", "version": "3.34.0", "description": "Analyst module for Inject Exercise Platform", "main": "index.js", "license": "MIT", Loading analyst/src/components/ActionLog/index.tsx +32 −32 Original line number Diff line number Diff line Loading @@ -2,10 +2,7 @@ import { Icon, NonIdealState } from '@blueprintjs/core' import { css, cx } from '@emotion/css' import { useRelativeTime } from '@inject/shared' import type { ActionLog as ActionLogFragment, MilestoneState, } from '@inject/graphql' import type { IActionLog, MilestoneState } from '@inject/graphql' import { ellipsized, highlightedOnActive, Loading @@ -19,7 +16,7 @@ import { useCallback, useContext, useMemo } from 'react' import useActionLogs from '../dataHooks/useActionLogs' import useMilestoneStates from '../dataHooks/useMilestoneStates' import { ExerciseContext } from '../ExerciseContext' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useFormatTimestamp from '../useFormatTimestamp' import { actionTypeColor, compareDates, getTeamById } from '../utilities' Loading @@ -33,13 +30,15 @@ const td = css` cursor: pointer; ` const getIcon = (logType: ActionLogFragment['type']) => { const getIcon = (logType: IActionLog['logType']): JSX.Element => { switch (logType) { case 'INJECT': case 'CUSTOM_INJECT': case 'TOOL': case 'FORM_SUBMISSION': case 'FORM': case 'FORM_REVIEW': case 'CONFIRMATION': return ( <Icon icon='full-circle' color={actionTypeColor(logType.toString())} /> ) Loading @@ -48,17 +47,26 @@ const getIcon = (logType: ActionLogFragment['type']) => { } } const getContent = (actionLog: ActionLogFragment): string => { const getContent = (actionLog: IActionLog): string => { switch (actionLog.details.__typename) { case 'InjectDetailsType': case 'IInjectDetailsType': case 'ICustomInjectDetailsType': return textFromRenderedContent(actionLog.details.content.rendered) case 'CustomInjectDetailsType': return textFromRenderedContent(actionLog.details.content.rendered) case 'ToolDetailsType': case 'IToolDetailsType': return `${actionLog.details.tool.displayName}, ${actionLog.details.tool.requiresInput ? `${actionLog.details.argument} → ` : ''}${textFromRenderedContent(actionLog.details.content.rendered)}` case 'TeamQuestionnaireStateType': case 'ITeamQuestionnaireStateType': return actionLog.details.questionnaire.displayName case 'EmailType': { case 'IQuestionnaireSubmissionType': { const { teamQuestionnaireState } = actionLog.details return `${teamQuestionnaireState.questionnaire.displayName} submitted by ${teamQuestionnaireState.team.name}` } case 'IQuestionnaireReviewDetailsType': // TODO: 3.34.0 follow-up return '' case 'IConfirmationDetailsType': // TODO: 3.34.0 follow-up return '' case 'IEmailType': { const senderAddress = actionLog.details.sender.address const recipients = actionLog.details.thread.participants .filter(participant => participant.address !== senderAddress) Loading @@ -66,10 +74,6 @@ const getContent = (actionLog: ActionLogFragment): string => { .join(', ') return `${senderAddress} → ${recipients}: ${textFromRenderedContent(actionLog.details.content.rendered)}` } case 'QuestionnaireSubmissionType': { const { teamQuestionnaireState } = actionLog.details return `${teamQuestionnaireState.questionnaire.displayName} submitted by ${teamQuestionnaireState.team.name}` } } } Loading @@ -83,7 +87,7 @@ type ActionLogItem = { } interface ActionLogProps { selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { Loading @@ -94,18 +98,11 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { const { exercise } = useContext(ExerciseContext) const getHandleClick = useCallback( (actionLog: ActionLogFragment) => () => { switch (actionLog.type) { case 'INJECT': case 'CUSTOM_INJECT': case 'TOOL': case 'FORM': case 'FORM_SUBMISSION': return selectedDispatch({ type: 'selectActions', actionLog }) case 'EMAIL': return selectedDispatch({ type: 'selectEmails', actionLog }) } }, (actionLog: IActionLog) => () => selectedDispatch({ type: 'selectActionLog', actionLog, }), [selectedDispatch] ) Loading @@ -121,7 +118,7 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { const items: ActionLogItem[] = useMemo(() => { const items: ActionLogItem[] = actionLogs.map(actionLog => ({ id: actionLog.id, icon: getIcon(actionLog.type), icon: getIcon(actionLog.logType), text: getContent(actionLog), timestamp: actionLog.timestamp, handleClick: getHandleClick(actionLog), Loading @@ -143,7 +140,10 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { `teams: ${milestoneStateTeamNames(milestoneState)}`, timestamp: milestoneState.timestampReached, handleClick: () => selectedDispatch({ type: 'selectMilestones', milestoneState }), selectedDispatch({ type: 'selectMilestoneState', milestoneState, }), teamId, }) ) Loading analyst/src/components/Milestones/AllTeamsMilestoneCard.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import type { Dispatch, FC } from 'react' import { useContext } from 'react' import useMilestoneStates from '../dataHooks/useMilestoneStates' import { ExerciseContext } from '../ExerciseContext' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import { milestoneCard } from './milestoneCardCss' const wrapper = css` Loading @@ -21,7 +21,7 @@ const wrapper = css` interface AllTeamsMilestoneCardProps { isSelected?: boolean milestone: Milestone selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } const AllTeamsMilestoneCard: FC<AllTeamsMilestoneCardProps> = ({ Loading Loading @@ -56,7 +56,7 @@ const AllTeamsMilestoneCard: FC<AllTeamsMilestoneCardProps> = ({ icon={null} onClick={() => selectedDispatch({ type: 'selectMilestones', type: 'selectMilestoneState', milestoneState: filteredMilestoneStates[0], }) } Loading analyst/src/components/Milestones/MilestoneCard.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import { MilestoneDescription } from '@inject/frontend' import type { MilestoneState } from '@inject/graphql' import { StyledTag } from '@inject/shared' import type { Dispatch, FC } from 'react' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useFormatTimestamp from '../useFormatTimestamp' import { milestoneCard } from './milestoneCardCss' Loading @@ -19,7 +19,7 @@ const wrapper = css` interface MilestoneCardProps { isSelected?: boolean milestoneState: MilestoneState selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> teamId: string } Loading @@ -39,7 +39,7 @@ const MilestoneCard: FC<MilestoneCardProps> = ({ intent={milestoneState.reached ? 'success' : undefined} icon={null} onClick={() => selectedDispatch({ type: 'selectMilestones', milestoneState }) selectedDispatch({ type: 'selectMilestoneState', milestoneState }) } > <div className={wrapper}> Loading analyst/src/components/Milestones/MilestoneCards.tsx +2 −2 Original line number Diff line number Diff line import type { MilestoneState } from '@inject/graphql' import type { Dispatch, FC } from 'react' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useMilestoneStates from '../dataHooks/useMilestoneStates' import useMilestones from '../dataHooks/useMilestones' import AllTeamsMilestoneCard from './AllTeamsMilestoneCard' Loading @@ -9,7 +9,7 @@ import MilestoneCard from './MilestoneCard' interface MilestoneCardsProps { teamId: string | undefined selectedState?: MilestoneState selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } const MilestoneCards: FC<MilestoneCardsProps> = ({ Loading Loading
analyst/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/analyst", "version": "3.1.0", "version": "3.34.0", "description": "Analyst module for Inject Exercise Platform", "main": "index.js", "license": "MIT", Loading
analyst/src/components/ActionLog/index.tsx +32 −32 Original line number Diff line number Diff line Loading @@ -2,10 +2,7 @@ import { Icon, NonIdealState } from '@blueprintjs/core' import { css, cx } from '@emotion/css' import { useRelativeTime } from '@inject/shared' import type { ActionLog as ActionLogFragment, MilestoneState, } from '@inject/graphql' import type { IActionLog, MilestoneState } from '@inject/graphql' import { ellipsized, highlightedOnActive, Loading @@ -19,7 +16,7 @@ import { useCallback, useContext, useMemo } from 'react' import useActionLogs from '../dataHooks/useActionLogs' import useMilestoneStates from '../dataHooks/useMilestoneStates' import { ExerciseContext } from '../ExerciseContext' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useFormatTimestamp from '../useFormatTimestamp' import { actionTypeColor, compareDates, getTeamById } from '../utilities' Loading @@ -33,13 +30,15 @@ const td = css` cursor: pointer; ` const getIcon = (logType: ActionLogFragment['type']) => { const getIcon = (logType: IActionLog['logType']): JSX.Element => { switch (logType) { case 'INJECT': case 'CUSTOM_INJECT': case 'TOOL': case 'FORM_SUBMISSION': case 'FORM': case 'FORM_REVIEW': case 'CONFIRMATION': return ( <Icon icon='full-circle' color={actionTypeColor(logType.toString())} /> ) Loading @@ -48,17 +47,26 @@ const getIcon = (logType: ActionLogFragment['type']) => { } } const getContent = (actionLog: ActionLogFragment): string => { const getContent = (actionLog: IActionLog): string => { switch (actionLog.details.__typename) { case 'InjectDetailsType': case 'IInjectDetailsType': case 'ICustomInjectDetailsType': return textFromRenderedContent(actionLog.details.content.rendered) case 'CustomInjectDetailsType': return textFromRenderedContent(actionLog.details.content.rendered) case 'ToolDetailsType': case 'IToolDetailsType': return `${actionLog.details.tool.displayName}, ${actionLog.details.tool.requiresInput ? `${actionLog.details.argument} → ` : ''}${textFromRenderedContent(actionLog.details.content.rendered)}` case 'TeamQuestionnaireStateType': case 'ITeamQuestionnaireStateType': return actionLog.details.questionnaire.displayName case 'EmailType': { case 'IQuestionnaireSubmissionType': { const { teamQuestionnaireState } = actionLog.details return `${teamQuestionnaireState.questionnaire.displayName} submitted by ${teamQuestionnaireState.team.name}` } case 'IQuestionnaireReviewDetailsType': // TODO: 3.34.0 follow-up return '' case 'IConfirmationDetailsType': // TODO: 3.34.0 follow-up return '' case 'IEmailType': { const senderAddress = actionLog.details.sender.address const recipients = actionLog.details.thread.participants .filter(participant => participant.address !== senderAddress) Loading @@ -66,10 +74,6 @@ const getContent = (actionLog: ActionLogFragment): string => { .join(', ') return `${senderAddress} → ${recipients}: ${textFromRenderedContent(actionLog.details.content.rendered)}` } case 'QuestionnaireSubmissionType': { const { teamQuestionnaireState } = actionLog.details return `${teamQuestionnaireState.questionnaire.displayName} submitted by ${teamQuestionnaireState.team.name}` } } } Loading @@ -83,7 +87,7 @@ type ActionLogItem = { } interface ActionLogProps { selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { Loading @@ -94,18 +98,11 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { const { exercise } = useContext(ExerciseContext) const getHandleClick = useCallback( (actionLog: ActionLogFragment) => () => { switch (actionLog.type) { case 'INJECT': case 'CUSTOM_INJECT': case 'TOOL': case 'FORM': case 'FORM_SUBMISSION': return selectedDispatch({ type: 'selectActions', actionLog }) case 'EMAIL': return selectedDispatch({ type: 'selectEmails', actionLog }) } }, (actionLog: IActionLog) => () => selectedDispatch({ type: 'selectActionLog', actionLog, }), [selectedDispatch] ) Loading @@ -121,7 +118,7 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { const items: ActionLogItem[] = useMemo(() => { const items: ActionLogItem[] = actionLogs.map(actionLog => ({ id: actionLog.id, icon: getIcon(actionLog.type), icon: getIcon(actionLog.logType), text: getContent(actionLog), timestamp: actionLog.timestamp, handleClick: getHandleClick(actionLog), Loading @@ -143,7 +140,10 @@ export const ActionLog: FC<ActionLogProps> = ({ selectedDispatch }) => { `teams: ${milestoneStateTeamNames(milestoneState)}`, timestamp: milestoneState.timestampReached, handleClick: () => selectedDispatch({ type: 'selectMilestones', milestoneState }), selectedDispatch({ type: 'selectMilestoneState', milestoneState, }), teamId, }) ) Loading
analyst/src/components/Milestones/AllTeamsMilestoneCard.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import type { Dispatch, FC } from 'react' import { useContext } from 'react' import useMilestoneStates from '../dataHooks/useMilestoneStates' import { ExerciseContext } from '../ExerciseContext' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import { milestoneCard } from './milestoneCardCss' const wrapper = css` Loading @@ -21,7 +21,7 @@ const wrapper = css` interface AllTeamsMilestoneCardProps { isSelected?: boolean milestone: Milestone selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } const AllTeamsMilestoneCard: FC<AllTeamsMilestoneCardProps> = ({ Loading Loading @@ -56,7 +56,7 @@ const AllTeamsMilestoneCard: FC<AllTeamsMilestoneCardProps> = ({ icon={null} onClick={() => selectedDispatch({ type: 'selectMilestones', type: 'selectMilestoneState', milestoneState: filteredMilestoneStates[0], }) } Loading
analyst/src/components/Milestones/MilestoneCard.tsx +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ import { MilestoneDescription } from '@inject/frontend' import type { MilestoneState } from '@inject/graphql' import { StyledTag } from '@inject/shared' import type { Dispatch, FC } from 'react' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useFormatTimestamp from '../useFormatTimestamp' import { milestoneCard } from './milestoneCardCss' Loading @@ -19,7 +19,7 @@ const wrapper = css` interface MilestoneCardProps { isSelected?: boolean milestoneState: MilestoneState selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> teamId: string } Loading @@ -39,7 +39,7 @@ const MilestoneCard: FC<MilestoneCardProps> = ({ intent={milestoneState.reached ? 'success' : undefined} icon={null} onClick={() => selectedDispatch({ type: 'selectMilestones', milestoneState }) selectedDispatch({ type: 'selectMilestoneState', milestoneState }) } > <div className={wrapper}> Loading
analyst/src/components/Milestones/MilestoneCards.tsx +2 −2 Original line number Diff line number Diff line import type { MilestoneState } from '@inject/graphql' import type { Dispatch, FC } from 'react' import type { selectedReducerActionProps } from '../Overview/selectedReducer' import type { SelectedAction } from '../Overview/selectedReducer' import useMilestoneStates from '../dataHooks/useMilestoneStates' import useMilestones from '../dataHooks/useMilestones' import AllTeamsMilestoneCard from './AllTeamsMilestoneCard' Loading @@ -9,7 +9,7 @@ import MilestoneCard from './MilestoneCard' interface MilestoneCardsProps { teamId: string | undefined selectedState?: MilestoneState selectedDispatch: Dispatch<selectedReducerActionProps> selectedDispatch: Dispatch<SelectedAction> } const MilestoneCards: FC<MilestoneCardsProps> = ({ Loading