Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 committed Sep 5, 2023
1 parent d3f6608 commit a66ca60
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 282 deletions.
2 changes: 1 addition & 1 deletion client/src/app/Paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export enum Paths {
proxies = "/proxies",
migrationTargets = "/migration-targets",
assessment = "/assessment",
questionnaire = "/questionnaire",
questionnaire = "/questionnaire/:questionnaireId",
jira = "/jira",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { IconedStatus } from "@app/components/IconedStatus";
import { TimesCircleIcon } from "@patternfly/react-icons";
import { WarningTriangleIcon } from "@patternfly/react-icons";

export interface IAnswerTableProps {
answers: Answer[];
hideAnswerKey?: boolean;
}

const AnswerTable: React.FC<IAnswerTableProps> = ({ answers }) => {
const AnswerTable: React.FC<IAnswerTableProps> = ({
answers,
hideAnswerKey,
}) => {
const { t } = useTranslation();

const tableControls = useLocalTableControls({
idProperty: "text",
items: answers,
items: hideAnswerKey
? answers.filter((answer) => answer.selected)
: answers,
columnNames: {
choice: "Answer choice",
weight: "Weight",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { Assessment, Question } from "@app/api/models";
import { useLocalTableControls } from "@app/hooks/table-controls";
import { Label } from "@patternfly/react-core";
import AnswerTable from "./answer-table";
import { NoDataEmptyState } from "@app/components/NoDataEmptyState";
import AnswerTable from "@app/components/answer-table/answer-table";

const QuestionsTable: React.FC<{
fetchError?: Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { ConditionalRender } from "@app/components/ConditionalRender";
import { AppPlaceholder } from "@app/components/AppPlaceholder";
import { useTranslation } from "react-i18next";
import QuestionnaireSectionTabTitle from "./components/questionnaire-section-tab-title";
import QuestionsTable from "./components/questions-table";
import "./assessment-summary-page.css";
import { useFetchQuestionnaires } from "@app/queries/questionnaires";
import { useFetchAssessmentById } from "@app/queries/assessments";
import QuestionsTable from "@app/components/questions-table/questions-table";

interface AssessmentSummaryRouteParams {
assessmentId: string;
Expand All @@ -35,8 +35,6 @@ interface AssessmentSummaryRouteParams {

const AssessmentSummaryPage: React.FC = () => {
const { assessmentId } = useParams<AssessmentSummaryRouteParams>();
const assessmentIdAsNumber = parseInt(assessmentId, 10);
// const applicationIdAsNumber = parseInt(applicationId, 10);

const { t } = useTranslation();

Expand All @@ -55,7 +53,7 @@ const AssessmentSummaryPage: React.FC = () => {
assessment,
isFetching: fetchingAssessment,
fetchError: fetchAssessmentError,
} = useFetchAssessmentById(assessmentIdAsNumber);
} = useFetchAssessmentById(assessmentId);

const { questionnaires, isFetching, fetchError } = useFetchQuestionnaires();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ const DynamicAssessmentButton: FunctionComponent<
console.error("Error while creating assessment:", error);
}
} else {
// Matching assessment found, navigate to assessment details
history.push(
formatPath(Paths.assessmentSummary, {
formatPath(Paths.applicationsAssessment, {
assessmentId: matchingAssessment.id,
})
);
Expand All @@ -74,7 +73,7 @@ const DynamicAssessmentButton: FunctionComponent<
type="button"
variant="primary"
style={{
backgroundColor: matchingAssessment ? "#F0AB01" : "", // Use "#FFA500" for Retake
backgroundColor: matchingAssessment ? "#F0AB01" : "",
}}
onClick={() => {
onHandleAssessmentAction();
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit a66ca60

Please sign in to comment.