@vtex/faststore-plugin-buyer-portal 2.0.34 → 2.0.36
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/public/buyer-portal-icons.svg +30 -3
- package/src/features/contracts/layouts/ContractInformationLayout/ContractInformationLayout.tsx +0 -1
- package/src/features/contracts/layouts/ContractListingLayout/ContractListingLayout.tsx +0 -1
- package/src/features/org-units/components/OrgUnitDetailsNavbar/LocalizationIconButtonTrigger.tsx +112 -0
- package/src/features/org-units/components/OrgUnitDetailsNavbar/OrgUnitDetailsNavbar.tsx +56 -51
- package/src/features/org-units/components/OrgUnitDetailsNavbar/org-unit-details-navbar.scss +159 -55
- package/src/features/org-units/components/OrgUnitHeaderNav/OrgUnitHeaderNav.tsx +12 -19
- package/src/features/org-units/components/OrgUnitHeaderNav/org-unit-header-nav.scss +78 -7
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +0 -1
- package/src/features/profile/components/ProfileSummary/ProfileSummary.tsx +38 -20
- package/src/features/profile/components/ProfileSummary/profile-summary.scss +80 -13
- package/src/features/shared/layouts/BaseTabsLayout/Navbar.tsx +19 -118
- package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +0 -106
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +0 -1
- package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +0 -1
- package/src/features/shared/layouts/SumaPageLayout/SumaPageLayout.tsx +0 -1
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/pages/user-details.tsx +12 -3
|
@@ -8,10 +8,8 @@ import {
|
|
|
8
8
|
} from "@faststore/ui";
|
|
9
9
|
|
|
10
10
|
import { Icon } from "../../../shared/components";
|
|
11
|
-
import { useBuyerPortal } from "../../../shared/hooks";
|
|
12
11
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
13
12
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
14
|
-
import { useOrgUnitByUser } from "../../hooks";
|
|
15
13
|
|
|
16
14
|
import { getOrgUnitHeaderNavItems } from "./getOrgUnitHeaderNavItems";
|
|
17
15
|
|
|
@@ -19,40 +17,31 @@ import type { OrgUnitBasicData } from "../../types";
|
|
|
19
17
|
|
|
20
18
|
export type OrgUnitHeaderNavProps = {
|
|
21
19
|
orgUnit: OrgUnitBasicData;
|
|
22
|
-
userId: string;
|
|
23
20
|
userRoles: string[];
|
|
24
|
-
/** The user's own unit id
|
|
21
|
+
/** The user's own unit id (resolved by `OrgUnitDetailsNavbar`). */
|
|
25
22
|
userUnitId?: string;
|
|
26
23
|
};
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
|
-
* Header control of
|
|
30
|
-
* and, when the user may go up the hierarchy, a dropdown
|
|
31
|
-
* units (root first) with the current unit highlighted at
|
|
32
|
-
* Selecting a unit lands on its Contracts listing
|
|
26
|
+
* Header control of every Organization Account page: a pill with the current
|
|
27
|
+
* Organization Unit and, when the user may go up the hierarchy, a dropdown
|
|
28
|
+
* listing the parent units (root first) with the current unit highlighted at
|
|
29
|
+
* the bottom. Selecting a unit lands on its Contracts listing, the unit's
|
|
30
|
+
* home page, however many contracts it has.
|
|
33
31
|
* Mirrors `Header.tsx` in the `multiple-contracts` prototype.
|
|
34
32
|
*/
|
|
35
33
|
export const OrgUnitHeaderNav = ({
|
|
36
34
|
orgUnit,
|
|
37
|
-
userId,
|
|
38
35
|
userRoles,
|
|
39
36
|
userUnitId,
|
|
40
37
|
}: OrgUnitHeaderNavProps) => {
|
|
41
38
|
const { t } = useLocalization();
|
|
42
39
|
const { push } = useRouter();
|
|
43
|
-
const { featureFlags } = useBuyerPortal();
|
|
44
|
-
const { orgUnit: fetchedUserUnit } = useOrgUnitByUser(userId, {
|
|
45
|
-
lazy: Boolean(userUnitId),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
40
|
const { ancestors, canNavigate } = getOrgUnitHeaderNavItems({
|
|
49
41
|
orgUnit,
|
|
50
|
-
userUnitId
|
|
42
|
+
userUnitId,
|
|
51
43
|
userRoles,
|
|
52
|
-
buildLink: (orgUnitId) =>
|
|
53
|
-
featureFlags?.suma
|
|
54
|
-
? buyerPortalRoutes.contracts({ orgUnitId })
|
|
55
|
-
: buyerPortalRoutes.orgUnitDetails({ orgUnitId }),
|
|
44
|
+
buildLink: (orgUnitId) => buyerPortalRoutes.contracts({ orgUnitId }),
|
|
56
45
|
});
|
|
57
46
|
|
|
58
47
|
return (
|
|
@@ -89,6 +78,10 @@ export const OrgUnitHeaderNav = ({
|
|
|
89
78
|
key={ancestor.unitId}
|
|
90
79
|
data-fs-bp-org-unit-header-nav-item
|
|
91
80
|
onClick={() => push(ancestor.item)}
|
|
81
|
+
// The library focuses an item on `mouseenter` (roving-tabindex
|
|
82
|
+
// nav) but never blurs it on `mouseleave`, so its hover-look
|
|
83
|
+
// would otherwise linger after the cursor moves away.
|
|
84
|
+
onMouseLeave={(event) => event.currentTarget.blur()}
|
|
92
85
|
>
|
|
93
86
|
<Icon name="Folder" width={20} height={20} />
|
|
94
87
|
<span data-fs-bp-org-unit-header-nav-item-name>
|
|
@@ -9,24 +9,31 @@
|
|
|
9
9
|
[data-fs-bp-org-unit-header-nav-trigger] {
|
|
10
10
|
display: inline-flex;
|
|
11
11
|
align-items: center;
|
|
12
|
-
gap: var(--fs-bp-gap-2);
|
|
13
12
|
height: var(--fs-bp-spacing-9);
|
|
14
13
|
max-width: 100%;
|
|
15
14
|
padding: 0 var(--fs-bp-padding-4);
|
|
16
15
|
@include text-style('action');
|
|
16
|
+
font-weight: var(--fs-bp-weight-medium);
|
|
17
17
|
color: var(--fs-bp-color-neutral-8);
|
|
18
18
|
background: transparent;
|
|
19
19
|
border: 0;
|
|
20
20
|
border-radius: var(--fs-bp-border-radius-full);
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
white-space: nowrap;
|
|
23
|
-
transition: background-color 0.2s;
|
|
23
|
+
transition: background-color 0.2s, transform 0.2s;
|
|
24
|
+
transform-origin: center;
|
|
25
|
+
// Keeps the text from snapping during the press-scale.
|
|
26
|
+
will-change: transform;
|
|
24
27
|
|
|
25
28
|
&:hover:not(:disabled) {
|
|
26
29
|
background-color: var(--fs-bp-color-neutral-1);
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
&:active:not(:disabled)
|
|
32
|
+
&:active:not(:disabled) {
|
|
33
|
+
background-color: var(--fs-bp-color-neutral-1);
|
|
34
|
+
transform: scale(0.98);
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
&[aria-expanded="true"] {
|
|
31
38
|
background-color: var(--fs-bp-color-neutral-1);
|
|
32
39
|
}
|
|
@@ -37,21 +44,39 @@
|
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
[data-fs-bp-org-unit-header-nav-icon] {
|
|
47
|
+
display: block;
|
|
40
48
|
flex: 0 0 auto;
|
|
41
49
|
color: var(--fs-bp-color-brand);
|
|
50
|
+
margin-right: var(--fs-bp-gap-2);
|
|
51
|
+
|
|
52
|
+
// Phones: dropped to leave the unit name as much room as possible.
|
|
53
|
+
@include u.media("<tablet") {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
[data-fs-bp-org-unit-header-nav-name] {
|
|
59
|
+
position: relative;
|
|
45
60
|
min-width: 0;
|
|
46
61
|
max-width: 20rem;
|
|
47
62
|
overflow: hidden;
|
|
48
63
|
text-overflow: ellipsis;
|
|
64
|
+
// Tight leading centers the glyphs against the icon; the padding keeps
|
|
65
|
+
// descenders inside the `overflow: hidden` clip; `top` is an optical nudge.
|
|
66
|
+
line-height: 1;
|
|
67
|
+
padding-bottom: 3px;
|
|
68
|
+
top: 1px;
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
[data-fs-bp-org-unit-header-nav-caret] {
|
|
72
|
+
display: block;
|
|
52
73
|
flex: 0 0 auto;
|
|
53
74
|
color: var(--fs-bp-color-neutral-8);
|
|
54
75
|
transition: transform 0.2s;
|
|
76
|
+
margin-left: 2px;
|
|
77
|
+
// The caret glyph has more built-in inset than the folder; balances the
|
|
78
|
+
// trigger's optical padding.
|
|
79
|
+
margin-right: calc(-1 * var(--fs-bp-margin-1));
|
|
55
80
|
}
|
|
56
81
|
|
|
57
82
|
[aria-expanded="true"] [data-fs-bp-org-unit-header-nav-caret] {
|
|
@@ -59,6 +84,31 @@
|
|
|
59
84
|
}
|
|
60
85
|
}
|
|
61
86
|
|
|
87
|
+
// `align="center"` sets an inline `translateX(-50%)`; the keyframes keep it.
|
|
88
|
+
@keyframes fs-bp-org-unit-header-nav-menu-in {
|
|
89
|
+
from {
|
|
90
|
+
opacity: 0;
|
|
91
|
+
transform: translate(-50%, -8px) scale(0.96);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
to {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
transform: translate(-50%, 0) scale(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes fs-bp-org-unit-header-nav-menu-in-start {
|
|
101
|
+
from {
|
|
102
|
+
opacity: 0;
|
|
103
|
+
transform: translateY(-8px) scale(0.96);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
to {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
transform: translateY(0) scale(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
62
112
|
// The menu renders in a portal (document.body), so it is styled at the root.
|
|
63
113
|
[data-fs-bp-org-unit-header-nav-menu][data-fs-dropdown-menu] {
|
|
64
114
|
--fs-dropdown-menu-box-shadow: var(--fs-bp-elevation-dropdown);
|
|
@@ -69,6 +119,18 @@
|
|
|
69
119
|
padding: var(--fs-bp-padding-1) 0;
|
|
70
120
|
background-color: var(--fs-bp-color-white);
|
|
71
121
|
border: 1px solid var(--fs-bp-color-neutral-2);
|
|
122
|
+
transform-origin: top center;
|
|
123
|
+
animation: fs-bp-org-unit-header-nav-menu-in 0.2s cubic-bezier(0, 0, 0.2, 1) forwards;
|
|
124
|
+
|
|
125
|
+
// Phones: the trigger sits at the header's left edge (it replaces the logo),
|
|
126
|
+
// so a menu centered on it would overflow the viewport. Pin it to the
|
|
127
|
+
// header's left padding instead — `!important` beats the vendor's inline
|
|
128
|
+
// `left`, and the keyframe drops the centering `-50%` offset.
|
|
129
|
+
@include u.media("<tablet") {
|
|
130
|
+
left: var(--fs-bp-spacing-5) !important;
|
|
131
|
+
transform-origin: top left;
|
|
132
|
+
animation-name: fs-bp-org-unit-header-nav-menu-in-start;
|
|
133
|
+
}
|
|
72
134
|
|
|
73
135
|
[data-fs-bp-org-unit-header-nav-item] {
|
|
74
136
|
display: flex;
|
|
@@ -86,18 +148,27 @@
|
|
|
86
148
|
}
|
|
87
149
|
|
|
88
150
|
svg {
|
|
151
|
+
display: block;
|
|
89
152
|
flex: 0 0 auto;
|
|
90
153
|
color: var(--fs-bp-color-neutral-7);
|
|
91
154
|
}
|
|
92
155
|
|
|
93
156
|
[data-fs-bp-org-unit-header-nav-item-name] {
|
|
157
|
+
position: relative;
|
|
94
158
|
min-width: 0;
|
|
95
159
|
overflow: hidden;
|
|
96
160
|
text-overflow: ellipsis;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
// Same as the trigger's `-name` rule above.
|
|
163
|
+
line-height: 1;
|
|
164
|
+
padding-bottom: 3px;
|
|
165
|
+
top: 1px;
|
|
97
166
|
}
|
|
98
167
|
|
|
168
|
+
// `:focus-visible`, not `:focus`: the Dropdown focuses the first item when
|
|
169
|
+
// opened by a click, which shouldn't look hovered.
|
|
99
170
|
&:hover,
|
|
100
|
-
&:focus {
|
|
171
|
+
&:focus-visible {
|
|
101
172
|
color: var(--fs-bp-color-neutral-8);
|
|
102
173
|
background-color: var(--fs-bp-color-neutral-1);
|
|
103
174
|
|
|
@@ -109,8 +180,8 @@
|
|
|
109
180
|
|
|
110
181
|
[data-fs-bp-org-unit-header-nav-item-current] {
|
|
111
182
|
color: var(--fs-bp-color-black);
|
|
112
|
-
font-weight: var(--fs-bp-weight-
|
|
113
|
-
background-color: var(--fs-bp-color-neutral-
|
|
183
|
+
font-weight: var(--fs-bp-weight-semibold);
|
|
184
|
+
background-color: var(--fs-bp-color-neutral-1);
|
|
114
185
|
cursor: default;
|
|
115
186
|
|
|
116
187
|
svg {
|
|
@@ -119,7 +190,7 @@
|
|
|
119
190
|
|
|
120
191
|
&:hover,
|
|
121
192
|
&:focus {
|
|
122
|
-
background-color: var(--fs-bp-color-neutral-
|
|
193
|
+
background-color: var(--fs-bp-color-neutral-1);
|
|
123
194
|
|
|
124
195
|
svg {
|
|
125
196
|
color: var(--fs-bp-color-brand);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
-
import {
|
|
4
|
+
import { Link, Tooltip } from "@faststore/ui";
|
|
5
5
|
|
|
6
6
|
import { Icon } from "../../../shared/components";
|
|
7
7
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
@@ -36,30 +36,48 @@ export const ProfileSummary = ({
|
|
|
36
36
|
data-fs-self-profile-summary-bordered={bordered}
|
|
37
37
|
{...otherProps}
|
|
38
38
|
>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
data-fs-self-profile-summary-org
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
{/* Omitted while the user's unit is still unknown (e.g. loading). */}
|
|
40
|
+
{(orgName || showManageLink) && (
|
|
41
|
+
<div data-fs-self-profile-summary-header>
|
|
42
|
+
{orgName && (
|
|
43
|
+
<div data-fs-self-profile-summary-org>
|
|
44
|
+
<Icon
|
|
45
|
+
name="FilledFolder"
|
|
46
|
+
width={20}
|
|
47
|
+
height={20}
|
|
48
|
+
data-fs-self-profile-summary-org-icon
|
|
49
|
+
/>
|
|
50
|
+
<h2 data-fs-self-profile-summary-org-name>{orgName}</h2>
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
{showManageLink && (
|
|
54
|
+
<Link
|
|
55
|
+
data-fs-self-profile-summary-org-link
|
|
56
|
+
href={resolveLink("/buyer-portal")}
|
|
57
|
+
>
|
|
58
|
+
{t("shared.actions.manageOrganization")}{" "}
|
|
59
|
+
<Icon name="OpenInNew" width={23} height={23} />
|
|
60
|
+
</Link>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
51
64
|
<div data-fs-self-profile-summary-person-actions>
|
|
52
65
|
<div data-fs-self-profile-summary-person-data>
|
|
53
66
|
<h2>{name}</h2>
|
|
54
67
|
<p>{email}</p>
|
|
55
68
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
{/* Above the button: the dropdown menu clips anything below it
|
|
70
|
+
(`overflow: hidden`), unlike the header's bottom tooltips. */}
|
|
71
|
+
<Tooltip content={t("shared.buttons.logout")} placement="top-center">
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
data-fs-self-profile-summary-logout-button
|
|
75
|
+
onClick={onLogoutClick}
|
|
76
|
+
aria-label={t("shared.buttons.logout")}
|
|
77
|
+
>
|
|
78
|
+
<Icon name="Logout" width={20} height={20} />
|
|
79
|
+
</button>
|
|
80
|
+
</Tooltip>
|
|
63
81
|
</div>
|
|
64
82
|
</section>
|
|
65
83
|
);
|
|
@@ -14,14 +14,36 @@
|
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
16
16
|
justify-content: space-between;
|
|
17
|
+
gap: var(--fs-bp-gap-2);
|
|
17
18
|
padding: var(--fs-bp-padding-5);
|
|
18
|
-
padding-top: var(--fs-bp-padding-3);
|
|
19
19
|
border-bottom: 1px solid var(--fs-bp-color-neutral-3);
|
|
20
20
|
|
|
21
|
+
[data-fs-self-profile-summary-org] {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
min-width: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-fs-self-profile-summary-org-icon] {
|
|
28
|
+
display: block;
|
|
29
|
+
flex: 0 0 auto;
|
|
30
|
+
margin-right: var(--fs-bp-gap-2);
|
|
31
|
+
color: var(--fs-bp-color-brand);
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
[data-fs-self-profile-summary-org-name] {
|
|
35
|
+
position: relative;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
22
40
|
@include text-style('action');
|
|
23
|
-
|
|
24
|
-
color: var(--fs-bp-color-
|
|
41
|
+
font-weight: var(--fs-bp-weight-medium);
|
|
42
|
+
color: var(--fs-bp-color-neutral-8);
|
|
43
|
+
// Same as [data-fs-bp-org-unit-header-nav-name].
|
|
44
|
+
line-height: 1;
|
|
45
|
+
padding-bottom: 3px;
|
|
46
|
+
top: 1px;
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
[data-fs-self-profile-summary-org-link] {
|
|
@@ -44,14 +66,19 @@
|
|
|
44
66
|
}
|
|
45
67
|
|
|
46
68
|
[data-fs-self-profile-summary-person-actions] {
|
|
47
|
-
|
|
48
69
|
display: grid;
|
|
49
70
|
align-items: center;
|
|
50
71
|
grid-template-columns: minmax(15.25rem, 1fr) auto;
|
|
51
72
|
gap: var(--fs-bp-gap-2);
|
|
52
|
-
padding: var(--fs-bp-padding-5)
|
|
73
|
+
padding: var(--fs-bp-padding-5);
|
|
53
74
|
|
|
54
75
|
[data-fs-self-profile-summary-person-data] {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: var(--fs-bp-gap-1);
|
|
79
|
+
min-width: 0;
|
|
80
|
+
|
|
81
|
+
// Same text style for both lines; only the color tells them apart.
|
|
55
82
|
h2, p {
|
|
56
83
|
overflow: hidden;
|
|
57
84
|
white-space: nowrap;
|
|
@@ -59,22 +86,62 @@
|
|
|
59
86
|
display: block;
|
|
60
87
|
}
|
|
61
88
|
|
|
62
|
-
h2 {
|
|
89
|
+
h2, p {
|
|
90
|
+
margin: 0;
|
|
63
91
|
@include text-style('emphasis');
|
|
64
|
-
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
h2 {
|
|
95
|
+
color: var(--fs-bp-color-neutral-8);
|
|
65
96
|
}
|
|
66
97
|
|
|
67
98
|
p {
|
|
68
|
-
|
|
69
|
-
|
|
99
|
+
color: var(--fs-bp-color-neutral-7);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Repeats the header's tooltip styles: the menu renders in a portal.
|
|
104
|
+
@import "@faststore/ui/src/components/molecules/Tooltip/styles.scss";
|
|
105
|
+
|
|
106
|
+
[data-fs-tooltip] {
|
|
107
|
+
--fs-tooltip-background: var(--fs-bp-color-black);
|
|
108
|
+
--fs-tooltip-text-color: var(--fs-bp-color-white);
|
|
109
|
+
--fs-tooltip-border-radius: var(--fs-bp-border-radius-2);
|
|
110
|
+
--fs-tooltip-padding: 0.375rem var(--fs-bp-padding-3);
|
|
111
|
+
|
|
112
|
+
[data-fs-tooltip-wrapper] {
|
|
113
|
+
box-shadow: var(--fs-bp-elevation-4);
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-fs-tooltip-content] {
|
|
118
|
+
@include text-style('caption');
|
|
119
|
+
font-weight: var(--fs-bp-weight-regular);
|
|
120
|
+
line-height: 1.32;
|
|
121
|
+
white-space: nowrap;
|
|
70
122
|
}
|
|
71
123
|
}
|
|
72
124
|
|
|
73
125
|
[data-fs-self-profile-summary-logout-button] {
|
|
74
|
-
|
|
75
|
-
--fs-control-tap-size: var(--fs-bp-spacing-9);
|
|
126
|
+
display: flex;
|
|
76
127
|
flex: 0 0 auto;
|
|
77
|
-
|
|
78
|
-
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: var(--fs-bp-spacing-9);
|
|
131
|
+
height: var(--fs-bp-spacing-9);
|
|
132
|
+
padding: 0;
|
|
133
|
+
color: var(--fs-bp-color-neutral-8);
|
|
134
|
+
background: transparent;
|
|
135
|
+
border: 0;
|
|
136
|
+
border-radius: var(--fs-bp-border-radius-full);
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
|
|
139
|
+
&:hover {
|
|
140
|
+
background-color: var(--fs-bp-color-transparent-0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:active {
|
|
144
|
+
background-color: var(--fs-bp-color-transparent-1);
|
|
145
|
+
}
|
|
79
146
|
}
|
|
80
147
|
}
|
|
@@ -1,34 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
6
|
-
import {
|
|
7
|
-
Dropdown,
|
|
8
|
-
DropdownMenu,
|
|
9
|
-
IconButton,
|
|
10
|
-
Link,
|
|
11
|
-
Skeleton,
|
|
12
|
-
} from "@faststore/ui";
|
|
13
|
-
|
|
14
|
-
const LocalizationButton = dynamic(
|
|
15
|
-
() =>
|
|
16
|
-
import("@faststore/core/experimental").then(
|
|
17
|
-
(m) => m.LocalizationButton_unstable
|
|
18
|
-
),
|
|
19
|
-
{ ssr: false }
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
import { OrgUnitBreadcrumb } from "../../../org-units/components";
|
|
23
|
-
import { ProfileSummary } from "../../../profile/components";
|
|
24
|
-
import { BasicDropdownMenu } from "../../components";
|
|
25
|
-
import { Icon } from "../../components/Icon";
|
|
26
|
-
import { useDrawerProps } from "../../hooks";
|
|
27
|
-
import { useLocalization } from "../../localization/LocalizationContext";
|
|
28
|
-
import { doLogout } from "../../utils";
|
|
29
|
-
|
|
30
|
-
import { AboutDrawer } from "./about-drawer/AboutDrawer";
|
|
31
|
-
import { SidebarDrawer } from "./sidebar-drawer/SidebarDrawer";
|
|
3
|
+
import { OrgUnitDetailsNavbar } from "../../../org-units/components";
|
|
4
|
+
import { useBuyerPortal } from "../../hooks";
|
|
32
5
|
|
|
33
6
|
import type { OrgUnitBasicData } from "../../../org-units/types";
|
|
34
7
|
|
|
@@ -46,103 +19,31 @@ export type NavbarProps = {
|
|
|
46
19
|
loading?: boolean;
|
|
47
20
|
};
|
|
48
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The Organization Account has a single header for every account, with or
|
|
24
|
+
* without SUMA: the tabs layouts render the same `OrgUnitDetailsNavbar` as
|
|
25
|
+
* the other pages, with the Menu drawer showing their full navigation.
|
|
26
|
+
*/
|
|
49
27
|
export const Navbar = ({
|
|
50
28
|
orgUnit,
|
|
51
29
|
person,
|
|
52
30
|
pageName,
|
|
53
31
|
loading = false,
|
|
54
32
|
contractId = "",
|
|
55
|
-
...otherProps
|
|
56
33
|
}: NavbarProps) => {
|
|
57
|
-
const {
|
|
58
|
-
const { resolveLink } = useLink();
|
|
59
|
-
const {
|
|
60
|
-
open: openSidebarMenu,
|
|
61
|
-
isOpen: isOpenSidebarMenuDrawerOpen,
|
|
62
|
-
...deleteOpenSidebarMenuDrawerProps
|
|
63
|
-
} = useDrawerProps();
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
open: openAboutMenu,
|
|
67
|
-
isOpen: isOpenAboutMenu,
|
|
68
|
-
...aboutMenuDrawerProps
|
|
69
|
-
} = useDrawerProps();
|
|
34
|
+
const { currentUser } = useBuyerPortal();
|
|
70
35
|
|
|
71
36
|
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<Skeleton
|
|
84
|
-
data-fs-bp-nav-breadcrumb-skeleton
|
|
85
|
-
size={{ width: "22rem", height: "2.5rem" }}
|
|
86
|
-
/>
|
|
87
|
-
) : (
|
|
88
|
-
<OrgUnitBreadcrumb
|
|
89
|
-
orgUnit={orgUnit}
|
|
90
|
-
userId={person.id}
|
|
91
|
-
userRoles={person.roles ?? []}
|
|
92
|
-
maxItems={1}
|
|
93
|
-
hasDropdown
|
|
94
|
-
/>
|
|
95
|
-
)}
|
|
96
|
-
<div data-fs-bp-nav-menu-actions>
|
|
97
|
-
<LocalizationButton
|
|
98
|
-
saveLabel={t("shared.buttons.save")}
|
|
99
|
-
currencyLabel={t("layouts.labels.currency")}
|
|
100
|
-
languageLabel={t("layouts.labels.language")}
|
|
101
|
-
icon="Globe"
|
|
102
|
-
/>
|
|
103
|
-
<Link
|
|
104
|
-
href={resolveLink("/")}
|
|
105
|
-
target="_blank"
|
|
106
|
-
data-fs-bp-nav-menu-start-shopping-link
|
|
107
|
-
>
|
|
108
|
-
{t("layouts.navigation.startShopping")}
|
|
109
|
-
</Link>
|
|
110
|
-
|
|
111
|
-
<IconButton
|
|
112
|
-
data-fs-bp-nav-about-trigger
|
|
113
|
-
icon={<Icon name="CircleQuestionMark" width={24} height={24} />}
|
|
114
|
-
aria-label={"open about menu"}
|
|
115
|
-
onClick={openAboutMenu}
|
|
116
|
-
/>
|
|
117
|
-
<Dropdown>
|
|
118
|
-
<BasicDropdownMenu.Trigger iconSize={20} iconName="AccountCircle" />
|
|
119
|
-
<DropdownMenu align="right" data-fs-bp-nav-menu>
|
|
120
|
-
<ProfileSummary
|
|
121
|
-
data-fs-bp-nav-menu-profile-summary
|
|
122
|
-
onLogoutClick={doLogout}
|
|
123
|
-
orgName={orgUnit?.name ?? ""}
|
|
124
|
-
person={person}
|
|
125
|
-
/>
|
|
126
|
-
</DropdownMenu>
|
|
127
|
-
</Dropdown>
|
|
128
|
-
</div>
|
|
129
|
-
</nav>
|
|
130
|
-
{isOpenSidebarMenuDrawerOpen && (
|
|
131
|
-
<SidebarDrawer
|
|
132
|
-
orgUnitName={orgUnit?.name ?? ""}
|
|
133
|
-
pageName={pageName}
|
|
134
|
-
{...deleteOpenSidebarMenuDrawerProps}
|
|
135
|
-
isOpen={isOpenSidebarMenuDrawerOpen}
|
|
136
|
-
/>
|
|
137
|
-
)}
|
|
138
|
-
{isOpenAboutMenu && (
|
|
139
|
-
<AboutDrawer
|
|
140
|
-
contractId={contractId}
|
|
141
|
-
{...aboutMenuDrawerProps}
|
|
142
|
-
unitId={orgUnit?.id ?? ""}
|
|
143
|
-
isOpen={isOpenAboutMenu}
|
|
144
|
-
/>
|
|
145
|
-
)}
|
|
146
|
-
</>
|
|
37
|
+
<OrgUnitDetailsNavbar
|
|
38
|
+
orgId={orgUnit?.id ?? ""}
|
|
39
|
+
contractId={contractId}
|
|
40
|
+
person={{
|
|
41
|
+
name: person.name,
|
|
42
|
+
email: person.email ?? currentUser?.email ?? "",
|
|
43
|
+
}}
|
|
44
|
+
loading={loading}
|
|
45
|
+
sidebarVariant="full"
|
|
46
|
+
pageName={pageName}
|
|
47
|
+
/>
|
|
147
48
|
);
|
|
148
49
|
};
|