Skip to content

Commit cb42cfd

Browse files
committed
Social: Remove share limits logic and UI
1 parent a3795e3 commit cb42cfd

File tree

24 files changed

+16
-724
lines changed

24 files changed

+16
-724
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: removed
3+
4+
Remove the obsolete share limits logic.

projects/js-packages/publicize-components/src/components/admin-page/header/index.js

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,22 @@
1-
import {
2-
Container,
3-
Col,
4-
H3,
5-
Button,
6-
SocialIcon,
7-
getUserLocale,
8-
} from '@automattic/jetpack-components';
1+
import { Button, Col, Container, H3 } from '@automattic/jetpack-components';
92
import { ConnectionError, useConnectionErrorNotice } from '@automattic/jetpack-connection';
103
import { getAdminUrl } from '@automattic/jetpack-script-data';
114
import { useDispatch, useSelect } from '@wordpress/data';
125
import { __ } from '@wordpress/i18n';
13-
import { Icon, postList } from '@wordpress/icons';
146
import { store as socialStore } from '../../../social-store';
15-
import StatCards from './stat-cards';
167
import styles from './styles.module.scss';
178

189
const Header = () => {
19-
const {
20-
hasConnections,
21-
isModuleEnabled,
22-
totalSharesCount,
23-
sharedPostsCount,
24-
isShareLimitEnabled,
25-
} = useSelect( select => {
10+
const { hasConnections, isModuleEnabled } = useSelect( select => {
2611
const store = select( socialStore );
2712
return {
2813
hasConnections: store.getConnections().length > 0,
2914
isModuleEnabled: store.getSocialModuleSettings().publicize,
30-
totalSharesCount: store.getTotalSharesCount(),
31-
sharedPostsCount: store.getSharedPostsCount(),
32-
isShareLimitEnabled: store.isShareLimitEnabled(),
3315
};
3416
} );
3517

3618
const { hasConnectionError } = useConnectionErrorNotice();
3719

38-
const formatter = Intl.NumberFormat( getUserLocale(), {
39-
notation: 'compact',
40-
compactDisplay: 'short',
41-
} );
42-
4320
const { openConnectionsModal } = useDispatch( socialStore );
4421

4522
return (
@@ -71,24 +48,6 @@ const Header = () => {
7148
</Button>
7249
</div>
7350
</Col>
74-
{ isShareLimitEnabled ? (
75-
<Col sm={ 4 } md={ 4 } lg={ { start: 7, end: 12 } }>
76-
<StatCards
77-
stats={ [
78-
{
79-
icon: <SocialIcon />,
80-
label: __( 'Total shares past 30 days', 'jetpack-publicize-components' ),
81-
value: formatter.format( totalSharesCount ),
82-
},
83-
{
84-
icon: <Icon icon={ postList } />,
85-
label: __( 'Posted this month', 'jetpack-publicize-components' ),
86-
value: formatter.format( sharedPostsCount ),
87-
},
88-
] }
89-
/>
90-
</Col>
91-
) : null }
9251
</Container>
9352
</>
9453
);

projects/js-packages/publicize-components/src/components/admin-page/header/stat-cards/index.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

projects/js-packages/publicize-components/src/components/admin-page/header/stat-cards/styles.module.scss

Lines changed: 0 additions & 45 deletions
This file was deleted.

projects/js-packages/publicize-components/src/social-store/hydrate-stores.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ export async function hydrateStores() {
5555
await finishResolution( 'getEntityRecords', [ 'wpcom/v2', 'publicize/services' ] );
5656
}
5757

58-
if ( ! wpcomEntities.some( ( { name } ) => name === 'publicize/shares-data' ) ) {
59-
await addEntities( [
60-
{
61-
kind: 'wpcom/v2',
62-
name: 'publicize/shares-data',
63-
baseURL: '/wpcom/v2/publicize/shares-data',
64-
label: __( 'Publicize shares data', 'jetpack-publicize-components' ),
65-
},
66-
] );
67-
}
68-
6958
if ( ! wpcomEntities.some( ( { name } ) => name === 'publicize/scheduled-actions' ) ) {
7059
await addEntities( [
7160
{

projects/js-packages/publicize-components/src/social-store/selectors/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as scheduledSharesSelectors from './scheduled-shares';
44
import * as servicesSelectors from './services';
55
import * as sharepostSelectors from './share-post';
66
import * as shareStatusSelectors from './share-status';
7-
import * as sharesDataSelectors from './shares-data';
87
import * as socialImageGeneratorSelectors from './social-image-generator';
98
import * as socialModuleSelectors from './social-module-settings';
109
import * as socialSettingsSelectors from './social-settings';
@@ -19,7 +18,6 @@ const selectors = {
1918
...socialModuleSelectors,
2019
...socialSettingsSelectors,
2120
...servicesSelectors,
22-
...sharesDataSelectors,
2321
...scheduledSharesSelectors,
2422
...unifiedModalSelectors,
2523
};

projects/js-packages/publicize-components/src/social-store/selectors/shares-data.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

projects/js-packages/publicize-components/src/social-store/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,6 @@ export type ScheduledShare = {
145145
wpcom_user_id: number;
146146
};
147147

148-
export type SharesData = {
149-
publicized_count: number;
150-
to_be_publicized_count: number;
151-
shared_posts_count: number;
152-
is_share_limit_enabled: boolean;
153-
};
154-
155148
export type SocialImageFontOption = {
156149
id: string;
157150
label: string;

projects/js-packages/publicize-components/src/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ export interface SocialUrls {
99
connectionsManagementPage: string;
1010
}
1111

12-
export type SharesData = {
13-
to_be_publicized_count: number;
14-
publicized_count: number;
15-
shared_posts_count: number;
16-
is_share_limit_enabled: boolean;
17-
};
18-
1912
export type ConnectionService = {
2013
id: string;
2114
label: string;
@@ -49,7 +42,6 @@ export interface SocialScriptData {
4942
is_publicize_enabled: boolean;
5043
plugin_info: PluginInfo;
5144
settings: SocialSettings;
52-
shares_data: SharesData;
5345
store_initial_state: SocialStoreState;
5446
supported_services: Array< ConnectionService >;
5547
urls: SocialUrls;

projects/js-packages/publicize-components/src/utils/test-utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ export function mockScriptData( data = {} ) {
203203
social: { version: '1.0.0' },
204204
jetpack: { version: '1.0.0' },
205205
},
206-
shares_data: {},
207206
store_initial_state: {},
208207
...data.social,
209208
},

0 commit comments

Comments
 (0)