Skip to content

Commit

Permalink
Fixes companies verification button (#3333)
Browse files Browse the repository at this point in the history
  • Loading branch information
kornifex authored May 16, 2024
1 parent 87abd0f commit 86b6eb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions front/src/Apps/Companies/CompanyInfo/CompanyInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@ import { CompanyPrivate } from "@td/codegen-ui";
import React from "react";
import CompanyIdentificationForm from "./CompanyIdentificationForm";
import CompanyProfileForm from "./CompanyProfileForm";
import AccountFieldCompanyVerificationStatus from "../../Account/fields/AccountFieldCompanyVerificationStatus";
import { PROFESSIONALS } from "@td/constants";

import "./companyInfo.scss";

const { VITE_VERIFY_COMPANY } = import.meta.env;

interface CompanyInfoProps {
company: CompanyPrivate;
}

const CompanyInfo = ({ company }: CompanyInfoProps) => {
const isWasteProfessional = company.companyTypes.some(ct =>
PROFESSIONALS.includes(ct)
);

return (
<div className="company-info">
<CompanyIdentificationForm company={company} />
<br />
<hr />
<CompanyProfileForm company={company} />
{isWasteProfessional && VITE_VERIFY_COMPANY === "true" && (
<AccountFieldCompanyVerificationStatus company={company} />
)}
</div>
);
};
Expand Down
11 changes: 0 additions & 11 deletions front/src/Apps/Companies/CompanyInfo/CompanyProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@ import { gql, useMutation } from "@apollo/client";
import { Loader } from "../../common/Components";
import CompanyProfileSubForm from "./CompanyProfileSubForm";
import { NotificationError } from "../../common/Components/Error/Error";
import AccountFieldCompanyVerificationStatus from "../../Account/fields/AccountFieldCompanyVerificationStatus";
import { PROFESSIONALS } from "@td/constants";
import CompanyProfileInformation from "./CompanyProfileInformation";

const { VITE_VERIFY_COMPANY } = import.meta.env;

interface CompanyProfileFormProps {
company: CompanyPrivate;
}
Expand Down Expand Up @@ -660,10 +656,6 @@ const CompanyProfileForm = ({ company }: CompanyProfileFormProps) => {
updateCompanyWorkerCertifError ||
deleteErrorWorkerCertif;

const isWasteProfessional = company.companyTypes.some(ct =>
PROFESSIONALS.includes(ct)
);

return (
<CompanyFormWrapper
title="Profil"
Expand Down Expand Up @@ -713,9 +705,6 @@ const CompanyProfileForm = ({ company }: CompanyProfileFormProps) => {
</div>
);
})}
{isWasteProfessional && VITE_VERIFY_COMPANY === "true" && (
<AccountFieldCompanyVerificationStatus company={company} />
)}
{loading && <Loader />}
{error && <NotificationError apolloError={error} />}
</form>
Expand Down

0 comments on commit 86b6eb9

Please sign in to comment.