@vtex/faststore-plugin-buyer-portal 1.0.26 → 1.0.27
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/package.json +1 -1
- package/plugin.config.js +16 -14
- package/src/clients/BuyerPortalClient.ts +12 -1
- package/src/clients/Client.ts +2 -3
- package/src/components/AddressesCard/AddressesCard.tsx +17 -7
- package/src/components/BasicCard/BasicCard.tsx +2 -2
- package/src/components/BasicDrawer/basic-drawer.scss +2 -2
- package/src/components/ContractsCard/ContractsCard.tsx +1 -1
- package/src/components/DeleteOrgUnitDrawer/delete-org-unit-drawer.scss +5 -4
- package/src/components/ErrorMessage/error-message.scss +1 -1
- package/src/components/InputText/input-text.scss +4 -4
- package/src/components/InternalTopbar/InternalTopbar.tsx +9 -10
- package/src/components/InternalTopbar/internal-top-bar.scss +1 -0
- package/src/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +45 -12
- package/src/components/MainLinksDropdownMenu/main-links-dropdown-menu.scss +37 -0
- package/src/components/ProfileCard/ProfileCard.tsx +7 -1
- package/src/components/SelfManagementDrawer/self-management-drawer.scss +1 -1
- package/src/components/UsersCard/UsersCard.tsx +3 -3
- package/src/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +10 -10
- package/src/layouts/AddressesLayout/AddressesLayout.tsx +2 -3
- package/src/layouts/AddressesLayout/addresses-layout.scss +2 -0
- package/src/layouts/ContractsLayout/ContractsLayout.tsx +3 -8
- package/src/layouts/HomeLayout/HomeLayout.tsx +1 -1
- package/src/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +14 -6
- package/src/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +10 -19
- package/src/layouts/OrgUnitsLayout/org-units-layout.scss +1 -0
- package/src/layouts/ProfileLayout/ProfileLayout.tsx +1 -2
- package/src/layouts/ProfileLayout/profile-layout.scss +2 -0
- package/src/layouts/UserDetailsLayout/UserDetailsLayout.tsx +4 -5
- package/src/layouts/UserDetailsLayout/user-details-layout.scss +1 -1
- package/src/layouts/UsersLayout/UsersLayout.tsx +7 -12
- package/src/layouts/UsersLayout/users-layout.scss +2 -0
- package/src/pages/address-details.tsx +7 -4
- package/src/pages/addresses.tsx +15 -6
- package/src/pages/contracts.tsx +13 -12
- package/src/pages/home.tsx +7 -4
- package/src/pages/org-unit-details.tsx +7 -7
- package/src/pages/org-units.tsx +13 -10
- package/src/pages/profile.tsx +17 -8
- package/src/pages/user-details.tsx +7 -4
- package/src/pages/users.tsx +14 -7
- package/src/services/get-addresses.service.ts +12 -16
- package/src/services/get-org-unit-basic-data.service.ts +11 -0
- package/src/services/get-organization.service.ts +2 -2
- package/src/services/get-users.service.ts +1 -1
- package/src/types/OrgUnitSummaryData.ts +15 -2
- package/src/types/OrganizationData.ts +4 -4
- package/src/utils/getClientContext.ts +18 -3
package/package.json
CHANGED
package/plugin.config.js
CHANGED
|
@@ -9,32 +9,34 @@ module.exports = {
|
|
|
9
9
|
path: "/org-unit/[orgUnitId]",
|
|
10
10
|
appLayout: false,
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
path: "/
|
|
12
|
+
"address-details": {
|
|
13
|
+
path: "/address/[addressId]",
|
|
14
14
|
appLayout: false,
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
path: "/
|
|
16
|
+
"user-details": {
|
|
17
|
+
path: "/user/[userId]",
|
|
18
18
|
appLayout: false,
|
|
19
19
|
},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
// Shared pages
|
|
22
|
+
"org-units": {
|
|
23
|
+
path: "/org-units/[[...orgUnitId]]",
|
|
22
24
|
appLayout: false,
|
|
23
25
|
},
|
|
24
|
-
|
|
25
|
-
path: "/
|
|
26
|
+
profile: {
|
|
27
|
+
path: "/profile/[[...orgUnitId]]",
|
|
26
28
|
appLayout: false,
|
|
27
29
|
},
|
|
28
|
-
|
|
29
|
-
path: "/
|
|
30
|
+
contracts: {
|
|
31
|
+
path: "/contracts/[[...orgUnitId]]",
|
|
30
32
|
appLayout: false,
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
path: "/
|
|
34
|
+
addresses: {
|
|
35
|
+
path: "/addresses/[[...orgUnitId]]",
|
|
34
36
|
appLayout: false,
|
|
35
37
|
},
|
|
36
|
-
|
|
37
|
-
path: "/
|
|
38
|
+
users: {
|
|
39
|
+
path: "/users/[[...orgUnitId]]",
|
|
38
40
|
appLayout: false,
|
|
39
41
|
},
|
|
40
42
|
},
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AddressData } from "../types/AddressData";
|
|
2
2
|
import type { ContractData } from "../types/ContractData";
|
|
3
3
|
import type { OrgUnitData } from "../types/OrgUnitsData";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
OrgUnitBasicData,
|
|
6
|
+
OrgUnitSummaryData,
|
|
7
|
+
} from "../types/OrgUnitSummaryData";
|
|
5
8
|
import { getApiUrl } from "../utils/api";
|
|
6
9
|
import Client from "./Client";
|
|
7
10
|
|
|
@@ -58,6 +61,14 @@ class BuyerPortalClient extends Client {
|
|
|
58
61
|
// }
|
|
59
62
|
|
|
60
63
|
//Org Units
|
|
64
|
+
getOrgUnitBasicData(id: string, cookie: string) {
|
|
65
|
+
return this.get<OrgUnitBasicData>(`units/${id}`, {
|
|
66
|
+
headers: {
|
|
67
|
+
Cookie: cookie,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
61
72
|
getOrgUnitSummary(id: string, cookie: string) {
|
|
62
73
|
return this.get<OrgUnitSummaryData>(`units/summary/${id}`, {
|
|
63
74
|
headers: {
|
package/src/clients/Client.ts
CHANGED
|
@@ -46,10 +46,9 @@ class Client {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (!response.ok) {
|
|
49
|
+
console.error("Request failed:", responseData);
|
|
49
50
|
throw new Error(
|
|
50
|
-
responseData
|
|
51
|
-
? (responseData as unknown as { message: string }).message
|
|
52
|
-
: "Request failed"
|
|
51
|
+
responseData ? JSON.stringify(responseData) : "Request failed"
|
|
53
52
|
);
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -6,24 +6,31 @@ import {
|
|
|
6
6
|
DropdownButton,
|
|
7
7
|
} from "@faststore/ui";
|
|
8
8
|
import { Tag } from "../Tag/Tag";
|
|
9
|
-
import { AddressData } from "../../types/AddressData";
|
|
9
|
+
import type { AddressData } from "../../types/AddressData";
|
|
10
10
|
import { Icon } from "../Icon";
|
|
11
11
|
import { BasicCard } from "../BasicCard/BasicCard";
|
|
12
12
|
|
|
13
13
|
type AddressesCardProps = {
|
|
14
|
-
addresses
|
|
14
|
+
addresses?: AddressData[];
|
|
15
|
+
orgUnitData?: {
|
|
16
|
+
id: string | null;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
15
19
|
};
|
|
16
20
|
|
|
17
|
-
export default function AddressesCard({
|
|
21
|
+
export default function AddressesCard({
|
|
22
|
+
addresses = [],
|
|
23
|
+
orgUnitData,
|
|
24
|
+
}: AddressesCardProps) {
|
|
18
25
|
return (
|
|
19
26
|
<BasicCard
|
|
20
|
-
footerLink=
|
|
27
|
+
footerLink={`/addresses${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
21
28
|
footerMessage="Manage addresses"
|
|
22
29
|
title="Addresses"
|
|
23
30
|
subTitle={addresses.length ?? 0}
|
|
24
|
-
onPlusIconClick={() => {
|
|
31
|
+
onPlusIconClick={() => {}}
|
|
25
32
|
>
|
|
26
|
-
{addresses.length &&
|
|
33
|
+
{Boolean(addresses.length) &&
|
|
27
34
|
addresses.slice(0, 3).map((address) => {
|
|
28
35
|
return (
|
|
29
36
|
<div key={address.id}>
|
|
@@ -45,7 +52,10 @@ export default function AddressesCard({ addresses }: AddressesCardProps) {
|
|
|
45
52
|
</div>
|
|
46
53
|
</div>
|
|
47
54
|
<div data-fs-card-action-row>
|
|
48
|
-
<Toggle
|
|
55
|
+
<Toggle
|
|
56
|
+
id="addressActive"
|
|
57
|
+
defaultChecked={address.isActive}
|
|
58
|
+
/>
|
|
49
59
|
|
|
50
60
|
<Dropdown>
|
|
51
61
|
<DropdownButton data-fs-card-row-dropdown-button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import { Icon as UIIcon, IconButton } from "@faststore/ui";
|
|
3
3
|
import Link from "next/link";
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ export const BasicCard = ({
|
|
|
37
37
|
{onPlusIconClick && (
|
|
38
38
|
<IconButton
|
|
39
39
|
icon={<UIIcon name="PlusCircle" width={20} height={20} />}
|
|
40
|
-
aria-label={
|
|
40
|
+
aria-label={"addresses action"}
|
|
41
41
|
onClick={onPlusIconClick}
|
|
42
42
|
/>
|
|
43
43
|
)}
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
|
|
70
70
|
cursor: pointer;
|
|
71
71
|
|
|
72
|
-
padding: var(--fs-spacing-
|
|
72
|
+
padding: var(--fs-spacing-3) calc(var(--fs-spacing-5) + var(--fs-spacing-0));
|
|
73
73
|
min-width: 10.625rem;
|
|
74
74
|
border-radius: var(--fs-border-radius-pill);
|
|
75
75
|
|
|
76
76
|
font-size: var(--fs-text-size-1);
|
|
77
77
|
font-weight: 600;
|
|
78
|
-
line-height: var(--fs-spacing-
|
|
78
|
+
line-height: var(--fs-spacing-3);
|
|
79
79
|
text-align: center;
|
|
80
80
|
|
|
81
81
|
&[data-fs-bp-basic-drawer-button-variant="confirm"] {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@faststore/ui";
|
|
9
9
|
import { Icon } from "../Icon";
|
|
10
10
|
import { BasicCard } from "../BasicCard/BasicCard";
|
|
11
|
-
import { ContractData } from "../../types/ContractData";
|
|
11
|
+
import type { ContractData } from "../../types/ContractData";
|
|
12
12
|
|
|
13
13
|
type ContractsCardProps = {
|
|
14
14
|
orgUnitData?: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
@import "../BasicDrawer/basic-drawer.scss";
|
|
2
|
+
|
|
1
3
|
[data-fs-bp-basic-drawer][data-fs-bp-delete-org-unit-drawer] {
|
|
2
|
-
@import "../BasicDrawer/basic-drawer.scss";
|
|
3
4
|
@import "../Tab/tab.scss";
|
|
4
5
|
@import "../OrgUnitsHierarchyTree/org-units-hierarchy-tree.scss";
|
|
5
6
|
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
|
|
25
26
|
[data-fs-bp-tab-bar] {
|
|
26
27
|
margin-top: var(--fs-spacing-4);
|
|
27
|
-
margin-bottom: var(--fs-spacing-
|
|
28
|
+
margin-bottom: var(--fs-spacing-3);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
[data-fs-bp-delete-org-unit-drawer-user-line] {
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
[data-fs-bp-delete-org-unit-drawer-user-org] {
|
|
60
61
|
font-weight: 400;
|
|
61
62
|
font-size: var(--fs-text-size-1);
|
|
62
|
-
line-height: var(--fs-spacing-
|
|
63
|
+
line-height: var(--fs-spacing-3);
|
|
63
64
|
color: #707070;
|
|
64
65
|
margin: 0 calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
65
66
|
width: 9.375rem;
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
[data-fs-bp-delete-org-unit-drawer-user-type] {
|
|
68
69
|
font-weight: 400;
|
|
69
70
|
font-size: var(--fs-text-size-1);
|
|
70
|
-
line-height: var(--fs-spacing-
|
|
71
|
+
line-height: var(--fs-spacing-3);
|
|
71
72
|
color: #707070;
|
|
72
73
|
margin: 0 calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
73
74
|
width: 9.375rem;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
cursor: text;
|
|
7
7
|
|
|
8
8
|
border: var(--fs-border-width) solid #d6d6d6;
|
|
9
|
-
padding: calc(var(--fs-spacing-3) + var(--fs-spacing-0)) var(--fs-spacing-
|
|
9
|
+
padding: calc(var(--fs-spacing-3) + var(--fs-spacing-0)) var(--fs-spacing-3);
|
|
10
10
|
border-radius: calc(var(--fs-border-radius) * 2);
|
|
11
11
|
background-color: #ffffff;
|
|
12
12
|
color: #5c5c5c;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
[data-fs-bp-input-text-label] {
|
|
15
15
|
font-size: var(--fs-text-size-2);
|
|
16
16
|
font-weight: 400;
|
|
17
|
-
line-height: var(--fs-spacing-
|
|
17
|
+
line-height: var(--fs-spacing-3);
|
|
18
18
|
|
|
19
19
|
position: absolute;
|
|
20
20
|
transform-origin: 0 0;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
font-size: var(--fs-text-size-1);
|
|
28
28
|
font-weight: 400;
|
|
29
|
-
line-height: var(--fs-spacing-
|
|
29
|
+
line-height: var(--fs-spacing-3);
|
|
30
30
|
border-width: 0;
|
|
31
31
|
|
|
32
32
|
position: absolute;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
position: absolute;
|
|
41
41
|
width: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
42
42
|
height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
43
|
-
right: var(--fs-spacing-
|
|
43
|
+
right: var(--fs-spacing-3);
|
|
44
44
|
top: 1.125rem;
|
|
45
45
|
cursor: pointer;
|
|
46
46
|
|
|
@@ -4,10 +4,10 @@ import type { HTMLAttributes } from "react";
|
|
|
4
4
|
|
|
5
5
|
import Link from "next/link";
|
|
6
6
|
import { Icon } from "../Icon";
|
|
7
|
+
import { useBuyerPortal } from "../../hooks/useBuyerPortal";
|
|
7
8
|
|
|
8
9
|
interface InternapTopBarProps
|
|
9
10
|
extends Omit<HTMLAttributes<HTMLDivElement>, "role" | "title"> {
|
|
10
|
-
rootName: string;
|
|
11
11
|
titleIcon?: ReactNode;
|
|
12
12
|
title: string | ReactNode;
|
|
13
13
|
subTitle?: string | ReactNode;
|
|
@@ -17,7 +17,6 @@ interface InternapTopBarProps
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const InternalTopBar = ({
|
|
20
|
-
rootName,
|
|
21
20
|
titleIcon,
|
|
22
21
|
title,
|
|
23
22
|
subTitle,
|
|
@@ -26,6 +25,8 @@ export const InternalTopBar = ({
|
|
|
26
25
|
children,
|
|
27
26
|
href = "/buyer-portal",
|
|
28
27
|
}: InternapTopBarProps) => {
|
|
28
|
+
const { orgUnit } = useBuyerPortal();
|
|
29
|
+
|
|
29
30
|
return (
|
|
30
31
|
<header data-fs-buyer-portal-topbar>
|
|
31
32
|
<div data-fs-buyer-portal-topbar-navigation>
|
|
@@ -40,13 +41,13 @@ export const InternalTopBar = ({
|
|
|
40
41
|
data-fs-buyer-portal-topbar-navigation-back
|
|
41
42
|
/>
|
|
42
43
|
}
|
|
43
|
-
aria-label={
|
|
44
|
+
aria-label={"topbar goback"}
|
|
44
45
|
/>
|
|
45
46
|
</Link>
|
|
46
47
|
<div data-fs-internal-topbar-icon-wrapper>
|
|
47
48
|
<Icon name="StarFolder" height={24} width={24} />
|
|
48
49
|
</div>
|
|
49
|
-
{
|
|
50
|
+
{orgUnit?.name ?? "Buyer Portal"}
|
|
50
51
|
</div>
|
|
51
52
|
|
|
52
53
|
<div data-fs-buyer-portal-topbar-wrapper>
|
|
@@ -75,12 +76,10 @@ export const InternalTopBar = ({
|
|
|
75
76
|
<div data-fs-buyer-portal-topbar-actions>
|
|
76
77
|
{children}
|
|
77
78
|
{showActions && (
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/>
|
|
83
|
-
</>
|
|
79
|
+
<IconButton
|
|
80
|
+
icon={<Icon name="MoreVert" height={24} width={24} />}
|
|
81
|
+
aria-label="topbar options"
|
|
82
|
+
/>
|
|
84
83
|
)}
|
|
85
84
|
</div>
|
|
86
85
|
</header>
|
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import { DropdownItem, DropdownMenu } from "@faststore/ui";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { useBuyerPortal } from "../../hooks/useBuyerPortal";
|
|
5
|
+
import type { OrgUnitBasicData } from "../../types/OrgUnitSummaryData";
|
|
6
|
+
|
|
7
|
+
const getMenuItems = (orgUnit?: OrgUnitBasicData | null) => {
|
|
8
|
+
const contractsOrProfileOption =
|
|
9
|
+
orgUnit?.contractMode === "Single"
|
|
10
|
+
? { name: "Profile", link: "/profile" }
|
|
11
|
+
: { name: "Contracts", link: "/contracts" };
|
|
12
|
+
|
|
13
|
+
const menuItems = [
|
|
14
|
+
{ name: "Users", link: "/users" },
|
|
15
|
+
{ name: "Organizational Units", link: "/org-units" },
|
|
16
|
+
contractsOrProfileOption,
|
|
17
|
+
{ name: "Addresses", link: "/addresses" },
|
|
18
|
+
].map((item) => ({
|
|
19
|
+
...item,
|
|
20
|
+
link: orgUnit ? `${item.link}/${orgUnit.id}` : item.link,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const firstOption = orgUnit
|
|
24
|
+
? { name: orgUnit.name, link: `/org-unit/${orgUnit.id}` }
|
|
25
|
+
: { name: "Buyer Portal", link: "/buyer-portal" };
|
|
26
|
+
|
|
27
|
+
return [firstOption, ...menuItems];
|
|
28
|
+
};
|
|
2
29
|
|
|
3
30
|
export const MainLinksDropdownMenu = () => {
|
|
31
|
+
const { push, asPath } = useRouter();
|
|
32
|
+
const { orgUnit } = useBuyerPortal();
|
|
33
|
+
|
|
4
34
|
return (
|
|
5
|
-
<DropdownMenu>
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
<DropdownMenu align="center" data-fs-bp-main-links-dropdown-menu>
|
|
36
|
+
{getMenuItems(orgUnit).map(({ name, link }) => {
|
|
37
|
+
const isActive = asPath === link;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<DropdownItem
|
|
41
|
+
data-fs-bp-main-link-is-active={isActive}
|
|
42
|
+
key={link}
|
|
43
|
+
onClick={() => push(link)}
|
|
44
|
+
>
|
|
45
|
+
<span>{name}</span>
|
|
46
|
+
<Icon name="Check" width={12} height={12} />
|
|
47
|
+
</DropdownItem>
|
|
48
|
+
);
|
|
49
|
+
})}
|
|
17
50
|
</DropdownMenu>
|
|
18
51
|
);
|
|
19
52
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[data-fs-bp-main-links-dropdown-menu] {
|
|
2
|
+
padding: var(--fs-spacing-1) 0;
|
|
3
|
+
min-width: 16.25rem;
|
|
4
|
+
|
|
5
|
+
[data-fs-dropdown-item] {
|
|
6
|
+
padding: var(--fs-spacing-1) calc(var(--fs-spacing-4) - var(--fs-spacing-0))
|
|
7
|
+
var(--fs-spacing-1) var(--fs-spacing-6);
|
|
8
|
+
gap: var(--fs-spacing-1);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
font-weight: var(--fs-text-weight-medium);
|
|
13
|
+
font-size: var(--fs-text-size-1);
|
|
14
|
+
line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
15
|
+
text-transform: capitalize;
|
|
16
|
+
|
|
17
|
+
&:first-of-type {
|
|
18
|
+
padding-left: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
background-color: #f5f5f5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[data-fs-icon] {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&[data-fs-bp-main-link-is-active="true"] {
|
|
30
|
+
color: #0366dd;
|
|
31
|
+
|
|
32
|
+
[data-fs-icon] {
|
|
33
|
+
display: inline;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -6,6 +6,11 @@ type ProfileCardProps = {
|
|
|
6
6
|
id: string;
|
|
7
7
|
|
|
8
8
|
imageUrl?: string;
|
|
9
|
+
|
|
10
|
+
orgUnitData?: {
|
|
11
|
+
id: string | null;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
9
14
|
};
|
|
10
15
|
|
|
11
16
|
export default function ProfileCard({
|
|
@@ -13,10 +18,11 @@ export default function ProfileCard({
|
|
|
13
18
|
email,
|
|
14
19
|
id,
|
|
15
20
|
imageUrl,
|
|
21
|
+
orgUnitData,
|
|
16
22
|
}: ProfileCardProps) {
|
|
17
23
|
return (
|
|
18
24
|
<BasicCard
|
|
19
|
-
footerLink=
|
|
25
|
+
footerLink={`/profile${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
20
26
|
footerMessage="View profile"
|
|
21
27
|
title="Profile"
|
|
22
28
|
>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { Icon } from "../Icon";
|
|
11
11
|
import { BasicCard } from "../BasicCard/BasicCard";
|
|
12
|
-
import { UserData } from "../../types/UserData";
|
|
12
|
+
import type { UserData } from "../../types/UserData";
|
|
13
13
|
|
|
14
14
|
type UsersCardProps = {
|
|
15
15
|
orgUnitData?: {
|
|
@@ -19,7 +19,7 @@ type UsersCardProps = {
|
|
|
19
19
|
users: UserData[];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export default function UsersCard({ users, orgUnitData }: UsersCardProps) {
|
|
22
|
+
export default function UsersCard({ users = [], orgUnitData }: UsersCardProps) {
|
|
23
23
|
return (
|
|
24
24
|
<BasicCard
|
|
25
25
|
footerLink={`/users${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
@@ -28,7 +28,7 @@ export default function UsersCard({ users, orgUnitData }: UsersCardProps) {
|
|
|
28
28
|
onPlusIconClick={() => {}}
|
|
29
29
|
title="Users"
|
|
30
30
|
>
|
|
31
|
-
{users.length &&
|
|
31
|
+
{Boolean(users.length) &&
|
|
32
32
|
users.slice(0, 3).map((user: UserData) => {
|
|
33
33
|
return (
|
|
34
34
|
<div key={user.userId}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DropdownItem, DropdownMenu, Toggle } from "@faststore/ui";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
|
|
4
|
-
import { AddressData } from "../../types/AddressData";
|
|
4
|
+
import type { AddressData } from "../../types/AddressData";
|
|
5
5
|
import { addressLabelToPropMapping } from "../../utils/addresLabelToPropMapping";
|
|
6
6
|
import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
|
|
7
7
|
import { Icon } from "../../components/Icon";
|
|
@@ -21,7 +21,6 @@ export const AddressDetailsLayout = ({
|
|
|
21
21
|
<GlobalLayout>
|
|
22
22
|
<section data-fs-address-details-section>
|
|
23
23
|
<InternalTopBar
|
|
24
|
-
rootName="Stellar Inc."
|
|
25
24
|
href="/buyer-portal"
|
|
26
25
|
showActions
|
|
27
26
|
titleIcon={
|
|
@@ -36,7 +35,7 @@ export const AddressDetailsLayout = ({
|
|
|
36
35
|
titleDropDownItems={
|
|
37
36
|
<DropdownMenu>
|
|
38
37
|
{["Location 1", "Location 2", "Location 3"].map((item) => (
|
|
39
|
-
<DropdownItem>{item}</DropdownItem>
|
|
38
|
+
<DropdownItem key={item}>{item}</DropdownItem>
|
|
40
39
|
))}
|
|
41
40
|
</DropdownMenu>
|
|
42
41
|
}
|
|
@@ -56,13 +55,13 @@ export const AddressDetailsLayout = ({
|
|
|
56
55
|
<div data-fs-address-details-info-wrapper>
|
|
57
56
|
<div data-fs-address-details-section-header>
|
|
58
57
|
<h1 data-fs-address-details-title>Address Details</h1>
|
|
59
|
-
<button data-fs-address-details-button>
|
|
58
|
+
<button type="button" data-fs-address-details-button>
|
|
60
59
|
<Icon
|
|
61
60
|
name="Edit"
|
|
62
61
|
width={20}
|
|
63
62
|
height={20}
|
|
64
63
|
data-fs-address-details-icon
|
|
65
|
-
|
|
64
|
+
/>
|
|
66
65
|
Edit
|
|
67
66
|
</button>
|
|
68
67
|
</div>
|
|
@@ -72,6 +71,7 @@ export const AddressDetailsLayout = ({
|
|
|
72
71
|
.map((prop, index) => {
|
|
73
72
|
return (
|
|
74
73
|
<div
|
|
74
|
+
key={prop}
|
|
75
75
|
data-fs-address-details-info-line
|
|
76
76
|
data-fs-address-details-info-line-first={index === 0}
|
|
77
77
|
>
|
|
@@ -92,26 +92,26 @@ export const AddressDetailsLayout = ({
|
|
|
92
92
|
{addressData.locations.length}
|
|
93
93
|
</span>
|
|
94
94
|
</h1>
|
|
95
|
-
<button data-fs-address-details-button>
|
|
95
|
+
<button type="button" data-fs-address-details-button>
|
|
96
96
|
<Icon
|
|
97
97
|
name="Add"
|
|
98
98
|
width={20}
|
|
99
99
|
height={20}
|
|
100
100
|
data-fs-address-details-icon
|
|
101
|
-
|
|
101
|
+
/>
|
|
102
102
|
Add New
|
|
103
103
|
</button>
|
|
104
104
|
</div>
|
|
105
105
|
|
|
106
106
|
<div data-fs-address-details-locations>
|
|
107
107
|
{addressData.locations.map((location) => (
|
|
108
|
-
<div data-fs-address-details-location>
|
|
108
|
+
<div key={location} data-fs-address-details-location>
|
|
109
109
|
<span data-fs-address-details-location-name>{location}</span>
|
|
110
110
|
<span data-fs-address-details-location-actions>
|
|
111
|
-
<button data-fs-address-details-location-delete>
|
|
111
|
+
<button type="button" data-fs-address-details-location-delete>
|
|
112
112
|
<Icon name="Delete" width={24} height={24} />
|
|
113
113
|
</button>
|
|
114
|
-
<button data-fs-address-details-location-more>
|
|
114
|
+
<button type="button" data-fs-address-details-location-more>
|
|
115
115
|
<Icon name="MoreVert" width={24} height={24} />
|
|
116
116
|
</button>
|
|
117
117
|
</span>
|
|
@@ -5,7 +5,7 @@ import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
|
|
|
5
5
|
import SortFilter from "../../components/SortFilter/SortFilter";
|
|
6
6
|
import { statusFilters } from "../../utils/search";
|
|
7
7
|
|
|
8
|
-
import { AddressSummaryData } from "../../types/AddressData";
|
|
8
|
+
import type { AddressSummaryData } from "../../types/AddressData";
|
|
9
9
|
import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
|
|
10
10
|
import { Icon } from "../../components/Icon";
|
|
11
11
|
import { useQueryParams } from "../../hooks/useQueryParams";
|
|
@@ -27,14 +27,13 @@ export const AddressLayout = ({ data }: AddressLayoutProps) => {
|
|
|
27
27
|
<GlobalLayout>
|
|
28
28
|
<section data-fs-addresses-section>
|
|
29
29
|
<InternalTopBar
|
|
30
|
-
rootName="Stellar Inc."
|
|
31
30
|
showActions={false}
|
|
32
31
|
title="Addresses"
|
|
33
32
|
subTitle={data.length ?? 0}
|
|
34
33
|
titleDropDownItems={<MainLinksDropdownMenu />}
|
|
35
34
|
>
|
|
36
35
|
<div data-fs-topbar-actions-wrapper>
|
|
37
|
-
<button data-fs-topbar-dropdown-add-trigger>
|
|
36
|
+
<button type="button" data-fs-topbar-dropdown-add-trigger>
|
|
38
37
|
<Icon
|
|
39
38
|
name="Add"
|
|
40
39
|
width={20}
|
|
@@ -5,10 +5,11 @@ import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
|
|
|
5
5
|
import SortFilter from "../../components/SortFilter/SortFilter";
|
|
6
6
|
import { statusFilters } from "../../utils/search";
|
|
7
7
|
|
|
8
|
-
import { ContractData } from "../../types/ContractData";
|
|
8
|
+
import type { ContractData } from "../../types/ContractData";
|
|
9
9
|
import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
|
|
10
10
|
import { Icon } from "../../components/Icon";
|
|
11
11
|
import { useQueryParams } from "../../hooks/useQueryParams";
|
|
12
|
+
import { MainLinksDropdownMenu } from "../../components/MainLinksDropdownMenu/MainLinksDropdownMenu";
|
|
12
13
|
|
|
13
14
|
export type ContractsLayoutProps = {
|
|
14
15
|
data: ContractData[];
|
|
@@ -21,14 +22,8 @@ export const ContractsLayout = ({ data }: ContractsLayoutProps) => {
|
|
|
21
22
|
<GlobalLayout>
|
|
22
23
|
<section data-fs-contracts-section>
|
|
23
24
|
<InternalTopBar
|
|
24
|
-
rootName="Stellar Inc."
|
|
25
25
|
title="Contracts"
|
|
26
|
-
titleDropDownItems={
|
|
27
|
-
<DropdownMenu>
|
|
28
|
-
<DropdownItem>Empresa 02</DropdownItem>
|
|
29
|
-
<DropdownItem>Empresa 03</DropdownItem>
|
|
30
|
-
</DropdownMenu>
|
|
31
|
-
}
|
|
26
|
+
titleDropDownItems={<MainLinksDropdownMenu />}
|
|
32
27
|
/>
|
|
33
28
|
|
|
34
29
|
<div data-fs-contracts-page>
|
|
@@ -3,7 +3,7 @@ import ContractsCard from "../../components/ContractsCard/ContractsCard";
|
|
|
3
3
|
import OrganizationalUnitsCard from "../../components/OrganizationalUnitsCard/OrganizationalUnitsCard";
|
|
4
4
|
import ProfileCard from "../../components/ProfileCard/ProfileCard";
|
|
5
5
|
import UsersCard from "../../components/UsersCard/UsersCard";
|
|
6
|
-
import { OrganizationData } from "../../types/OrganizationData";
|
|
6
|
+
import type { OrganizationData } from "../../types/OrganizationData";
|
|
7
7
|
import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
|
|
8
8
|
|
|
9
9
|
export type HomeLayoutProps = {
|