@solostylist/ui-kit 1.0.142 → 1.0.144
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.
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { j as r } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
2
|
+
import { useState as k } from "react";
|
|
3
|
+
import { Box as a, Grid as f } from "@mui/material";
|
|
4
|
+
import C from "../s-icon-button/s-icon-button.js";
|
|
5
|
+
const _ = 40, B = 16, R = ({
|
|
6
6
|
actions: u,
|
|
7
7
|
maxWidth: d,
|
|
8
8
|
columns: s = 3,
|
|
9
9
|
children: p,
|
|
10
10
|
showOnHover: n = !0,
|
|
11
11
|
visible: o,
|
|
12
|
-
position:
|
|
13
|
-
backdropColor: x = "
|
|
14
|
-
backdropOpacity: m =
|
|
15
|
-
blurAmount:
|
|
16
|
-
borderRadius:
|
|
12
|
+
position: l = "center",
|
|
13
|
+
backdropColor: x = "background.paper",
|
|
14
|
+
backdropOpacity: m = 0.9,
|
|
15
|
+
blurAmount: v = 10,
|
|
16
|
+
borderRadius: j = 0,
|
|
17
17
|
overlaySx: g,
|
|
18
18
|
onVisibilityChange: e
|
|
19
19
|
}) => {
|
|
20
|
-
const [I, i] =
|
|
20
|
+
const [I, i] = k(!1), y = o !== void 0 ? o : n && I, h = () => {
|
|
21
21
|
n && o === void 0 && (i(!0), e == null || e(!0));
|
|
22
22
|
}, A = () => {
|
|
23
23
|
n && o === void 0 && (i(!1), e == null || e(!1));
|
|
24
24
|
}, E = () => {
|
|
25
|
-
switch (
|
|
25
|
+
switch (l) {
|
|
26
26
|
case "top-left":
|
|
27
27
|
return { justifyContent: "flex-start", alignItems: "flex-start" };
|
|
28
28
|
case "top-right":
|
|
@@ -36,7 +36,7 @@ const T = 40, B = 16, R = ({
|
|
|
36
36
|
return { justifyContent: "center", alignItems: "center" };
|
|
37
37
|
}
|
|
38
38
|
}, M = () => {
|
|
39
|
-
switch (
|
|
39
|
+
switch (l) {
|
|
40
40
|
case "top-left":
|
|
41
41
|
return "flex-start";
|
|
42
42
|
case "top-right":
|
|
@@ -49,16 +49,16 @@ const T = 40, B = 16, R = ({
|
|
|
49
49
|
default:
|
|
50
50
|
return "center";
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, T = () => {
|
|
53
53
|
let t = d;
|
|
54
|
-
return s && (t = s *
|
|
54
|
+
return s && (t = s * _ + (s - 1) * B + s * 16), t;
|
|
55
55
|
};
|
|
56
56
|
return (
|
|
57
57
|
// Main container with flex to center the children
|
|
58
|
-
/* @__PURE__ */ r.jsx(
|
|
58
|
+
/* @__PURE__ */ r.jsx(a, { display: "flex", children: /* @__PURE__ */ r.jsxs(a, { position: "relative", onMouseEnter: h, onMouseLeave: A, children: [
|
|
59
59
|
p,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
y && /* @__PURE__ */ r.jsx(
|
|
61
|
+
a,
|
|
62
62
|
{
|
|
63
63
|
position: "absolute",
|
|
64
64
|
top: 0,
|
|
@@ -69,18 +69,18 @@ const T = 40, B = 16, R = ({
|
|
|
69
69
|
bgcolor: x,
|
|
70
70
|
sx: {
|
|
71
71
|
opacity: m,
|
|
72
|
-
backdropFilter: `blur(${
|
|
72
|
+
backdropFilter: `blur(${v}px)`,
|
|
73
73
|
transform: "translateZ(0)",
|
|
74
74
|
willChange: "transform",
|
|
75
75
|
transition: "opacity 0.2s ease-in-out",
|
|
76
76
|
...E(),
|
|
77
77
|
...g
|
|
78
78
|
},
|
|
79
|
-
borderRadius:
|
|
80
|
-
children: /* @__PURE__ */ r.jsx(
|
|
81
|
-
var
|
|
82
|
-
return /* @__PURE__ */ r.jsx(
|
|
83
|
-
|
|
79
|
+
borderRadius: j,
|
|
80
|
+
children: /* @__PURE__ */ r.jsx(f, { container: !0, spacing: 2, justifyContent: M(), maxWidth: T(), children: u.map((t, b) => {
|
|
81
|
+
var c;
|
|
82
|
+
return /* @__PURE__ */ r.jsx(f, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ r.jsx(
|
|
83
|
+
C,
|
|
84
84
|
{
|
|
85
85
|
tooltipOptions: { title: t.tooltip, placement: "top" },
|
|
86
86
|
onClick: t.onClick,
|
|
@@ -90,17 +90,19 @@ const T = 40, B = 16, R = ({
|
|
|
90
90
|
sx: {
|
|
91
91
|
margin: 1,
|
|
92
92
|
backgroundColor: t.isActive ? "primary.main" : void 0,
|
|
93
|
+
color: t.isActive ? "primary.contrastText" : void 0,
|
|
93
94
|
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
94
95
|
opacity: t.disabled ? 0.5 : 1,
|
|
95
96
|
"&:hover": {
|
|
96
|
-
backgroundColor: t.isActive ? "primary.
|
|
97
|
+
backgroundColor: t.isActive ? "primary.main" : void 0,
|
|
98
|
+
color: t.isActive ? "primary.contrastText" : void 0
|
|
97
99
|
},
|
|
98
|
-
...(
|
|
100
|
+
...(c = t.iconButtonProps) == null ? void 0 : c.sx
|
|
99
101
|
},
|
|
100
102
|
...t.iconButtonProps,
|
|
101
103
|
children: t.icon
|
|
102
104
|
}
|
|
103
|
-
) }, `${t.tooltip}-${
|
|
105
|
+
) }, `${t.tooltip}-${b}`);
|
|
104
106
|
}) })
|
|
105
107
|
}
|
|
106
108
|
)
|
|
@@ -12,10 +12,12 @@ export interface SCommentMessageProps {
|
|
|
12
12
|
totalReplies?: number;
|
|
13
13
|
onLike?: (commentId: string | number) => void;
|
|
14
14
|
onReply?: (commentId: string | number, parentId?: string | number) => void;
|
|
15
|
+
onToggleReplies?: (commentId: string | number) => void;
|
|
15
16
|
showReplies?: boolean;
|
|
16
17
|
avatarSize?: number;
|
|
17
18
|
level?: number;
|
|
18
19
|
maxLevel?: number;
|
|
20
|
+
loading?: boolean;
|
|
19
21
|
children?: React.ReactNode;
|
|
20
22
|
sx?: SxProps;
|
|
21
23
|
}
|
|
@@ -1,140 +1,125 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { j as t } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import { useState as S, useEffect as R } from "react";
|
|
3
|
+
import { Box as c, Stack as x, Typography as g, IconButton as q, Button as F, Collapse as G } from "@mui/material";
|
|
4
|
+
import J from "../s-avatar/s-avatar.js";
|
|
5
|
+
import e from "../s-skeleton/s-skeleton.js";
|
|
6
|
+
import { F as K } from "../Favorite-DmSF47XC.js";
|
|
7
|
+
import { c as L } from "../createSvgIcon-Dq42_0tn.js";
|
|
8
|
+
import { E as O } from "../ExpandMore-mZGpvXf6.js";
|
|
9
|
+
const Q = L(/* @__PURE__ */ t.jsx("path", {
|
|
9
10
|
d: "m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
10
|
-
}), "ExpandLess"),
|
|
11
|
+
}), "ExpandLess"), U = L(/* @__PURE__ */ t.jsx("path", {
|
|
11
12
|
d: "M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3m-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05"
|
|
12
|
-
}), "FavoriteBorder"),
|
|
13
|
+
}), "FavoriteBorder"), X = L(/* @__PURE__ */ t.jsx("path", {
|
|
13
14
|
d: "M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11"
|
|
14
|
-
}), "Reply"),
|
|
15
|
-
const
|
|
16
|
-
return f < 60 ? "just now" :
|
|
17
|
-
},
|
|
18
|
-
id:
|
|
19
|
-
userName:
|
|
20
|
-
userAvatar:
|
|
21
|
-
commentContent:
|
|
15
|
+
}), "Reply"), Z = (i) => {
|
|
16
|
+
const d = /* @__PURE__ */ new Date(), j = typeof i == "string" ? new Date(i) : i, p = d.getTime() - j.getTime(), f = Math.floor(p / 1e3), n = Math.floor(f / 60), o = Math.floor(n / 60), s = Math.floor(o / 24), h = Math.floor(s / 7), r = Math.floor(s / 30), a = Math.floor(s / 365);
|
|
17
|
+
return f < 60 ? "just now" : n < 60 ? n === 1 ? "1 minute ago" : `${n} minutes ago` : o < 24 ? o === 1 ? "1 hour ago" : `${o} hours ago` : s < 7 ? s === 1 ? "1 day ago" : `${s} days ago` : h < 4 ? h === 1 ? "1 week ago" : `${h} weeks ago` : r < 12 ? r === 1 ? "1 month ago" : `${r} months ago` : a === 1 ? "1 year ago" : `${a} years ago`;
|
|
18
|
+
}, _ = ({
|
|
19
|
+
id: i = Date.now(),
|
|
20
|
+
userName: d,
|
|
21
|
+
userAvatar: j,
|
|
22
|
+
commentContent: p,
|
|
22
23
|
datetime: f,
|
|
23
|
-
likes:
|
|
24
|
-
isLiked:
|
|
25
|
-
replies:
|
|
26
|
-
totalReplies:
|
|
27
|
-
onLike:
|
|
24
|
+
likes: n = 0,
|
|
25
|
+
isLiked: o = !1,
|
|
26
|
+
replies: s = [],
|
|
27
|
+
totalReplies: h,
|
|
28
|
+
onLike: r,
|
|
28
29
|
onReply: a,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
onToggleReplies: C,
|
|
31
|
+
showReplies: u = !0,
|
|
32
|
+
avatarSize: m = 48,
|
|
33
|
+
level: b = 0,
|
|
34
|
+
maxLevel: z = 3,
|
|
35
|
+
loading: T = !1,
|
|
36
|
+
children: k,
|
|
37
|
+
sx: $ = {}
|
|
35
38
|
}) => {
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
a && a(
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
}, [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
const [E, v] = S(n), [w, I] = S(o), [y, H] = S(!1), W = () => {
|
|
40
|
+
w ? (v((l) => Math.max(0, l - 1)), I(!1)) : (v((l) => l + 1), I(!0)), r && r(i);
|
|
41
|
+
}, A = () => {
|
|
42
|
+
a && a(i);
|
|
43
|
+
}, P = () => {
|
|
44
|
+
H(!y), C && C(i);
|
|
45
|
+
}, V = Z(f), M = h ?? s.length, B = M > 0, D = Math.min(b, z) * 2;
|
|
46
|
+
return R(() => {
|
|
47
|
+
v(n);
|
|
48
|
+
}, [n]), R(() => {
|
|
49
|
+
I(o);
|
|
50
|
+
}, [o]), T ? /* @__PURE__ */ t.jsx(c, { sx: { pl: D, py: 1, ...$ }, children: /* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
51
|
+
/* @__PURE__ */ t.jsx(e, { component: "rounded-avatar", width: m, height: m }),
|
|
52
|
+
/* @__PURE__ */ t.jsxs(c, { sx: { flex: 1 }, children: [
|
|
53
|
+
/* @__PURE__ */ t.jsxs(x, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
54
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: 120, height: 20 }),
|
|
55
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: 80, height: 16 })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: "100%", height: 16, sx: { mb: 0.5 } }),
|
|
58
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: "85%", height: 16, sx: { mb: 0.5 } }),
|
|
59
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: "70%", height: 16, sx: { mb: 2 } }),
|
|
60
|
+
/* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
61
|
+
/* @__PURE__ */ t.jsx(e, { component: "icon-button" }),
|
|
62
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: 20, height: 16 }),
|
|
63
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: 60, height: 32 }),
|
|
64
|
+
/* @__PURE__ */ t.jsx(e, { variant: "text", width: 80, height: 32 })
|
|
65
|
+
] })
|
|
66
|
+
] })
|
|
67
|
+
] }) }) : /* @__PURE__ */ t.jsxs(c, { sx: { pl: D, py: 1, ...$ }, children: [
|
|
68
|
+
/* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
69
|
+
/* @__PURE__ */ t.jsx(J, { avatar: j, name: d, size: m }),
|
|
70
|
+
/* @__PURE__ */ t.jsxs(c, { sx: { flex: 1 }, children: [
|
|
71
|
+
/* @__PURE__ */ t.jsxs(x, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
72
|
+
/* @__PURE__ */ t.jsx(g, { variant: "subtitle2", fontWeight: "600", children: d }),
|
|
73
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(g, { variant: "caption", color: "text.secondary", children: V }) })
|
|
54
74
|
] }),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
size: "small",
|
|
61
|
-
onClick: B,
|
|
62
|
-
sx: {
|
|
63
|
-
color: j ? "error.main" : "text.secondary",
|
|
64
|
-
p: 0.5,
|
|
65
|
-
"&:hover": {
|
|
66
|
-
backgroundColor: "action.hover"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
children: j ? /* @__PURE__ */ e.jsx(q, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(K, { fontSize: "small" })
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
k > 0 && /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: k }),
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
74
|
-
$,
|
|
75
|
+
/* @__PURE__ */ t.jsx(g, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: p }),
|
|
76
|
+
/* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
77
|
+
/* @__PURE__ */ t.jsx(
|
|
78
|
+
q,
|
|
75
79
|
{
|
|
76
80
|
size: "small",
|
|
77
|
-
|
|
78
|
-
onClick: D,
|
|
79
|
-
variant: "text",
|
|
81
|
+
onClick: W,
|
|
80
82
|
sx: {
|
|
81
|
-
color: "text.secondary"
|
|
82
|
-
textTransform: "none",
|
|
83
|
-
minWidth: "auto",
|
|
84
|
-
px: 1,
|
|
85
|
-
py: 0.5,
|
|
86
|
-
fontSize: "0.75rem",
|
|
87
|
-
"&:hover": {
|
|
88
|
-
backgroundColor: "action.hover"
|
|
89
|
-
}
|
|
83
|
+
color: w ? "error.main" : "text.secondary"
|
|
90
84
|
},
|
|
91
|
-
children: "
|
|
85
|
+
children: w ? /* @__PURE__ */ t.jsx(K, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(U, { fontSize: "small" })
|
|
92
86
|
}
|
|
93
87
|
),
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
E > 0 && /* @__PURE__ */ t.jsx(g, { variant: "caption", color: "text.secondary", children: E }),
|
|
89
|
+
/* @__PURE__ */ t.jsx(F, { size: "small", startIcon: /* @__PURE__ */ t.jsx(X, { fontSize: "small" }), onClick: A, variant: "text", children: "Reply" }),
|
|
90
|
+
B && u && /* @__PURE__ */ t.jsxs(
|
|
91
|
+
F,
|
|
96
92
|
{
|
|
97
93
|
size: "small",
|
|
98
|
-
startIcon:
|
|
99
|
-
onClick:
|
|
94
|
+
startIcon: y ? /* @__PURE__ */ t.jsx(Q, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(O, { fontSize: "small" }),
|
|
95
|
+
onClick: P,
|
|
100
96
|
variant: "text",
|
|
101
|
-
sx: {
|
|
102
|
-
color: "primary.main",
|
|
103
|
-
textTransform: "none",
|
|
104
|
-
minWidth: "auto",
|
|
105
|
-
px: 1,
|
|
106
|
-
py: 0.5,
|
|
107
|
-
fontSize: "0.75rem",
|
|
108
|
-
"&:hover": {
|
|
109
|
-
backgroundColor: "action.hover"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
97
|
children: [
|
|
113
|
-
|
|
98
|
+
M,
|
|
114
99
|
" ",
|
|
115
|
-
|
|
100
|
+
M === 1 ? "reply" : "replies"
|
|
116
101
|
]
|
|
117
102
|
}
|
|
118
103
|
)
|
|
119
104
|
] }),
|
|
120
|
-
|
|
105
|
+
k && /* @__PURE__ */ t.jsx(c, { sx: { mt: 2 }, children: k })
|
|
121
106
|
] })
|
|
122
107
|
] }),
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
B && u && /* @__PURE__ */ t.jsx(G, { in: y, children: /* @__PURE__ */ t.jsx(c, { sx: { mt: 2 }, children: s.map((l, Y) => /* @__PURE__ */ t.jsx(
|
|
109
|
+
_,
|
|
125
110
|
{
|
|
126
|
-
...
|
|
127
|
-
level:
|
|
128
|
-
maxLevel:
|
|
129
|
-
onLike:
|
|
111
|
+
...l,
|
|
112
|
+
level: b + 1,
|
|
113
|
+
maxLevel: z,
|
|
114
|
+
onLike: r,
|
|
130
115
|
onReply: a,
|
|
131
|
-
showReplies:
|
|
132
|
-
avatarSize: Math.max(32,
|
|
116
|
+
showReplies: u,
|
|
117
|
+
avatarSize: Math.max(32, m - 8)
|
|
133
118
|
},
|
|
134
|
-
|
|
119
|
+
l.id || `reply-${Y}`
|
|
135
120
|
)) }) })
|
|
136
121
|
] });
|
|
137
122
|
};
|
|
138
123
|
export {
|
|
139
|
-
|
|
124
|
+
_ as default
|
|
140
125
|
};
|
|
@@ -1,70 +1,93 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
2
|
+
import { useState as j, useEffect as G } from "react";
|
|
3
|
+
import { Box as h, Stack as a, Divider as D, Typography as x, IconButton as H } from "@mui/material";
|
|
4
|
+
import J from "../s-avatar/s-avatar.js";
|
|
5
|
+
import K from "../s-image-modal/s-image-modal.js";
|
|
6
|
+
import P from "../s-lazy-image/s-lazy-image.js";
|
|
7
|
+
import Q from "../s-rating/s-rating.js";
|
|
8
|
+
import r from "../s-skeleton/s-skeleton.js";
|
|
9
|
+
import { c as L } from "../createSvgIcon-Dq42_0tn.js";
|
|
10
|
+
const X = L(/* @__PURE__ */ e.jsx("path", {
|
|
10
11
|
d: "M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2m4 0v12h4V3z"
|
|
11
|
-
}), "ThumbDown"),
|
|
12
|
+
}), "ThumbDown"), Z = L(/* @__PURE__ */ e.jsx("path", {
|
|
12
13
|
d: "M1 21h4V9H1zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73z"
|
|
13
|
-
}), "ThumbUp"),
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
id:
|
|
18
|
-
userName:
|
|
19
|
-
userAvatar:
|
|
20
|
-
rating:
|
|
21
|
-
reviewContent:
|
|
22
|
-
datetime:
|
|
14
|
+
}), "ThumbUp"), _ = (l) => {
|
|
15
|
+
const m = /* @__PURE__ */ new Date(), v = typeof l == "string" ? new Date(l) : l, y = m.getTime() - v.getTime(), w = Math.floor(y / 1e3), c = Math.floor(w / 60), s = Math.floor(c / 60), i = Math.floor(s / 24), d = Math.floor(i / 7), f = Math.floor(i / 30), g = Math.floor(i / 365);
|
|
16
|
+
return w < 60 ? "just now" : c < 60 ? c === 1 ? "1 minute ago" : `${c} minutes ago` : s < 24 ? s === 1 ? "1 hour ago" : `${s} hours ago` : i < 7 ? i === 1 ? "1 day ago" : `${i} days ago` : d < 4 ? d === 1 ? "1 week ago" : `${d} weeks ago` : f < 12 ? f === 1 ? "1 month ago" : `${f} months ago` : g === 1 ? "1 year ago" : `${g} years ago`;
|
|
17
|
+
}, ce = ({
|
|
18
|
+
id: l = Date.now(),
|
|
19
|
+
userName: m,
|
|
20
|
+
userAvatar: v,
|
|
21
|
+
rating: y,
|
|
22
|
+
reviewContent: w,
|
|
23
|
+
datetime: c,
|
|
23
24
|
images: s,
|
|
24
|
-
userHelpfulVote:
|
|
25
|
-
helpfulYes:
|
|
26
|
-
helpfulNo:
|
|
27
|
-
onHelpfulVote:
|
|
28
|
-
showHelpfulSection:
|
|
29
|
-
avatarSize:
|
|
30
|
-
maxRating:
|
|
31
|
-
readOnly:
|
|
32
|
-
|
|
25
|
+
userHelpfulVote: i = null,
|
|
26
|
+
helpfulYes: d = 0,
|
|
27
|
+
helpfulNo: f = 0,
|
|
28
|
+
onHelpfulVote: g,
|
|
29
|
+
showHelpfulSection: R = !0,
|
|
30
|
+
avatarSize: I = 48,
|
|
31
|
+
maxRating: V = 5,
|
|
32
|
+
readOnly: W = !0,
|
|
33
|
+
showDivider: S = !0,
|
|
34
|
+
loading: E = !1,
|
|
35
|
+
sx: T = {}
|
|
33
36
|
}) => {
|
|
34
|
-
const [
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
id: `review-${
|
|
37
|
+
const [O, M] = j(d), [U, b] = j(f), [p, k] = j(i), [Y, $] = j(!1), [B, C] = j(null), z = (n) => {
|
|
38
|
+
let o = n;
|
|
39
|
+
p === n ? (n === "yes" ? M((t) => Math.max(0, t - 1)) : b((t) => Math.max(0, t - 1)), k(null), o = null) : (p === "yes" ? M((t) => Math.max(0, t - 1)) : p === "no" && b((t) => Math.max(0, t - 1)), n === "yes" ? M((t) => t + 1) : b((t) => t + 1), k(n), o = n), g && g(l, o);
|
|
40
|
+
}, u = (s == null ? void 0 : s.map((n, o) => ({
|
|
41
|
+
id: `review-${l}-image-${o}`,
|
|
39
42
|
type: "image",
|
|
40
|
-
url:
|
|
41
|
-
title: `Review image ${
|
|
42
|
-
desc: `Image ${
|
|
43
|
-
}))) || [],
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
/* @__PURE__ */ e.jsxs(
|
|
55
|
-
/* @__PURE__ */ e.jsx(
|
|
56
|
-
/* @__PURE__ */ e.jsxs(
|
|
57
|
-
/* @__PURE__ */ e.jsxs(
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
43
|
+
url: n,
|
|
44
|
+
title: `Review image ${o + 1}`,
|
|
45
|
+
desc: `Image ${o + 1} from ${m}'s review`
|
|
46
|
+
}))) || [], A = (n) => {
|
|
47
|
+
const o = u[n];
|
|
48
|
+
o && (C(o), $(!0));
|
|
49
|
+
}, F = () => {
|
|
50
|
+
$(!1), C(null);
|
|
51
|
+
}, N = (n) => {
|
|
52
|
+
C(n);
|
|
53
|
+
}, q = _(c);
|
|
54
|
+
return G(() => {
|
|
55
|
+
k(i);
|
|
56
|
+
}, [i]), E ? /* @__PURE__ */ e.jsxs(h, { sx: { py: 2, ...T }, children: [
|
|
57
|
+
/* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
58
|
+
/* @__PURE__ */ e.jsx(r, { component: "rounded-avatar", width: I, height: I }),
|
|
59
|
+
/* @__PURE__ */ e.jsxs(h, { sx: { flex: 1 }, children: [
|
|
60
|
+
/* @__PURE__ */ e.jsxs(a, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
61
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: 120, height: 20 }),
|
|
62
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: 80, height: 16 })
|
|
60
63
|
] }),
|
|
61
|
-
/* @__PURE__ */ e.jsx(
|
|
62
|
-
/* @__PURE__ */ e.jsx(
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
/* @__PURE__ */ e.jsx(h, { sx: { mb: 1 }, children: /* @__PURE__ */ e.jsx(r, { variant: "text", width: 100, height: 20 }) }),
|
|
65
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: "100%", height: 16, sx: { mb: 0.5 } }),
|
|
66
|
+
/* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 1, sx: { display: "inline-flex", alignItems: "center" }, children: [
|
|
67
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: 140, height: 16, sx: { mr: 2 } }),
|
|
68
|
+
/* @__PURE__ */ e.jsx(r, { component: "icon-button" }),
|
|
69
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: 20, height: 16 }),
|
|
70
|
+
/* @__PURE__ */ e.jsx(r, { component: "icon-button" }),
|
|
71
|
+
/* @__PURE__ */ e.jsx(r, { variant: "text", width: 20, height: 16 })
|
|
72
|
+
] })
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
S && /* @__PURE__ */ e.jsx(D, { sx: { mt: 2 } })
|
|
76
|
+
] }) : /* @__PURE__ */ e.jsxs(h, { sx: { py: 2, ...T }, children: [
|
|
77
|
+
/* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
78
|
+
/* @__PURE__ */ e.jsx(J, { avatar: v, name: m, size: I }),
|
|
79
|
+
/* @__PURE__ */ e.jsxs(h, { sx: { flex: 1 }, children: [
|
|
80
|
+
/* @__PURE__ */ e.jsxs(a, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
81
|
+
/* @__PURE__ */ e.jsx(x, { variant: "subtitle2", fontWeight: "600", children: m }),
|
|
82
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: q }) })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ e.jsx(h, { sx: { mb: 1 }, children: /* @__PURE__ */ e.jsx(Q, { value: y, max: V, readOnly: W, size: "small" }) }),
|
|
85
|
+
/* @__PURE__ */ e.jsx(x, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: w }),
|
|
86
|
+
s && s.length > 0 && /* @__PURE__ */ e.jsx(a, { direction: "row", spacing: 1, sx: { mb: 2, flexWrap: "wrap", gap: 1 }, children: s.map((n, o) => /* @__PURE__ */ e.jsx(
|
|
87
|
+
P,
|
|
65
88
|
{
|
|
66
|
-
src:
|
|
67
|
-
alt: `Review image ${
|
|
89
|
+
src: n,
|
|
90
|
+
alt: `Review image ${o + 1}`,
|
|
68
91
|
width: 80,
|
|
69
92
|
height: 80,
|
|
70
93
|
variant: "rounded",
|
|
@@ -72,68 +95,68 @@ const K = $(/* @__PURE__ */ e.jsx("path", {
|
|
|
72
95
|
objectFit: "cover",
|
|
73
96
|
cursor: "pointer"
|
|
74
97
|
},
|
|
75
|
-
onClick: () =>
|
|
76
|
-
onMouseEnter: (
|
|
77
|
-
|
|
98
|
+
onClick: () => A(o),
|
|
99
|
+
onMouseEnter: (t) => {
|
|
100
|
+
t.currentTarget.style.opacity = "0.8";
|
|
78
101
|
},
|
|
79
|
-
onMouseLeave: (
|
|
80
|
-
|
|
102
|
+
onMouseLeave: (t) => {
|
|
103
|
+
t.currentTarget.style.opacity = "1";
|
|
81
104
|
}
|
|
82
105
|
},
|
|
83
|
-
|
|
106
|
+
o
|
|
84
107
|
)) }),
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */ e.jsx(
|
|
108
|
+
R && /* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 1, sx: { display: "inline-flex", alignItems: "center" }, children: [
|
|
109
|
+
/* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", sx: { mr: 2 }, children: "Was this review helpful?" }),
|
|
87
110
|
/* @__PURE__ */ e.jsx(
|
|
88
|
-
|
|
111
|
+
H,
|
|
89
112
|
{
|
|
90
113
|
size: "small",
|
|
91
|
-
onClick: () =>
|
|
114
|
+
onClick: () => z("yes"),
|
|
92
115
|
sx: {
|
|
93
|
-
color:
|
|
116
|
+
color: p === "yes" ? "primary.main" : "text.secondary",
|
|
94
117
|
"&:hover": {
|
|
95
118
|
backgroundColor: "action.hover"
|
|
96
119
|
}
|
|
97
120
|
},
|
|
98
|
-
children: /* @__PURE__ */ e.jsx(
|
|
121
|
+
children: /* @__PURE__ */ e.jsx(Z, { fontSize: "small" })
|
|
99
122
|
}
|
|
100
123
|
),
|
|
101
|
-
/* @__PURE__ */ e.jsx(
|
|
124
|
+
/* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: O }),
|
|
102
125
|
/* @__PURE__ */ e.jsx(
|
|
103
|
-
|
|
126
|
+
H,
|
|
104
127
|
{
|
|
105
128
|
size: "small",
|
|
106
|
-
onClick: () =>
|
|
129
|
+
onClick: () => z("no"),
|
|
107
130
|
sx: {
|
|
108
|
-
color:
|
|
131
|
+
color: p === "no" ? "error.main" : "text.secondary",
|
|
109
132
|
ml: 1,
|
|
110
133
|
"&:hover": {
|
|
111
134
|
backgroundColor: "action.hover"
|
|
112
135
|
}
|
|
113
136
|
},
|
|
114
|
-
children: /* @__PURE__ */ e.jsx(
|
|
137
|
+
children: /* @__PURE__ */ e.jsx(X, { fontSize: "small" })
|
|
115
138
|
}
|
|
116
139
|
),
|
|
117
|
-
/* @__PURE__ */ e.jsx(
|
|
140
|
+
/* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: U })
|
|
118
141
|
] })
|
|
119
142
|
] })
|
|
120
143
|
] }),
|
|
121
|
-
/* @__PURE__ */ e.jsx(
|
|
144
|
+
S && /* @__PURE__ */ e.jsx(D, { sx: { mt: 2 } }),
|
|
122
145
|
/* @__PURE__ */ e.jsx(
|
|
123
|
-
|
|
146
|
+
K,
|
|
124
147
|
{
|
|
125
|
-
isOpen:
|
|
126
|
-
onClose:
|
|
127
|
-
selectedItem:
|
|
128
|
-
onItemChange:
|
|
129
|
-
mediaItems:
|
|
130
|
-
showNavigation:
|
|
131
|
-
showThumbnailDock:
|
|
132
|
-
showCounter:
|
|
148
|
+
isOpen: Y,
|
|
149
|
+
onClose: F,
|
|
150
|
+
selectedItem: B,
|
|
151
|
+
onItemChange: N,
|
|
152
|
+
mediaItems: u,
|
|
153
|
+
showNavigation: u.length > 1,
|
|
154
|
+
showThumbnailDock: u.length > 1,
|
|
155
|
+
showCounter: u.length > 1
|
|
133
156
|
}
|
|
134
157
|
)
|
|
135
158
|
] });
|
|
136
159
|
};
|
|
137
160
|
export {
|
|
138
|
-
|
|
161
|
+
ce as default
|
|
139
162
|
};
|