+
@@ -119,37 +117,37 @@ class AddReview extends React.Component {
height={400}
>
-
-
-
- Add review
-
-
-
-
-
-
-
-
+
+
+
+ Add review
+
+
+
+
+
+
+
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js
new file mode 100644
index 00000000000..c69d68de227
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js
@@ -0,0 +1,101 @@
+import React from "react";
+import {List, message, Typography, Empty, Button, Row, Col} from "antd";
+import SingleReview from "./SingleReview";
+import axios from "axios";
+import config from "../../../../../public/conf/config.json";
+import AddReview from "./AddReview";
+
+const {Text, Paragraph} = Typography;
+
+class CurrentUsersReview extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ data: []
+
+ };
+ }
+
+ componentDidMount() {
+ this.fetchData();
+ }
+
+ fetchData = () => {
+ const {uuid} = this.props;
+
+ axios.get(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/app/user/" + uuid,
+ ).then(res => {
+ if (res.status === 200) {
+ const data = res.data.data.data;
+ this.setState({data});
+ }
+
+ }).catch((error) => {
+ if (error.response.hasOwnProperty(status) && error.response.status === 401) {
+ message.error('You are not logged in');
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login';
+ } else {
+ message.error('Something went wrong when trying to get your review... :(');
+ }
+ });
+ };
+
+ render() {
+ const {data} = this.state;
+ const {uuid} = this.props;
+ return (
+
+
MY REVIEW
+
+ {data.length > 0 && (
+
+
+
+ (
+
+
+
+ )}
+ >
+
+
+
+
+
+
+
+ )}
+
+ {data.length === 0 && (
+
+
Share your experience with your community by adding a review.
+ }
+ >
+ {/**/}
+
+
+
+ )}
+
+
+
+ );
+ }
+
+}
+
+export default CurrentUsersReview;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/EditReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/EditReview.js
new file mode 100644
index 00000000000..ddc7892b40a
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/EditReview.js
@@ -0,0 +1,164 @@
+import React from "react";
+import {Drawer, Button, Icon, Row, Col, Typography, Divider, Input, Spin, notification} from 'antd';
+import StarRatings from "react-star-ratings";
+import axios from "axios";
+import config from "../../../../../public/conf/config.json";
+
+const {Title} = Typography;
+const {TextArea} = Input;
+
+class EditReview extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ visible: false,
+ content: '',
+ rating: 0,
+ loading: false
+ };
+ }
+
+ showDrawer = () => {
+ this.setState({
+ visible: true,
+ content: '',
+ rating: 0,
+ loading: false
+ });
+ };
+
+ onClose = () => {
+ this.setState({
+ visible: false,
+
+ });
+ };
+ changeRating = (newRating, name) => {
+ this.setState({
+ rating: newRating
+ });
+ };
+
+ onChange = (e) => {
+ this.setState({content: e.target.value})
+ };
+
+ onSubmit = () => {
+ const {content, rating} = this.state;
+ const {uuid} = this.props;
+ this.setState({
+ loading: true
+ });
+
+ const payload = {
+ content: content,
+ rating: rating
+ };
+
+ axios.post(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/reviews/" + uuid,
+ payload,
+ ).then(res => {
+ if (res.status === 201) {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["success"]({
+ message: 'Done!',
+ description:
+ 'Your review has been posted successfully.',
+ });
+
+ setTimeout(() => {
+ window.location.href = uuid;
+ }, 2000)
+ } else {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["error"]({
+ message: 'Something went wrong',
+ description:
+ "We are unable to add your review right now.",
+ });
+ }
+
+ }).catch((error) => {
+ if (error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login';
+ } else {
+ this.setState({
+ loading: false,
+ visible: false
+ });
+ notification["error"]({
+ message: 'Something went wrong',
+ description:
+ "We are unable to add your review right now.",
+ });
+ }
+ });
+
+
+ };
+
+ render() {
+ return (
+
+
+
+
+
+
+
+
+ Add review
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default EditReview;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css
index f77c5a31376..606437675a2 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css
@@ -1,15 +1,15 @@
-.demo-infinite-container {
+.infinite-container {
overflow: auto;
padding: 8px 24px;
}
-.demo-loading-container {
+.loading-container {
position: absolute;
bottom: 40px;
width: 100%;
text-align: center;
}
-.demo-loading {
+.loading {
position: absolute;
bottom: -40px;
left: 50%;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js
index db2b69c52df..54ba6321aca 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js
@@ -87,20 +87,8 @@ class Reviews extends React.Component {
};
render() {
- const review = {
- id: 2,
- content: "Btw, it was clear to me that I can cancel the 1 year subscription before the free trial week and so I did. Dont understand the negative reviews about that. It has a good collection of excercises, meditations etc. You just answer 5 questions and you get challenges assigned to you. I would have liked something even more personalized. I didnt like the interface. It is a bit messy and difficult to follow your tasks. So, I didnt want to do a full-year subscription. There could be more options.",
- rootParentI: -1,
- immediateParentId: -1,
- createdAt: "Fri, 24 May 2019 17:27:22 IST",
- modifiedAt: "Fri, 24 May 2019 17:27:22 IST",
- rating: 4,
- replies: []
- };
- // console.log(this.state.loadMore);
- // console.log(this.state.data.length);
return (
-
+
{this.state.loading && this.state.hasMore && (
-
+
)}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js
index d76bb00ed26..60497086d0b 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/SingleReview.js
@@ -6,14 +6,15 @@ import Twemoji from "react-twemoji";
import "./Reviews.css";
const {Text, Paragraph} = Typography;
-const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3'];
+const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3','#e84393','#f9ca24'];
class SingleReview extends React.Component {
render() {
- const review = this.props.review;
- const randomColor = colorList[Math.floor(Math.random() * (colorList.length))];
- const avatarLetter = review.username.charAt(0).toUpperCase();
+ const {review} = this.props;
+ const {username} = review;
+ const randomColor = colorList[username.length%10];
+ const avatarLetter = username.charAt(0).toUpperCase();
const content = (
{review.createdAt}
-
-
- {review.content}
+
+
+ {review.content}
+
-
);
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
index 71bae0e7927..fbdb202364d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js
@@ -68,7 +68,7 @@ class NormalLoginForm extends React.Component {
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, request
).then(res => {
if (res.status === 200) {
- window.location = res.data.url;
+ window.location = config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+"/store";
}
}).catch(function (error) {
if (error.response.status === 400) {
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
index 2a2a1dd0ff4..55c99248581 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js
@@ -48,7 +48,6 @@ class Dashboard extends React.Component {
-
{this.state.routes.map((route) => (
))}