Skip to content

Commit cdbf173

Browse files
committed
feat: carousel
1 parent f72bbb9 commit cdbf173

File tree

6 files changed

+223
-7
lines changed

6 files changed

+223
-7
lines changed

apps/frontend/src/components/launches/providers/linkedin/linkedin.provider.tsx

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
11
import { withProvider } from '@gitroom/frontend/components/launches/providers/high.order.provider';
2-
export default withProvider(
3-
null,
2+
import { Checkbox } from '@gitroom/react/form/checkbox';
3+
import { useT } from '@gitroom/react/translation/get.transation.service.client';
4+
import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values';
5+
import { LinkedinDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/linkedin.dto';
6+
7+
const LinkedInSettings = () => {
8+
const t = useT();
9+
const { watch, register, formState, control } = useSettings();
10+
11+
return (
12+
<div className="mb-[20px]">
13+
<Checkbox
14+
variant="hollow"
15+
label={t('post_as_images_carousel', 'Post as images carousel')}
16+
{...register('post_as_images_carousel', {
17+
value: false,
18+
})}
19+
/>
20+
</div>
21+
);
22+
};
23+
export default withProvider<LinkedinDto>(
24+
LinkedInSettings,
425
undefined,
5-
undefined,
6-
async (posts) => {
26+
LinkedinDto,
27+
async (posts, vals) => {
728
const [firstPost, ...restPosts] = posts;
29+
30+
if (
31+
vals.post_as_images_carousel &&
32+
(firstPost.length < 2 ||
33+
firstPost.some((p) => p.path.indexOf('mp4') > -1))
34+
) {
35+
return 'LinkedIn carousel can only be created with 2 or more images and no videos.';
36+
}
37+
838
if (
939
firstPost.length > 1 &&
1040
firstPost.some((p) => p.path.indexOf('mp4') > -1)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { IsBoolean, IsOptional } from 'class-validator';
2+
3+
export class LinkedinDto {
4+
@IsBoolean()
5+
@IsOptional()
6+
post_as_images_carousel: boolean;
7+
}

libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { readOrFetch } from '@gitroom/helpers/utils/read.or.fetch';
1111
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
1212
import { Integration } from '@prisma/client';
1313
import { PostPlug } from '@gitroom/helpers/decorators/post.plug';
14+
import { LinkedinDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/linkedin.dto';
1415

1516
export class LinkedinProvider extends SocialAbstract implements SocialProvider {
1617
identifier = 'linkedin';
@@ -314,7 +315,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
314315
return connectAll.join('');
315316
}
316317

317-
async post(
318+
async post<LinkedinDto>(
318319
id: string,
319320
accessToken: string,
320321
postDetails: PostDetails[],

libraries/react-shared-libraries/src/translation/locales/en/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,5 +482,6 @@
482482
"90_days": "90 Days",
483483
"start_7_days_free_trial": "Start 7 days free trial",
484484
"change_language": "Change Language",
485-
"that_a_wrap": "That's a wrap!\n\nIf you enjoyed this thread:\n\n1. Follow me @{{username}} for more of these\n2. RT the tweet below to share this thread with your audience\n"
485+
"that_a_wrap": "That's a wrap!\n\nIf you enjoyed this thread:\n\n1. Follow me @{{username}} for more of these\n2. RT the tweet below to share this thread with your audience\n",
486+
"post_as_images_carousel": "Post as images carousel"
486487
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
"i18next": "^25.2.1",
150150
"i18next-browser-languagedetector": "^8.1.0",
151151
"i18next-resources-to-backend": "^1.2.1",
152+
"image-to-pdf": "^3.0.2",
152153
"ioredis": "^5.3.2",
153154
"json-to-graphql-query": "^2.2.5",
154155
"jsonwebtoken": "^9.0.2",

0 commit comments

Comments
 (0)