Skip to content

Commit 45f0957

Browse files
committed
add devto, medium and hashnode
1 parent 004cf3c commit 45f0957

File tree

15 files changed

+393
-198
lines changed

15 files changed

+393
-198
lines changed

apps/frontend/src/components/launches/polonto.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const ActionControls = ({ store }: any) => {
4444
<Button
4545
loading={load}
4646
className="outline-none"
47-
innerClassName="invert outline-none"
47+
innerClassName="invert outline-none text-black"
4848
onClick={async () => {
4949
setLoad(true);
5050
const blob = await store.toBlob();
@@ -56,10 +56,10 @@ const ActionControls = ({ store }: any) => {
5656
body: formData,
5757
})
5858
).json();
59-
close.setMedia({
59+
close.setMedia([{
6060
id: data.id,
6161
path: data.path,
62-
});
62+
}]);
6363
close.close();
6464
}}
6565
>
@@ -69,7 +69,7 @@ const ActionControls = ({ store }: any) => {
6969
);
7070
};
7171
const Polonto: FC<{
72-
setMedia: (params: { id: string; path: string }) => void;
72+
setMedia: (params: { id: string; path: string }[]) => void;
7373
type?: 'image' | 'video';
7474
closeModal: () => void;
7575
width?: number;

apps/frontend/src/components/media/media.component.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const Pagination: FC<{
127127
export const ShowMediaBoxModal: FC = () => {
128128
const [showModal, setShowModal] = useState(false);
129129
const [callBack, setCallBack] =
130-
useState<(params: { id: string; path: string }) => void | undefined>();
130+
useState<(params: { id: string; path: string }[]) => void | undefined>();
131131
const closeModal = useCallback(() => {
132132
setShowModal(false);
133133
setCallBack(undefined);
@@ -155,7 +155,7 @@ export const showMediaBox = (
155155
};
156156
const CHUNK_SIZE = 1024 * 1024;
157157
export const MediaBox: FC<{
158-
setMedia: (params: { id: string; path: string }) => void;
158+
setMedia: (params: { id: string; path: string }[]) => void;
159159
type?: 'image' | 'video';
160160
closeModal: () => void;
161161
}> = (props) => {
@@ -767,12 +767,12 @@ export const MediaComponent: FC<{
767767
const showDesignModal = useCallback(() => {
768768
setMediaModal(true);
769769
}, [modal]);
770-
const changeMedia = useCallback((m: { path: string; id: string }) => {
771-
setCurrentMedia(m);
770+
const changeMedia = useCallback((m: { path: string; id: string }[]) => {
771+
setCurrentMedia(m[0]);
772772
onChange({
773773
target: {
774774
name,
775-
value: m,
775+
value: m[0],
776776
},
777777
});
778778
}, []);
@@ -807,7 +807,7 @@ export const MediaComponent: FC<{
807807
<div className="my-[20px] cursor-pointer w-[200px] h-[200px] border-2 border-tableBorder">
808808
<img
809809
className="w-full h-full object-cover"
810-
src={mediaDirectory.set(currentMedia.path)}
810+
src={currentMedia.path}
811811
onClick={() => window.open(mediaDirectory.set(currentMedia.path))}
812812
/>
813813
</div>

apps/frontend/src/components/new-launch/providers/devto/devto.provider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export default withProvider({
9090
postComment: PostComment.COMMENT,
9191
minimumCharacters: [],
9292
SettingsComponent: DevtoSettings,
93-
CustomPreviewComponent: DevtoPreview,
93+
CustomPreviewComponent: undefined, // DevtoPreview,
9494
dto: DevToSettingsDto,
9595
checkValidity: undefined,
96-
maximumCharacters: undefined,
96+
maximumCharacters: 100000,
9797
});

apps/frontend/src/components/new-launch/providers/devto/devto.tags.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const DevtoTags: FC<{
1616
}) => void;
1717
}> = (props) => {
1818
const { onChange, name, label } = props;
19+
const form = useSettings();
1920
const customFunc = useCustomProviderFunction();
2021
const [tags, setTags] = useState<any[]>([]);
2122
const { getValues } = useSettings();
@@ -24,14 +25,9 @@ export const DevtoTags: FC<{
2425
(tagIndex: number) => {
2526
const modify = tagValue.filter((_, i) => i !== tagIndex);
2627
setTagValue(modify);
27-
onChange({
28-
target: {
29-
value: modify,
30-
name,
31-
},
32-
});
28+
form.setValue(name, modify);
3329
},
34-
[tagValue]
30+
[tagValue, name, form]
3531
);
3632
const onAddition = useCallback(
3733
(newTag: any) => {
@@ -40,14 +36,9 @@ export const DevtoTags: FC<{
4036
}
4137
const modify = [...tagValue, newTag];
4238
setTagValue(modify);
43-
onChange({
44-
target: {
45-
value: modify,
46-
name,
47-
},
48-
});
39+
form.setValue(name, modify);
4940
},
50-
[tagValue]
41+
[tagValue, name, form]
5142
);
5243
useEffect(() => {
5344
customFunc.get('tags').then((data) => setTags(data));

apps/frontend/src/components/new-launch/providers/hashnode/hashnode.provider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export default withProvider({
9292
postComment: PostComment.COMMENT,
9393
minimumCharacters: [],
9494
SettingsComponent: HashnodeSettings,
95-
CustomPreviewComponent: HashnodePreview,
95+
CustomPreviewComponent: undefined, // HashnodePreview,
9696
dto: HashnodeSettingsDto,
9797
checkValidity: undefined,
98-
maximumCharacters: undefined,
98+
maximumCharacters: 10000,
9999
});

apps/frontend/src/components/new-launch/providers/medium/medium.provider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ const MediumSettings: FC = () => {
6767
);
6868
};
6969
export default withProvider({
70-
postComment: PostComment.COMMENT,
70+
postComment: PostComment.POST,
7171
minimumCharacters: [],
7272
SettingsComponent: MediumSettings,
73-
CustomPreviewComponent: MediumPreview,
73+
CustomPreviewComponent: undefined, //MediumPreview,
7474
dto: MediumSettingsDto,
7575
checkValidity: undefined,
76-
maximumCharacters: undefined,
76+
maximumCharacters: 100000,
7777
});

libraries/nestjs-libraries/src/dtos/posts/providers-settings/all.providers.settings.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { SlackDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-setting
1010
import { InstagramDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/instagram.dto';
1111
import { LinkedinDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/linkedin.dto';
1212
import { IsIn } from 'class-validator';
13+
import { MediumSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/medium.settings.dto';
14+
import { DevToSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/dev.to.settings.dto';
15+
import { HashnodeSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/hashnode.settings.dto';
1316

1417
export type ProviderExtension<T extends string, M> = { __type: T } & M;
1518
export type AllProvidersSettings =
@@ -26,6 +29,9 @@ export type AllProvidersSettings =
2629
| ProviderExtension<'linkedin-page', LinkedinDto>
2730
| ProviderExtension<'instagram', InstagramDto>
2831
| ProviderExtension<'instagram-standalone', InstagramDto>
32+
| ProviderExtension<'medium', MediumSettingsDto>
33+
| ProviderExtension<'devto', DevToSettingsDto>
34+
| ProviderExtension<'hashnode', HashnodeSettingsDto>
2935
| ProviderExtension<'facebook', None>
3036
| ProviderExtension<'threads', None>
3137
| ProviderExtension<'mastodon', None>
@@ -52,6 +58,9 @@ export const allProviders = (setEmpty?: any) => {
5258
{ value: LinkedinDto, name: 'linkedin-page' },
5359
{ value: InstagramDto, name: 'instagram' },
5460
{ value: InstagramDto, name: 'instagram-standalone' },
61+
{ value: MediumSettingsDto, name: 'medium' },
62+
{ value: DevToSettingsDto, name: 'devto' },
63+
{ value: HashnodeSettingsDto, name: 'hashnode' },
5564
{ value: setEmpty, name: 'facebook' },
5665
{ value: setEmpty, name: 'threads' },
5766
{ value: setEmpty, name: 'mastodon' },

libraries/nestjs-libraries/src/dtos/posts/providers-settings/dev.to.settings.dto.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class DevToSettingsDto {
4141

4242
@IsArray()
4343
@ArrayMaxSize(4)
44-
@IsOptional()
44+
@Type(() => DevToTagsSettingsDto)
45+
@ValidateNested({ each: true })
4546
tags: DevToTagsSettingsDto[];
4647
}

libraries/nestjs-libraries/src/dtos/posts/providers-settings/hashnode.settings.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ export class HashnodeSettingsDto {
5353

5454
@IsArray()
5555
@ArrayMinSize(1)
56+
@Type(() => HashnodeTagsSettings)
57+
@ValidateNested({ each: true })
5658
tags: HashnodeTagsSettings[];
5759
}

libraries/nestjs-libraries/src/integrations/article/dev.to.provider.ts

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

0 commit comments

Comments
 (0)