Skip to content

Commit 46efafb

Browse files
committed
Update based on latest config.
1 parent daa5454 commit 46efafb

File tree

3 files changed

+31
-44
lines changed

3 files changed

+31
-44
lines changed

src/reactions/block.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"$schema": "https://schemas.wp.org/trunk/block.json",
3-
"name": "activitypub/reactions",
4-
"apiVersion": 2,
5-
"version": "1.0.0",
6-
"title": "Fediverse Reactions",
7-
"category": "widgets",
8-
"icon": "heart",
9-
"description": "Display Fediverse likes and reposts",
10-
"supports": {
11-
"html": false,
12-
"align": true,
13-
"layout": {
14-
"default": {
15-
"type": "constrained",
16-
"orientation": "vertical",
17-
"justifyContent": "center"
18-
}
19-
}
20-
},
21-
"attributes": {},
22-
"blockHooks": {
23-
"core/post-content": "after"
24-
},
25-
"textdomain": "activitypub",
26-
"editorScript": "file:./index.js",
27-
"style": [ "file:./style-index.css", "wp-components" ],
28-
"viewScript": "file:./view.js"
2+
"$schema": "https://schemas.wp.org/trunk/block.json",
3+
"name": "activitypub/reactions",
4+
"apiVersion": 2,
5+
"version": "1.0.0",
6+
"title": "Fediverse Reactions",
7+
"category": "widgets",
8+
"icon": "heart",
9+
"description": "Display Fediverse likes and reposts",
10+
"supports": {
11+
"html": false,
12+
"align": true,
13+
"layout": {
14+
"default": {
15+
"type": "constrained",
16+
"orientation": "vertical",
17+
"justifyContent": "center"
18+
}
19+
}
20+
},
21+
"attributes": {},
22+
"blockHooks": {
23+
"core/post-content": "after"
24+
},
25+
"textdomain": "activitypub",
26+
"editorScript": "file:./index.js",
27+
"style": [ "file:./style-index.css", "wp-components" ],
28+
"viewScript": "file:./view.js"
2929
}

src/reactions/edit.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,15 @@ const generateDummyReactions = () => ( {
111111
_x( '%d likes', 'number of likes', 'activitypub' ),
112112
9
113113
),
114-
items: Array.from( { length: 9 }, ( _, i ) =>
115-
generateDummyReaction( i )
116-
),
114+
items: Array.from( { length: 9 }, ( _, i ) => generateDummyReaction( i ) ),
117115
},
118116
reposts: {
119117
label: sprintf(
120118
/* translators: %d: Number of reposts */
121119
_x( '%d reposts', 'number of reposts', 'activitypub' ),
122120
6
123121
),
124-
items: Array.from( { length: 6 }, ( _, i ) =>
125-
generateDummyReaction( i + 9 )
126-
),
122+
items: Array.from( { length: 6 }, ( _, i ) => generateDummyReaction( i + 9 ) ),
127123
},
128124
} );
129125

@@ -158,11 +154,7 @@ export default function Edit( { attributes, __unstableLayoutClassNames } ) {
158154

159155
return (
160156
<div { ...blockProps }>
161-
<InnerBlocks
162-
template={ TEMPLATE }
163-
allowedBlocks={ ALLOWED_BLOCKS }
164-
templateLock={ false }
165-
/>
157+
<InnerBlocks template={ TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } templateLock={ false } />
166158
<Reactions reactions={ dummyReactions } />
167159
</div>
168160
);

src/reactions/reactions.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,7 @@ const ReactionGroup = ( { items, label } ) => {
211211

212212
// Calculate how many avatars can fit
213213
// First avatar takes full width, rest take effective width
214-
const maxAvatars = Math.max(
215-
1,
216-
Math.floor(
217-
( availableWidth - AVATAR_WIDTH ) / EFFECTIVE_AVATAR_WIDTH
218-
)
219-
);
214+
const maxAvatars = Math.max( 1, Math.floor( ( availableWidth - AVATAR_WIDTH ) / EFFECTIVE_AVATAR_WIDTH ) );
220215

221216
// Ensure we don't show more than we have
222217
setVisibleCount( Math.min( maxAvatars, items.length ) );

0 commit comments

Comments
 (0)