@paro.io/expert-shared-components 1.4.9 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/ReviewsTab/LeaveResponseModal.d.ts +3 -2
- package/lib/components/ReviewsTab/LeaveResponseModal.js +2 -1
- package/lib/components/ReviewsTab/ProjectReviewsSection.d.ts +1 -1
- package/lib/components/ReviewsTab/RatingHeader.js +4 -1
- package/lib/components/ReviewsTab/ReviewsTab.d.ts +4 -2
- package/lib/components/ReviewsTab/ReviewsTab.js +10 -2
- package/package.json +1 -1
|
@@ -4,10 +4,11 @@ interface LeaveResponseModalProps {
|
|
|
4
4
|
responseModal: boolean;
|
|
5
5
|
setResponseModal: (responseModal: boolean) => void;
|
|
6
6
|
createOrUpdateRating?: any;
|
|
7
|
-
isEditResponse
|
|
7
|
+
isEditResponse?: boolean;
|
|
8
8
|
daysLeft: number;
|
|
9
9
|
getParoProjectsDocument?: any;
|
|
10
10
|
clientName?: string;
|
|
11
|
+
updateRouteAfterSubmitResponse?: any;
|
|
11
12
|
}
|
|
12
|
-
declare const LeaveResponseModal: ({ rating, responseModal, setResponseModal, createOrUpdateRating, isEditResponse, daysLeft, getParoProjectsDocument, clientName, }: LeaveResponseModalProps) => React.JSX.Element;
|
|
13
|
+
declare const LeaveResponseModal: ({ rating, responseModal, setResponseModal, createOrUpdateRating, isEditResponse, daysLeft, getParoProjectsDocument, clientName, updateRouteAfterSubmitResponse }: LeaveResponseModalProps) => React.JSX.Element;
|
|
13
14
|
export default LeaveResponseModal;
|
|
@@ -40,7 +40,7 @@ const base_ui_1 = require("@paro.io/base-ui");
|
|
|
40
40
|
const core_1 = require("@material-ui/core");
|
|
41
41
|
const ReviewsTab_1 = require("./ReviewsTab");
|
|
42
42
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
43
|
-
const LeaveResponseModal = ({ rating, responseModal, setResponseModal, createOrUpdateRating, isEditResponse, daysLeft, getParoProjectsDocument, clientName, }) => {
|
|
43
|
+
const LeaveResponseModal = ({ rating, responseModal, setResponseModal, createOrUpdateRating, isEditResponse, daysLeft, getParoProjectsDocument, clientName, updateRouteAfterSubmitResponse }) => {
|
|
44
44
|
const [showError, setShowError] = (0, react_1.useState)(false);
|
|
45
45
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
46
46
|
const placeholderText = (rating === null || rating === void 0 ? void 0 : rating.overallRating) >= 4
|
|
@@ -89,6 +89,7 @@ const LeaveResponseModal = ({ rating, responseModal, setResponseModal, createOrU
|
|
|
89
89
|
});
|
|
90
90
|
setLoading(false);
|
|
91
91
|
setResponseModal(false);
|
|
92
|
+
updateRouteAfterSubmitResponse && updateRouteAfterSubmitResponse();
|
|
92
93
|
}).catch(() => {
|
|
93
94
|
(0, ReviewsTab_1.toastNotification)({
|
|
94
95
|
position: 'top-center',
|
|
@@ -17,7 +17,7 @@ type ProjectReviewsSectionProps = {
|
|
|
17
17
|
isInternal?: boolean;
|
|
18
18
|
createOrUpdateRating?: any;
|
|
19
19
|
getparoProjectsByClientIdDocument?: any;
|
|
20
|
-
projectIdToShow?:
|
|
20
|
+
projectIdToShow?: number;
|
|
21
21
|
};
|
|
22
22
|
export declare const calculateAverageRatings: (paroProjectsData: any[]) => {
|
|
23
23
|
overallRating: number;
|
|
@@ -102,7 +102,10 @@ const RatingHeader = ({ ratings, project, index, highlightedRatings, requestStat
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
(0, react_1.useEffect)(() => {
|
|
105
|
-
if (projectIdToShow) {
|
|
105
|
+
if (projectIdToShow === undefined || projectIdToShow === null) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (projectIdToShow >= 0 && isClientPortal) {
|
|
106
109
|
const headerToScrollTo = document.getElementById(`header_${projectIdToShow}`);
|
|
107
110
|
headerToScrollTo === null || headerToScrollTo === void 0 ? void 0 : headerToScrollTo.scrollIntoView({ behavior: 'smooth' });
|
|
108
111
|
toggleOpen(projectIdToShow);
|
|
@@ -9,7 +9,9 @@ interface ReviewsTabProps {
|
|
|
9
9
|
isClientPortal?: boolean;
|
|
10
10
|
isInternal?: boolean;
|
|
11
11
|
getparoProjectsByClientIdDocument?: any;
|
|
12
|
-
projectIdToShow?:
|
|
12
|
+
projectIdToShow?: number;
|
|
13
|
+
ratingIdForResponse?: number;
|
|
14
|
+
updateRouteAfterSubmitResponse?: any;
|
|
13
15
|
}
|
|
14
16
|
interface ToastNotificationProps {
|
|
15
17
|
color?: 'success' | 'info' | 'warning' | 'danger';
|
|
@@ -21,5 +23,5 @@ interface ToastNotificationProps {
|
|
|
21
23
|
}
|
|
22
24
|
export declare const RatingsBar: (data: any) => JSX.Element;
|
|
23
25
|
export declare const toastNotification: ({ className, color, icon, message, position, style, }: ToastNotificationProps) => string;
|
|
24
|
-
export declare const ReviewsTab: ({ paroProjectsData, legacyFreelancerId, expertName, getParoProjectsDocument, createOrUpdateRating, createOrUpdateRatingRequestMutation, isClientPortal, isInternal, getparoProjectsByClientIdDocument, projectIdToShow, }: ReviewsTabProps) => JSX.Element;
|
|
26
|
+
export declare const ReviewsTab: ({ paroProjectsData, legacyFreelancerId, expertName, getParoProjectsDocument, createOrUpdateRating, createOrUpdateRatingRequestMutation, isClientPortal, isInternal, getparoProjectsByClientIdDocument, projectIdToShow, ratingIdForResponse, updateRouteAfterSubmitResponse, }: ReviewsTabProps) => JSX.Element;
|
|
25
27
|
export {};
|
|
@@ -44,6 +44,7 @@ const base_ui_1 = require("@paro.io/base-ui");
|
|
|
44
44
|
const AverageRatings_1 = __importDefault(require("./AverageRatings"));
|
|
45
45
|
const ProjectReviewsSection_1 = __importStar(require("./ProjectReviewsSection"));
|
|
46
46
|
const react_hot_toast_1 = require("react-hot-toast");
|
|
47
|
+
const LeaveResponseModal_1 = __importDefault(require("./LeaveResponseModal"));
|
|
47
48
|
const useStyles = (0, core_1.makeStyles)({
|
|
48
49
|
buttonStyle: {
|
|
49
50
|
display: 'flex',
|
|
@@ -199,7 +200,8 @@ const toastNotification = ({ className, color = 'success', icon = 'success', mes
|
|
|
199
200
|
});
|
|
200
201
|
};
|
|
201
202
|
exports.toastNotification = toastNotification;
|
|
202
|
-
const ReviewsTab = ({ paroProjectsData, legacyFreelancerId, expertName, getParoProjectsDocument, createOrUpdateRating, createOrUpdateRatingRequestMutation, isClientPortal = false, isInternal = false, getparoProjectsByClientIdDocument, projectIdToShow, }) => {
|
|
203
|
+
const ReviewsTab = ({ paroProjectsData, legacyFreelancerId, expertName, getParoProjectsDocument, createOrUpdateRating, createOrUpdateRatingRequestMutation, isClientPortal = false, isInternal = false, getparoProjectsByClientIdDocument, projectIdToShow, ratingIdForResponse, updateRouteAfterSubmitResponse, }) => {
|
|
204
|
+
var _a, _b;
|
|
203
205
|
const [loadingSubmitId, setLoadingSubmitId] = (0, react_1.useState)(null);
|
|
204
206
|
const [orderBy, setOrderBy] = react_1.default.useState('');
|
|
205
207
|
const [highlightedRatings, setHighlightedRatings] = (0, react_1.useState)(paroProjectsData);
|
|
@@ -207,6 +209,8 @@ const ReviewsTab = ({ paroProjectsData, legacyFreelancerId, expertName, getParoP
|
|
|
207
209
|
const [selectedButton, setSelectedButton] = (0, react_1.useState)('');
|
|
208
210
|
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
209
211
|
const [openAllRows, setOpenAllRows] = (0, react_1.useState)(true);
|
|
212
|
+
const [responseModal, setResponseModal] = (0, react_1.useState)(projectIdToShow ? true : false);
|
|
213
|
+
const isExpertPortal = !isClientPortal && !isInternal;
|
|
210
214
|
const toggleOpen = (index) => {
|
|
211
215
|
if (!openRowId.includes(index)) {
|
|
212
216
|
setOpenRowId((prev) => [...prev, index]);
|
|
@@ -307,6 +311,8 @@ const ReviewsTab = ({ paroProjectsData, legacyFreelancerId, expertName, getParoP
|
|
|
307
311
|
var _a;
|
|
308
312
|
return (_a = obj === null || obj === void 0 ? void 0 : obj.client) === null || _a === void 0 ? void 0 : _a.id;
|
|
309
313
|
}).filter((value, index, self) => self.indexOf(value) === index);
|
|
314
|
+
const projectDataForResponseModal = projectIdToShow && isExpertPortal && paroProjectsData ? paroProjectsData.find((project) => project.id === Number(projectIdToShow)) : -1;
|
|
315
|
+
const ratingForResponse = projectDataForResponseModal && ((_a = projectDataForResponseModal === null || projectDataForResponseModal === void 0 ? void 0 : projectDataForResponseModal.rating) === null || _a === void 0 ? void 0 : _a.find((rating) => rating.id === ratingIdForResponse));
|
|
310
316
|
return (react_1.default.createElement("div", { className: "reviewsTab", style: { width: '100%', overflowX: 'auto' } },
|
|
311
317
|
react_1.default.createElement(core_1.Box, null,
|
|
312
318
|
react_1.default.createElement("div", { className: "flex flex-row justify-evenly items-center py-2" },
|
|
@@ -333,6 +339,8 @@ const ReviewsTab = ({ paroProjectsData, legacyFreelancerId, expertName, getParoP
|
|
|
333
339
|
react_1.default.createElement(SortButtons, { selectedButton: selectedButton, handleSelectableButton: handleSelectableButton, isClientPortal: isClientPortal !== null && isClientPortal !== void 0 ? isClientPortal : false }),
|
|
334
340
|
react_1.default.createElement(core_1.Box, { pt: 3 },
|
|
335
341
|
react_1.default.createElement(core_1.Divider, null)),
|
|
336
|
-
react_1.default.createElement(ProjectReviewsSection_1.default, { uniqueClients: uniqueClients, paroProjectsData: isClientPortal ? highlightedRatings : paroProjectsData, openRowId: openRowId, openAllRows: openAllRows, toggleOpen: toggleOpen, expertName: expertName, legacyFreelancerId: legacyFreelancerId, getParoProjectsDocument: getParoProjectsDocument, handleAddToProfile: handleAddToProfile, highlightedRatings: highlightedRatings, setHighlightedRatings: setHighlightedRatings, loadingSubmitId: loadingSubmitId, createOrUpdateRatingRequestMutation: createOrUpdateRatingRequestMutation, selectedButton: selectedButton, isClientPortal: isClientPortal, isInternal: isInternal, createOrUpdateRating: createOrUpdateRating, getparoProjectsByClientIdDocument: getparoProjectsByClientIdDocument, projectIdToShow: projectIdToShow })
|
|
342
|
+
react_1.default.createElement(ProjectReviewsSection_1.default, { uniqueClients: uniqueClients, paroProjectsData: isClientPortal ? highlightedRatings : paroProjectsData, openRowId: openRowId, openAllRows: openAllRows, toggleOpen: toggleOpen, expertName: expertName, legacyFreelancerId: legacyFreelancerId, getParoProjectsDocument: getParoProjectsDocument, handleAddToProfile: handleAddToProfile, highlightedRatings: highlightedRatings, setHighlightedRatings: setHighlightedRatings, loadingSubmitId: loadingSubmitId, createOrUpdateRatingRequestMutation: createOrUpdateRatingRequestMutation, selectedButton: selectedButton, isClientPortal: isClientPortal, isInternal: isInternal, createOrUpdateRating: createOrUpdateRating, getparoProjectsByClientIdDocument: getparoProjectsByClientIdDocument, projectIdToShow: projectIdToShow }),
|
|
343
|
+
responseModal &&
|
|
344
|
+
react_1.default.createElement(LeaveResponseModal_1.default, { rating: ratingForResponse, responseModal: responseModal, setResponseModal: setResponseModal, createOrUpdateRating: createOrUpdateRating, isEditResponse: false, daysLeft: 14, getParoProjectsDocument: getParoProjectsDocument, clientName: (_b = projectDataForResponseModal === null || projectDataForResponseModal === void 0 ? void 0 : projectDataForResponseModal.client) === null || _b === void 0 ? void 0 : _b.name, updateRouteAfterSubmitResponse: updateRouteAfterSubmitResponse })));
|
|
337
345
|
};
|
|
338
346
|
exports.ReviewsTab = ReviewsTab;
|