Begin job details cards.

This commit is contained in:
Patrick Fic
2020-01-07 16:44:14 -08:00
parent e65273f2b6
commit 16eceb192f
9 changed files with 108 additions and 35 deletions

View File

@@ -0,0 +1,16 @@
import React from "react";
import JobDetailCardsCustomerContainer from "./job-detail-cards.customer.container";
import { useTranslation } from "react-i18next";
export default function JobDetailCards({ selectedJob }) {
const { t } = useTranslation();
if (!selectedJob) {
return <div>{t("jobs.errors.nojobselected")}</div>;
}
return (
<div>
<JobDetailCardsCustomerContainer selectedJob={selectedJob} />
</div>
);
}

View File

@@ -0,0 +1,8 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Card } from "antd";
export default function JobDetailCardsCustomerComponent({ loading, data }) {
const { t } = useTranslation();
return <Card loading={loading}>Card has loaded.</Card>;
}

View File

@@ -0,0 +1,15 @@
import React from "react";
import JobDetailCardsCustomerComponent from "./job-detail-cards.customer.component";
import { useQuery } from "@apollo/react-hooks";
import AlertComponent from "../alert/alert.component";
import { QUERY_JOBS_IN_PRODUCTION } from "../../graphql/jobs.queries";
export default function JobDetailCardsCustomerContainer({ selectedJob }) {
const { loading, error, data } = useQuery(QUERY_JOBS_IN_PRODUCTION, {
fetchPolicy: "network-only"
});
if (error) return <AlertComponent message={error.message} type='error' />;
return <JobDetailCardsCustomerComponent loading={loading} data={data} />;
}