refactor: rm company profile

This commit is contained in:
Nathnael
2026-08-08 15:06:46 +00:00
parent d337fa0d85
commit 7a32bb95ff
25 changed files with 1313 additions and 2899 deletions

View File

@@ -32,8 +32,6 @@ import { formatDate, humanize } from "./format";
/** Friendly labels for the proposed-change snapshot keys (UpdateProfileDto). */
export const FIELD_LABELS: Record<string, string> = {
companyName: "Company name",
companyEmail: "Company email",
companyPhone: "Company phone",
companyLocation: "Location",
companyAddress: "Address",
tin: "TIN",
@@ -73,8 +71,6 @@ export function currentValue(company: Company, key: string): string {
const attrs = (company.attributes ?? {}) as Record<string, unknown>;
const map: Record<string, unknown> = {
companyName: c.name,
companyEmail: c.email,
companyPhone: c.phone,
companyLocation: c.country,
companyAddress: c.address,
tin: c.tin,
@@ -118,7 +114,8 @@ function FaydaIdentityDiff({
if (!subject) return null;
const current =
subject === "owner" ? company.identity?.owner : company.identity?.poa;
const read = (key: string) => snapshot[`${subject}${key}`] as string | undefined;
const read = (key: string) =>
snapshot[`${subject}${key}`] as string | undefined;
const verifiedAt = read("FaydaVerifiedAt");
const fields: { label: string; from?: string | null; to?: string }[] = [
{ label: "Name", from: current?.name, to: read("Name") },
@@ -131,7 +128,9 @@ function FaydaIdentityDiff({
<Stack gap={8}>
<Group gap={8}>
<Text size="sm" fw={600} c="edr-text">
{subject === "owner" ? "Owner re-verification" : "PoA re-verification"}
{subject === "owner"
? "Owner re-verification"
: "PoA re-verification"}
</Text>
{verifiedAt && (
<Text size="xs" c="dimmed">
@@ -283,8 +282,8 @@ export function ChangeRequestReview({ company }: { company: Company }) {
icon={<AlertTriangle size={16} />}
>
Changes were requested on an earlier round of this same
submission: <strong>{pending.note}</strong> check whether
this resubmission actually addresses it before approving.
submission: <strong>{pending.note}</strong> check whether this
resubmission actually addresses it before approving.
</Alert>
)}
@@ -297,8 +296,8 @@ export function ChangeRequestReview({ company }: { company: Company }) {
from={currentValue(company, key)}
to={
pending.snapshot[key] === null ||
pending.snapshot[key] === undefined ||
pending.snapshot[key] === ""
pending.snapshot[key] === undefined ||
pending.snapshot[key] === ""
? "—"
: String(pending.snapshot[key])
}
@@ -312,7 +311,10 @@ export function ChangeRequestReview({ company }: { company: Company }) {
) : null}
{faydaIdentitySnapshot && (
<FaydaIdentityDiff company={company} snapshot={faydaIdentitySnapshot} />
<FaydaIdentityDiff
company={company}
snapshot={faydaIdentitySnapshot}
/>
)}
{documentChanges.length > 0 && (
@@ -373,9 +375,10 @@ export function ChangeRequestReview({ company }: { company: Company }) {
type="button"
size="sm"
onClick={() =>
void fetchViewableFile(fileId, `Document ${i + 1}`).then(
view,
)
void fetchViewableFile(
fileId,
`Document ${i + 1}`,
).then(view)
}
>
Document {i + 1}
@@ -446,7 +449,10 @@ export function ChangeRequestReview({ company }: { company: Company }) {
variant="light"
color="yellow"
onClick={() => {
setActionTarget({ id: pending.id, kind: "request-changes" });
setActionTarget({
id: pending.id,
kind: "request-changes",
});
setNote("");
}}
>
@@ -525,7 +531,11 @@ export function ChangeRequestReview({ company }: { company: Company }) {
}
/** Compact "N changes pending" pill for the customer list/detail header. */
export function ChangeRequestPendingBadge({ companyId }: { companyId: string }) {
export function ChangeRequestPendingBadge({
companyId,
}: {
companyId: string;
}) {
const query = useQuery(
api.customers.changeRequests.queryOptions({ input: { id: companyId } }),
);