@salesforce/ui-bundle-template-app-react-sample-b2e 11.19.0 → 11.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/package.json +4 -4
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/applications/applicationSearchService.ts +25 -43
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceRequests/maintenanceRequestSearchService.ts +31 -65
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceWorkers/maintenanceWorkerSearchService.ts +21 -43
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/properties/propertySearchService.ts +33 -53
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/applications/ApplicationCard.tsx +80 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/dashboard/GlobalSearchBar.tsx +2 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/layout/VerticalNav.tsx +28 -18
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/maintenanceRequests/MaintenanceRequestCard.tsx +79 -52
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/maintenanceWorkers/WorkerCard.tsx +87 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/search/UnifiedSearch.tsx +213 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/api/distinctValuesService.ts +84 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/api/searchService.ts +71 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/MergedSearchResults.tsx +263 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/Search.tsx +185 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/SearchResults.tsx +77 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/SourceSection.tsx +166 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/controls/PaginationControls.tsx +185 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/controls/ScopeSelector.tsx +55 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/controls/SearchBar.tsx +55 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/controls/SortControl.tsx +62 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/ActiveFilters.tsx +61 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/DefaultFilterPanel.tsx +125 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/{object-search/components → search/components/filters}/FilterContext.tsx +7 -20
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/BooleanFilter.tsx +50 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/DateRangeFilter.tsx +160 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/FilterFieldWrapper.tsx +26 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/MultiSelectFilter.tsx +88 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/NumericRangeFilter.tsx +78 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/SelectFilter.tsx +46 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/filters/inputs/TextFilter.tsx +52 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/components/results/DefaultResultRow.tsx +109 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/config.json +83 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/{object-search → search}/hooks/useAsyncData.ts +3 -10
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/hooks/useDistinctValues.ts +59 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/hooks/useSearch.ts +703 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/index.ts +90 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/loadConfig.ts +14 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/queryBuilder.ts +156 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/types.ts +307 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/utils/debounce.ts +17 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/utils/fieldUtils.ts +14 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/utils/filterUtils.ts +285 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/search/utils/sortUtils.ts +34 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/lib/constants.ts +16 -29
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/lib/routeConfig.ts +1 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/lib/searchConfig.ts +190 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/ApplicationSearch.tsx +8 -385
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/Home.tsx +4 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/MaintenanceRequestSearch.tsx +8 -458
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/MaintenanceWorkerSearch.tsx +8 -341
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/PropertySearch.tsx +7 -243
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/pages/Search.tsx +16 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/routes.tsx +6 -0
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/tsconfig.tsbuildinfo +1 -1
- package/dist/package-lock.json +2 -2
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/applications/query/distinctApplicationStatus.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/applications/query/searchApplications.graphql +0 -65
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceRequests/query/distinctMaintenanceRequestPriority.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceRequests/query/distinctMaintenanceRequestStatus.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceRequests/query/distinctMaintenanceRequestType.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceRequests/query/searchMaintenanceRequests.graphql +0 -82
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceWorkers/query/distinctMaintenanceWorkerEmploymentType.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/maintenanceWorkers/query/searchMaintenanceWorkers.graphql +0 -64
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/properties/query/distinctPropertyStatus.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/properties/query/distinctPropertyType.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/api/properties/query/searchProperties.graphql +0 -105
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/shared/ObjectSearchErrorState.tsx +0 -45
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/components/shared/UserAvatar.tsx +0 -35
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/api/accountSearchService.ts +0 -46
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/api/query/distinctAccountIndustries.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/api/query/distinctAccountTypes.graphql +0 -19
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/api/query/getAccountDetail.graphql +0 -121
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/api/query/searchAccounts.graphql +0 -51
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/pages/AccountObjectDetailPage.tsx +0 -355
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/pages/AccountSearch.tsx +0 -304
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/__examples__/pages/Home.tsx +0 -34
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/api/objectSearchService.ts +0 -82
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/ActiveFilters.tsx +0 -89
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/ObjectBreadcrumb.tsx +0 -66
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/PaginationControls.tsx +0 -109
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/SearchBar.tsx +0 -41
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/SortControl.tsx +0 -143
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/BooleanFilter.tsx +0 -78
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/DateFilter.tsx +0 -128
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/DateRangeFilter.tsx +0 -70
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/FilterFieldWrapper.tsx +0 -43
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/MultiSelectFilter.tsx +0 -105
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/NumericRangeFilter.tsx +0 -171
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/SearchFilter.tsx +0 -52
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/SelectFilter.tsx +0 -97
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/components/filters/TextFilter.tsx +0 -93
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/hooks/useDebouncedCallback.ts +0 -34
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/hooks/useObjectSearchParams.ts +0 -254
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/utils/debounce.ts +0 -25
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/utils/fieldUtils.ts +0 -29
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/utils/filterUtils.ts +0 -404
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/features/object-search/utils/sortUtils.ts +0 -38
- package/dist/force-app/main/default/uiBundles/propertymanagementapp/src/lib/filterUtils.ts +0 -11
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
query GetAccountDetail($id: ID!) {
|
|
2
|
-
uiapi {
|
|
3
|
-
query {
|
|
4
|
-
Account(where: { Id: { eq: $id } }) {
|
|
5
|
-
edges {
|
|
6
|
-
node {
|
|
7
|
-
Id
|
|
8
|
-
Name @optional {
|
|
9
|
-
value
|
|
10
|
-
displayValue
|
|
11
|
-
}
|
|
12
|
-
Owner @optional {
|
|
13
|
-
Name @optional {
|
|
14
|
-
value
|
|
15
|
-
displayValue
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Phone @optional {
|
|
19
|
-
value
|
|
20
|
-
displayValue
|
|
21
|
-
}
|
|
22
|
-
Fax @optional {
|
|
23
|
-
value
|
|
24
|
-
displayValue
|
|
25
|
-
}
|
|
26
|
-
Parent @optional {
|
|
27
|
-
Name @optional {
|
|
28
|
-
value
|
|
29
|
-
displayValue
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
Website @optional {
|
|
33
|
-
value
|
|
34
|
-
displayValue
|
|
35
|
-
}
|
|
36
|
-
Type @optional {
|
|
37
|
-
value
|
|
38
|
-
displayValue
|
|
39
|
-
}
|
|
40
|
-
NumberOfEmployees @optional {
|
|
41
|
-
value
|
|
42
|
-
displayValue
|
|
43
|
-
}
|
|
44
|
-
Industry @optional {
|
|
45
|
-
value
|
|
46
|
-
displayValue
|
|
47
|
-
}
|
|
48
|
-
AnnualRevenue @optional {
|
|
49
|
-
value
|
|
50
|
-
displayValue
|
|
51
|
-
}
|
|
52
|
-
Description @optional {
|
|
53
|
-
value
|
|
54
|
-
displayValue
|
|
55
|
-
}
|
|
56
|
-
BillingStreet @optional {
|
|
57
|
-
value
|
|
58
|
-
displayValue
|
|
59
|
-
}
|
|
60
|
-
BillingCity @optional {
|
|
61
|
-
value
|
|
62
|
-
displayValue
|
|
63
|
-
}
|
|
64
|
-
BillingState @optional {
|
|
65
|
-
value
|
|
66
|
-
displayValue
|
|
67
|
-
}
|
|
68
|
-
BillingPostalCode @optional {
|
|
69
|
-
value
|
|
70
|
-
displayValue
|
|
71
|
-
}
|
|
72
|
-
BillingCountry @optional {
|
|
73
|
-
value
|
|
74
|
-
displayValue
|
|
75
|
-
}
|
|
76
|
-
ShippingStreet @optional {
|
|
77
|
-
value
|
|
78
|
-
displayValue
|
|
79
|
-
}
|
|
80
|
-
ShippingCity @optional {
|
|
81
|
-
value
|
|
82
|
-
displayValue
|
|
83
|
-
}
|
|
84
|
-
ShippingState @optional {
|
|
85
|
-
value
|
|
86
|
-
displayValue
|
|
87
|
-
}
|
|
88
|
-
ShippingPostalCode @optional {
|
|
89
|
-
value
|
|
90
|
-
displayValue
|
|
91
|
-
}
|
|
92
|
-
ShippingCountry @optional {
|
|
93
|
-
value
|
|
94
|
-
displayValue
|
|
95
|
-
}
|
|
96
|
-
CreatedBy @optional {
|
|
97
|
-
Name @optional {
|
|
98
|
-
value
|
|
99
|
-
displayValue
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
CreatedDate @optional {
|
|
103
|
-
value
|
|
104
|
-
displayValue
|
|
105
|
-
}
|
|
106
|
-
LastModifiedBy @optional {
|
|
107
|
-
Name @optional {
|
|
108
|
-
value
|
|
109
|
-
displayValue
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
LastModifiedDate @optional {
|
|
113
|
-
value
|
|
114
|
-
displayValue
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
query SearchAccounts(
|
|
2
|
-
$first: Int
|
|
3
|
-
$after: String
|
|
4
|
-
$where: Account_Filter
|
|
5
|
-
$orderBy: Account_OrderBy
|
|
6
|
-
) {
|
|
7
|
-
uiapi {
|
|
8
|
-
query {
|
|
9
|
-
Account(first: $first, after: $after, where: $where, orderBy: $orderBy) {
|
|
10
|
-
edges {
|
|
11
|
-
node {
|
|
12
|
-
Id
|
|
13
|
-
Name @optional {
|
|
14
|
-
value
|
|
15
|
-
displayValue
|
|
16
|
-
}
|
|
17
|
-
Industry @optional {
|
|
18
|
-
value
|
|
19
|
-
displayValue
|
|
20
|
-
}
|
|
21
|
-
Type @optional {
|
|
22
|
-
value
|
|
23
|
-
displayValue
|
|
24
|
-
}
|
|
25
|
-
Phone @optional {
|
|
26
|
-
value
|
|
27
|
-
displayValue
|
|
28
|
-
}
|
|
29
|
-
Owner @optional {
|
|
30
|
-
Name @optional {
|
|
31
|
-
value
|
|
32
|
-
displayValue
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
AnnualRevenue @optional {
|
|
36
|
-
value
|
|
37
|
-
displayValue
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
pageInfo {
|
|
42
|
-
hasNextPage
|
|
43
|
-
hasPreviousPage
|
|
44
|
-
endCursor
|
|
45
|
-
startCursor
|
|
46
|
-
}
|
|
47
|
-
totalCount
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { useParams, useNavigate } from "react-router";
|
|
3
|
-
import { createDataSDK } from "@salesforce/platform-sdk";
|
|
4
|
-
import { AlertCircle, ChevronDown, ChevronRight, FileQuestion } from "lucide-react";
|
|
5
|
-
import GET_ACCOUNT_DETAIL from "../api/query/getAccountDetail.graphql?raw";
|
|
6
|
-
import type {
|
|
7
|
-
GetAccountDetailQuery,
|
|
8
|
-
GetAccountDetailQueryVariables,
|
|
9
|
-
} from "../../../../api/graphql-operations-types";
|
|
10
|
-
import { Alert, AlertTitle, AlertDescription } from "../../../../components/ui/alert";
|
|
11
|
-
import { Button } from "../../../../components/ui/button";
|
|
12
|
-
import { Card, CardContent } from "../../../../components/ui/card";
|
|
13
|
-
import { fieldValue, getAddressFieldLines, formatDateTimeField } from "../../utils/fieldUtils";
|
|
14
|
-
import {
|
|
15
|
-
Collapsible,
|
|
16
|
-
CollapsibleTrigger,
|
|
17
|
-
CollapsibleContent,
|
|
18
|
-
} from "../../../../components/ui/collapsible";
|
|
19
|
-
import { Separator } from "../../../../components/ui/separator";
|
|
20
|
-
import { Skeleton } from "../../../../components/ui/skeleton";
|
|
21
|
-
import { useAsyncData } from "../../hooks/useAsyncData";
|
|
22
|
-
import { ObjectBreadcrumb } from "../../components/ObjectBreadcrumb";
|
|
23
|
-
|
|
24
|
-
type AccountNode = NonNullable<
|
|
25
|
-
NonNullable<
|
|
26
|
-
NonNullable<NonNullable<GetAccountDetailQuery["uiapi"]["query"]["Account"]>["edges"]>[number]
|
|
27
|
-
>["node"]
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
async function fetchAccountDetail(recordId: string): Promise<AccountNode | null | undefined> {
|
|
31
|
-
const data = await createDataSDK();
|
|
32
|
-
const result = await data.graphql!.query<GetAccountDetailQuery, GetAccountDetailQueryVariables>({
|
|
33
|
-
query: GET_ACCOUNT_DETAIL,
|
|
34
|
-
variables: { id: recordId },
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (result.errors?.length) {
|
|
38
|
-
throw new Error(result.errors.map((e) => e.message).join("; "));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return result.data?.uiapi?.query?.Account?.edges?.[0]?.node;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default function AccountObjectDetail() {
|
|
45
|
-
const { recordId } = useParams();
|
|
46
|
-
const navigate = useNavigate();
|
|
47
|
-
|
|
48
|
-
const {
|
|
49
|
-
data: account,
|
|
50
|
-
loading,
|
|
51
|
-
error,
|
|
52
|
-
} = useAsyncData(() => fetchAccountDetail(recordId!), [recordId]);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
|
56
|
-
<ObjectBreadcrumb
|
|
57
|
-
listPath="/accounts"
|
|
58
|
-
listLabel="Accounts"
|
|
59
|
-
loading={loading}
|
|
60
|
-
recordName={
|
|
61
|
-
account
|
|
62
|
-
? (fieldValue(account.Name) ?? "")
|
|
63
|
-
: error
|
|
64
|
-
? "Error"
|
|
65
|
-
: loading
|
|
66
|
-
? undefined
|
|
67
|
-
: "Not Found"
|
|
68
|
-
}
|
|
69
|
-
/>
|
|
70
|
-
|
|
71
|
-
{/* Loading state */}
|
|
72
|
-
{loading && <AccountDetailSkeleton />}
|
|
73
|
-
|
|
74
|
-
{/* Error state */}
|
|
75
|
-
{error && <AccountDetailError onBack={() => navigate(-1)} />}
|
|
76
|
-
|
|
77
|
-
{/* Not found state */}
|
|
78
|
-
{!loading && !error && !account && <AccountDetailNotFound onBack={() => navigate(-1)} />}
|
|
79
|
-
|
|
80
|
-
{/* Content */}
|
|
81
|
-
{account && <AccountDetailContent account={account} />}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function AccountDetailContent({ account }: { account: AccountNode }) {
|
|
87
|
-
const billingAddress = getAddressFieldLines({
|
|
88
|
-
street: fieldValue(account.BillingStreet),
|
|
89
|
-
city: fieldValue(account.BillingCity),
|
|
90
|
-
state: fieldValue(account.BillingState),
|
|
91
|
-
postalCode: fieldValue(account.BillingPostalCode),
|
|
92
|
-
country: fieldValue(account.BillingCountry),
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const shippingAddress = getAddressFieldLines({
|
|
96
|
-
street: fieldValue(account.ShippingStreet),
|
|
97
|
-
city: fieldValue(account.ShippingCity),
|
|
98
|
-
state: fieldValue(account.ShippingState),
|
|
99
|
-
postalCode: fieldValue(account.ShippingPostalCode),
|
|
100
|
-
country: fieldValue(account.ShippingCountry),
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const dateTimeOptions = { dateStyle: "medium", timeStyle: "short" } as const;
|
|
104
|
-
const createdDate = formatDateTimeField(
|
|
105
|
-
fieldValue(account.CreatedDate),
|
|
106
|
-
undefined,
|
|
107
|
-
dateTimeOptions,
|
|
108
|
-
);
|
|
109
|
-
const lastModifiedDate = formatDateTimeField(
|
|
110
|
-
fieldValue(account.LastModifiedDate),
|
|
111
|
-
undefined,
|
|
112
|
-
dateTimeOptions,
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<>
|
|
117
|
-
<h1 className="text-2xl font-bold mb-4">Account: {fieldValue(account.Name)}</h1>
|
|
118
|
-
|
|
119
|
-
<Card>
|
|
120
|
-
<CardContent className="space-y-8 pt-6">
|
|
121
|
-
{/* Top section */}
|
|
122
|
-
<div>
|
|
123
|
-
<div className="space-y-4">
|
|
124
|
-
<FieldRow>
|
|
125
|
-
<FieldItem label="Account Owner">{fieldValue(account.Owner?.Name)}</FieldItem>
|
|
126
|
-
<FieldItem label="Phone">
|
|
127
|
-
<TelephoneField value={fieldValue(account.Phone)} />
|
|
128
|
-
</FieldItem>
|
|
129
|
-
</FieldRow>
|
|
130
|
-
<FieldRow>
|
|
131
|
-
<FieldItem label="Account Name">{fieldValue(account.Name)}</FieldItem>
|
|
132
|
-
<FieldItem label="Fax">
|
|
133
|
-
<TelephoneField value={fieldValue(account.Fax)} />
|
|
134
|
-
</FieldItem>
|
|
135
|
-
</FieldRow>
|
|
136
|
-
<FieldRow>
|
|
137
|
-
<FieldItem label="Parent Account">{fieldValue(account.Parent?.Name)}</FieldItem>
|
|
138
|
-
<FieldItem label="Website">{fieldValue(account.Website)}</FieldItem>
|
|
139
|
-
</FieldRow>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<Separator />
|
|
144
|
-
|
|
145
|
-
{/* Additional Information */}
|
|
146
|
-
<Section title="Additional Information">
|
|
147
|
-
<FieldRow>
|
|
148
|
-
<FieldItem label="Type">{fieldValue(account.Type)}</FieldItem>
|
|
149
|
-
<FieldItem label="Employees">{fieldValue(account.NumberOfEmployees)}</FieldItem>
|
|
150
|
-
</FieldRow>
|
|
151
|
-
<FieldRow>
|
|
152
|
-
<FieldItem label="Industry">{fieldValue(account.Industry)}</FieldItem>
|
|
153
|
-
<FieldItem label="Annual Revenue">{fieldValue(account.AnnualRevenue)}</FieldItem>
|
|
154
|
-
</FieldRow>
|
|
155
|
-
<FieldItem label="Description">{fieldValue(account.Description)}</FieldItem>
|
|
156
|
-
</Section>
|
|
157
|
-
|
|
158
|
-
<Separator />
|
|
159
|
-
|
|
160
|
-
{/* Address Information */}
|
|
161
|
-
<Section title="Address Information">
|
|
162
|
-
<FieldRow>
|
|
163
|
-
<FieldItem label="Billing Address">
|
|
164
|
-
{billingAddress ? billingAddress.map((line, i) => <div key={i}>{line}</div>) : null}
|
|
165
|
-
</FieldItem>
|
|
166
|
-
<FieldItem label="Shipping Address">
|
|
167
|
-
{shippingAddress
|
|
168
|
-
? shippingAddress.map((line, i) => <div key={i}>{line}</div>)
|
|
169
|
-
: null}
|
|
170
|
-
</FieldItem>
|
|
171
|
-
</FieldRow>
|
|
172
|
-
</Section>
|
|
173
|
-
|
|
174
|
-
<Separator />
|
|
175
|
-
|
|
176
|
-
{/* System Information */}
|
|
177
|
-
<Section title="System Information">
|
|
178
|
-
<FieldRow>
|
|
179
|
-
<FieldItem label="Created By">
|
|
180
|
-
{[fieldValue(account.CreatedBy?.Name), createdDate].filter(Boolean).join(" ") ||
|
|
181
|
-
null}
|
|
182
|
-
</FieldItem>
|
|
183
|
-
<FieldItem label="Last Modified By">
|
|
184
|
-
{[fieldValue(account.LastModifiedBy?.Name), lastModifiedDate]
|
|
185
|
-
.filter(Boolean)
|
|
186
|
-
.join(" ") || null}
|
|
187
|
-
</FieldItem>
|
|
188
|
-
</FieldRow>
|
|
189
|
-
</Section>
|
|
190
|
-
</CardContent>
|
|
191
|
-
</Card>
|
|
192
|
-
</>
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function TelephoneField({ value }: { value?: string | null }) {
|
|
197
|
-
if (!value) return null;
|
|
198
|
-
return (
|
|
199
|
-
<a href={`tel:${value}`} className="underline">
|
|
200
|
-
{value}
|
|
201
|
-
</a>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function FieldItem({ label, children }: { label: string; children: React.ReactNode }) {
|
|
206
|
-
return (
|
|
207
|
-
<div>
|
|
208
|
-
<dt className="text-sm text-muted-foreground">{label}</dt>
|
|
209
|
-
<dd className="mt-0.5">{children ?? "—"}</dd>
|
|
210
|
-
</div>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function FieldRow({ children }: { children: React.ReactNode }) {
|
|
215
|
-
return <div className="grid grid-cols-2 gap-x-8 gap-y-4">{children}</div>;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function Section({ title, children }: { title: string; children: React.ReactNode }) {
|
|
219
|
-
const [open, setOpen] = useState(true);
|
|
220
|
-
return (
|
|
221
|
-
<Collapsible open={open} onOpenChange={setOpen}>
|
|
222
|
-
<CollapsibleTrigger className="flex items-center gap-2 cursor-pointer text-lg font-semibold py-2">
|
|
223
|
-
{open ? <ChevronDown className="size-5" /> : <ChevronRight className="size-5" />}
|
|
224
|
-
{title}
|
|
225
|
-
</CollapsibleTrigger>
|
|
226
|
-
<CollapsibleContent>
|
|
227
|
-
<div className="mt-2 space-y-4">{children}</div>
|
|
228
|
-
</CollapsibleContent>
|
|
229
|
-
</Collapsible>
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function AccountDetailError({ onBack }: { onBack: () => void }) {
|
|
234
|
-
return (
|
|
235
|
-
<>
|
|
236
|
-
<Alert variant="destructive" role="alert">
|
|
237
|
-
<AlertCircle />
|
|
238
|
-
<AlertTitle>
|
|
239
|
-
<h2>Failed to load account</h2>
|
|
240
|
-
</AlertTitle>
|
|
241
|
-
<AlertDescription>
|
|
242
|
-
Something went wrong while loading this account. Please try again later.
|
|
243
|
-
</AlertDescription>
|
|
244
|
-
</Alert>
|
|
245
|
-
<div className="mt-4 flex gap-3">
|
|
246
|
-
<Button variant="outline" onClick={onBack}>
|
|
247
|
-
← Back
|
|
248
|
-
</Button>
|
|
249
|
-
<Button variant="outline" onClick={() => window.location.reload()}>
|
|
250
|
-
Retry
|
|
251
|
-
</Button>
|
|
252
|
-
</div>
|
|
253
|
-
</>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function AccountDetailNotFound({ onBack }: { onBack: () => void }) {
|
|
258
|
-
return (
|
|
259
|
-
<Card>
|
|
260
|
-
<CardContent className="flex flex-col items-center justify-center py-16 text-center">
|
|
261
|
-
<FileQuestion className="size-12 text-muted-foreground mb-4" />
|
|
262
|
-
<h2 className="text-lg font-semibold mb-1">Account not found</h2>
|
|
263
|
-
<p className="text-sm text-muted-foreground mb-6">
|
|
264
|
-
The account you're looking for doesn't exist or may have been deleted.
|
|
265
|
-
</p>
|
|
266
|
-
<Button variant="outline" onClick={onBack}>
|
|
267
|
-
← Go back
|
|
268
|
-
</Button>
|
|
269
|
-
</CardContent>
|
|
270
|
-
</Card>
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function AccountDetailSkeleton() {
|
|
275
|
-
return (
|
|
276
|
-
<>
|
|
277
|
-
<Skeleton className="h-8 w-56 mb-4" />
|
|
278
|
-
|
|
279
|
-
<Card>
|
|
280
|
-
<CardContent className="space-y-8 pt-6">
|
|
281
|
-
{/* Top section: field rows */}
|
|
282
|
-
<div>
|
|
283
|
-
<div className="space-y-4">
|
|
284
|
-
<SkeletonFieldRow />
|
|
285
|
-
<SkeletonFieldRow />
|
|
286
|
-
<SkeletonFieldRow />
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
|
|
290
|
-
<Separator />
|
|
291
|
-
|
|
292
|
-
{/* Additional Information */}
|
|
293
|
-
<SkeletonSection />
|
|
294
|
-
|
|
295
|
-
<Separator />
|
|
296
|
-
|
|
297
|
-
{/* Address Information */}
|
|
298
|
-
<div className="space-y-4">
|
|
299
|
-
<Skeleton className="h-7 w-48 py-2" />
|
|
300
|
-
<div className="grid grid-cols-2 gap-x-8 gap-y-4">
|
|
301
|
-
<div>
|
|
302
|
-
<Skeleton className="h-4 w-28 mb-1.5" />
|
|
303
|
-
<Skeleton className="h-5 w-44 mb-1" />
|
|
304
|
-
<Skeleton className="h-5 w-36 mb-1" />
|
|
305
|
-
<Skeleton className="h-5 w-28" />
|
|
306
|
-
</div>
|
|
307
|
-
<div>
|
|
308
|
-
<Skeleton className="h-4 w-32 mb-1.5" />
|
|
309
|
-
<Skeleton className="h-5 w-44 mb-1" />
|
|
310
|
-
<Skeleton className="h-5 w-36 mb-1" />
|
|
311
|
-
<Skeleton className="h-5 w-28" />
|
|
312
|
-
</div>
|
|
313
|
-
</div>
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<Separator />
|
|
317
|
-
|
|
318
|
-
{/* System Information */}
|
|
319
|
-
<div className="space-y-4">
|
|
320
|
-
<Skeleton className="h-7 w-48 py-2" />
|
|
321
|
-
<SkeletonFieldRow />
|
|
322
|
-
</div>
|
|
323
|
-
</CardContent>
|
|
324
|
-
</Card>
|
|
325
|
-
</>
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function SkeletonField() {
|
|
330
|
-
return (
|
|
331
|
-
<div>
|
|
332
|
-
<Skeleton className="h-4 w-24 mb-1.5" />
|
|
333
|
-
<Skeleton className="h-5 w-40" />
|
|
334
|
-
</div>
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function SkeletonFieldRow() {
|
|
339
|
-
return (
|
|
340
|
-
<div className="grid grid-cols-2 gap-x-8 gap-y-4">
|
|
341
|
-
<SkeletonField />
|
|
342
|
-
<SkeletonField />
|
|
343
|
-
</div>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function SkeletonSection() {
|
|
348
|
-
return (
|
|
349
|
-
<div className="space-y-4">
|
|
350
|
-
<Skeleton className="h-7 w-48 py-2" />
|
|
351
|
-
<SkeletonFieldRow />
|
|
352
|
-
<SkeletonFieldRow />
|
|
353
|
-
</div>
|
|
354
|
-
);
|
|
355
|
-
}
|