@griddo/ax 1.56.9 → 1.57.2
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.js +1 -0
- package/package.json +2 -2
- package/src/components/ActionMenu/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +7 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/style.tsx +29 -24
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +7 -1
- package/src/components/Fields/ComponentArray/SameComponentArray/style.tsx +29 -24
- package/src/components/Fields/DateField/index.tsx +3 -2
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +1 -1
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +1 -1
- package/src/components/Fields/UrlField/index.tsx +12 -1
- package/src/components/Fields/Wysiwyg/config.tsx +80 -56
- package/src/components/Fields/Wysiwyg/index.tsx +23 -6
- package/src/components/FloatingMenu/index.tsx +9 -6
- package/src/components/FloatingMenu/style.tsx +8 -6
- package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +1 -1
- package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +1 -1
- package/src/components/InformativeMenu/index.tsx +3 -2
- package/src/components/InformativeMenu/style.tsx +0 -1
- package/src/components/MainWrapper/AppBar/index.tsx +8 -7
- package/src/components/MainWrapper/AppBar/style.tsx +7 -0
- package/src/components/MenuItem/style.tsx +1 -0
- package/src/components/Modal/style.tsx +14 -13
- package/src/components/Nav/index.tsx +8 -3
- package/src/components/Nav/style.tsx +5 -0
- package/src/components/SearchField/index.tsx +43 -14
- package/src/components/SearchField/style.tsx +23 -10
- package/src/components/SideModal/index.tsx +24 -8
- package/src/components/SideModal/style.tsx +13 -2
- package/src/components/SubNav/style.tsx +3 -2
- package/src/containers/Navigation/Defaults/actions.tsx +26 -24
- package/src/containers/Navigation/Defaults/reducer.tsx +2 -2
- package/src/containers/PageEditor/actions.tsx +9 -8
- package/src/containers/Settings/Social/actions.tsx +9 -31
- package/src/containers/Settings/Social/constants.tsx +2 -3
- package/src/containers/Settings/Social/interfaces.tsx +2 -7
- package/src/containers/Settings/Social/reducer.tsx +3 -14
- package/src/containers/Sites/actions.tsx +3 -63
- package/src/containers/Sites/constants.tsx +0 -1
- package/src/containers/Sites/interfaces.tsx +0 -6
- package/src/containers/Sites/reducer.tsx +1 -29
- package/src/forms/editor.tsx +2 -0
- package/src/forms/validators.tsx +2 -0
- package/src/helpers/dates.tsx +23 -24
- package/src/helpers/index.tsx +2 -0
- package/src/helpers/objects.tsx +17 -2
- package/src/helpers/schemas.tsx +7 -4
- package/src/hooks/forms.tsx +23 -24
- package/src/modules/App/Routing/NavMenu/NavItem/index.tsx +10 -5
- package/src/modules/App/Routing/NavMenu/NavItem/style.tsx +13 -9
- package/src/modules/App/Routing/NavMenu/index.tsx +39 -37
- package/src/modules/App/Routing/NavMenu/style.tsx +9 -3
- package/src/modules/Categories/CategoriesList/CategoryItem/index.tsx +1 -1
- package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/index.tsx +6 -3
- package/src/modules/Categories/CategoriesList/CategoryNav/NavItem/style.tsx +5 -1
- package/src/modules/Content/ContentFilters/index.tsx +6 -3
- package/src/modules/Content/ContentFilters/style.tsx +6 -1
- package/src/modules/Content/HeaderMenus/Live/index.tsx +1 -1
- package/src/modules/Content/HeaderMenus/Name/index.tsx +10 -4
- package/src/modules/Content/HeaderMenus/Status/index.tsx +7 -3
- package/src/modules/Content/HeaderMenus/Translations/index.tsx +1 -1
- package/src/modules/Content/HeaderMenus/Types/index.tsx +1 -1
- package/src/modules/Content/OptionTable/index.tsx +6 -3
- package/src/modules/Content/OptionTable/style.tsx +4 -0
- package/src/modules/Content/PageItem/index.tsx +3 -3
- package/src/modules/Content/index.tsx +5 -3
- package/src/modules/GlobalEditor/index.tsx +37 -14
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +33 -13
- package/src/modules/Navigation/Defaults/Item/atoms.tsx +1 -1
- package/src/modules/Navigation/Defaults/Nav/index.tsx +8 -3
- package/src/modules/Navigation/Defaults/Nav/style.tsx +4 -0
- package/src/modules/Navigation/Defaults/index.tsx +4 -0
- package/src/modules/Navigation/Menus/List/Nav/index.tsx +8 -3
- package/src/modules/Navigation/Menus/List/Nav/style.tsx +4 -0
- package/src/modules/Navigation/Menus/List/index.tsx +3 -1
- package/src/modules/Navigation/Menus/List/style.tsx +9 -1
- package/src/modules/PageEditor/index.tsx +38 -14
- package/src/modules/Settings/ContentTypes/DataPacks/AddModal/Filter/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/AddModal/SortFilter/index.tsx +1 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Nav/index.tsx +11 -6
- package/src/modules/Settings/ContentTypes/DataPacks/Nav/style.tsx +6 -1
- package/src/modules/Settings/Globals/index.tsx +19 -31
- package/src/modules/Settings/Languages/LanguagePanel/Form/index.tsx +1 -1
- package/src/modules/Settings/Languages/Table/Item/index.tsx +1 -1
- package/src/modules/Settings/Social/index.tsx +35 -91
- package/src/modules/Sites/SitesList/SiteModal/index.tsx +12 -27
- package/src/modules/Sites/SitesList/index.tsx +15 -15
- package/src/modules/StructuredData/StructuredDataList/ContentFilters/index.tsx +3 -1
- package/src/modules/StructuredData/StructuredDataList/ContentFilters/style.tsx +6 -1
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Live/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Name/index.tsx +10 -4
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Site/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Status/index.tsx +7 -3
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Translations/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/HeaderMenus/Types/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/OptionTable/index.tsx +6 -3
- package/src/modules/StructuredData/StructuredDataList/OptionTable/style.tsx +4 -0
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +1 -1
- package/src/modules/Users/UserList/HeaderMenus/Name/index.tsx +13 -5
- package/src/schemas/index.tsx +7 -0
- package/src/schemas/pages/GlobalPage.tsx +166 -0
- package/src/schemas/pages/Page.tsx +181 -0
- package/src/schemas/pages/index.tsx +4 -0
- package/src/types/index.tsx +8 -14
- package/tsconfig.paths.json +2 -1
- package/public/img/schemas/Accordion/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Accordion/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/AddressCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/AddressCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicBoxedCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicBoxedCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout006@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout006@2x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout007@1x.png +0 -0
- package/public/img/schemas/BasicContent/layouts/layout007@2x.png +0 -0
- package/public/img/schemas/BasicContent/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicContent/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/BasicIconCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/BasicIconCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/CardCollection/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/CardCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/CardCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/DownloadCollection/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/DownloadCollection/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/EventCard/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/EventCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/EventCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/EventsDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/EventsDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout003@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout003@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout004@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout004@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout005@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout005@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout006@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout006@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout007@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout007@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout008@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout008@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout009@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout009@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout010@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout010@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout011@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout011@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout012@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/layouts/layout012@2x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedAudiovisual/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/FeaturedBlock/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/FeaturedProgram/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedProgram/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeaturedText/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeaturedText/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/FeedbackForm/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/FeedbackForm/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/HeroCarousel/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/HeroCarousel/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/HeroImage/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/HeroImage/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/IconCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/IconCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/IconCenteredCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/IconCenteredCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Image/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Image/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/ImageCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/ImageCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Intro/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Intro/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/LogoCard/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/LogoCard/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/NewsDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/NewsDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/PersonDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/PersonDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/PublicationDistributor/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/PublicationDistributor/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/SchoolFooter/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/SchoolFooter/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Slider/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Slider/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/Testimonial/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/Testimonial/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Testimonial/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout001@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout001@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout002@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/layouts/layout002@2x.png +0 -0
- package/public/img/schemas/TextBluePanel/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/TextBluePanel/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/Video/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/Video/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/imgHeros.png +0 -0
- package/public/img/schemas/imgStandard.jpg +0 -0
- package/public/img/schemas/templates/BasicTemplate/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/BasicTemplate/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/templates/Error404/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/Error404/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/templates/NewsList/thumbnails/thumbnail@1x.png +0 -0
- package/public/img/schemas/templates/NewsList/thumbnails/thumbnail@2x.png +0 -0
- package/public/img/schemas/themes/LinkStyle.png +0 -0
- package/public/img/schemas/themes/LinkStyle@2x.png +0 -0
- package/public/img/schemas/themes/PrimaryStyle.png +0 -0
- package/public/img/schemas/themes/PrimaryStyle@2x.png +0 -0
- package/public/img/schemas/themes/STYLE01.png +0 -0
- package/public/img/schemas/themes/STYLE02.png +0 -0
- package/public/img/schemas/themes/STYLE03.png +0 -0
- package/public/img/schemas/themes/STYLE04.png +0 -0
- package/public/img/schemas/themes/STYLE05.png +0 -0
- package/public/img/schemas/themes/STYLE06.png +0 -0
- package/public/img/schemas/themes/SecondaryStyle.png +0 -0
- package/public/img/schemas/themes/SecondaryStyle@2x.png +0 -0
- package/src/components/MainWrapper/AppBar/SearchField/index.tsx +0 -54
- package/src/components/MainWrapper/AppBar/SearchField/style.tsx +0 -55
|
@@ -11,7 +11,6 @@ import { sitesActions } from "@ax/containers/Sites";
|
|
|
11
11
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
12
12
|
import { RouteLeavingGuard } from "@ax/guards";
|
|
13
13
|
import { useIsDirty, useModal } from "@ax/hooks";
|
|
14
|
-
import { setIsSavedData } from "@ax/forms";
|
|
15
14
|
import Editor from "./Editor";
|
|
16
15
|
|
|
17
16
|
import * as S from "./style";
|
|
@@ -39,12 +38,13 @@ const GlobalEditor = (props: IProps) => {
|
|
|
39
38
|
setCurrentSiteInfo,
|
|
40
39
|
savedSiteInfo,
|
|
41
40
|
userEditing,
|
|
41
|
+
isNewTranslation,
|
|
42
42
|
} = props;
|
|
43
43
|
|
|
44
44
|
const { isOpen, toggleModal } = useModal();
|
|
45
45
|
const { isOpen: isUnpublishOpen, toggleModal: toggleUnpublishModal } = useModal();
|
|
46
46
|
const [isPreviewMode, setIsPreviewMode] = useState(false);
|
|
47
|
-
const { isDirty } = useIsDirty(editorContent.editorContent);
|
|
47
|
+
const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent.editorContent, isNewTranslation);
|
|
48
48
|
|
|
49
49
|
const isPublished = props.pageStatus === pageStatus.PUBLISHED || props.pageStatus === pageStatus.UPLOAD_PENDING;
|
|
50
50
|
const isDraft = props.pageStatus === pageStatus.MODIFIED;
|
|
@@ -61,6 +61,9 @@ const GlobalEditor = (props: IProps) => {
|
|
|
61
61
|
const handleGetPage = async () => await getPage(pageID, true);
|
|
62
62
|
setTab(defaultTab);
|
|
63
63
|
handleGetPage();
|
|
64
|
+
if (!pageID) {
|
|
65
|
+
setIsDirty(true);
|
|
66
|
+
}
|
|
64
67
|
|
|
65
68
|
const interval = setInterval(() => {
|
|
66
69
|
pageID && sendPagePing(pageID);
|
|
@@ -97,24 +100,32 @@ const GlobalEditor = (props: IProps) => {
|
|
|
97
100
|
|
|
98
101
|
const publishPage = async () => {
|
|
99
102
|
const { updatePageStatus, savePage, pageID } = props;
|
|
100
|
-
setIsSavedData(true);
|
|
101
103
|
|
|
102
104
|
const publishPage = {
|
|
103
105
|
status: pageStatus.UPLOAD_PENDING,
|
|
104
106
|
};
|
|
105
107
|
|
|
106
|
-
pageID
|
|
108
|
+
pageID
|
|
109
|
+
? await updatePageStatus([pageID], pageStatus.UPLOAD_PENDING)
|
|
110
|
+
: await savePage(false, publishPage).then((isSaved: boolean) => {
|
|
111
|
+
if (isSaved) {
|
|
112
|
+
resetDirty();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
107
115
|
};
|
|
108
116
|
|
|
109
117
|
const publishChanges = async () => {
|
|
110
118
|
const { savePage } = props;
|
|
111
|
-
setIsSavedData(true);
|
|
112
119
|
|
|
113
120
|
const publishPage = {
|
|
114
121
|
status: pageStatus.UPLOAD_PENDING,
|
|
115
122
|
};
|
|
116
123
|
|
|
117
|
-
await savePage(false, publishPage)
|
|
124
|
+
await savePage(false, publishPage).then((isSaved: boolean) => {
|
|
125
|
+
if (isSaved) {
|
|
126
|
+
resetDirty();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
const unpublishPage = async () => {
|
|
@@ -136,17 +147,23 @@ const GlobalEditor = (props: IProps) => {
|
|
|
136
147
|
|
|
137
148
|
const handlePublishDraft = async () => {
|
|
138
149
|
const { savePage } = props;
|
|
139
|
-
|
|
140
|
-
await savePage(false, null, true)
|
|
150
|
+
|
|
151
|
+
await savePage(false, null, true).then((isSaved: boolean) => {
|
|
152
|
+
if (isSaved) {
|
|
153
|
+
resetDirty();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
141
156
|
};
|
|
142
157
|
|
|
143
158
|
const handleDiscardDraft = async () => {
|
|
144
159
|
const { discardDraft } = props;
|
|
160
|
+
resetDirty();
|
|
145
161
|
await discardDraft();
|
|
146
162
|
};
|
|
147
163
|
|
|
148
164
|
const handleDiscarChanges = async () => {
|
|
149
165
|
const { getPage, pageID } = props;
|
|
166
|
+
resetDirty();
|
|
150
167
|
await getPage(pageID, true);
|
|
151
168
|
};
|
|
152
169
|
|
|
@@ -230,7 +247,6 @@ const GlobalEditor = (props: IProps) => {
|
|
|
230
247
|
|
|
231
248
|
const handleSavePage = async () => {
|
|
232
249
|
const { savePage } = props;
|
|
233
|
-
setIsSavedData(true);
|
|
234
250
|
|
|
235
251
|
const publishPage = {
|
|
236
252
|
status: pageStatus.UPLOAD_PENDING,
|
|
@@ -238,7 +254,11 @@ const GlobalEditor = (props: IProps) => {
|
|
|
238
254
|
|
|
239
255
|
const createDraft = isPublished && !hasDraft;
|
|
240
256
|
const status = props.pageStatus === pageStatus.PUBLISHED && !createDraft ? publishPage : undefined;
|
|
241
|
-
await savePage(createDraft, status)
|
|
257
|
+
await savePage(createDraft, status).then((isSaved: boolean) => {
|
|
258
|
+
if (isSaved) {
|
|
259
|
+
resetDirty();
|
|
260
|
+
}
|
|
261
|
+
});
|
|
242
262
|
};
|
|
243
263
|
|
|
244
264
|
const goToPages = (path: string) => setRoute(path);
|
|
@@ -259,15 +279,15 @@ const GlobalEditor = (props: IProps) => {
|
|
|
259
279
|
switch (props.pageStatus) {
|
|
260
280
|
case pageStatus.PUBLISHED:
|
|
261
281
|
case pageStatus.UPLOAD_PENDING:
|
|
262
|
-
return isPublished && hasDraft ? "Save & publish" : "Save draft";
|
|
282
|
+
return !isDirty ? "Saved" : isPublished && hasDraft ? "Save & publish" : "Save draft";
|
|
263
283
|
default:
|
|
264
|
-
return "Save";
|
|
284
|
+
return !isDirty ? "Saved" : "Save";
|
|
265
285
|
}
|
|
266
286
|
};
|
|
267
287
|
|
|
268
288
|
const rightButtonProps = {
|
|
269
289
|
label: isSaving ? "Saving" : getSaveLabel(),
|
|
270
|
-
disabled: isSaving || isPreviewMode,
|
|
290
|
+
disabled: isSaving || isPreviewMode || !isDirty,
|
|
271
291
|
action: handleSavePage,
|
|
272
292
|
};
|
|
273
293
|
|
|
@@ -280,6 +300,7 @@ const GlobalEditor = (props: IProps) => {
|
|
|
280
300
|
|
|
281
301
|
const toggleDraftPage = async () => {
|
|
282
302
|
const { getPage } = props;
|
|
303
|
+
resetDirty();
|
|
283
304
|
const pageID = isDraft ? editorContent.editorContent.draftFromPage : editorContent.editorContent.haveDraftPage;
|
|
284
305
|
await getPage(pageID);
|
|
285
306
|
};
|
|
@@ -445,6 +466,7 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
|
|
|
445
466
|
savedSiteInfo: state.sites.savedSiteInfo,
|
|
446
467
|
userEditing: state.pageEditor.userEditing,
|
|
447
468
|
currentUserID: state.users.currentUser.id,
|
|
469
|
+
isNewTranslation: state.pageEditor.isNewTranslation,
|
|
448
470
|
});
|
|
449
471
|
|
|
450
472
|
interface IPageEditorStateProps {
|
|
@@ -463,6 +485,7 @@ interface IPageEditorStateProps {
|
|
|
463
485
|
savedSiteInfo: any;
|
|
464
486
|
userEditing: IUserEditing | null;
|
|
465
487
|
currentUserID: number | null;
|
|
488
|
+
isNewTranslation: boolean;
|
|
466
489
|
}
|
|
467
490
|
|
|
468
491
|
const mapDispatchToProps = {
|
|
@@ -485,7 +508,7 @@ const mapDispatchToProps = {
|
|
|
485
508
|
|
|
486
509
|
interface IPageEditorDispatchProps {
|
|
487
510
|
getPage(pageID?: number, global?: boolean): Promise<void>;
|
|
488
|
-
savePage(createDraft: boolean, publishPage?: any, publishDraft?: boolean): Promise<
|
|
511
|
+
savePage(createDraft: boolean, publishPage?: any, publishDraft?: boolean): Promise<boolean>;
|
|
489
512
|
deletePage(params?: ISavePageParams): Promise<boolean>;
|
|
490
513
|
validatePage(): Promise<boolean>;
|
|
491
514
|
updatePageStatus(id: number[], status: string): Promise<boolean>;
|
|
@@ -26,27 +26,42 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
26
26
|
currentDefaultsContent,
|
|
27
27
|
navLanguages,
|
|
28
28
|
isNewTranslation,
|
|
29
|
-
|
|
29
|
+
createTranslation,
|
|
30
30
|
selectedDefault,
|
|
31
31
|
setHeader,
|
|
32
32
|
setFooter,
|
|
33
33
|
setHistoryPush,
|
|
34
|
+
header,
|
|
35
|
+
footer,
|
|
34
36
|
} = props;
|
|
35
37
|
|
|
36
38
|
const { isOpen, toggleModal } = useModal();
|
|
39
|
+
const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent, isNewTranslation);
|
|
40
|
+
|
|
41
|
+
const currentDefaultNav = currentDefaultsContent.find((item: any) => item.setAsDefault);
|
|
42
|
+
const isNew = !header && !footer;
|
|
43
|
+
const isSetAsDefault = editorContent && editorContent.setAsDefault;
|
|
37
44
|
|
|
38
45
|
useEffect(() => {
|
|
39
46
|
getValues();
|
|
47
|
+
if (isNew) {
|
|
48
|
+
setIsDirty(true);
|
|
49
|
+
}
|
|
40
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
51
|
}, []);
|
|
42
52
|
|
|
43
|
-
const { isDirty } = useIsDirty(editorContent);
|
|
44
|
-
const currentDefaultNav = currentDefaultsContent.find((item: any) => item.setAsDefault);
|
|
45
|
-
const isNew = editorContent && !editorContent.id;
|
|
46
|
-
const isSetAsDefault = editorContent && editorContent.setAsDefault;
|
|
47
|
-
|
|
48
53
|
const save = () => {
|
|
49
|
-
isNew || isNewTranslation
|
|
54
|
+
isNew || isNewTranslation
|
|
55
|
+
? createNavigation().then((isSaved: boolean) => {
|
|
56
|
+
if (isSaved) {
|
|
57
|
+
resetDirty();
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
: updateNavigation(editorContent.id, editorContent, true).then((isSaved: boolean) => {
|
|
61
|
+
if (isSaved) {
|
|
62
|
+
resetDirty();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
50
65
|
};
|
|
51
66
|
|
|
52
67
|
const saveAsDefault = () => {
|
|
@@ -61,8 +76,8 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
61
76
|
};
|
|
62
77
|
|
|
63
78
|
const rightButtonProps = {
|
|
64
|
-
label: isSaving ? "Saving" : "Save",
|
|
65
|
-
disabled: isSaving,
|
|
79
|
+
label: !isDirty ? "Saved" : isSaving ? "Saving" : "Save",
|
|
80
|
+
disabled: isSaving || !isDirty,
|
|
66
81
|
action: () => saveButtonAction(),
|
|
67
82
|
};
|
|
68
83
|
|
|
@@ -72,6 +87,11 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
72
87
|
getValues();
|
|
73
88
|
};
|
|
74
89
|
|
|
90
|
+
const createNewTranslation = (isNewTranslation: boolean) => {
|
|
91
|
+
setIsDirty(true);
|
|
92
|
+
createTranslation(isNewTranslation);
|
|
93
|
+
};
|
|
94
|
+
|
|
75
95
|
const languageActions = {
|
|
76
96
|
setLanguage,
|
|
77
97
|
createNewTranslation,
|
|
@@ -161,7 +181,7 @@ const mapDispatchToProps = {
|
|
|
161
181
|
setSchema: navigationActions.setSchema,
|
|
162
182
|
createNavigation: navigationActions.createNavigation,
|
|
163
183
|
updateNavigation: navigationActions.updateNavigation,
|
|
164
|
-
|
|
184
|
+
createTranslation: navigationActions.createNewTranslation,
|
|
165
185
|
setHeader: navigationActions.setHeader,
|
|
166
186
|
setFooter: navigationActions.setFooter,
|
|
167
187
|
};
|
|
@@ -170,9 +190,9 @@ interface IDispatchProps {
|
|
|
170
190
|
setHistoryPush(path: string, isEditor?: boolean): void;
|
|
171
191
|
setLanguage?(lang: { locale: string; id: number | null }): void;
|
|
172
192
|
getValues(): void;
|
|
173
|
-
createNavigation():
|
|
174
|
-
updateNavigation(navID: number, data: any, fromEditor?: boolean):
|
|
175
|
-
|
|
193
|
+
createNavigation(): Promise<boolean>;
|
|
194
|
+
updateNavigation(navID: number, data: any, fromEditor?: boolean): Promise<boolean>;
|
|
195
|
+
createTranslation(isNewTranslation: boolean): void;
|
|
176
196
|
setHeader(id: number | null): void;
|
|
177
197
|
setFooter(id: number | null): void;
|
|
178
198
|
}
|
|
@@ -32,7 +32,7 @@ const Translations = (props: IProps) => {
|
|
|
32
32
|
const { currentLanguages, locale, languages, handleLanguage } = props;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<FloatingMenu Button={() => FlagsButton(currentLanguages)}
|
|
35
|
+
<FloatingMenu Button={() => FlagsButton(currentLanguages)}>
|
|
36
36
|
<LangMenu
|
|
37
37
|
currentLanguages={currentLanguages}
|
|
38
38
|
locale={locale}
|
|
@@ -3,6 +3,8 @@ import { NavLink } from "react-router-dom";
|
|
|
3
3
|
|
|
4
4
|
import { SubNav, MenuItem } from "@ax/components";
|
|
5
5
|
|
|
6
|
+
import * as S from './style';
|
|
7
|
+
|
|
6
8
|
const DefaultNav = (props: IProps): JSX.Element => {
|
|
7
9
|
const { current, defaultTypes, onClick } = props;
|
|
8
10
|
|
|
@@ -10,12 +12,15 @@ const DefaultNav = (props: IProps): JSX.Element => {
|
|
|
10
12
|
<SubNav>
|
|
11
13
|
{defaultTypes &&
|
|
12
14
|
defaultTypes.map((type: string, key: number) => {
|
|
13
|
-
const isSelected = current && type === current
|
|
15
|
+
const isSelected = !!current && type === current;
|
|
16
|
+
const selectedClass = isSelected ? "selected" : "";
|
|
14
17
|
const handleClick = () => onClick(type);
|
|
15
18
|
return (
|
|
16
19
|
<MenuItem key={key} onClick={handleClick}>
|
|
17
|
-
<NavLink to="#" className={
|
|
18
|
-
{
|
|
20
|
+
<NavLink to="#" className={selectedClass}>
|
|
21
|
+
<S.Link active={isSelected}>
|
|
22
|
+
{type}
|
|
23
|
+
</S.Link>
|
|
19
24
|
</NavLink>
|
|
20
25
|
</MenuItem>
|
|
21
26
|
);
|
|
@@ -32,6 +32,7 @@ const DefaultsList = (props: IProps): JSX.Element => {
|
|
|
32
32
|
restoreNavigation,
|
|
33
33
|
deleteNavigation,
|
|
34
34
|
getMenus,
|
|
35
|
+
resetDefaultsValues,
|
|
35
36
|
} = props;
|
|
36
37
|
|
|
37
38
|
const [page, setPage] = useState(1);
|
|
@@ -86,6 +87,7 @@ const DefaultsList = (props: IProps): JSX.Element => {
|
|
|
86
87
|
const memoizedGetMenus = useCallback(() => getMenus(), [getMenus]);
|
|
87
88
|
|
|
88
89
|
useEffect(() => {
|
|
90
|
+
resetDefaultsValues();
|
|
89
91
|
memoizedGetMenus();
|
|
90
92
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
93
|
}, []);
|
|
@@ -228,6 +230,7 @@ interface IDispatchProps {
|
|
|
228
230
|
restoreNavigation(navID: number | number[], type: string): void;
|
|
229
231
|
deleteNavigation(navID: number[], type: string): Promise<boolean>;
|
|
230
232
|
getMenus(): void;
|
|
233
|
+
resetDefaultsValues(): void;
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
interface IDefaultsProps {
|
|
@@ -251,6 +254,7 @@ const mapDispatchToProps = {
|
|
|
251
254
|
restoreNavigation: navigationActions.restoreNavigation,
|
|
252
255
|
deleteNavigation: navigationActions.deleteNavigation,
|
|
253
256
|
getMenus: menuActions.getMenus,
|
|
257
|
+
resetDefaultsValues: navigationActions.resetDefaultsValues,
|
|
254
258
|
};
|
|
255
259
|
|
|
256
260
|
export default connect(mapStateToProps, mapDispatchToProps)(DefaultsList);
|
|
@@ -7,6 +7,8 @@ import { IRootState } from "@ax/types";
|
|
|
7
7
|
import { useModal } from "@ax/hooks";
|
|
8
8
|
import { menuActions } from "@ax/containers/Navigation";
|
|
9
9
|
|
|
10
|
+
import * as S from "./style";
|
|
11
|
+
|
|
10
12
|
const Nav = (props: INav): JSX.Element => {
|
|
11
13
|
const { getCurrentMenu, currentType, isDirty, currentMenus } = props;
|
|
12
14
|
const [category, setCategory] = useState(currentType);
|
|
@@ -29,12 +31,15 @@ const Nav = (props: INav): JSX.Element => {
|
|
|
29
31
|
isDirty ? toggleModal() : getCurrentMenu(category.name);
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
const isSelected = category.name === currentType
|
|
34
|
+
const isSelected = category.name === currentType;
|
|
35
|
+
const selectedClass = isSelected ? "selected" : "";
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
38
|
<MenuItem onClick={_handleClick} key={category.name}>
|
|
36
|
-
<NavLink to="#" className={
|
|
37
|
-
{
|
|
39
|
+
<NavLink to="#" className={selectedClass}>
|
|
40
|
+
<S.Link active={isSelected}>
|
|
41
|
+
{category.title}
|
|
42
|
+
</S.Link>
|
|
38
43
|
</NavLink>
|
|
39
44
|
</MenuItem>
|
|
40
45
|
);
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const ListWrapper = styled.div`
|
|
4
4
|
display: flex;
|
|
5
5
|
height: 100%;
|
|
6
6
|
`;
|
|
7
|
+
|
|
8
|
+
const TableWrapper = styled.div`
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
overflow: auto;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export { ListWrapper, TableWrapper };
|
|
@@ -10,7 +10,6 @@ import { navigationActions } from "@ax/containers/Navigation";
|
|
|
10
10
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
11
11
|
import { RouteLeavingGuard } from "@ax/guards";
|
|
12
12
|
import { useIsDirty, useModal } from "@ax/hooks";
|
|
13
|
-
import { setIsSavedData } from "@ax/forms";
|
|
14
13
|
import { isModuleDisabled } from "@ax/helpers";
|
|
15
14
|
import { dataPacksActions } from "@ax/containers/Settings/DataPacks";
|
|
16
15
|
import Editor from "./Editor";
|
|
@@ -42,10 +41,11 @@ const PageEditor = (props: IProps) => {
|
|
|
42
41
|
validated,
|
|
43
42
|
pageEditor: { editorContent, schema },
|
|
44
43
|
userEditing,
|
|
44
|
+
isNewTranslation,
|
|
45
45
|
} = props;
|
|
46
46
|
|
|
47
47
|
const [isPreviewMode, setIsPreviewMode] = useState(false);
|
|
48
|
-
const { isDirty } = useIsDirty(editorContent.editorContent);
|
|
48
|
+
const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent.editorContent, isNewTranslation);
|
|
49
49
|
const { isOpen, toggleModal } = useModal();
|
|
50
50
|
const { isOpen: isUnpublishOpen, toggleModal: toggleUnpublishModal } = useModal();
|
|
51
51
|
|
|
@@ -63,6 +63,10 @@ const PageEditor = (props: IProps) => {
|
|
|
63
63
|
setTab(defaultTab);
|
|
64
64
|
handleGetPage();
|
|
65
65
|
|
|
66
|
+
if (!pageID) {
|
|
67
|
+
setIsDirty(true);
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
const interval = setInterval(() => {
|
|
67
71
|
pageID && sendPagePing(pageID);
|
|
68
72
|
}, 30000);
|
|
@@ -103,24 +107,32 @@ const PageEditor = (props: IProps) => {
|
|
|
103
107
|
|
|
104
108
|
const publishPage = async () => {
|
|
105
109
|
const { updatePageStatus, savePage, pageID } = props;
|
|
106
|
-
setIsSavedData(true);
|
|
107
110
|
|
|
108
111
|
const publishPage = {
|
|
109
112
|
status: pageStatus.UPLOAD_PENDING,
|
|
110
113
|
};
|
|
111
114
|
|
|
112
|
-
pageID
|
|
115
|
+
pageID
|
|
116
|
+
? await updatePageStatus([pageID], pageStatus.UPLOAD_PENDING)
|
|
117
|
+
: await savePage(false, publishPage).then((isSaved: boolean) => {
|
|
118
|
+
if (isSaved) {
|
|
119
|
+
resetDirty();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
113
122
|
};
|
|
114
123
|
|
|
115
124
|
const publishChanges = async () => {
|
|
116
125
|
const { savePage } = props;
|
|
117
|
-
setIsSavedData(true);
|
|
118
126
|
|
|
119
127
|
const publishPage = {
|
|
120
128
|
status: pageStatus.UPLOAD_PENDING,
|
|
121
129
|
};
|
|
122
130
|
|
|
123
|
-
await savePage(false, publishPage)
|
|
131
|
+
await savePage(false, publishPage).then((isSaved: boolean) => {
|
|
132
|
+
if (isSaved) {
|
|
133
|
+
resetDirty();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
124
136
|
};
|
|
125
137
|
|
|
126
138
|
const unpublishPage = async () => {
|
|
@@ -142,17 +154,23 @@ const PageEditor = (props: IProps) => {
|
|
|
142
154
|
|
|
143
155
|
const handlePublishDraft = async () => {
|
|
144
156
|
const { savePage } = props;
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
await savePage(false, null, true).then((isSaved: boolean) => {
|
|
158
|
+
if (isSaved) {
|
|
159
|
+
resetDirty();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
147
162
|
};
|
|
148
163
|
|
|
149
164
|
const handleDiscardDraft = async () => {
|
|
150
165
|
const { discardDraft } = props;
|
|
166
|
+
resetDirty();
|
|
151
167
|
await discardDraft();
|
|
152
168
|
};
|
|
153
169
|
|
|
154
170
|
const handleDiscarChanges = async () => {
|
|
155
171
|
const { getPage, pageID } = props;
|
|
172
|
+
resetDirty();
|
|
173
|
+
|
|
156
174
|
await getPage(pageID);
|
|
157
175
|
};
|
|
158
176
|
|
|
@@ -238,7 +256,6 @@ const PageEditor = (props: IProps) => {
|
|
|
238
256
|
|
|
239
257
|
const handleSavePage = async () => {
|
|
240
258
|
const { savePage } = props;
|
|
241
|
-
setIsSavedData(true);
|
|
242
259
|
|
|
243
260
|
const publishPage = {
|
|
244
261
|
status: pageStatus.UPLOAD_PENDING,
|
|
@@ -247,7 +264,11 @@ const PageEditor = (props: IProps) => {
|
|
|
247
264
|
const createDraft = isPublished && !hasDraft && !isGlobal;
|
|
248
265
|
const status = props.pageStatus === pageStatus.PUBLISHED && !createDraft ? publishPage : undefined;
|
|
249
266
|
|
|
250
|
-
await savePage(createDraft, status)
|
|
267
|
+
await savePage(createDraft, status).then((isSaved: boolean) => {
|
|
268
|
+
if (isSaved) {
|
|
269
|
+
resetDirty();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
251
272
|
};
|
|
252
273
|
|
|
253
274
|
const goToPages = (path: string) => setRoute(path);
|
|
@@ -286,15 +307,15 @@ const PageEditor = (props: IProps) => {
|
|
|
286
307
|
switch (props.pageStatus) {
|
|
287
308
|
case pageStatus.PUBLISHED:
|
|
288
309
|
case pageStatus.UPLOAD_PENDING:
|
|
289
|
-
return isGlobal || (isPublished && hasDraft) ? "Save & publish" : "Save draft";
|
|
310
|
+
return !isDirty ? "Saved" : isGlobal || (isPublished && hasDraft) ? "Save & publish" : "Save draft";
|
|
290
311
|
default:
|
|
291
|
-
return "Save";
|
|
312
|
+
return !isDirty ? "Saved" : "Save";
|
|
292
313
|
}
|
|
293
314
|
};
|
|
294
315
|
|
|
295
316
|
const rightButtonProps = {
|
|
296
317
|
label: isSaving ? "Saving" : getSaveLabel(),
|
|
297
|
-
disabled: isSaving || (!isTemplateActivated && !isGlobal) || isPreviewMode,
|
|
318
|
+
disabled: isSaving || (!isTemplateActivated && !isGlobal) || isPreviewMode || !isDirty,
|
|
298
319
|
action: handleSavePage,
|
|
299
320
|
};
|
|
300
321
|
|
|
@@ -307,6 +328,7 @@ const PageEditor = (props: IProps) => {
|
|
|
307
328
|
|
|
308
329
|
const toggleDraftPage = async () => {
|
|
309
330
|
const { getPage } = props;
|
|
331
|
+
resetDirty();
|
|
310
332
|
const pageID = isDraft ? editorContent.editorContent.draftFromPage : editorContent.editorContent.haveDraftPage;
|
|
311
333
|
await getPage(pageID);
|
|
312
334
|
};
|
|
@@ -482,6 +504,7 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
|
|
|
482
504
|
validated: state.pageEditor.validated,
|
|
483
505
|
userEditing: state.pageEditor.userEditing,
|
|
484
506
|
currentUserID: state.users.currentUser.id,
|
|
507
|
+
isNewTranslation: state.pageEditor.isNewTranslation,
|
|
485
508
|
});
|
|
486
509
|
|
|
487
510
|
interface IPageEditorStateProps {
|
|
@@ -501,6 +524,7 @@ interface IPageEditorStateProps {
|
|
|
501
524
|
validated: boolean;
|
|
502
525
|
userEditing: IUserEditing | null;
|
|
503
526
|
currentUserID: number | null;
|
|
527
|
+
isNewTranslation: boolean;
|
|
504
528
|
}
|
|
505
529
|
|
|
506
530
|
const mapDispatchToProps = {
|
|
@@ -524,7 +548,7 @@ const mapDispatchToProps = {
|
|
|
524
548
|
|
|
525
549
|
interface IPageEditorDispatchProps {
|
|
526
550
|
getPage(pageID?: number): Promise<void>;
|
|
527
|
-
savePage(createDraft: boolean, publishPage?: any, publishDraft?: boolean): Promise<
|
|
551
|
+
savePage(createDraft: boolean, publishPage?: any, publishDraft?: boolean): Promise<boolean>;
|
|
528
552
|
deletePage(params?: ISavePageParams): Promise<boolean>;
|
|
529
553
|
validatePage(): Promise<boolean>;
|
|
530
554
|
updatePageStatus(id: number[], status: string): Promise<boolean>;
|
|
@@ -21,7 +21,7 @@ const Filter = (props: IProps) => {
|
|
|
21
21
|
const handleClickAll = () => setFilter(null);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<FloatingMenu
|
|
24
|
+
<FloatingMenu Button={Select} position="left">
|
|
25
25
|
<ListTitle>Filter by category</ListTitle>
|
|
26
26
|
<ListItem key="all" onClick={handleClickAll}>
|
|
27
27
|
All
|
|
@@ -27,7 +27,7 @@ const SortFilter = (props: IProps) => {
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<FloatingMenu
|
|
30
|
+
<FloatingMenu Button={Select} position="left">
|
|
31
31
|
<ListTitle>Name Sorting</ListTitle>
|
|
32
32
|
<ListItem onClick={orderByNameAscending}>Ascendent</ListItem>
|
|
33
33
|
<ListItem onClick={orderByNameDescending}>Descendent</ListItem>
|
|
@@ -22,7 +22,7 @@ const Nav = (props: IProps): JSX.Element => {
|
|
|
22
22
|
isDirty ? toggleModal() : selectPack(null);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const selectedClass = selected ? "" : "selected";
|
|
26
26
|
|
|
27
27
|
const infoMenuProps: { icon: string; message: string; actionText: string; iconSize: "s" } = {
|
|
28
28
|
icon: "alert",
|
|
@@ -43,8 +43,10 @@ const Nav = (props: IProps): JSX.Element => {
|
|
|
43
43
|
<S.Item>
|
|
44
44
|
<S.Heading>Your packages</S.Heading>
|
|
45
45
|
<MenuItem onClick={resetFilter}>
|
|
46
|
-
<NavLink to="#" className={
|
|
47
|
-
|
|
46
|
+
<NavLink to="#" className={selectedClass}>
|
|
47
|
+
<S.Link active={!selected}>
|
|
48
|
+
Activated packages
|
|
49
|
+
</S.Link>
|
|
48
50
|
</NavLink>
|
|
49
51
|
</MenuItem>
|
|
50
52
|
</S.Item>
|
|
@@ -55,16 +57,19 @@ const Nav = (props: IProps): JSX.Element => {
|
|
|
55
57
|
activated.map((dataPack: any, key: number) => {
|
|
56
58
|
const { id, title, templates, config } = dataPack;
|
|
57
59
|
const isFromPage = templates && templates.length > 0;
|
|
58
|
-
const isSelected = id === (selected && selected.id)
|
|
60
|
+
const isSelected = id === (selected && selected.id);
|
|
61
|
+
const selectedClass = isSelected ? "selected" : "";
|
|
59
62
|
const _handleClick = () => {
|
|
60
63
|
setSelectedID(id);
|
|
61
64
|
isDirty ? toggleModal() : selectPack(id);
|
|
62
65
|
};
|
|
63
66
|
return (
|
|
64
67
|
<MenuItem key={key} onClick={_handleClick}>
|
|
65
|
-
<NavLink to="#" className={
|
|
68
|
+
<NavLink to="#" className={selectedClass}>
|
|
66
69
|
<S.LinkWrapper>
|
|
67
|
-
{
|
|
70
|
+
<S.Link active={isSelected}>
|
|
71
|
+
{title}
|
|
72
|
+
</S.Link>
|
|
68
73
|
{isFromPage && !config && <InformativeMenu {...infoMenuProps} />}
|
|
69
74
|
</S.LinkWrapper>
|
|
70
75
|
</NavLink>
|
|
@@ -45,9 +45,14 @@ const LinkWrapper = styled.div`
|
|
|
45
45
|
justify-content: center;
|
|
46
46
|
`;
|
|
47
47
|
|
|
48
|
+
const Link = styled.div<{ active: boolean }>`
|
|
49
|
+
color: ${p => p.active ? p.theme.color.textHighEmphasis : p.theme.color.textMediumEmphasis};
|
|
50
|
+
`;
|
|
51
|
+
|
|
48
52
|
export {
|
|
49
53
|
Heading,
|
|
50
54
|
SubItem,
|
|
51
55
|
Item,
|
|
52
|
-
LinkWrapper
|
|
56
|
+
LinkWrapper,
|
|
57
|
+
Link
|
|
53
58
|
}
|