@deenruv/reviews-plugin 1.0.16 → 1.0.17-dev.5
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/dist/plugin-ui/components/OrderInfo.js +2 -5
- package/dist/plugin-ui/components/ProductInfo.js +2 -5
- package/dist/plugin-ui/components/ReviewCustomer.js +22 -6
- package/dist/plugin-ui/components/ReviewOrder.js +2 -5
- package/dist/plugin-ui/components/ReviewProductSidebar.js +3 -6
- package/dist/plugin-ui/components/ReviewStateChange.js +2 -5
- package/dist/plugin-ui/components/UniversalSelectDialog.js +2 -5
- package/dist/plugin-ui/locales/en/index.d.ts +7 -0
- package/dist/plugin-ui/locales/en/reviews.json +7 -0
- package/dist/plugin-ui/locales/pl/index.d.ts +7 -0
- package/dist/plugin-ui/locales/pl/reviews.json +7 -0
- package/dist/plugin-ui/pages/Review.js +8 -11
- package/dist/plugin-ui/pages/Reviews.js +22 -6
- package/package.json +5 -5
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Card, CardContent, CardHeader, priceFormatter, Routes, } from "@deenruv/react-ui-devkit";
|
|
2
|
+
import { Card, CardContent, CardHeader, priceFormatter, Routes, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
3
3
|
import { Link } from "react-router";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
4
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
6
5
|
export const OrderInfo = ({ review }) => {
|
|
7
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
8
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
9
|
-
});
|
|
6
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
10
7
|
if (!review.order)
|
|
11
8
|
return null;
|
|
12
9
|
return (React.createElement(Card, { className: "w-full" },
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Card, CardContent, CardHeader, Routes, } from "@deenruv/react-ui-devkit";
|
|
2
|
+
import { Card, CardContent, CardHeader, Routes, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
3
3
|
import { Link } from "react-router";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
4
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
6
5
|
export const ProductInfo = ({ review }) => {
|
|
7
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
8
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
9
|
-
});
|
|
6
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
10
7
|
if (!review.productVariant)
|
|
11
8
|
return null;
|
|
12
9
|
return (React.createElement(Card, { className: "w-full" },
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { Badge, CLOSED_WITHOUT_RESOLUTION, createDialogFromComponent, DetailList, formatDate, useDetailView, useLazyQuery, useMutation, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { Badge, CLOSED_WITHOUT_RESOLUTION, createDialogFromComponent, DetailList, formatDate, useDetailView, useLazyQuery, useMutation, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ChangeReviewsStateMutation, ChangeReviewStateMutation, ListReviewQuery, } from "../graphql";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
4
|
import { TRANSLATION_NAMESPACE } from "../constants.js";
|
|
6
5
|
import { REVIEWS_ROUTES } from "../index.js";
|
|
7
|
-
import { ReplaceAllIcon, ReplaceIcon } from "lucide-react";
|
|
6
|
+
import { Check, ReplaceAllIcon, ReplaceIcon } from "lucide-react";
|
|
8
7
|
import { UniversalSelectDialog } from "./UniversalSelectDialog";
|
|
9
8
|
export const ReviewCustomer = () => {
|
|
10
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
11
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
12
|
-
});
|
|
9
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
13
10
|
const [fetch] = useLazyQuery(ListReviewQuery);
|
|
14
11
|
const [changeReviewState] = useMutation(ChangeReviewStateMutation);
|
|
15
12
|
const [changeReviewsState] = useMutation(ChangeReviewsStateMutation);
|
|
@@ -70,6 +67,25 @@ export const ReviewCustomer = () => {
|
|
|
70
67
|
},
|
|
71
68
|
},
|
|
72
69
|
], additionalRowActions: [
|
|
70
|
+
{
|
|
71
|
+
label: t("list.acceptReview"),
|
|
72
|
+
icon: React.createElement(Check, { className: "w-4 h-4" }),
|
|
73
|
+
canShow: ({ row }) => row.original.state === "PENDING" /* ReviewState.PENDING */,
|
|
74
|
+
onClick: async ({ row }) => {
|
|
75
|
+
try {
|
|
76
|
+
if (!row.original.id) {
|
|
77
|
+
throw new Error(t("dialog.singleStateChangeNoSelection"));
|
|
78
|
+
}
|
|
79
|
+
await changeReviewState({
|
|
80
|
+
input: { id: row.original.id, state: "ACCEPTED" /* ReviewState.ACCEPTED */ },
|
|
81
|
+
});
|
|
82
|
+
return { success: t("dialog.singleAcceptSuccess") };
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return { error: t("dialog.singleAcceptError") };
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
},
|
|
73
89
|
{
|
|
74
90
|
label: t("list.stateChange"),
|
|
75
91
|
icon: React.createElement(ReplaceIcon, { className: "w-4 h-4" }),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { CardContent, CardHeader, CardTitle, CustomCard, formatDate, useLazyQuery, Badge, useOrder, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { CardContent, CardHeader, CardTitle, CustomCard, formatDate, useLazyQuery, Badge, useOrder, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
3
|
import { GetReviewForOrderQuery } from "../graphql";
|
|
4
4
|
import { Calendar, MessageSquare, Star } from "lucide-react";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
5
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
7
6
|
const StarRating = ({ rating, maxRating = 5, }) => {
|
|
8
7
|
return (React.createElement("div", { className: "flex items-center gap-1" },
|
|
@@ -25,9 +24,7 @@ const getStatusColor = (status) => {
|
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
export const ReviewOrder = () => {
|
|
28
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
29
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
30
|
-
});
|
|
27
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
31
28
|
const { order } = useOrder();
|
|
32
29
|
const [getReviewForOrder, { data }] = useLazyQuery(GetReviewForOrderQuery);
|
|
33
30
|
useEffect(() => {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { CustomCard, useDetailView, useLazyQuery, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { CustomCard, useDetailView, useLazyQuery, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
3
|
import { Link } from "react-router";
|
|
4
4
|
import { GetReviewInfoForProductQuery } from "../graphql";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
5
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
7
6
|
export const ReviewProductSidebar = () => {
|
|
8
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
9
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
10
|
-
});
|
|
7
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
11
8
|
const { entity } = useDetailView("products-detail-view");
|
|
12
9
|
const [getInfo, { data }] = useLazyQuery(GetReviewInfoForProductQuery);
|
|
13
10
|
useEffect(() => {
|
|
@@ -15,7 +12,7 @@ export const ReviewProductSidebar = () => {
|
|
|
15
12
|
getInfo({ productId: entity.id });
|
|
16
13
|
}
|
|
17
14
|
}, [entity]);
|
|
18
|
-
return (React.createElement(CustomCard, { title: "
|
|
15
|
+
return (React.createElement(CustomCard, { title: t("productReviewSidebar.title"), color: "amber" },
|
|
19
16
|
React.createElement("div", { className: "text-sm mb-2" }, data?.getReviewInfoForProduct?.averageRating
|
|
20
17
|
? `${t("productReviewSidebar.averageRating")}: ${data.getReviewInfoForProduct.averageRating.toFixed(1)}`
|
|
21
18
|
: t("productReviewSidebar.noAverageRating")),
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { Dialog, DialogTrigger, Button, DialogContent, DialogHeader, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, DialogClose, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { Dialog, DialogTrigger, Button, DialogContent, DialogHeader, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, DialogClose, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
4
|
import { toast } from "sonner";
|
|
6
5
|
export const ReviewStateChange = ({ onSubmit, }) => {
|
|
7
6
|
const [state, setState] = useState();
|
|
8
7
|
const [message, setMessage] = useState();
|
|
9
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
10
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
11
|
-
});
|
|
8
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
12
9
|
return (React.createElement(Dialog, null,
|
|
13
10
|
React.createElement(DialogTrigger, { asChild: true },
|
|
14
11
|
React.createElement(Button, { variant: "destructive", size: "sm", className: "text-xs" }, t("detail.changeState"))),
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Button, DialogFooter, DialogHeader, DialogTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@deenruv/react-ui-devkit";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
2
|
+
import { Button, DialogFooter, DialogHeader, DialogTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
4
3
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
5
4
|
import { toast } from "sonner";
|
|
6
5
|
export function UniversalSelectDialog({ close, resolve, data: { title, description, defaultValue, options, selectLabel, selectPlaceholder, }, }) {
|
|
7
6
|
const [value, setValue] = useState(defaultValue ? defaultValue : undefined);
|
|
8
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
9
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
10
|
-
});
|
|
7
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
11
8
|
const onSubmit = () => {
|
|
12
9
|
const option = options.find((o) => o.value === value);
|
|
13
10
|
if (!option) {
|
|
@@ -16,6 +16,8 @@ declare const _default: {
|
|
|
16
16
|
singleStateChangeError: string;
|
|
17
17
|
singleStateChangeCancelled: string;
|
|
18
18
|
singleStateChangeNoSelection: string;
|
|
19
|
+
singleAcceptSuccess: string;
|
|
20
|
+
singleAcceptError: string;
|
|
19
21
|
cancel: string;
|
|
20
22
|
submit: string;
|
|
21
23
|
selectError: string;
|
|
@@ -29,6 +31,7 @@ declare const _default: {
|
|
|
29
31
|
viewCustomer: string;
|
|
30
32
|
id: string;
|
|
31
33
|
changeState: string;
|
|
34
|
+
acceptReview: string;
|
|
32
35
|
changeStateSuccess: string;
|
|
33
36
|
changeStateError: string;
|
|
34
37
|
cancel: string;
|
|
@@ -76,10 +79,13 @@ declare const _default: {
|
|
|
76
79
|
titleWithId: string;
|
|
77
80
|
};
|
|
78
81
|
productReviewSidebar: {
|
|
82
|
+
title: string;
|
|
79
83
|
averageRating: string;
|
|
80
84
|
noAverageRating: string;
|
|
81
85
|
totalReviews: string;
|
|
82
86
|
noTotalReviews: string;
|
|
87
|
+
totalRatings: string;
|
|
88
|
+
noTotalRatings: string;
|
|
83
89
|
totalReviewsForProduct: string;
|
|
84
90
|
noTotalReviewsForProduct: string;
|
|
85
91
|
viewAllReviews: string;
|
|
@@ -90,6 +96,7 @@ declare const _default: {
|
|
|
90
96
|
};
|
|
91
97
|
list: {
|
|
92
98
|
bulkStateChange: string;
|
|
99
|
+
acceptReview: string;
|
|
93
100
|
stateChange: string;
|
|
94
101
|
productId: string;
|
|
95
102
|
orderId: string;
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"singleStateChangeError": "An error occurred while changing the review state",
|
|
17
17
|
"singleStateChangeCancelled": "Single change of review state has been cancelled",
|
|
18
18
|
"singleStateChangeNoSelection": "No review selected for state change",
|
|
19
|
+
"singleAcceptSuccess": "Review has been accepted",
|
|
20
|
+
"singleAcceptError": "An error occurred while accepting the review",
|
|
19
21
|
"cancel": "Cancel",
|
|
20
22
|
"submit": "Submit",
|
|
21
23
|
"selectError": "Please select a review state"
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
"viewCustomer": "View customer",
|
|
30
32
|
"id": "Review {{id}}",
|
|
31
33
|
"changeState": "Change review state",
|
|
34
|
+
"acceptReview": "Accept review",
|
|
32
35
|
"changeStateSuccess": "Review state has been changed",
|
|
33
36
|
"changeStateError": "An error occurred while changing the review state",
|
|
34
37
|
"cancel": "Cancel",
|
|
@@ -76,10 +79,13 @@
|
|
|
76
79
|
"titleWithId": "Order review #{{orderId}}"
|
|
77
80
|
},
|
|
78
81
|
"productReviewSidebar": {
|
|
82
|
+
"title": "Product reviews",
|
|
79
83
|
"averageRating": "Average rating",
|
|
80
84
|
"noAverageRating": "No average rating",
|
|
81
85
|
"totalReviews": "Total reviews",
|
|
82
86
|
"noTotalReviews": "No total reviews",
|
|
87
|
+
"totalRatings": "Total ratings",
|
|
88
|
+
"noTotalRatings": "No ratings",
|
|
83
89
|
"totalReviewsForProduct": "Total reviews for product",
|
|
84
90
|
"noTotalReviewsForProduct": "No total reviews for product",
|
|
85
91
|
"viewAllReviews": "See all reviews for this product"
|
|
@@ -90,6 +96,7 @@
|
|
|
90
96
|
},
|
|
91
97
|
"list": {
|
|
92
98
|
"bulkStateChange": "Bulk change state",
|
|
99
|
+
"acceptReview": "Accept review",
|
|
93
100
|
"stateChange": "Change state",
|
|
94
101
|
"productId": "Product ID",
|
|
95
102
|
"orderId": "Order ID",
|
|
@@ -16,6 +16,8 @@ declare const _default: {
|
|
|
16
16
|
singleStateChangeError: string;
|
|
17
17
|
singleStateChangeCancelled: string;
|
|
18
18
|
singleStateChangeNoSelection: string;
|
|
19
|
+
singleAcceptSuccess: string;
|
|
20
|
+
singleAcceptError: string;
|
|
19
21
|
cancel: string;
|
|
20
22
|
submit: string;
|
|
21
23
|
selectError: string;
|
|
@@ -29,6 +31,7 @@ declare const _default: {
|
|
|
29
31
|
viewCustomer: string;
|
|
30
32
|
id: string;
|
|
31
33
|
changeState: string;
|
|
34
|
+
acceptReview: string;
|
|
32
35
|
changeStateSuccess: string;
|
|
33
36
|
changeStateError: string;
|
|
34
37
|
cancel: string;
|
|
@@ -76,10 +79,13 @@ declare const _default: {
|
|
|
76
79
|
titleWithId: string;
|
|
77
80
|
};
|
|
78
81
|
productReviewSidebar: {
|
|
82
|
+
title: string;
|
|
79
83
|
averageRating: string;
|
|
80
84
|
noAverageRating: string;
|
|
81
85
|
totalReviews: string;
|
|
82
86
|
noTotalReviews: string;
|
|
87
|
+
totalRatings: string;
|
|
88
|
+
noTotalRatings: string;
|
|
83
89
|
totalReviewsForProduct: string;
|
|
84
90
|
noTotalReviewsForProduct: string;
|
|
85
91
|
viewAllReviews: string;
|
|
@@ -90,6 +96,7 @@ declare const _default: {
|
|
|
90
96
|
};
|
|
91
97
|
list: {
|
|
92
98
|
bulkStateChange: string;
|
|
99
|
+
acceptReview: string;
|
|
93
100
|
stateChange: string;
|
|
94
101
|
productId: string;
|
|
95
102
|
orderId: string;
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"singleStateChangeError": "Wystąpił błąd podczas zmiany stanu opinii",
|
|
17
17
|
"singleStateChangeCancelled": "Zmiana stanu opinii została anulowana",
|
|
18
18
|
"singleStateChangeNoSelection": "Nie wybrano opinii do zmiany stanu",
|
|
19
|
+
"singleAcceptSuccess": "Opinia została zaakceptowana",
|
|
20
|
+
"singleAcceptError": "Wystąpił błąd podczas akceptowania opinii",
|
|
19
21
|
"cancel": "Anuluj",
|
|
20
22
|
"submit": "Zatwierdź",
|
|
21
23
|
"selectError": "Wybierz stan opinii"
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
"viewCustomer": "Zobacz klienta",
|
|
30
32
|
"id": "Opinia {{id}}",
|
|
31
33
|
"changeState": "Zmień stan opinii",
|
|
34
|
+
"acceptReview": "Zaakceptuj opinię",
|
|
32
35
|
"changeStateSuccess": "Stan opinii został zmieniony",
|
|
33
36
|
"changeStateError": "Wystąpił błąd podczas zmiany stanu opinii",
|
|
34
37
|
"cancel": "Anuluj",
|
|
@@ -76,10 +79,13 @@
|
|
|
76
79
|
"titleWithId": "Recenzja zamówienia #{{orderId}}"
|
|
77
80
|
},
|
|
78
81
|
"productReviewSidebar": {
|
|
82
|
+
"title": "Opinie o produkcie",
|
|
79
83
|
"averageRating": "Średnia ocena",
|
|
80
84
|
"noAverageRating": "Brak średniej oceny",
|
|
81
85
|
"totalReviews": "Łączna liczba ocen",
|
|
82
86
|
"noTotalReviews": "Brak ocen",
|
|
87
|
+
"totalRatings": "Łączna liczba ocen cząstkowych",
|
|
88
|
+
"noTotalRatings": "Brak ocen cząstkowych",
|
|
83
89
|
"totalReviewsForProduct": "Łączna liczba ocen dla produktu",
|
|
84
90
|
"noTotalReviewsForProduct": "Brak ocen dla produktu",
|
|
85
91
|
"viewAllReviews": "Zobacz wszystkie opinie o produkcie"
|
|
@@ -90,6 +96,7 @@
|
|
|
90
96
|
},
|
|
91
97
|
"list": {
|
|
92
98
|
"bulkStateChange": "Zmiana stanu dla wielu",
|
|
99
|
+
"acceptReview": "Zaakceptuj opinię",
|
|
93
100
|
"stateChange": "Zmień stan",
|
|
94
101
|
"productId": "ID produktu",
|
|
95
102
|
"orderId": "ID zamówienia",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Card, CardContent, CardHeader, CardTitle, PageBlock, Textarea, useLazyQuery, useQuery, Label, Badge, Separator, formatDate, Button, useMutation, ImageWithPreview, Routes, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { Card, CardContent, CardHeader, CardTitle, PageBlock, Textarea, useLazyQuery, useQuery, Label, Badge, Separator, formatDate, Button, useMutation, ImageWithPreview, Routes, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { ChangeReviewStateMutation, GetReviewQuery, GetReviewsConfigQuery, UpdateTranslationsReviewMutation, TranslateReviewsQuery, } from "../graphql";
|
|
4
4
|
import { Link, useParams } from "react-router";
|
|
@@ -6,13 +6,10 @@ import { ArrowLeft, Calendar, Mail, Star, User } from "lucide-react";
|
|
|
6
6
|
import { useNavigate } from "react-router";
|
|
7
7
|
import { OrderInfo, ProductInfo } from "../components";
|
|
8
8
|
import { TRANSLATION_NAMESPACE } from "../constants";
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
10
9
|
import { toast } from "sonner";
|
|
11
10
|
import { ReviewStateChange } from "../components/ReviewStateChange";
|
|
12
11
|
export const Review = () => {
|
|
13
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
14
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
15
|
-
});
|
|
12
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
16
13
|
const { id } = useParams();
|
|
17
14
|
const { data: config } = useQuery(GetReviewsConfigQuery);
|
|
18
15
|
const [get] = useLazyQuery(GetReviewQuery);
|
|
@@ -74,10 +71,10 @@ export const Review = () => {
|
|
|
74
71
|
translations: [...(prev.translations || []), ...newTranslations],
|
|
75
72
|
};
|
|
76
73
|
});
|
|
77
|
-
toast.success(t("generateAllMissingTranslationsSuccess"));
|
|
74
|
+
toast.success(t("detail.generateAllMissingTranslationsSuccess"));
|
|
78
75
|
}
|
|
79
76
|
catch (error) {
|
|
80
|
-
toast.error(t("generateAllMissingTranslationsError"));
|
|
77
|
+
toast.error(t("detail.generateAllMissingTranslationsError"));
|
|
81
78
|
}
|
|
82
79
|
};
|
|
83
80
|
const handleMissingTranslation = async (action, language) => {
|
|
@@ -164,7 +161,9 @@ export const Review = () => {
|
|
|
164
161
|
React.createElement(Button, { variant: "ghost", size: "icon", onClick: () => navigate(-1) },
|
|
165
162
|
React.createElement(ArrowLeft, { className: "w-5 h-5" })),
|
|
166
163
|
React.createElement("p", { className: "text-md font-semibold" }, review?.id ? t("detail.id", { id: review.id }) : null)),
|
|
167
|
-
React.createElement("div", { className: "flex flex-col gap-2 items-end" }, "PENDING" /* ReviewState.PENDING */ === review?.state && (React.createElement(
|
|
164
|
+
React.createElement("div", { className: "flex flex-col gap-2 items-end" }, "PENDING" /* ReviewState.PENDING */ === review?.state && (React.createElement("div", { className: "flex flex-wrap justify-end gap-2" },
|
|
165
|
+
React.createElement(Button, { variant: "action", size: "sm", className: "text-xs", onClick: () => handleChangeReviewState("ACCEPTED" /* ReviewState.ACCEPTED */) }, t("detail.acceptReview")),
|
|
166
|
+
React.createElement(ReviewStateChange, { onSubmit: handleChangeReviewState })))))),
|
|
168
167
|
React.createElement(CardContent, null, review ? (React.createElement("div", { className: "space-y-6" },
|
|
169
168
|
React.createElement("div", { className: "flex gap-4 justify-between items-start" },
|
|
170
169
|
React.createElement(Card, { className: "w-full" },
|
|
@@ -252,9 +251,7 @@ export const Review = () => {
|
|
|
252
251
|
}))))));
|
|
253
252
|
};
|
|
254
253
|
const TranslationComponent = ({ language, matchingTranslation, isOriginal, }) => {
|
|
255
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
256
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
257
|
-
});
|
|
254
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
258
255
|
const [body, setBody] = useState(matchingTranslation.body);
|
|
259
256
|
return (React.createElement("div", { className: "space-y-4" },
|
|
260
257
|
React.createElement("div", null,
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Badge, CLOSED_WITHOUT_RESOLUTION, createDialogFromComponent, DetailList, formatDate, useLazyQuery, useMutation, } from "@deenruv/react-ui-devkit";
|
|
1
|
+
import { Badge, CLOSED_WITHOUT_RESOLUTION, createDialogFromComponent, DetailList, formatDate, useLazyQuery, useMutation, useTranslation, } from "@deenruv/react-ui-devkit";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ListReviewQuery } from "../graphql/queries.js";
|
|
4
4
|
import { REVIEWS_ROUTES } from "../index.js";
|
|
5
5
|
import { TRANSLATION_NAMESPACE } from "../constants.js";
|
|
6
|
-
import {
|
|
7
|
-
import { ReplaceIcon, ReplaceAllIcon } from "lucide-react";
|
|
6
|
+
import { Check, ReplaceIcon, ReplaceAllIcon } from "lucide-react";
|
|
8
7
|
import { UniversalSelectDialog } from "../components/UniversalSelectDialog.js";
|
|
9
8
|
import { ChangeReviewsStateMutation, ChangeReviewStateMutation, } from "../graphql/mutations.js";
|
|
10
9
|
export const Reviews = () => {
|
|
11
|
-
const { t } = useTranslation(TRANSLATION_NAMESPACE
|
|
12
|
-
i18n: window.__DEENRUV_SETTINGS__.i18n,
|
|
13
|
-
});
|
|
10
|
+
const { t } = useTranslation(TRANSLATION_NAMESPACE);
|
|
14
11
|
const [fetch] = useLazyQuery(ListReviewQuery);
|
|
15
12
|
const [changeReviewState] = useMutation(ChangeReviewStateMutation);
|
|
16
13
|
const [changeReviewsState] = useMutation(ChangeReviewsStateMutation);
|
|
@@ -75,6 +72,25 @@ export const Reviews = () => {
|
|
|
75
72
|
},
|
|
76
73
|
},
|
|
77
74
|
], additionalRowActions: [
|
|
75
|
+
{
|
|
76
|
+
label: t("list.acceptReview"),
|
|
77
|
+
icon: React.createElement(Check, { className: "w-4 h-4" }),
|
|
78
|
+
canShow: ({ row }) => row.original.state === "PENDING" /* ReviewState.PENDING */,
|
|
79
|
+
onClick: async ({ row }) => {
|
|
80
|
+
try {
|
|
81
|
+
if (!row.original.id) {
|
|
82
|
+
throw new Error(t("dialog.singleStateChangeNoSelection"));
|
|
83
|
+
}
|
|
84
|
+
await changeReviewState({
|
|
85
|
+
input: { id: row.original.id, state: "ACCEPTED" /* ReviewState.ACCEPTED */ },
|
|
86
|
+
});
|
|
87
|
+
return { success: t("dialog.singleAcceptSuccess") };
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return { error: t("dialog.singleAcceptError") };
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
78
94
|
{
|
|
79
95
|
label: t("list.stateChange"),
|
|
80
96
|
icon: React.createElement(ReplaceIcon, { className: "w-4 h-4" }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deenruv/reviews-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17-dev.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"react-router": "^7.13.0",
|
|
31
31
|
"sonner": "^1.4.41",
|
|
32
32
|
"recharts": "^2.12.7",
|
|
33
|
-
"@deenruv/admin-types": "^1.0.
|
|
34
|
-
"@deenruv/
|
|
35
|
-
"@deenruv/
|
|
33
|
+
"@deenruv/admin-types": "^1.0.17-dev.5",
|
|
34
|
+
"@deenruv/react-ui-devkit": "^1.0.17-dev.5",
|
|
35
|
+
"@deenruv/common": "^1.0.17-dev.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"rimraf": "^5.0.10",
|
|
45
45
|
"tslib": "^2.6.2",
|
|
46
46
|
"typescript": "5.3.3",
|
|
47
|
-
"@deenruv/core": "^1.0.
|
|
47
|
+
"@deenruv/core": "^1.0.17-dev.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@deenruv/core": "^1.0.0"
|