@gravity-ui/blog-constructor 2.1.2-alpha.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/build/cjs/blocks/Author/Author.js +3 -3
- package/build/cjs/blocks/Banner/Banner.js +4 -7
- package/build/cjs/blocks/CTA/CTA.js +3 -6
- package/build/cjs/blocks/ColoredText/ColoredText.js +1 -1
- package/build/cjs/blocks/Feed/Feed.js +12 -28
- package/build/cjs/blocks/Feed/reducer.d.ts +1 -1
- package/build/cjs/blocks/Header/Header.js +3 -7
- package/build/cjs/blocks/Meta/Meta.js +5 -9
- package/build/cjs/blocks/Suggest/Suggest.js +4 -8
- package/build/cjs/blocks/YFM/YFM.js +1 -1
- package/build/cjs/components/FeedHeader/FeedHeader.d.ts +1 -1
- package/build/cjs/components/FeedHeader/FeedHeader.js +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/Controls.js +4 -26
- package/build/cjs/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
- package/build/cjs/components/FeedHeader/components/Controls/customRenders.js +1 -1
- package/build/cjs/components/Paginator/Paginator.js +2 -26
- package/build/cjs/components/Paginator/components/NavigationButton.js +1 -1
- package/build/cjs/components/Paginator/components/PaginatorItem.js +1 -1
- package/build/cjs/components/PostCard/PostCard.d.ts +0 -4
- package/build/cjs/components/PostCard/PostCard.js +1 -1
- package/build/cjs/components/PostInfo/PostInfo.d.ts +0 -4
- package/build/cjs/components/PostInfo/PostInfo.js +2 -2
- package/build/cjs/components/PostInfo/SuggestPostInfo.js +1 -1
- package/build/cjs/components/PostInfo/components/Date.js +1 -1
- package/build/cjs/components/PostInfo/components/Save.d.ts +0 -4
- package/build/cjs/components/PostInfo/components/Save.js +4 -8
- package/build/cjs/components/PostInfo/components/Sharing.d.ts +0 -4
- package/build/cjs/components/PostInfo/components/Sharing.js +5 -12
- package/build/cjs/components/Posts/Posts.js +1 -1
- package/build/cjs/components/PostsEmpty/PostsEmpty.js +1 -1
- package/build/cjs/components/Search/Search.js +2 -2
- package/build/cjs/components/Wrapper/Wrapper.js +1 -1
- package/build/cjs/constructor/BlogConstructorProvider.d.ts +1 -3
- package/build/cjs/constructor/BlogConstructorProvider.js +4 -6
- package/build/cjs/constructor/blocksMap.js +8 -8
- package/build/cjs/containers/BlogPage/BlogPage.d.ts +2 -2
- package/build/cjs/containers/BlogPage/BlogPage.js +2 -2
- package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
- package/build/cjs/containers/BlogPostPage/BlogPostPage.js +2 -2
- package/build/cjs/contexts/FeedContext.d.ts +1 -1
- package/build/cjs/contexts/theme/ThemeProvider.js +1 -1
- package/build/cjs/counters/metrika.d.ts +0 -4
- package/build/cjs/counters/metrika.js +0 -4
- package/build/cjs/models/blocks.d.ts +1 -1
- package/build/cjs/models/common.d.ts +2 -11
- package/build/cjs/models/common.js +2 -13
- package/build/cjs/utils/common.d.ts +1 -1
- package/build/cjs/utils/common.js +1 -1
- package/build/esm/blocks/Author/Author.js +5 -5
- package/build/esm/blocks/Banner/Banner.js +4 -7
- package/build/esm/blocks/CTA/CTA.js +3 -6
- package/build/esm/blocks/ColoredText/ColoredText.js +1 -1
- package/build/esm/blocks/Feed/Feed.js +8 -24
- package/build/esm/blocks/Feed/reducer.d.ts +1 -1
- package/build/esm/blocks/Header/Header.js +3 -7
- package/build/esm/blocks/Meta/Meta.js +5 -9
- package/build/esm/blocks/Suggest/Suggest.js +4 -8
- package/build/esm/blocks/YFM/YFM.js +1 -1
- package/build/esm/components/FeedHeader/FeedHeader.d.ts +1 -1
- package/build/esm/components/FeedHeader/FeedHeader.js +2 -2
- package/build/esm/components/FeedHeader/components/Controls/Controls.d.ts +1 -1
- package/build/esm/components/FeedHeader/components/Controls/Controls.js +6 -28
- package/build/esm/components/FeedHeader/components/Controls/customRenders.d.ts +1 -1
- package/build/esm/components/FeedHeader/components/Controls/customRenders.js +2 -2
- package/build/esm/components/Paginator/Paginator.js +3 -27
- package/build/esm/components/Paginator/components/NavigationButton.js +2 -2
- package/build/esm/components/Paginator/components/PaginatorItem.js +1 -1
- package/build/esm/components/PostCard/PostCard.d.ts +0 -4
- package/build/esm/components/PostCard/PostCard.js +3 -3
- package/build/esm/components/PostInfo/PostInfo.d.ts +0 -4
- package/build/esm/components/PostInfo/PostInfo.js +2 -2
- package/build/esm/components/PostInfo/SuggestPostInfo.js +1 -1
- package/build/esm/components/PostInfo/components/Date.js +1 -1
- package/build/esm/components/PostInfo/components/ReadingTime.js +1 -1
- package/build/esm/components/PostInfo/components/Save.d.ts +0 -4
- package/build/esm/components/PostInfo/components/Save.js +2 -6
- package/build/esm/components/PostInfo/components/Sharing.d.ts +0 -4
- package/build/esm/components/PostInfo/components/Sharing.js +4 -11
- package/build/esm/components/Posts/Posts.js +2 -2
- package/build/esm/components/PostsEmpty/PostsEmpty.js +1 -1
- package/build/esm/components/PostsError/PostsError.js +1 -1
- package/build/esm/components/Search/Search.js +3 -3
- package/build/esm/components/Wrapper/Wrapper.js +1 -1
- package/build/esm/constructor/BlogConstructorProvider.d.ts +1 -3
- package/build/esm/constructor/BlogConstructorProvider.js +4 -6
- package/build/esm/constructor/blocksMap.js +8 -8
- package/build/esm/containers/BlogPage/BlogPage.d.ts +2 -2
- package/build/esm/containers/BlogPage/BlogPage.js +2 -2
- package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +2 -2
- package/build/esm/containers/BlogPostPage/BlogPostPage.js +2 -2
- package/build/esm/contexts/FeedContext.d.ts +1 -1
- package/build/esm/contexts/theme/ThemeProvider.js +1 -1
- package/build/esm/counters/metrika.d.ts +0 -4
- package/build/esm/counters/metrika.js +0 -4
- package/build/esm/hooks/useLikes.js +1 -1
- package/build/esm/models/blocks.d.ts +1 -1
- package/build/esm/models/common.d.ts +2 -11
- package/build/esm/models/common.js +1 -12
- package/build/esm/utils/common.d.ts +1 -1
- package/build/esm/utils/common.js +3 -3
- package/package.json +5 -7
- package/server/data/contentFilter.js +1 -0
- package/server/data/createReadableContent.js +1 -1
- package/server/data/transformPost.d.ts +1 -1
- package/server/models/blocks.d.ts +1 -1
- package/server/models/common.d.ts +2 -11
- package/server/models/common.js +2 -13
@@ -1,15 +1,11 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { SliderBlock } from '@gravity-ui/page-constructor';
|
3
|
-
import { i18, Keyset } from '../../i18n';
|
4
|
-
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
3
|
import { PostCard } from '../../components/PostCard/PostCard';
|
6
|
-
import {
|
7
|
-
import { PostPageContext } from '../../contexts/PostPageContext';
|
4
|
+
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
8
5
|
import { BlogMetrikaGoalIds } from '../../constants';
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
*/
|
6
|
+
import { PostPageContext } from '../../contexts/PostPageContext';
|
7
|
+
import { Keyset, i18 } from '../../i18n';
|
8
|
+
import { PaddingsDirections } from '../../models/paddings';
|
13
9
|
const metrikaGoals = [
|
14
10
|
{
|
15
11
|
name: BlogMetrikaGoalIds.suggest,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { YFMWrapper } from '@gravity-ui/page-constructor';
|
3
2
|
import block from 'bem-cn-lite';
|
3
|
+
import { YFMWrapper } from '@gravity-ui/page-constructor';
|
4
4
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
5
|
import { PaddingsDirections } from '../../models/paddings';
|
6
6
|
const b = block('yfm');
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { ClassNameProps, HeaderBlockProps } from '../../models/common';
|
3
3
|
import { ControlsProps } from './components/Controls/Controls';
|
4
4
|
import './FeedHeader.css';
|
5
5
|
type HeaderProps = Pick<HeaderBlockProps, 'background' | 'offset' | 'theme' | 'verticalOffset'>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { BackgroundImage, Grid, getThemedValue,
|
3
|
-
import { Controls } from './components/Controls/Controls';
|
2
|
+
import { BackgroundImage, FullWidthBackground, Grid, getThemedValue, } from '@gravity-ui/page-constructor';
|
4
3
|
import { block } from '../../utils/cn';
|
4
|
+
import { Controls } from './components/Controls/Controls';
|
5
5
|
import './FeedHeader.css';
|
6
6
|
const b = block('feed-header');
|
7
7
|
export const FeedHeader = ({ tags, services, setIsFetching, offset = 'default', background, theme = 'default', verticalOffset = 'l', className, handleChangeQuery, queryParams, }) => {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
|
-
import { HandleChangeQueryParams,
|
2
|
+
import { HandleChangeQueryParams, Query, SetQueryType } from '../../../../models/common';
|
3
3
|
import './Controls.css';
|
4
4
|
export type SelectItem = {
|
5
5
|
content: string;
|
@@ -1,20 +1,14 @@
|
|
1
|
-
import React, {
|
2
|
-
import {
|
3
|
-
import { Icon, Button, Select } from '@gravity-ui/uikit';
|
4
|
-
import { Search } from '../../../Search/Search';
|
5
|
-
import { renderSwitcher, renderFilter, renderOption } from './customRenders';
|
6
|
-
import { LikesContext } from '../../../../contexts/LikesContext';
|
7
|
-
/**
|
8
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
9
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
10
|
-
*/
|
1
|
+
import React, { useContext, useMemo, useState } from 'react';
|
2
|
+
import { Button, Icon, Select } from '@gravity-ui/uikit';
|
11
3
|
import { BlogMetrikaGoalIds } from '../../../../constants';
|
4
|
+
import { LikesContext } from '../../../../contexts/LikesContext';
|
12
5
|
import metrika from '../../../../counters/metrika.js';
|
13
6
|
import { MetrikaCounter } from '../../../../counters/utils';
|
7
|
+
import { Keyset, i18 } from '../../../../i18n';
|
14
8
|
import { Save } from '../../../../icons/Save';
|
15
|
-
import { i18, Keyset } from '../../../../i18n';
|
16
9
|
import { block } from '../../../../utils/cn';
|
17
|
-
import {
|
10
|
+
import { Search } from '../../../Search/Search';
|
11
|
+
import { renderFilter, renderOption, renderSwitcher } from './customRenders';
|
18
12
|
import './Controls.css';
|
19
13
|
const b = block('feed-controls');
|
20
14
|
const ICON_SIZE = 16;
|
@@ -22,8 +16,6 @@ const DEFAULT_PAGE = 1;
|
|
22
16
|
const VIRTUALIZATION_THRESHOLD = 1000;
|
23
17
|
export const Controls = ({ setIsFetching, tags = [], services = [], handleChangeQuery, queryParams, }) => {
|
24
18
|
const { hasLikes } = useContext(LikesContext);
|
25
|
-
const handleAnalyticsTag = useAnalytics(DefaultEventNames.Tag);
|
26
|
-
const handleAnalyticsService = useAnalytics(DefaultEventNames.Service);
|
27
19
|
const { savedOnly: savedOnlyInitial, search: searchInitial, tags: tagInitial, services: servicesInitial, } = queryParams || {};
|
28
20
|
const [savedOnly, setSavedOnly] = useState(savedOnlyInitial === 'true');
|
29
21
|
const [search, setSearch] = useState(searchInitial);
|
@@ -38,16 +30,9 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
38
30
|
setIsFetching(true);
|
39
31
|
};
|
40
32
|
const handleTagSelect = (selectedTags) => {
|
41
|
-
/**
|
42
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
43
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
44
|
-
*/
|
45
33
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.tag, {
|
46
34
|
theme: selectedTags[0],
|
47
35
|
});
|
48
|
-
handleAnalyticsTag(null, {
|
49
|
-
theme: selectedTags[0],
|
50
|
-
});
|
51
36
|
const isEmptyTag = selectedTags.some((tag) => tag === 'empty');
|
52
37
|
handleChangeQuery({
|
53
38
|
tags: isEmptyTag ? '' : selectedTags[0],
|
@@ -60,16 +45,9 @@ export const Controls = ({ setIsFetching, tags = [], services = [], handleChange
|
|
60
45
|
return selectedServices.includes(service.value);
|
61
46
|
});
|
62
47
|
const metrikaAsString = forMetrikaServices.map((service) => service.content).join(',');
|
63
|
-
/**
|
64
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
65
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
66
|
-
*/
|
67
48
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.service, {
|
68
49
|
service: metrikaAsString,
|
69
50
|
});
|
70
|
-
handleAnalyticsService(null, {
|
71
|
-
service: metrikaAsString,
|
72
|
-
});
|
73
51
|
const servicesAsString = selectedServices.join(',');
|
74
52
|
handleChangeQuery({ services: servicesAsString, page: DEFAULT_PAGE });
|
75
53
|
setIsFetching(true);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { SelectOption, SelectProps } from '@gravity-ui/uikit';
|
2
2
|
import { CustomSwitcherProps } from '../CustomSwitcher/CustomSwitcher';
|
3
3
|
import './Controls.css';
|
4
4
|
type RenderSwitcherType = ({ initial, list, defaultLabel, }: {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { TextInput } from '@gravity-ui/uikit';
|
3
|
-
import {
|
3
|
+
import { Keyset, i18 } from '../../../../i18n';
|
4
4
|
import { block } from '../../../../utils/cn';
|
5
|
-
import { CustomSwitcher } from '../CustomSwitcher/CustomSwitcher';
|
6
5
|
import { CustomSelectOption, } from '../CustomSelectOption/CustomSelectOption';
|
6
|
+
import { CustomSwitcher } from '../CustomSwitcher/CustomSwitcher';
|
7
7
|
import './Controls.css';
|
8
8
|
const b = block('feed-controls');
|
9
9
|
export const renderSwitcher = ({ initial, list, defaultLabel }) =>
|
@@ -9,21 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import React, { useEffect,
|
13
|
-
import { useAnalytics } from '@gravity-ui/page-constructor';
|
12
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
14
13
|
import { BlogMetrikaGoalIds } from '../../constants';
|
15
|
-
/**
|
16
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
17
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
18
|
-
*/
|
19
14
|
import metrika from '../../counters/metrika.js';
|
20
15
|
import { MetrikaCounter } from '../../counters/utils';
|
21
|
-
import { getPageConfigs, getPagesCount } from './utils';
|
22
|
-
import { ArrowType } from './types';
|
23
16
|
import { block } from '../../utils/cn';
|
24
17
|
import { NavigationButton } from './components/NavigationButton';
|
25
18
|
import { PaginatorItem } from './components/PaginatorItem';
|
26
|
-
import {
|
19
|
+
import { ArrowType } from './types';
|
20
|
+
import { getPageConfigs, getPagesCount } from './utils';
|
27
21
|
import './Paginator.css';
|
28
22
|
const b = block('paginator');
|
29
23
|
const DEFAULT_PAGE_COUNT_FOR_SHOW_SUPPORT_BUTTONS = 6;
|
@@ -35,29 +29,16 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
|
35
29
|
}, [itemsPerPage, totalItems, maxPages]);
|
36
30
|
const handlePageChange = (pageIndex) => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(pageIndex);
|
37
31
|
const isShowSupportButtons = useMemo(() => pagesCount > pageCountForShowSupportButtons, [pageCountForShowSupportButtons, pagesCount]);
|
38
|
-
const handleAnalyticsHome = useAnalytics(DefaultEventNames.PaginatorHome);
|
39
|
-
const handleAnalyticsNext = useAnalytics(DefaultEventNames.PaginatorNext);
|
40
|
-
const handleAnalyticsPage = useAnalytics(DefaultEventNames.PaginatorPage);
|
41
32
|
if (pagesCount <= 1) {
|
42
33
|
return null;
|
43
34
|
}
|
44
35
|
const handleArrowClick = (type) => {
|
45
36
|
let newPage = page;
|
46
37
|
if (type === 'prev' && page > 1) {
|
47
|
-
/**
|
48
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
49
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
50
|
-
*/
|
51
38
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.home);
|
52
|
-
handleAnalyticsHome();
|
53
39
|
newPage = 1;
|
54
40
|
}
|
55
41
|
else if (type === 'next' && page < pagesCount) {
|
56
|
-
/**
|
57
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
58
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
59
|
-
*/
|
60
|
-
handleAnalyticsNext();
|
61
42
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.next);
|
62
43
|
newPage = page + 1;
|
63
44
|
}
|
@@ -67,12 +48,7 @@ export const Paginator = ({ itemsPerPage, totalItems, maxPages, page, className,
|
|
67
48
|
};
|
68
49
|
const handlePageClick = (index) => {
|
69
50
|
if (index !== page && typeof index === 'number') {
|
70
|
-
/**
|
71
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
72
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
73
|
-
*/
|
74
51
|
metrika.reachGoal(MetrikaCounter.CrossSite, BlogMetrikaGoalIds.page, { page: index });
|
75
|
-
handleAnalyticsPage();
|
76
52
|
handlePageChange(index);
|
77
53
|
}
|
78
54
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
import { i18, Keyset } from '../../../i18n';
|
2
|
+
import { Keyset, i18 } from '../../../i18n';
|
4
3
|
import { block } from '../../../utils/cn';
|
4
|
+
import { ArrowType } from '../types';
|
5
5
|
import '../Paginator.css';
|
6
6
|
const b = block('paginator');
|
7
7
|
export const NavigationButton = ({ arrowType, disabled }) => disabled ? null : (React.createElement("div", { className: b('icon') }, arrowType === ArrowType.Prev ? i18(Keyset.ButtonBegin) : i18(Keyset.ButtonFarther)));
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { Button } from '@gravity-ui/uikit';
|
3
3
|
import { LocaleContext } from '../../../contexts/LocaleContext';
|
4
|
-
import { getBlogPath } from '../../../utils/common';
|
5
4
|
import { block } from '../../../utils/cn';
|
5
|
+
import { getBlogPath } from '../../../utils/common';
|
6
6
|
import '../Paginator.css';
|
7
7
|
const b = block('paginator');
|
8
8
|
export const PaginatorItem = ({ dataKey, mods, content, onClick, loading = false, }) => {
|
@@ -7,10 +7,6 @@ type PostCardProps = {
|
|
7
7
|
fullWidth?: boolean;
|
8
8
|
showTag?: boolean;
|
9
9
|
size?: 's' | 'm';
|
10
|
-
/**
|
11
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
12
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
13
|
-
*/
|
14
10
|
metrikaGoals?: MetrikaGoal;
|
15
11
|
};
|
16
12
|
export declare const PostCard: React.FC<PostCardProps>;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import React, {
|
2
|
-
import { CardBase,
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
2
|
+
import { CardBase, HTML, YFMWrapper } from '@gravity-ui/page-constructor';
|
3
3
|
import { LikesContext } from '../../contexts/LikesContext';
|
4
|
-
import { SuggestPostInfo } from '../PostInfo/SuggestPostInfo';
|
5
4
|
import { block } from '../../utils/cn';
|
5
|
+
import { SuggestPostInfo } from '../PostInfo/SuggestPostInfo';
|
6
6
|
import './PostCard.css';
|
7
7
|
const b = block('post-card');
|
8
8
|
export const PostCard = ({ post, metrikaGoals, fullWidth = false, size = 's', showTag = false, }) => {
|
@@ -10,10 +10,6 @@ type PostInfoProps = {
|
|
10
10
|
readingTime: PostData['readingTime'];
|
11
11
|
date: PostData['date'];
|
12
12
|
theme?: 'light' | 'dark';
|
13
|
-
/**
|
14
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
15
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
16
|
-
*/
|
17
13
|
metrikaGoals?: BlogMetrikaGoals;
|
18
14
|
dataQa?: string;
|
19
15
|
};
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { PostPageContext } from '../../contexts/PostPageContext';
|
3
|
+
import { block } from '../../utils/cn';
|
3
4
|
import { Date } from './components/Date';
|
4
5
|
import { ReadingTime } from './components/ReadingTime';
|
5
|
-
import { Sharing } from './components/Sharing';
|
6
6
|
import { Save } from './components/Save';
|
7
|
-
import {
|
7
|
+
import { Sharing } from './components/Sharing';
|
8
8
|
import './PostInfo.css';
|
9
9
|
const b = block('post-info');
|
10
10
|
/**
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { useLikes } from '../../hooks/useLikes';
|
3
|
+
import { block } from '../../utils/cn';
|
3
4
|
import { Date } from './components/Date';
|
4
5
|
import { ReadingTime } from './components/ReadingTime';
|
5
6
|
import { Save } from './components/Save';
|
6
|
-
import { block } from '../../utils/cn';
|
7
7
|
import './PostInfo.css';
|
8
8
|
const b = block('post-info');
|
9
9
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { LocaleContext } from '../../../contexts/LocaleContext';
|
3
|
-
import { format } from '../../../utils/date';
|
4
3
|
import { block } from '../../../utils/cn';
|
4
|
+
import { format } from '../../../utils/date';
|
5
5
|
import '../PostInfo.css';
|
6
6
|
const b = block('post-info');
|
7
7
|
export const Date = ({ date, size = 's' }) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
3
|
-
import {
|
3
|
+
import { Keyset, i18 } from '../../../i18n';
|
4
4
|
import { Time } from '../../../icons/Time';
|
5
5
|
import { block } from '../../../utils/cn';
|
6
6
|
import '../PostInfo.css';
|
@@ -6,10 +6,6 @@ type SaveProps = {
|
|
6
6
|
hasUserLike: boolean;
|
7
7
|
handleUserLike: () => void;
|
8
8
|
theme?: 'light' | 'dark';
|
9
|
-
/**
|
10
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
11
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
12
|
-
*/
|
13
9
|
metrikaGoal?: string;
|
14
10
|
dataQa?: string;
|
15
11
|
size?: 's' | 'm';
|
@@ -1,15 +1,13 @@
|
|
1
|
-
import { useAnalytics } from '@gravity-ui/page-constructor';
|
2
|
-
import { Icon } from '@gravity-ui/uikit';
|
3
1
|
import React, { useContext } from 'react';
|
2
|
+
import { Icon } from '@gravity-ui/uikit';
|
4
3
|
import { UserContext } from '../../../contexts/UserContext';
|
5
4
|
import metrika from '../../../counters/metrika.js';
|
6
5
|
import { MetrikaCounter } from '../../../counters/utils';
|
7
|
-
// @ts-ignore
|
8
6
|
import { Save as SaveIcon } from '../../../icons/Save';
|
9
7
|
import { SaveFilled } from '../../../icons/SaveFilled';
|
10
|
-
import { DefaultEventNames } from '../../../models/common';
|
11
8
|
import { block } from '../../../utils/cn';
|
12
9
|
import { postLikeStatus } from '../../../utils/common';
|
10
|
+
// @ts-ignore
|
13
11
|
import '../PostInfo.css';
|
14
12
|
const ICON_SIZE = 16;
|
15
13
|
const b = block('post-info');
|
@@ -27,7 +25,6 @@ const b = block('post-info');
|
|
27
25
|
*/
|
28
26
|
export const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal, size, theme, dataQa, }) => {
|
29
27
|
const { uid } = useContext(UserContext);
|
30
|
-
const handleAnalytics = useAnalytics(DefaultEventNames.SaveButton);
|
31
28
|
return (React.createElement("div", { className: b('item', { size }), onClick: (event) => {
|
32
29
|
// both preventDefault and stopImmediatePropagation required to work properly
|
33
30
|
// https://stackoverflow.com/questions/24415631/reactjs-syntheticevent-stoppropagation-only-works-with-react-events
|
@@ -39,7 +36,6 @@ export const Save = ({ title, postId, hasUserLike, handleUserLike, metrikaGoal,
|
|
39
36
|
postLikeStatus(postId, Boolean(hasUserLike));
|
40
37
|
handleUserLike();
|
41
38
|
metrika.reachGoal(MetrikaCounter.CrossSite, metrikaGoal);
|
42
|
-
handleAnalytics();
|
43
39
|
}, "data-qa": `${dataQa ? dataQa + '-' : ''}save` },
|
44
40
|
React.createElement("div", { className: b('content', { cursor: Boolean(uid), theme }) },
|
45
41
|
React.createElement("span", { className: b('icon') },
|
@@ -2,10 +2,6 @@ import React from 'react';
|
|
2
2
|
import '../PostInfo.css';
|
3
3
|
type SharingProps = {
|
4
4
|
theme?: 'light' | 'dark';
|
5
|
-
/**
|
6
|
-
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
7
|
-
* https://st.yandex-team.ru/PAGECTR-7
|
8
|
-
*/
|
9
5
|
metrikaGoal?: string;
|
10
6
|
};
|
11
7
|
export declare const Sharing: React.FC<SharingProps>;
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import React, { useContext } from 'react';
|
2
2
|
import { SharePopover } from '@gravity-ui/uikit';
|
3
|
-
import React, { useCallback, useContext } from 'react';
|
4
3
|
import { MobileContext } from '../../../contexts/MobileContext';
|
5
4
|
import { PostPageContext } from '../../../contexts/PostPageContext';
|
6
5
|
import { RouterContext } from '../../../contexts/RouterContext';
|
@@ -8,7 +7,6 @@ import metrika from '../../../counters/metrika.js';
|
|
8
7
|
import { MetrikaCounter } from '../../../counters/utils';
|
9
8
|
import { Keyset, i18 } from '../../../i18n';
|
10
9
|
import { ShareArrowUp } from '../../../icons/ShareArrowUp';
|
11
|
-
import { DefaultEventNames } from '../../../models/common';
|
12
10
|
import { block } from '../../../utils/cn';
|
13
11
|
import { getAbsolutePath } from '../../../utils/common';
|
14
12
|
// @ts-ignore
|
@@ -18,15 +16,10 @@ export const Sharing = ({ theme, metrikaGoal }) => {
|
|
18
16
|
const router = useContext(RouterContext);
|
19
17
|
const isMobile = useContext(MobileContext);
|
20
18
|
const { shareOptions } = useContext(PostPageContext);
|
21
|
-
const
|
22
|
-
const handleMetrika = useCallback(() => {
|
19
|
+
const handleMetrika = () => {
|
23
20
|
metrika.reachGoal(MetrikaCounter.CrossSite, metrikaGoal);
|
24
|
-
}
|
25
|
-
const handleAnalytics = useCallback(() => {
|
26
|
-
handleAnalyticsGlobal();
|
27
|
-
handleMetrika();
|
28
|
-
}, [handleAnalyticsGlobal, handleMetrika]);
|
21
|
+
};
|
29
22
|
return (React.createElement("div", { className: b('item') },
|
30
23
|
React.createElement("span", { className: b('icon') },
|
31
|
-
React.createElement(SharePopover, { url: getAbsolutePath(router), className: b('share'), iconClass: b('share-icon'), switcherClassName: b('switcher', { theme }), tooltipClassName: b('popup'), useWebShareApi: isMobile, direction: 'column', buttonTitle: i18(Keyset.ActionShare), customIcon: ShareArrowUp, placement: "bottom", openByHover: false, shareOptions: shareOptions, handleMetrika:
|
24
|
+
React.createElement(SharePopover, { url: getAbsolutePath(router), className: b('share'), iconClass: b('share-icon'), switcherClassName: b('switcher', { theme }), tooltipClassName: b('popup'), useWebShareApi: isMobile, direction: 'column', buttonTitle: i18(Keyset.ActionShare), customIcon: ShareArrowUp, placement: "bottom", openByHover: false, shareOptions: shareOptions, handleMetrika: handleMetrika }))));
|
32
25
|
};
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CardLayoutBlock } from '@gravity-ui/page-constructor';
|
3
3
|
import { Button } from '@gravity-ui/uikit';
|
4
|
-
import {
|
4
|
+
import { Keyset, i18 } from '../../i18n';
|
5
|
+
import { block } from '../../utils/cn';
|
5
6
|
import { Paginator } from '../Paginator/Paginator';
|
6
7
|
import { PostCard } from '../PostCard/PostCard';
|
7
8
|
import { PostsEmpty } from '../PostsEmpty/PostsEmpty';
|
8
|
-
import { block } from '../../utils/cn';
|
9
9
|
import './Posts.css';
|
10
10
|
const b = block('posts');
|
11
11
|
export const Posts = ({ containerId, pinnedPostOnPage, currentPage, postsOnPage, isShowMoreVisible, errorShowMore, postCountOnPage, perPageInQuery, isFetching, isShowMoreFetching, handleShowMore, handlePageChange, pageCountForShowSupportButtons, }) => (React.createElement("div", { className: b() },
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { Keyset, i18 } from '../../i18n';
|
2
3
|
import { block } from '../../utils/cn';
|
3
4
|
import './PostsEmpty.css';
|
4
|
-
import { i18, Keyset } from '../../i18n';
|
5
5
|
const b = block('posts-empty');
|
6
6
|
export const PostsEmpty = () => (React.createElement("div", { className: b('container') },
|
7
7
|
React.createElement("div", { className: b('title') }, i18(Keyset.TitleEmptyContainer)),
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
2
2
|
import { debounce as lodashDebounce } from 'lodash';
|
3
3
|
import { TextInput } from '@gravity-ui/uikit';
|
4
|
-
import { ButtonWithIcon } from '../ButtonWithIcon/ButtonWithIcon';
|
5
4
|
import { useIsIPhone } from '../../hooks/useIsIPhone';
|
5
|
+
import { Keyset, i18 } from '../../i18n';
|
6
6
|
import { Close } from '../../icons/Close';
|
7
7
|
import { SearchIcon } from '../../icons/SearchIcon';
|
8
|
-
import { i18, Keyset } from '../../i18n';
|
9
8
|
import { block } from '../../utils/cn';
|
9
|
+
import { ButtonWithIcon } from '../ButtonWithIcon/ButtonWithIcon';
|
10
10
|
import './Search.css';
|
11
11
|
const b = block('search');
|
12
12
|
const SEARCH_ICON_SIZE = 16;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { block } from '../../utils/cn';
|
3
2
|
import { DEFAULT_PADDINGS } from '../../constants';
|
3
|
+
import { block } from '../../utils/cn';
|
4
4
|
import './Wrapper.css';
|
5
5
|
const b = block('wrapper');
|
6
6
|
export const Wrapper = ({ children, paddings = DEFAULT_PADDINGS, className, dataQa, }) => (React.createElement("section", { className: b({
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { DeviceContextProps } from '../contexts/DeviceContext';
|
3
3
|
import { RouterContextProps } from '../contexts/RouterContext';
|
4
4
|
import { UserContextProps } from '../contexts/UserContext';
|
5
|
-
import { DeviceContextProps } from '../contexts/DeviceContext';
|
6
5
|
import { ThemeValueType } from '../contexts/theme/ThemeValueContext';
|
7
6
|
import { Locale } from '../models/locale';
|
8
7
|
export interface BlogConstructorProviderProps {
|
@@ -12,7 +11,6 @@ export interface BlogConstructorProviderProps {
|
|
12
11
|
theme?: ThemeValueType;
|
13
12
|
user?: UserContextProps;
|
14
13
|
device?: DeviceContextProps;
|
15
|
-
analytics?: AnalyticsContextProps;
|
16
14
|
children?: React.ReactNode;
|
17
15
|
}
|
18
16
|
export declare const BlogConstructorProvider: React.FC<BlogConstructorProviderProps>;
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import React, { Fragment } from 'react';
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { DEFAULT_THEME } from '../constants';
|
3
|
+
import { DeviceContext } from '../contexts/DeviceContext';
|
4
4
|
import { LocaleContext } from '../contexts/LocaleContext';
|
5
|
+
import { MobileContext } from '../contexts/MobileContext';
|
5
6
|
import { RouterContext } from '../contexts/RouterContext';
|
6
7
|
import { UserContext } from '../contexts/UserContext';
|
7
|
-
import { DeviceContext } from '../contexts/DeviceContext';
|
8
8
|
import { ThemeValueContext } from '../contexts/theme/ThemeValueContext';
|
9
|
-
|
10
|
-
export const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = DEFAULT_THEME, user = {}, device = {}, analytics = {}, children, }) => {
|
9
|
+
export const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, theme = DEFAULT_THEME, user = {}, device = {}, children, }) => {
|
11
10
|
const context = [
|
12
11
|
React.createElement(ThemeValueContext.Provider, { value: { themeValue: theme }, key: "theme-context" }),
|
13
12
|
React.createElement(LocaleContext.Provider, { value: { locale }, key: "locale-context" }),
|
@@ -15,7 +14,6 @@ export const BlogConstructorProvider = ({ isMobile, locale = {}, router = {}, th
|
|
15
14
|
React.createElement(MobileContext.Provider, { value: Boolean(isMobile), key: "is-mobile-context" }),
|
16
15
|
React.createElement(UserContext.Provider, { value: user, key: "user-context" }),
|
17
16
|
React.createElement(DeviceContext.Provider, { value: device, key: "device-context" }),
|
18
|
-
React.createElement(AnalyticsContext.Provider, { value: analytics, key: "analytics-context" }),
|
19
17
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
20
18
|
return React.createElement(Fragment, null, context);
|
21
19
|
};
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import { Author } from '../blocks/Author/Author';
|
2
|
+
import { Banner } from '../blocks/Banner/Banner';
|
3
|
+
import { CTA } from '../blocks/CTA/CTA';
|
4
|
+
import { ColoredText } from '../blocks/ColoredText/ColoredText';
|
5
|
+
import { Feed } from '../blocks/Feed/Feed';
|
2
6
|
import { Header } from '../blocks/Header/Header';
|
3
|
-
import { YFM } from '../blocks/YFM/YFM';
|
4
7
|
import { Layout } from '../blocks/Layout/Layout';
|
5
8
|
import { Media } from '../blocks/Media/Media';
|
6
|
-
import { CTA } from '../blocks/CTA/CTA';
|
7
|
-
import { ColoredText } from '../blocks/ColoredText/ColoredText';
|
8
|
-
import { Author } from '../blocks/Author/Author';
|
9
|
-
import { Suggest } from '../blocks/Suggest/Suggest';
|
10
|
-
import { Banner } from '../blocks/Banner/Banner';
|
11
9
|
import { Meta } from '../blocks/Meta/Meta';
|
12
|
-
import {
|
10
|
+
import { Suggest } from '../blocks/Suggest/Suggest';
|
11
|
+
import { YFM } from '../blocks/YFM/YFM';
|
12
|
+
import { BlockType } from '../models/common';
|
13
13
|
const blocks = {
|
14
14
|
[BlockType.YFM]: YFM,
|
15
15
|
[BlockType.Layout]: Layout,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
|
2
|
+
import { GetPostsType, MetaProps, PostsProps, Service, SetQueryType, Tag, ToggleLikeCallbackType } from '../../models/common';
|
3
3
|
import './BlogPage.css';
|
4
4
|
export type BlogPageProps = {
|
5
5
|
content: PageContent;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { PageConstructor, PageConstructorProvider, } from '@gravity-ui/page-constructor';
|
3
|
-
import { FeedContext } from '../../contexts/FeedContext';
|
4
|
-
import { LikesContext } from '../../contexts/LikesContext';
|
5
3
|
import { MetaWrapper } from '../../components/MetaWrapper/MetaWrapper';
|
6
4
|
import componentMap from '../../constructor/blocksMap';
|
5
|
+
import { FeedContext } from '../../contexts/FeedContext';
|
6
|
+
import { LikesContext } from '../../contexts/LikesContext';
|
7
7
|
import './BlogPage.css';
|
8
8
|
export const BlogPage = ({ content, posts, tags, services, getPosts, metaData, toggleLike, navigation, settings, pageCountForShowSupportButtons, }) => (React.createElement("main", null,
|
9
9
|
React.createElement(LikesContext.Provider, { value: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
|
3
3
|
import { ShareOptions } from '@gravity-ui/uikit';
|
4
|
-
import { PostData, ToggleLikeCallbackType
|
4
|
+
import { MetaProps, PostData, ToggleLikeCallbackType } from '../../models/common';
|
5
5
|
import './BlogPostPage.css';
|
6
6
|
export interface BlogPostPageProps {
|
7
7
|
suggestedPosts: PostData[];
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { PageConstructor, PageConstructorProvider, } from '@gravity-ui/page-constructor';
|
3
|
+
import { MetaWrapper } from '../../components/MetaWrapper/MetaWrapper';
|
3
4
|
import componentMap from '../../constructor/blocksMap';
|
4
|
-
import { PostPageContext } from '../../contexts/PostPageContext';
|
5
5
|
import { LikesContext } from '../../contexts/LikesContext';
|
6
|
+
import { PostPageContext } from '../../contexts/PostPageContext';
|
6
7
|
import { useLikes } from '../../hooks/useLikes';
|
7
|
-
import { MetaWrapper } from '../../components/MetaWrapper/MetaWrapper';
|
8
8
|
import './BlogPostPage.css';
|
9
9
|
export const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, }) => {
|
10
10
|
const { hasUserLike, likesCount, handleLike } = useLikes({
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { PostData,
|
2
|
+
import { GetPostsType, PostData, Service, SetQueryType, Tag } from '../models/common';
|
3
3
|
export interface FeedContextProps {
|
4
4
|
posts?: PostData[];
|
5
5
|
pinnedPost?: PostData;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { DEFAULT_THEME } from '../../constants';
|
2
3
|
import { ThemeContext } from './ThemeContext';
|
3
4
|
import { ThemeValueContext } from './ThemeValueContext';
|
4
|
-
import { DEFAULT_THEME } from '../../constants';
|
5
5
|
export class ThemeProvider extends React.Component {
|
6
6
|
constructor() {
|
7
7
|
super(...arguments);
|