Skip to content

Commit d54366a

Browse files
Merge pull request #2 from wrappid/WRPD-feature-1
feat(core): ✨ Added the feature of Linkedin Post Scheduler
2 parents c3ebfc9 + f8623a6 commit d54366a

16 files changed

+20289
-35
lines changed

app/actions/test.action.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { RESET_TEST, TEST_FAILURE, TEST_SUCCESS } from "../types/test.types";
1+
import { RESET_TEST, POST_FAILURE, POST_SUCCESS } from "../types/test.types";
22

33
export const testSuccess = () => {
44
return (dispatch) => {
5-
dispatch({ type: TEST_SUCCESS });
5+
dispatch({ type: POST_SUCCESS });
66
};
77
};
88

99
export const testFailure = () => {
1010
return (dispatch) => {
11-
dispatch({ type: TEST_FAILURE });
11+
dispatch({ type: POST_FAILURE });
1212
};
1313
};
1414

app/components.registry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import ModuleComponent from "./components/ModuleComponent";
2+
import MultipleImagePicker from "./components/MultipleImagePicker";
3+
import PostToLinkedin from "./components/PostToLinkedin";
24
import TestComponent from "./components/TestComponent";
35
import TestComponentMobile from "./components/TestComponentMobile";
46
import TestComponentWeb from "./components/TestComponentWeb";
57

68
export const ComponentsRegistry = {
79
ModuleComponent : { comp: ModuleComponent },
10+
MultipleImagePicker : { comp: MultipleImagePicker },
11+
PostToLinkedin : { comp: PostToLinkedin },
812
TestComponents : { comp: TestComponent },
913
TestComponentsMobile: {
1014
comp: TestComponentMobile,
@@ -14,4 +18,5 @@ export const ComponentsRegistry = {
1418
comp : TestComponentWeb,
1519
mobile: false
1620
}
21+
1722
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* eslint-disable no-unused-vars */
2+
/* eslint-disable etc/no-commented-out-code */
3+
import { useState } from "react";
4+
5+
import {
6+
CoreBox, CoreIcon, CoreInput, CoreImage,
7+
CoreClasses
8+
} from "@wrappid/core";
9+
10+
const ImageUpload = (props) => {
11+
// const [selectedImages, setSelectedImages] = useState([]);
12+
const [previewUrls, setPreviewUrls] = useState([]);
13+
14+
const handleImageChange = (event) => {
15+
const files = Array.from(event.target.files);
16+
17+
props?.formik?.setFieldValue(props?.id, files); // Set images in Formik
18+
};
19+
20+
return (
21+
<CoreBox>
22+
<CoreInput
23+
{...props}
24+
type="file"
25+
// onChange={handleImageChange}
26+
inputProps={{
27+
accept : "image/*",
28+
multiple: true,
29+
readOnly: true
30+
}}
31+
/>
32+
33+
{/* Image previews */}
34+
{previewUrls.length > 0 ? (
35+
<CoreBox
36+
styleClasses={[CoreClasses.DISPLAY.FLEX, CoreClasses.FLEX.FLEXWRAP, CoreClasses.GAP.GAP_1, CoreClasses.MARGIN.MX10]}
37+
>
38+
{previewUrls.map((url, index) => (
39+
<CoreImage
40+
key={index}
41+
src={url}
42+
alt={`Preview ${index + 1}`}
43+
width={100}
44+
height={100}
45+
/>
46+
))}
47+
</CoreBox>
48+
) : (
49+
<p>No image uploaded</p>
50+
)}
51+
52+
<CoreIcon icon="photo_camera" />
53+
</CoreBox>
54+
);
55+
};
56+
57+
export default ImageUpload;

app/components/PostToLinkedin.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* eslint-disable etc/no-commented-out-code */
2+
3+
import { BlankLayout, CoreBox, CoreClasses, CoreForm, CoreLayoutItem } from "@wrappid/core";
4+
5+
export default function PostToLinkedin() {
6+
7+
return (
8+
// eslint-disable-next-line react/jsx-no-comment-textnodes
9+
<>
10+
<CoreLayoutItem id={BlankLayout.PLACEHOLDER.CONTENT}>
11+
<CoreBox styleClasses={[CoreClasses.PADDING.P3]}>
12+
<CoreForm
13+
formId="linkedinPost"
14+
mode="edit"
15+
authenticated={true}
16+
/>
17+
</CoreBox>
18+
19+
</CoreLayoutItem>
20+
21+
</>
22+
);
23+
}

app/reducers.registry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import testReducer from "./reducers/test.reducer";
1+
import linkedinReducer from "./reducers/linkedIn.reducer";
22

3-
export const ReducersRegistry = { "test": testReducer };
3+
export const ReducersRegistry = { "linkedIn": linkedinReducer };

app/reducers/linkedIn.reducer.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { POST_FAILURE, POST_SUCCESS } from "../types/test.types";
2+
3+
const initialState = {
4+
data : {},
5+
error : false,
6+
success: false,
7+
};
8+
9+
const linkedinReducer = (state = initialState, action) => {
10+
switch (action.type) {
11+
case POST_SUCCESS:
12+
return {
13+
...state,
14+
data : action.payload,
15+
error : false,
16+
success: true
17+
};
18+
19+
case POST_FAILURE:
20+
return {
21+
...state,
22+
error : true,
23+
success: false
24+
};
25+
26+
default:
27+
return state;
28+
}
29+
};
30+
31+
export default linkedinReducer;

app/reducers/test.reducer.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RESET_TEST, TEST_FAILURE, TEST_SUCCESS } from "../types/test.types";
1+
import { RESET_TEST } from "../types/test.types";
22

33
const initialState = {
44
error : false,
@@ -8,18 +8,6 @@ const initialState = {
88

99
const testReducer = (state = initialState, action) => {
1010
switch (action.type) {
11-
case TEST_SUCCESS:
12-
return {
13-
...state,
14-
success: true
15-
};
16-
17-
case TEST_FAILURE:
18-
return {
19-
...state,
20-
success: true
21-
};
22-
2311
case RESET_TEST:
2412
return initialState;
2513

app/routes.registry.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
import { BlankLayout } from "@wrappid/core";
2+
13
export const RoutesRegistry = {
24
defaultModuleRoute: {
35
Page : { appComponent: "ModuleComponent" },
46
authRequired: false,
57
entityRef : "wrappid",
68
url : "wrappid"
79
},
10+
11+
linkedInPost: {
12+
Page : { appComponent: "PostToLinkedin", layout: BlankLayout.name },
13+
authRequired: true,
14+
entityRef : "linkedinpost",
15+
url : "linkedinpost"
16+
},
817
};

app/types/test.types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const TEST_SUCCESS = "TEST_SUCCESS";
2-
export const TEST_FAILURE = "TEST_FAILURE";
1+
export const POST_SUCCESS = "POST_SUCCESS";
2+
export const POST_FAILURE = "POST_FAILURE";
33
export const RESET_TEST = "RESET_TEST";

0 commit comments

Comments
 (0)