@vtex/faststore-plugin-buyer-portal 1.1.97 → 1.1.98
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/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbDropdown.tsx +5 -1
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbLink.tsx +2 -1
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbPath.tsx +1 -0
- package/src/features/org-units/components/OrgUnitBreadcrumb/org-unit-breadcrumb.scss +5 -1
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +17 -9
- package/src/features/org-units/types/OrgUnitBreadcrumbTypes.ts +1 -0
- package/src/features/shared/layouts/BaseTabsLayout/Navbar.tsx +17 -9
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +1 -0
- package/src/features/shared/layouts/FinanceTabsLayout/FinanceTabsLayout.tsx +1 -0
- package/src/features/shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout.tsx +1 -0
- package/src/themes/index.scss +5 -1
package/package.json
CHANGED
|
@@ -11,7 +11,11 @@ export const OrgUnitBreadcrumbDropdown = ({
|
|
|
11
11
|
const { push } = useRouter();
|
|
12
12
|
|
|
13
13
|
const dropdownItems = items.map((item) => (
|
|
14
|
-
<DropdownItem
|
|
14
|
+
<DropdownItem
|
|
15
|
+
onClick={() => push(item.item)}
|
|
16
|
+
key={item.item}
|
|
17
|
+
disabled={!item.enabled}
|
|
18
|
+
>
|
|
15
19
|
<Icon name="Folder" width={20} height={20} />
|
|
16
20
|
{item.name}
|
|
17
21
|
</DropdownItem>
|
|
@@ -10,6 +10,7 @@ export const OrgUnitBreadcrumbLink = ({
|
|
|
10
10
|
name,
|
|
11
11
|
item,
|
|
12
12
|
isLast,
|
|
13
|
+
enabled,
|
|
13
14
|
}: OrgUnitBreadcrumbItemProps) => {
|
|
14
15
|
const [truncate, setTruncate] = useState(false);
|
|
15
16
|
const linkRef = useRef<HTMLParagraphElement | HTMLAnchorElement>(null);
|
|
@@ -23,7 +24,7 @@ export const OrgUnitBreadcrumbLink = ({
|
|
|
23
24
|
}, []);
|
|
24
25
|
|
|
25
26
|
const linkContent = (
|
|
26
|
-
<div data-fs-bp-breadcrumb-link>
|
|
27
|
+
<div data-fs-bp-breadcrumb-link data-fs-breadcrumb-disabled={!enabled}>
|
|
27
28
|
{isLast ? (
|
|
28
29
|
<p
|
|
29
30
|
ref={linkRef as React.RefObject<HTMLParagraphElement>}
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
[data-fs-breadcrumb-disabled] {
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
[data-fs-bp-breadcrumb-divider] {
|
|
51
55
|
color: #858585;
|
|
52
56
|
flex: 0 0 auto;
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
border-radius: var(--fs-border-radius-pill);
|
|
66
70
|
|
|
67
71
|
&:hover {
|
|
68
|
-
background-color: #
|
|
72
|
+
background-color: #f5f5f5;
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
OrgUnitDetailsNavbar,
|
|
28
28
|
OrgUnitsDropdownMenu,
|
|
29
29
|
} from "../../components";
|
|
30
|
+
import { useOrgUnitByUser } from "../../hooks";
|
|
30
31
|
|
|
31
32
|
import {
|
|
32
33
|
MAX_DESKTOP_BREADCRUMB_ITEMS,
|
|
@@ -54,15 +55,22 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
54
55
|
const isMobile = useMediaQuery(QUERY_TABLET);
|
|
55
56
|
|
|
56
57
|
const isSingleContract = contracts.length <= 1;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
|
|
59
|
+
const { orgUnit: userUnit } = useOrgUnitByUser(user?.id ?? "");
|
|
60
|
+
|
|
61
|
+
const orgUnitList = orgUnit?.path.ids.split("/").slice(1) ?? [];
|
|
62
|
+
|
|
63
|
+
const userUnitIndex = orgUnitList.findIndex(
|
|
64
|
+
(unitId) => unitId === userUnit?.id
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const breadcrumbList = orgUnitList.map((orgUnitId, index) => ({
|
|
68
|
+
unitId: orgUnitId,
|
|
69
|
+
item: buyerPortalRoutes.orgUnitDetails({ orgUnitId }),
|
|
70
|
+
name: orgUnit.path.names.split("/")[index],
|
|
71
|
+
position: index + 1,
|
|
72
|
+
enabled: index >= userUnitIndex,
|
|
73
|
+
}));
|
|
66
74
|
|
|
67
75
|
return (
|
|
68
76
|
<GlobalLayout>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "@faststore/ui";
|
|
12
12
|
|
|
13
13
|
import { OrgUnitBreadcrumb } from "../../../org-units/components";
|
|
14
|
+
import { useOrgUnitByUser } from "../../../org-units/hooks";
|
|
14
15
|
import { ProfileSummary } from "../../../profile/components";
|
|
15
16
|
import { Icon } from "../../components/Icon";
|
|
16
17
|
import { useDrawerProps } from "../../hooks";
|
|
@@ -28,6 +29,7 @@ export type NavbarProps = {
|
|
|
28
29
|
image?: ReactNode;
|
|
29
30
|
name: string;
|
|
30
31
|
role?: string;
|
|
32
|
+
id: string;
|
|
31
33
|
};
|
|
32
34
|
loading?: boolean;
|
|
33
35
|
};
|
|
@@ -45,17 +47,23 @@ export const Navbar = ({
|
|
|
45
47
|
...deleteOpenSidebarMenuDrawerProps
|
|
46
48
|
} = useDrawerProps();
|
|
47
49
|
|
|
50
|
+
const { orgUnit: userUnit } = useOrgUnitByUser(person.id);
|
|
51
|
+
|
|
52
|
+
const orgUnitList = orgUnit?.path.ids.split("/").slice(1) ?? [];
|
|
53
|
+
|
|
54
|
+
const userUnitIndex = orgUnitList.findIndex(
|
|
55
|
+
(unitId) => unitId === userUnit?.id
|
|
56
|
+
);
|
|
57
|
+
|
|
48
58
|
const breadcrumbList = loading
|
|
49
59
|
? []
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
position: index + 1,
|
|
58
|
-
})) ?? [];
|
|
60
|
+
: orgUnitList.map((orgUnitId, index) => ({
|
|
61
|
+
unitId: orgUnitId,
|
|
62
|
+
item: buyerPortalRoutes.orgUnitDetails({ orgUnitId }),
|
|
63
|
+
name: orgUnit?.path.names.split("/")[index] ?? "",
|
|
64
|
+
position: index + 1,
|
|
65
|
+
enabled: index >= userUnitIndex,
|
|
66
|
+
}));
|
|
59
67
|
|
|
60
68
|
return (
|
|
61
69
|
<>
|
package/src/themes/index.scss
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// Colors (Branding Core)
|
|
13
13
|
// --------------------------------------------------------
|
|
14
14
|
// --fs-color-main-0: blue;
|
|
15
|
-
--fs-color-neutral-7: #
|
|
15
|
+
--fs-color-neutral-7: #5c5c5c;
|
|
16
16
|
--fs-text-color-secondary: #1f1f1f;
|
|
17
17
|
--fs-text-color-button: #0068d7;
|
|
18
18
|
--fs-bkg-color-secondary: #f5f5f5;
|
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
width: 12.5rem;
|
|
55
55
|
[data-fs-dropdown-item] {
|
|
56
56
|
--fs-dropdown-item-color: black !important;
|
|
57
|
+
|
|
58
|
+
&:disabled {
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
[data-fs-dropdown-active-item] {
|