@griddo/ax 1.73.28 → 1.74.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/config/griddo-config/index.js +24 -3
- package/config/webpackSchemas.config.js +3 -5
- package/package.json +3 -2
- package/scripts/griddo-sync-schemas.js +4 -3
- package/src/__mocks__/axios/SitesList.ts +84 -0
- package/src/__mocks__/store/SitesList.ts +714 -0
- package/src/__tests__/components/Avatar/Avatar.test.tsx +119 -0
- package/src/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +61 -0
- package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +10 -10
- package/src/__tests__/components/LanguageMenu/LanguageMenu.test.tsx +221 -0
- package/src/__tests__/components/Loading/Loading.test.tsx +23 -0
- package/src/__tests__/components/Login/Login.test.tsx +247 -0
- package/src/__tests__/components/Login/RecoveryModal/RecoveryModal.test.tsx +185 -0
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +6 -6
- package/src/__tests__/modules/Sites/Sites.test.tsx +259 -0
- package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +51 -0
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +896 -0
- package/src/api/sites.tsx +43 -4
- package/src/components/ActionMenu/index.tsx +1 -1
- package/src/components/Avatar/index.tsx +4 -4
- package/src/components/Browser/index.tsx +27 -20
- package/src/components/BrowserContent/index.tsx +6 -0
- package/src/components/Fields/AsyncSelect/style.tsx +6 -3
- package/src/components/Fields/CheckField/index.tsx +1 -0
- package/src/components/Fields/DateField/style.tsx +3 -1
- package/src/components/Fields/HeadingField/index.tsx +14 -5
- package/src/components/Fields/ImageField/index.tsx +3 -0
- package/src/components/Fields/ImageField/style.tsx +2 -2
- package/src/components/Fields/Select/style.tsx +2 -0
- package/src/components/Fields/SliderField/index.tsx +2 -1
- package/src/components/Fields/TextField/index.tsx +1 -0
- package/src/components/Icon/components/BulletList.js +16 -0
- package/src/components/Icon/components/Grid2.js +16 -0
- package/src/components/Icon/svgs/Bullet-list.svg +3 -0
- package/src/components/Icon/svgs/Grid-2.svg +3 -0
- package/src/components/IconAction/index.tsx +4 -2
- package/src/components/IconAction/style.tsx +8 -2
- package/src/components/LanguageMenu/index.tsx +13 -6
- package/src/components/Login/RecoveryModal/index.tsx +5 -4
- package/src/components/Login/index.tsx +13 -3
- package/src/components/Login/style.tsx +12 -25
- package/src/components/Pagination/style.tsx +1 -1
- package/src/components/SearchField/index.tsx +9 -1
- package/src/components/SideModal/style.tsx +8 -8
- package/src/components/TableFilters/LastAccessFilter/index.tsx +52 -0
- package/src/components/TableFilters/LastAccessFilter/style.tsx +31 -0
- package/src/components/TableFilters/LiveFilter/index.tsx +7 -5
- package/src/components/TableFilters/NameFilter/index.tsx +4 -3
- package/src/components/TableFilters/index.tsx +2 -0
- package/src/components/TableList/index.tsx +2 -1
- package/src/components/TableList/style.tsx +2 -2
- package/src/components/index.tsx +2 -0
- package/src/containers/App/actions.tsx +5 -0
- package/src/containers/App/interfaces.tsx +1 -1
- package/src/containers/App/reducer.tsx +1 -1
- package/src/containers/Navigation/Defaults/actions.tsx +3 -1
- package/src/containers/PageEditor/actions.tsx +6 -3
- package/src/containers/Sites/actions.tsx +76 -11
- package/src/containers/Sites/constants.tsx +2 -0
- package/src/containers/Sites/interfaces.tsx +12 -0
- package/src/containers/Sites/reducer.tsx +8 -0
- package/src/helpers/schemas.tsx +27 -1
- package/src/hooks/iframe.ts +56 -0
- package/src/hooks/index.tsx +3 -0
- package/src/modules/Content/index.tsx +4 -3
- package/src/modules/FramePreview/index.tsx +25 -39
- package/src/modules/GlobalEditor/Editor/index.tsx +2 -2
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +16 -4
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +11 -7
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +4 -3
- package/src/modules/Navigation/Menus/List/Table/SidePanel/Form/index.tsx +1 -0
- package/src/modules/PageEditor/Editor/index.tsx +2 -2
- package/src/modules/PageEditor/PageBrowser/index.tsx +16 -4
- package/src/modules/PageEditor/index.tsx +8 -7
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/Field/index.tsx +12 -11
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/index.tsx +3 -17
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/style.tsx +2 -10
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +72 -0
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/style.tsx +32 -0
- package/src/modules/Sites/SitesList/{SiteItem → GridView/GridSiteItem}/index.tsx +17 -27
- package/src/modules/Sites/SitesList/{SiteItem → GridView/GridSiteItem}/style.tsx +14 -25
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +64 -0
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/style.tsx +50 -0
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +75 -0
- package/src/modules/Sites/SitesList/ListView/BulkHeader/style.tsx +8 -0
- package/src/modules/Sites/SitesList/ListView/ListSiteItem/index.tsx +200 -0
- package/src/modules/Sites/SitesList/ListView/ListSiteItem/style.tsx +112 -0
- package/src/modules/Sites/SitesList/RecentSiteItem/index.tsx +50 -0
- package/src/modules/Sites/SitesList/RecentSiteItem/style.tsx +28 -0
- package/src/modules/Sites/SitesList/SiteModal/index.tsx +4 -3
- package/src/modules/Sites/SitesList/atoms.tsx +47 -0
- package/src/modules/Sites/SitesList/hooks.tsx +102 -0
- package/src/modules/Sites/SitesList/index.tsx +272 -19
- package/src/modules/Sites/SitesList/style.tsx +157 -4
- package/src/modules/Sites/SitesList/utils.tsx +33 -0
- package/src/modules/Sites/index.tsx +6 -11
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +1 -1
- package/src/types/index.tsx +25 -2
|
@@ -34,6 +34,7 @@ const Text = styled.div`
|
|
|
34
34
|
|
|
35
35
|
const CategoriesWrapper = styled.div`
|
|
36
36
|
margin-top: ${(p) => p.theme.spacing.m};
|
|
37
|
+
padding-bottom: ${(p) => p.theme.spacing.m};
|
|
37
38
|
`;
|
|
38
39
|
|
|
39
40
|
const StyledButton = styled(Button)`
|
|
@@ -42,13 +43,4 @@ const StyledButton = styled(Button)`
|
|
|
42
43
|
right: 0;
|
|
43
44
|
`;
|
|
44
45
|
|
|
45
|
-
export {
|
|
46
|
-
Heading,
|
|
47
|
-
Config,
|
|
48
|
-
ModalContent,
|
|
49
|
-
SubscribeWrapper,
|
|
50
|
-
SectionContent,
|
|
51
|
-
Text,
|
|
52
|
-
StyledButton,
|
|
53
|
-
CategoriesWrapper,
|
|
54
|
-
};
|
|
46
|
+
export { Heading, Config, ModalContent, SubscribeWrapper, SectionContent, Text, StyledButton, CategoriesWrapper };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Icon, FloatingMenu, ListTitle, ListItem } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
|
|
7
|
+
const GridHeaderFilter = ({ sortItems, sortedState }: IGridHeaderFilterProps): JSX.Element => {
|
|
8
|
+
const { isAscending, sortedByTitle, sortedByLastAccess, sortedByDateCreated } = sortedState;
|
|
9
|
+
|
|
10
|
+
const sortAscendingName = () => sortItems("name", true);
|
|
11
|
+
const sortDescendingName = () => sortItems("name", false);
|
|
12
|
+
const sortAscendingLastAccess = () => sortItems("lastAccess", true);
|
|
13
|
+
const sortDescendingLastAccess = () => sortItems("lastAccess", false);
|
|
14
|
+
const sortAscendingDateCreated = () => sortItems("dateCreated", true);
|
|
15
|
+
const sortDescendingDateCreated = () => sortItems("dateCreated", false);
|
|
16
|
+
|
|
17
|
+
const SortedStateArrow = () =>
|
|
18
|
+
isAscending ? <Icon name="FullArrowUp" size="16" /> : <Icon name="FullArrowDown" size="16" />;
|
|
19
|
+
|
|
20
|
+
const isActive = sortedByTitle || sortedByLastAccess;
|
|
21
|
+
|
|
22
|
+
const getFilterLabel = () => {
|
|
23
|
+
if (sortedByTitle) return "Name";
|
|
24
|
+
if (sortedByLastAccess) return "Last access";
|
|
25
|
+
if (sortedByDateCreated) return "Creation date";
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Button = () => (
|
|
29
|
+
<S.FloatingMenuButton isActive={isActive} data-testid="grid-floating-menu-button">
|
|
30
|
+
<S.Label data-testid="filter-label">{getFilterLabel()}</S.Label>
|
|
31
|
+
<S.IconsWrapper>
|
|
32
|
+
{isActive && <SortedStateArrow />}
|
|
33
|
+
<S.InteractiveArrow>
|
|
34
|
+
<Icon name="DownArrow" size="16" />
|
|
35
|
+
</S.InteractiveArrow>
|
|
36
|
+
</S.IconsWrapper>
|
|
37
|
+
</S.FloatingMenuButton>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<FloatingMenu Button={Button} position="left">
|
|
42
|
+
<ListTitle>Name Sorting</ListTitle>
|
|
43
|
+
<ListItem isSelected={sortedByTitle && isAscending} onClick={sortAscendingName}>
|
|
44
|
+
Ascendent
|
|
45
|
+
</ListItem>
|
|
46
|
+
<ListItem isSelected={sortedByTitle && !isAscending} onClick={sortDescendingName}>
|
|
47
|
+
Descendent
|
|
48
|
+
</ListItem>
|
|
49
|
+
<ListTitle>Sort by access date</ListTitle>
|
|
50
|
+
<ListItem isSelected={sortedByLastAccess && !isAscending} onClick={sortDescendingLastAccess}>
|
|
51
|
+
Newest
|
|
52
|
+
</ListItem>
|
|
53
|
+
<ListItem isSelected={sortedByLastAccess && isAscending} onClick={sortAscendingLastAccess}>
|
|
54
|
+
Oldest
|
|
55
|
+
</ListItem>
|
|
56
|
+
<ListTitle>Sort by creation</ListTitle>
|
|
57
|
+
<ListItem isSelected={sortedByDateCreated && isAscending} onClick={sortAscendingDateCreated}>
|
|
58
|
+
Newest
|
|
59
|
+
</ListItem>
|
|
60
|
+
<ListItem isSelected={sortedByDateCreated && !isAscending} onClick={sortDescendingDateCreated}>
|
|
61
|
+
Oldest
|
|
62
|
+
</ListItem>
|
|
63
|
+
</FloatingMenu>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export interface IGridHeaderFilterProps {
|
|
68
|
+
sortedState: any;
|
|
69
|
+
sortItems(orderPointer: string, isAscending: boolean): any;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default GridHeaderFilter;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Header } from "@ax/components/TableList/style";
|
|
3
|
+
|
|
4
|
+
const FloatingMenuButton = styled(Header)<{ isActive: boolean }>`
|
|
5
|
+
padding-left: ${(p) => p.theme.spacing.xxs};
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
&:hover {
|
|
8
|
+
color: ${(p) => p.theme.color.interactive01};
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const IconsWrapper = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
svg {
|
|
17
|
+
margin-left: 4px;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const InteractiveArrow = styled.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
svg {
|
|
24
|
+
path {
|
|
25
|
+
fill: ${(p) => p.theme.color.interactive01};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const Label = styled.span``;
|
|
31
|
+
|
|
32
|
+
export { FloatingMenuButton, IconsWrapper, InteractiveArrow, Label };
|
|
@@ -2,15 +2,17 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import { useModal } from "@ax/hooks";
|
|
5
|
-
import {
|
|
5
|
+
import { isDevelopment } from "@ax/helpers";
|
|
6
6
|
import { ISite } from "@ax/types";
|
|
7
7
|
import { appActions } from "@ax/containers/App";
|
|
8
8
|
import { sitesActions } from "@ax/containers/Sites";
|
|
9
|
-
import { FieldsBehavior, Icon, Modal, Tooltip
|
|
9
|
+
import { FieldsBehavior, Icon, Modal, Tooltip } from "@ax/components";
|
|
10
|
+
|
|
11
|
+
import { ItemName, ItemThumbnail } from "./../../atoms";
|
|
10
12
|
|
|
11
13
|
import * as S from "./style";
|
|
12
14
|
|
|
13
|
-
const
|
|
15
|
+
const GridSiteItem = (props: IGridSiteItemProps): JSX.Element => {
|
|
14
16
|
const { site, setSiteInfo, setHistoryPush, deleteSite, publishSite, unpublishSite } = props;
|
|
15
17
|
const { isOpen: isOpenDelete, toggleModal: toggleDeleteModal } = useModal();
|
|
16
18
|
const { isOpen: isOpenPublish, toggleModal: togglePublishModal } = useModal();
|
|
@@ -35,15 +37,8 @@ const SiteItem = (props: ISiteItemProps): JSX.Element => {
|
|
|
35
37
|
"offline-pending": "Offline pending",
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
const thumbnailPlaceholder = "/img/placeholder/thumbnail@1x.png";
|
|
39
|
-
const thumbnail = site.thumbnail ? (
|
|
40
|
-
<Image width={238} height={178} url={site.thumbnail} />
|
|
41
|
-
) : (
|
|
42
|
-
<S.Thumbnail backgroundUrl={thumbnailPlaceholder} />
|
|
43
|
-
);
|
|
44
|
-
|
|
45
40
|
const setSite = async () => {
|
|
46
|
-
|
|
41
|
+
setSiteInfo(site);
|
|
47
42
|
const contentPath = "/sites/pages";
|
|
48
43
|
setHistoryPush(contentPath, false);
|
|
49
44
|
};
|
|
@@ -117,23 +112,18 @@ const SiteItem = (props: ISiteItemProps): JSX.Element => {
|
|
|
117
112
|
|
|
118
113
|
const { title, mainAction, secondaryAction, content } = getPublishModal(site.isPublished);
|
|
119
114
|
|
|
120
|
-
const siteName =
|
|
121
|
-
site.name.length > 40 ? (
|
|
122
|
-
<Tooltip content={site.name} left={120}>
|
|
123
|
-
{trimText(site.name, 40)}
|
|
124
|
-
</Tooltip>
|
|
125
|
-
) : (
|
|
126
|
-
site.name
|
|
127
|
-
);
|
|
128
|
-
|
|
129
115
|
const siteTooltip = isDevelopment() && `Site id: ${site.id}`;
|
|
130
116
|
|
|
131
117
|
return (
|
|
132
118
|
<>
|
|
133
|
-
<S.SiteWrapper key={site.id} onClick={setSite}>
|
|
134
|
-
<Tooltip content={siteTooltip}>
|
|
119
|
+
<S.SiteWrapper key={site.id} onClick={setSite} data-testid="grid-site-item">
|
|
120
|
+
<Tooltip content={siteTooltip}>
|
|
121
|
+
<ItemThumbnail src={site.thumbnail} width={280} height={199} />
|
|
122
|
+
</Tooltip>
|
|
135
123
|
<S.Wrapper>
|
|
136
|
-
<S.Title>
|
|
124
|
+
<S.Title>
|
|
125
|
+
<ItemName name={site.name} length={40} />
|
|
126
|
+
</S.Title>
|
|
137
127
|
<S.IconsWrapper>
|
|
138
128
|
<Tooltip content={publishedTooltip[publishedState]}>
|
|
139
129
|
{publishedState && <Icon name={publishedState} size="24" />}
|
|
@@ -150,7 +140,7 @@ const SiteItem = (props: ISiteItemProps): JSX.Element => {
|
|
|
150
140
|
mainAction={mainDeleteAction}
|
|
151
141
|
>
|
|
152
142
|
{isOpenDelete ? (
|
|
153
|
-
<S.ModalContent>
|
|
143
|
+
<S.ModalContent data-testid="delete-modal">
|
|
154
144
|
<p>
|
|
155
145
|
Are you sure you want to delete <strong>‘{site.name}’</strong> site?
|
|
156
146
|
<br />
|
|
@@ -170,13 +160,13 @@ const SiteItem = (props: ISiteItemProps): JSX.Element => {
|
|
|
170
160
|
secondaryAction={secondaryAction}
|
|
171
161
|
mainAction={mainAction}
|
|
172
162
|
>
|
|
173
|
-
{isOpenPublish ? <S.ModalContent>{content}</S.ModalContent> : null}
|
|
163
|
+
{isOpenPublish ? <S.ModalContent data-testid="publish-modal">{content}</S.ModalContent> : null}
|
|
174
164
|
</Modal>
|
|
175
165
|
</>
|
|
176
166
|
);
|
|
177
167
|
};
|
|
178
168
|
|
|
179
|
-
interface
|
|
169
|
+
interface IGridSiteItemProps {
|
|
180
170
|
site: ISite;
|
|
181
171
|
setSiteInfo(currentSiteInfo: any): void;
|
|
182
172
|
setHistoryPush(page: string, isEditor: boolean): void;
|
|
@@ -193,4 +183,4 @@ const mapDispatchToProps = {
|
|
|
193
183
|
unpublishSite: sitesActions.unpublishSite,
|
|
194
184
|
};
|
|
195
185
|
|
|
196
|
-
export default connect(null, mapDispatchToProps)(
|
|
186
|
+
export default connect(null, mapDispatchToProps)(GridSiteItem);
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import ActionMenu from "
|
|
2
|
+
import { ActionMenu } from "@ax/components";
|
|
3
3
|
|
|
4
4
|
const SiteWrapper = styled.div`
|
|
5
|
-
background: ${p => p.theme.color.uiBackground02};
|
|
6
|
-
height: 252px;
|
|
5
|
+
background: ${(p) => p.theme.color.uiBackground02};
|
|
7
6
|
border-radius: 4px;
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
9
|
align-items: flex-start;
|
|
11
|
-
padding: ${p => p.theme.spacing.s};
|
|
10
|
+
padding: ${(p) => p.theme.spacing.s};
|
|
12
11
|
cursor: pointer;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
background: url(${p => p.backgroundUrl}) no-repeat;
|
|
17
|
-
background-size: cover;
|
|
18
|
-
min-height: 178px;
|
|
19
|
-
width: 238px;
|
|
12
|
+
div {
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
}
|
|
20
15
|
`;
|
|
21
16
|
|
|
22
17
|
const Wrapper = styled.div`
|
|
23
18
|
position: relative;
|
|
24
|
-
margin-top: ${p => p.theme.spacing.xs};
|
|
19
|
+
margin-top: ${(p) => p.theme.spacing.xs};
|
|
25
20
|
display: flex;
|
|
26
21
|
align-items: center;
|
|
22
|
+
max-height: 36px;
|
|
27
23
|
width: 100%;
|
|
28
24
|
height: 100%;
|
|
29
25
|
padding-right: 36px;
|
|
@@ -31,7 +27,7 @@ const Wrapper = styled.div`
|
|
|
31
27
|
`;
|
|
32
28
|
|
|
33
29
|
const Title = styled.span`
|
|
34
|
-
${p => p.theme.textStyle.headingXS};
|
|
30
|
+
${(p) => p.theme.textStyle.headingXS};
|
|
35
31
|
`;
|
|
36
32
|
|
|
37
33
|
const IconsWrapper = styled.div`
|
|
@@ -47,23 +43,16 @@ const StyledActionMenu = styled(ActionMenu)`
|
|
|
47
43
|
`;
|
|
48
44
|
|
|
49
45
|
const ModalContent = styled.div`
|
|
50
|
-
padding: ${p => p.theme.spacing.m};
|
|
46
|
+
padding: ${(p) => p.theme.spacing.m};
|
|
51
47
|
|
|
52
48
|
p:nth-child(1) {
|
|
53
|
-
margin-bottom: ${p => p.theme.spacing.m};
|
|
49
|
+
margin-bottom: ${(p) => p.theme.spacing.m};
|
|
54
50
|
}
|
|
55
51
|
|
|
56
52
|
p:nth-child(2) {
|
|
57
|
-
margin-bottom: ${p => p.theme.spacing.xxs};
|
|
53
|
+
margin-bottom: ${(p) => p.theme.spacing.xxs};
|
|
58
54
|
}
|
|
59
55
|
`;
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Thumbnail,
|
|
64
|
-
Wrapper,
|
|
65
|
-
Title,
|
|
66
|
-
IconsWrapper,
|
|
67
|
-
StyledActionMenu,
|
|
68
|
-
ModalContent
|
|
69
|
-
}
|
|
57
|
+
|
|
58
|
+
export { SiteWrapper, Wrapper, Title, IconsWrapper, StyledActionMenu, ModalContent };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { CheckField, TableCounter, LastAccessFilter, NameFilter, LiveFilter } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
|
|
7
|
+
const TableHeader = (props: IProps): JSX.Element => {
|
|
8
|
+
const {
|
|
9
|
+
isScrolling,
|
|
10
|
+
selectAllItems,
|
|
11
|
+
checkState,
|
|
12
|
+
sortItems,
|
|
13
|
+
filterItems,
|
|
14
|
+
sortedListStatus,
|
|
15
|
+
totalItems,
|
|
16
|
+
filterValues,
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const liveStatusValue: any = {
|
|
20
|
+
all: "all",
|
|
21
|
+
online: "active",
|
|
22
|
+
offline: "offline",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<S.TableHeader isScrolling={isScrolling} data-testid="sites-table-header">
|
|
27
|
+
<S.CheckHeader>
|
|
28
|
+
<CheckField
|
|
29
|
+
key="selectAll"
|
|
30
|
+
name="selectAll"
|
|
31
|
+
value="selectAll"
|
|
32
|
+
onChange={selectAllItems}
|
|
33
|
+
checked={checkState.isAllSelected}
|
|
34
|
+
disabled={false}
|
|
35
|
+
error={false}
|
|
36
|
+
/>
|
|
37
|
+
</S.CheckHeader>
|
|
38
|
+
<S.NameWrapper>
|
|
39
|
+
<NameFilter sortItems={sortItems} sortedState={sortedListStatus} pointer="name" />
|
|
40
|
+
</S.NameWrapper>
|
|
41
|
+
<S.DomainHeader>Domain</S.DomainHeader>
|
|
42
|
+
<S.LiveHeader>
|
|
43
|
+
<LiveFilter filterItems={filterItems} value={liveStatusValue[filterValues.liveStatus]} hasBasicStatus={true} />
|
|
44
|
+
</S.LiveHeader>
|
|
45
|
+
<S.LastAccessCell>
|
|
46
|
+
<LastAccessFilter sortItems={sortItems} sortedState={sortedListStatus} />
|
|
47
|
+
</S.LastAccessCell>
|
|
48
|
+
<TableCounter totalItems={totalItems} />
|
|
49
|
+
</S.TableHeader>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
interface IProps {
|
|
54
|
+
isScrolling: boolean;
|
|
55
|
+
totalItems: number;
|
|
56
|
+
selectAllItems: () => void;
|
|
57
|
+
checkState: Record<string, boolean>;
|
|
58
|
+
sortItems: (orderPointer: string, isAscending: boolean) => void;
|
|
59
|
+
filterItems: (filterPointer: string, filtersSelected: string) => void;
|
|
60
|
+
sortedListStatus: { isAscending: boolean; sortedByDate: boolean; sortedByTitle: boolean; sortedByURL: boolean };
|
|
61
|
+
filterValues: any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default TableHeader;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
import { Header } from "@ax/components/TableList/style";
|
|
4
|
+
|
|
5
|
+
const TableHeader = styled.div<{ isScrolling?: boolean }>`
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
padding: ${(p) => p.theme.spacing.m};
|
|
10
|
+
border-bottom: ${(p) => (p.isScrolling ? `1px solid ${p.theme.color.uiLine};` : "")};
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const HeaderWrapper = styled.div`
|
|
14
|
+
position: relative;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const CheckHeader = styled(Header)`
|
|
18
|
+
padding-right: 0;
|
|
19
|
+
width: 40px;
|
|
20
|
+
label {
|
|
21
|
+
margin-bottom: ${(p) => p.theme.spacing.s};
|
|
22
|
+
}
|
|
23
|
+
> div {
|
|
24
|
+
width: ${(p) => p.theme.spacing.s};
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const NameWrapper = styled.div`
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 438px;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const DomainHeader = styled(Header)`
|
|
34
|
+
flex-grow: 1;
|
|
35
|
+
position: relative;
|
|
36
|
+
width: 440px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const LiveHeader = styled(Header)`
|
|
40
|
+
position: relative;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const LastAccessCell = styled(Header)`
|
|
45
|
+
position: relative;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
width: 200px;
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export { TableHeader, CheckHeader, DomainHeader, LiveHeader, NameWrapper, HeaderWrapper, LastAccessCell };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { BulkSelectionOptions } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
import TableHeader from "./TableHeader";
|
|
6
|
+
|
|
7
|
+
import * as S from "./style";
|
|
8
|
+
|
|
9
|
+
const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
10
|
+
const {
|
|
11
|
+
showBulk,
|
|
12
|
+
checkState,
|
|
13
|
+
bulkPublish,
|
|
14
|
+
bulkUnpublish,
|
|
15
|
+
selectItems,
|
|
16
|
+
selectAllItems,
|
|
17
|
+
totalItems,
|
|
18
|
+
sortItems,
|
|
19
|
+
filterItems,
|
|
20
|
+
sortedListStatus,
|
|
21
|
+
filterValues,
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const actions = [
|
|
25
|
+
{
|
|
26
|
+
icon: "upload-pending",
|
|
27
|
+
text: "publish",
|
|
28
|
+
action: bulkPublish,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
icon: "offline",
|
|
32
|
+
text: "unpublish",
|
|
33
|
+
action: bulkUnpublish,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
return showBulk ? (
|
|
38
|
+
<S.BulkWrapper data-testid="sites-list-bulk-wrapper">
|
|
39
|
+
<BulkSelectionOptions
|
|
40
|
+
isScrolling={false}
|
|
41
|
+
checkState={checkState}
|
|
42
|
+
actions={actions}
|
|
43
|
+
selectItems={selectItems}
|
|
44
|
+
totalItems={totalItems}
|
|
45
|
+
/>
|
|
46
|
+
</S.BulkWrapper>
|
|
47
|
+
) : (
|
|
48
|
+
<TableHeader
|
|
49
|
+
isScrolling={false}
|
|
50
|
+
selectAllItems={selectAllItems}
|
|
51
|
+
checkState={checkState}
|
|
52
|
+
sortItems={sortItems}
|
|
53
|
+
filterItems={filterItems}
|
|
54
|
+
sortedListStatus={sortedListStatus}
|
|
55
|
+
totalItems={totalItems}
|
|
56
|
+
filterValues={filterValues}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export interface IBulkHeaderProps {
|
|
62
|
+
showBulk: boolean;
|
|
63
|
+
checkState: any;
|
|
64
|
+
bulkPublish: () => void;
|
|
65
|
+
bulkUnpublish: () => void;
|
|
66
|
+
selectItems: () => void;
|
|
67
|
+
selectAllItems: () => void;
|
|
68
|
+
totalItems: number;
|
|
69
|
+
sortItems: (orderPointer: string, isAscending: any) => void;
|
|
70
|
+
filterItems: (filterPointer: string, filtersSelected: string) => void;
|
|
71
|
+
sortedListStatus: any;
|
|
72
|
+
filterValues: any;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default BulkHeader;
|