@blocklet/discuss-kit-ux 2.1.190 → 2.1.192
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/components/profile-card/index.d.ts +1 -1
- package/dist/components/profile-card/profile-card.d.ts +5 -1
- package/dist/{editor-BNWEz7Qx.mjs → editor-Dnvr-2B3.mjs} +1 -1
- package/dist/{index-Df9duIx9.mjs → index-DVR6adH3.mjs} +153 -92
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +145 -83
- package/package.json +6 -6
- package/dist/components/profile-card/ProfileCard.stories.d.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ProfileCard } from './profile-card';
|
|
@@ -3,5 +3,9 @@ interface ProfileCardProps {
|
|
|
3
3
|
user: User;
|
|
4
4
|
click: () => void;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export declare function ProfileCard({ user, click, ...rest }: ProfileCardProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ProfileCardTooltip({ user, children }: {
|
|
8
|
+
user: User;
|
|
9
|
+
children: React.ReactElement;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-DVR6adH3.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -4,10 +4,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
var _a, _b, _c, _d, _e, _f;
|
|
5
5
|
import { Labels2, LabelPicker } from "@blocklet/labels";
|
|
6
6
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { useTheme, ThemeProvider, styled as styled$
|
|
7
|
+
import { useTheme, ThemeProvider, styled as styled$2 } from "@mui/material/styles";
|
|
8
8
|
import { create as create$1, styled } from "@arcblock/ux/lib/Theme";
|
|
9
9
|
import { useEffect, useRef, useState, createElement, useContext, useMemo, useCallback, isValidElement, Suspense, createContext, Fragment as Fragment$1, forwardRef, useImperativeHandle } from "react";
|
|
10
|
-
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$
|
|
10
|
+
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, CircularProgress, Backdrop, Autocomplete, Typography as Typography$1, TextField, InputAdornment, SwipeableDrawer, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
11
11
|
import isNil from "lodash/isNil";
|
|
12
12
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
13
13
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
@@ -31,7 +31,7 @@ import { grey, green, amber } from "@mui/material/colors";
|
|
|
31
31
|
import useMediaQuery$1 from "@mui/material/useMediaQuery";
|
|
32
32
|
import DID from "@arcblock/ux/lib/DID";
|
|
33
33
|
import Tooltip, { tooltipClasses } from "@mui/material/Tooltip";
|
|
34
|
-
import {
|
|
34
|
+
import { useNavigate, useMatch, Link, useLocation, useParams, Outlet, useSearchParams, useBlocker } from "react-router-dom";
|
|
35
35
|
import { useBrowser } from "@arcblock/react-hooks";
|
|
36
36
|
import UxRelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
37
37
|
import Chip from "@mui/material/Chip";
|
|
@@ -50,7 +50,6 @@ import bridge from "@arcblock/bridge";
|
|
|
50
50
|
import NotificationsActiveOutlinedIcon from "@mui/icons-material/NotificationsActiveOutlined";
|
|
51
51
|
import { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
52
52
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
53
|
-
import DIDAddress from "@arcblock/did-connect/lib/Address";
|
|
54
53
|
import MuiMenuItem from "@mui/material/MenuItem";
|
|
55
54
|
import clsx from "clsx";
|
|
56
55
|
import IconButton$1 from "@mui/material/IconButton";
|
|
@@ -1127,6 +1126,53 @@ const useResponsiveValue = (values2) => {
|
|
|
1127
1126
|
const r = useResponsive();
|
|
1128
1127
|
return r(values2);
|
|
1129
1128
|
};
|
|
1129
|
+
const useChatInWallet = () => {
|
|
1130
|
+
var _a2;
|
|
1131
|
+
const navigate = useNavigate();
|
|
1132
|
+
const { walletVersion, mobile } = useBrowser();
|
|
1133
|
+
const chatInWallet = useMatch("/chat-in-wallet/:chatId?");
|
|
1134
|
+
const isInArcSphere2 = ((_a2 = window == null ? void 0 : window.navigator) == null ? void 0 : _a2.userAgent.indexOf("ArcSphere")) > -1;
|
|
1135
|
+
const isChatInWalletV2 = useMemo(() => {
|
|
1136
|
+
try {
|
|
1137
|
+
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
1138
|
+
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1139
|
+
} catch (e) {
|
|
1140
|
+
console.error(e);
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1143
|
+
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1144
|
+
const isWebNavbar = useMemo(() => {
|
|
1145
|
+
try {
|
|
1146
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1147
|
+
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1148
|
+
} catch (e) {
|
|
1149
|
+
console.error(e);
|
|
1150
|
+
return false;
|
|
1151
|
+
}
|
|
1152
|
+
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1153
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
1154
|
+
if (isChatInWalletV2) {
|
|
1155
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
1156
|
+
} else {
|
|
1157
|
+
bridge.call("clickChat", { id: id2, title });
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
const navigateToChatList = () => {
|
|
1161
|
+
navigate("/chat-in-wallet");
|
|
1162
|
+
};
|
|
1163
|
+
const updateUnreadState = useCallback((unread) => {
|
|
1164
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
1165
|
+
}, []);
|
|
1166
|
+
return {
|
|
1167
|
+
navigateToChat,
|
|
1168
|
+
navigateToChatList,
|
|
1169
|
+
isChatInWalletV2,
|
|
1170
|
+
isWebNavbar,
|
|
1171
|
+
isInArcSphere: isInArcSphere2,
|
|
1172
|
+
updateUnreadState,
|
|
1173
|
+
chatInWallet
|
|
1174
|
+
};
|
|
1175
|
+
};
|
|
1130
1176
|
function ProfileCard({ user, click, ...rest }) {
|
|
1131
1177
|
var _a2, _b2, _c2;
|
|
1132
1178
|
const { session } = useSessionContext();
|
|
@@ -1136,7 +1182,7 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1136
1182
|
chatUrl = "";
|
|
1137
1183
|
}
|
|
1138
1184
|
return /* @__PURE__ */ jsxs(
|
|
1139
|
-
Box
|
|
1185
|
+
Box,
|
|
1140
1186
|
{
|
|
1141
1187
|
sx: {
|
|
1142
1188
|
boxSizing: "border-box",
|
|
@@ -1151,11 +1197,11 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1151
1197
|
},
|
|
1152
1198
|
...rest,
|
|
1153
1199
|
children: [
|
|
1154
|
-
/* @__PURE__ */ jsxs(Box
|
|
1200
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, cursor: "pointer" }, onClick: click, children: [
|
|
1155
1201
|
/* @__PURE__ */ jsx(Avatar, { did: user.did, src: user.avatar, size: 44, shape: "circle", variant: "circle" }),
|
|
1156
|
-
/* @__PURE__ */ jsxs(Box
|
|
1202
|
+
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", flex: 1, overflow: "hidden" }, children: [
|
|
1157
1203
|
/* @__PURE__ */ jsxs(
|
|
1158
|
-
Box
|
|
1204
|
+
Box,
|
|
1159
1205
|
{
|
|
1160
1206
|
component: "span",
|
|
1161
1207
|
sx: {
|
|
@@ -1165,9 +1211,9 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1165
1211
|
lineHeight: 1.3
|
|
1166
1212
|
},
|
|
1167
1213
|
children: [
|
|
1168
|
-
/* @__PURE__ */ jsx(Box
|
|
1214
|
+
/* @__PURE__ */ jsx(Box, { sx: { fontWeight: "bold" }, children: user.fullName }),
|
|
1169
1215
|
user.role && /* @__PURE__ */ jsx(
|
|
1170
|
-
Box
|
|
1216
|
+
Box,
|
|
1171
1217
|
{
|
|
1172
1218
|
sx: {
|
|
1173
1219
|
px: 1.25,
|
|
@@ -1194,13 +1240,13 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1194
1240
|
did: user.did
|
|
1195
1241
|
}
|
|
1196
1242
|
),
|
|
1197
|
-
/* @__PURE__ */ jsx(Box
|
|
1243
|
+
/* @__PURE__ */ jsx(Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsx(Badge, { passports: (user == null ? void 0 : user.passports) || [], pointInfo: (user == null ? void 0 : user.pointInfo) || {}, did: user == null ? void 0 : user.did }) })
|
|
1198
1244
|
] })
|
|
1199
1245
|
] }),
|
|
1200
1246
|
chatUrl && (user == null ? void 0 : user.did) !== window.blocklet.appId && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.did) !== user.did && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1201
|
-
/* @__PURE__ */ jsx(Box
|
|
1202
|
-
/* @__PURE__ */ jsx(Box
|
|
1203
|
-
Button,
|
|
1247
|
+
/* @__PURE__ */ jsx(Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1248
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
1249
|
+
Button$1,
|
|
1204
1250
|
{
|
|
1205
1251
|
component: Link,
|
|
1206
1252
|
to: chatUrl,
|
|
@@ -1216,54 +1262,59 @@ function ProfileCard({ user, click, ...rest }) {
|
|
|
1216
1262
|
}
|
|
1217
1263
|
);
|
|
1218
1264
|
}
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1265
|
+
const HtmlTooltip$2 = styled$1(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1266
|
+
Tooltip,
|
|
1267
|
+
{
|
|
1268
|
+
PopperProps: {
|
|
1269
|
+
disablePortal: true
|
|
1270
|
+
},
|
|
1271
|
+
...props,
|
|
1272
|
+
classes: { popper: className }
|
|
1273
|
+
}
|
|
1274
|
+
))(() => ({
|
|
1275
|
+
[`& .${tooltipClasses.tooltip}`]: {
|
|
1276
|
+
backgroundColor: "transparent",
|
|
1277
|
+
maxWidth: "initial"
|
|
1278
|
+
}
|
|
1279
|
+
}));
|
|
1280
|
+
function ProfileCardTooltip({ user, children }) {
|
|
1221
1281
|
const navigate = useNavigate();
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1224
|
-
const
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1233
|
-
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1234
|
-
const isWebNavbar = useMemo(() => {
|
|
1235
|
-
try {
|
|
1236
|
-
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1237
|
-
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1238
|
-
} catch (e) {
|
|
1239
|
-
console.error(e);
|
|
1240
|
-
return false;
|
|
1241
|
-
}
|
|
1242
|
-
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1243
|
-
const navigateToChat = ({ id: id2, title }) => {
|
|
1244
|
-
if (isChatInWalletV2) {
|
|
1245
|
-
navigate(`/chat-in-wallet/${id2}`);
|
|
1282
|
+
const [open, setOpen] = useState(false);
|
|
1283
|
+
const { mobile } = useBrowser();
|
|
1284
|
+
const { chatInWallet } = useChatInWallet();
|
|
1285
|
+
const click = (e) => {
|
|
1286
|
+
var _a2, _b2;
|
|
1287
|
+
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1288
|
+
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1289
|
+
setOpen(false);
|
|
1290
|
+
if (chatInWallet) {
|
|
1291
|
+
openProfile(user == null ? void 0 : user.did, true);
|
|
1246
1292
|
} else {
|
|
1247
|
-
|
|
1293
|
+
setTimeout(() => {
|
|
1294
|
+
if (isInDiscussKitApp) {
|
|
1295
|
+
navigate(`/profile?did=${user == null ? void 0 : user.did}`);
|
|
1296
|
+
} else {
|
|
1297
|
+
openProfile(user == null ? void 0 : user.did);
|
|
1298
|
+
}
|
|
1299
|
+
}, 100);
|
|
1248
1300
|
}
|
|
1249
1301
|
};
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
const HtmlTooltip$1 = styled$1(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1302
|
+
if (mobile.any) {
|
|
1303
|
+
return children;
|
|
1304
|
+
}
|
|
1305
|
+
return /* @__PURE__ */ jsx(
|
|
1306
|
+
HtmlTooltip$2,
|
|
1307
|
+
{
|
|
1308
|
+
open,
|
|
1309
|
+
onClose: () => setOpen(false),
|
|
1310
|
+
onOpen: () => setOpen(true),
|
|
1311
|
+
PopperProps: { disablePortal: false },
|
|
1312
|
+
title: /* @__PURE__ */ jsx(ProfileCard, { user, click }),
|
|
1313
|
+
children
|
|
1314
|
+
}
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1317
|
+
const HtmlTooltip$1 = styled$2(({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1267
1318
|
Tooltip,
|
|
1268
1319
|
{
|
|
1269
1320
|
PopperProps: {
|
|
@@ -1544,13 +1595,16 @@ function ViewMore({ children, ...rest }) {
|
|
|
1544
1595
|
] });
|
|
1545
1596
|
}
|
|
1546
1597
|
const BlockletEditor$1 = lazyRetry(() => import("@blocklet/editor"));
|
|
1547
|
-
const StyledBlockletEditor = styled$
|
|
1598
|
+
const StyledBlockletEditor = styled$2(BlockletEditor$1)`
|
|
1548
1599
|
.editor-scroller {
|
|
1549
1600
|
min-height: initial;
|
|
1550
1601
|
}
|
|
1551
1602
|
.ContentEditable__root {
|
|
1552
1603
|
padding: 0;
|
|
1553
1604
|
}
|
|
1605
|
+
.be-editable > p:last-child {
|
|
1606
|
+
margin-bottom: 0;
|
|
1607
|
+
}
|
|
1554
1608
|
`;
|
|
1555
1609
|
const innerHeight = parseInt(String(window.innerHeight / 3), 10);
|
|
1556
1610
|
function PostContent({
|
|
@@ -1610,6 +1664,10 @@ function PostContent({
|
|
|
1610
1664
|
}
|
|
1611
1665
|
) }) });
|
|
1612
1666
|
}
|
|
1667
|
+
const tablerArrowForwardUp = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
1668
|
+
/* @__PURE__ */ jsx("path", { d: "m15 14l4-4l-4-4" }),
|
|
1669
|
+
/* @__PURE__ */ jsx("path", { d: "M19 10H8a4 4 0 1 0 0 8h1" })
|
|
1670
|
+
] }) });
|
|
1613
1671
|
const StyledMuiMenu = styled(MuiMenu)`
|
|
1614
1672
|
.MuiMenuItem-root {
|
|
1615
1673
|
min-height: 32px;
|
|
@@ -1672,7 +1730,7 @@ function Menu({ items = [], ...rest }) {
|
|
|
1672
1730
|
] });
|
|
1673
1731
|
}
|
|
1674
1732
|
Menu.Item = MuiMenuItem;
|
|
1675
|
-
const Root$1 = styled$
|
|
1733
|
+
const Root$1 = styled$2(Box$1)`
|
|
1676
1734
|
.post-highlighted {
|
|
1677
1735
|
animation: highlighted-post-fade 3s;
|
|
1678
1736
|
animation-timing-function: ease-out;
|
|
@@ -1764,6 +1822,7 @@ function PostComponent({
|
|
|
1764
1822
|
AuthorInfo,
|
|
1765
1823
|
{
|
|
1766
1824
|
size: "sm",
|
|
1825
|
+
avatarSize: 32,
|
|
1767
1826
|
user: post.author,
|
|
1768
1827
|
createdAt: renderTime(),
|
|
1769
1828
|
showProfileCard,
|
|
@@ -1773,24 +1832,26 @@ function PostComponent({
|
|
|
1773
1832
|
),
|
|
1774
1833
|
/* @__PURE__ */ jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
|
1775
1834
|
] }),
|
|
1776
|
-
/* @__PURE__ */ jsxs(Box$1, { sx: { ml:
|
|
1777
|
-
post.replyTo && /* @__PURE__ */ jsxs(
|
|
1778
|
-
|
|
1835
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { ml: 5.5 }, children: [
|
|
1836
|
+
post.replyTo && /* @__PURE__ */ jsx(Box$1, { sx: { pt: 1 }, children: /* @__PURE__ */ jsx(ProfileCardTooltip, { user: post.replyTo, children: /* @__PURE__ */ jsxs(
|
|
1837
|
+
Stack$1,
|
|
1779
1838
|
{
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1839
|
+
direction: "row",
|
|
1840
|
+
alignItems: "center",
|
|
1841
|
+
gap: 0.5,
|
|
1842
|
+
sx: {
|
|
1843
|
+
display: "inline-flex",
|
|
1844
|
+
color: "text.secondary",
|
|
1845
|
+
cursor: "pointer",
|
|
1846
|
+
".did-address-text": { color: "primary.light" }
|
|
1847
|
+
},
|
|
1785
1848
|
children: [
|
|
1786
|
-
|
|
1787
|
-
/* @__PURE__ */ jsx(
|
|
1788
|
-
|
|
1789
|
-
/* @__PURE__ */ jsx(DIDAddress, { copyable: false, responsive: false, compact: true, inline: true, children: post.replyTo.did }),
|
|
1790
|
-
")"
|
|
1849
|
+
/* @__PURE__ */ jsx(Box$1, { component: tablerArrowForwardUp }),
|
|
1850
|
+
/* @__PURE__ */ jsx("span", { children: "Reply to" }),
|
|
1851
|
+
/* @__PURE__ */ jsx(Box$1, { component: "span", children: post.replyTo.fullName })
|
|
1791
1852
|
]
|
|
1792
1853
|
}
|
|
1793
|
-
),
|
|
1854
|
+
) }) }),
|
|
1794
1855
|
showSystemTip && /* @__PURE__ */ jsx(
|
|
1795
1856
|
Box$1,
|
|
1796
1857
|
{
|
|
@@ -1805,7 +1866,7 @@ function PostComponent({
|
|
|
1805
1866
|
children: systemTip
|
|
1806
1867
|
}
|
|
1807
1868
|
),
|
|
1808
|
-
!showSystemTip && !post.deletedAt && /* @__PURE__ */ jsx(Box$1, {
|
|
1869
|
+
!showSystemTip && !post.deletedAt && /* @__PURE__ */ jsx(Box$1, { children: /* @__PURE__ */ jsx(
|
|
1809
1870
|
PostContent,
|
|
1810
1871
|
{
|
|
1811
1872
|
content: post.content,
|
|
@@ -1829,7 +1890,7 @@ const iconoirThumbsUp = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24
|
|
|
1829
1890
|
/* @__PURE__ */ jsx("path", { d: "M16.472 20H4.1a.6.6 0 0 1-.6-.6V9.6a.6.6 0 0 1 .6-.6h2.768a2 2 0 0 0 1.715-.971l2.71-4.517a1.631 1.631 0 0 1 2.961 1.308l-1.022 3.408a.6.6 0 0 0 .574.772h4.576a2 2 0 0 1 1.929 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1830
1891
|
/* @__PURE__ */ jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
1831
1892
|
] }) });
|
|
1832
|
-
const StyledDialog = styled$
|
|
1893
|
+
const StyledDialog = styled$1(Dialog)`
|
|
1833
1894
|
.ux-dialog_header {
|
|
1834
1895
|
padding: 0 16px;
|
|
1835
1896
|
}
|
|
@@ -2172,9 +2233,13 @@ function GithubReaction({
|
|
|
2172
2233
|
borderColor: "divider",
|
|
2173
2234
|
borderRadius: 1,
|
|
2174
2235
|
cursor: "pointer",
|
|
2236
|
+
bgcolor: "transparent",
|
|
2237
|
+
"&:hover": {
|
|
2238
|
+
bgcolor: "grey.100"
|
|
2239
|
+
},
|
|
2175
2240
|
...selected && {
|
|
2176
|
-
borderColor: "
|
|
2177
|
-
bgcolor: (theme) => alpha(theme.palette.
|
|
2241
|
+
borderColor: "warning.light",
|
|
2242
|
+
bgcolor: (theme) => alpha(theme.palette.warning.light, 0.2)
|
|
2178
2243
|
}
|
|
2179
2244
|
},
|
|
2180
2245
|
onClick: () => toggleRate(option.value),
|
|
@@ -2191,7 +2256,10 @@ function GithubReaction({
|
|
|
2191
2256
|
alignItems: "center",
|
|
2192
2257
|
gap: 3,
|
|
2193
2258
|
".github-reaction-icon": {
|
|
2194
|
-
|
|
2259
|
+
width: "1em",
|
|
2260
|
+
height: "1em",
|
|
2261
|
+
fontSize: 20,
|
|
2262
|
+
color: "text.secondary",
|
|
2195
2263
|
cursor: "pointer"
|
|
2196
2264
|
},
|
|
2197
2265
|
".github-reaction-icon:hover": {
|
|
@@ -2213,14 +2281,7 @@ function GithubReaction({
|
|
|
2213
2281
|
},
|
|
2214
2282
|
onClick: handleOpen,
|
|
2215
2283
|
children: [
|
|
2216
|
-
/* @__PURE__ */ jsx(
|
|
2217
|
-
Box,
|
|
2218
|
-
{
|
|
2219
|
-
className: "github-reaction-icon",
|
|
2220
|
-
component: tablerMoodPlus,
|
|
2221
|
-
sx: { width: "1em", height: "1em", fontSize: 18 }
|
|
2222
|
-
}
|
|
2223
|
-
),
|
|
2284
|
+
/* @__PURE__ */ jsx(Box, { className: "github-reaction-icon", component: tablerMoodPlus }),
|
|
2224
2285
|
open && /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsx(
|
|
2225
2286
|
Box,
|
|
2226
2287
|
{
|
|
@@ -2452,10 +2513,10 @@ function Comment({
|
|
|
2452
2513
|
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsx(
|
|
2453
2514
|
Box$1,
|
|
2454
2515
|
{
|
|
2516
|
+
component: tablerMessageCircle,
|
|
2455
2517
|
className: "github-reaction-icon",
|
|
2456
2518
|
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2457
|
-
sx: { lineHeight: 1 }
|
|
2458
|
-
children: /* @__PURE__ */ jsx(Box$1, { component: tablerMessageCircle, sx: { width: "1em", height: "1em", fontSize: 18 } })
|
|
2519
|
+
sx: { lineHeight: 1 }
|
|
2459
2520
|
}
|
|
2460
2521
|
),
|
|
2461
2522
|
renderDonation && renderDonation(post)
|
|
@@ -2853,7 +2914,7 @@ function CommentsProvider({
|
|
|
2853
2914
|
);
|
|
2854
2915
|
return /* @__PURE__ */ jsx(CommentsContext.Provider, { value, children });
|
|
2855
2916
|
}
|
|
2856
|
-
const LoadMoreButtonWrapper = styled$
|
|
2917
|
+
const LoadMoreButtonWrapper = styled$2(Box$1)`
|
|
2857
2918
|
background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 11L8 5L16 11' stroke='%23e1e4e8' stroke-linecap='square' stroke-width='1.5' /%3E%3C/svg%3E");
|
|
2858
2919
|
background-repeat: repeat-x;
|
|
2859
2920
|
background-position: center;
|
|
@@ -4719,7 +4780,7 @@ const MessageList = forwardRef(({ chat, ...rest }, ref) => {
|
|
|
4719
4780
|
!isAtBottom && /* @__PURE__ */ jsx(Box$1, { sx: { position: "absolute", bottom: 16, right: 24 }, onClick: scrollToBottom, children: /* @__PURE__ */ jsx(Fab, { color: "inherit", sx: { width: { xs: 36, sm: 44 }, height: { xs: 36, sm: 44 } }, children: /* @__PURE__ */ jsx(ArrowDownward, {}) }) })
|
|
4720
4781
|
] });
|
|
4721
4782
|
});
|
|
4722
|
-
const HtmlTooltip = styled$
|
|
4783
|
+
const HtmlTooltip = styled$2(({ className, ...props }) => /* @__PURE__ */ jsx(Tooltip$1, { ...props, classes: { popper: className } }))(() => ({
|
|
4723
4784
|
[`& .${tooltipClasses$1.tooltip}`]: {
|
|
4724
4785
|
color: "inherit",
|
|
4725
4786
|
backgroundColor: "#fff",
|
|
@@ -4847,7 +4908,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
4847
4908
|
}
|
|
4848
4909
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
4849
4910
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
4850
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
4911
|
+
const Editor = lazyRetry(() => import("./editor-Dnvr-2B3.mjs"));
|
|
4851
4912
|
function LazyEditor(props) {
|
|
4852
4913
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4853
4914
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, ay, ar, N, am, as, av, aw, l, ax, f, p, r, j, au, t, h, aa, az, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-
|
|
2
|
+
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, ay, ar, N, am, as, av, aw, l, ax, f, p, r, j, au, t, h, aa, az, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-DVR6adH3.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@arcblock/ux/lib/Locale/context"), require("@mui/icons-material"), require("@mui/lab/LoadingButton"), require("@mui/material/Alert"), require("@mui/material/Box"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@arcblock/ux/lib/Util"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, context, iconsMaterial, LoadingButton, Alert, Box, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, Util, CheckboxPlugin,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@arcblock/ux/lib/Locale/context"), require("@mui/icons-material"), require("@mui/lab/LoadingButton"), require("@mui/material/Alert"), require("@mui/material/Box"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@arcblock/ux/lib/Util"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@blocklet/editor/lib/ext/EditorHolderPlugin"), require("@mui/material/colors/red"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("ufo"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("url-join"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@blocklet/editor/lib/ext/BusyPlugin"), require("@arcblock/ux/lib/Header/addon-button"), require("axios"), require("react-hot-toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@arcblock/ux/lib/Locale/context", "@mui/icons-material", "@mui/lab/LoadingButton", "@mui/material/Alert", "@mui/material/Box", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@arcblock/ux/lib/Util", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@blocklet/editor/lib/ext/EditorHolderPlugin", "@mui/material/colors/red", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "ufo", "dayjs", "dayjs/plugin/relativeTime", "url-join", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@blocklet/editor/lib/ext/BusyPlugin", "@arcblock/ux/lib/Header/addon-button", "axios", "react-hot-toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.context, global.iconsMaterial, global.LoadingButton, global.Alert, global.Box, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.Util, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.EditorHolderPlugin, global.red, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.ufo, global.dayjs, global.relativeTime, global.joinUrl, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.BusyPlugin, global.addonButton, global.axios, global.hotToast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, context, iconsMaterial, LoadingButton, Alert, Box, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, Util, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, EditorHolderPlugin, red, Dialog, orderBy, Typography, Skeleton, ReactDOM, ufo, dayjs, relativeTime, joinUrl, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, editor$1, Fab, debounce, useIsFocused, BusyPlugin, addonButton, axios, hotToast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -1050,6 +1050,53 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1050
1050
|
const r = useResponsive();
|
|
1051
1051
|
return r(values2);
|
|
1052
1052
|
};
|
|
1053
|
+
const useChatInWallet = () => {
|
|
1054
|
+
var _a2;
|
|
1055
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1056
|
+
const { walletVersion, mobile } = reactHooks.useBrowser();
|
|
1057
|
+
const chatInWallet = reactRouterDom.useMatch("/chat-in-wallet/:chatId?");
|
|
1058
|
+
const isInArcSphere2 = ((_a2 = window == null ? void 0 : window.navigator) == null ? void 0 : _a2.userAgent.indexOf("ArcSphere")) > -1;
|
|
1059
|
+
const isChatInWalletV2 = react.useMemo(() => {
|
|
1060
|
+
try {
|
|
1061
|
+
const targetVersion = mobile.apple.device ? "5.3.5" : "5.3.1";
|
|
1062
|
+
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1063
|
+
} catch (e) {
|
|
1064
|
+
console.error(e);
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1068
|
+
const isWebNavbar = react.useMemo(() => {
|
|
1069
|
+
try {
|
|
1070
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1071
|
+
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1072
|
+
} catch (e) {
|
|
1073
|
+
console.error(e);
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1077
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
1078
|
+
if (isChatInWalletV2) {
|
|
1079
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
1080
|
+
} else {
|
|
1081
|
+
bridge.call("clickChat", { id: id2, title });
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
const navigateToChatList = () => {
|
|
1085
|
+
navigate("/chat-in-wallet");
|
|
1086
|
+
};
|
|
1087
|
+
const updateUnreadState = react.useCallback((unread) => {
|
|
1088
|
+
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
1089
|
+
}, []);
|
|
1090
|
+
return {
|
|
1091
|
+
navigateToChat,
|
|
1092
|
+
navigateToChatList,
|
|
1093
|
+
isChatInWalletV2,
|
|
1094
|
+
isWebNavbar,
|
|
1095
|
+
isInArcSphere: isInArcSphere2,
|
|
1096
|
+
updateUnreadState,
|
|
1097
|
+
chatInWallet
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1053
1100
|
function ProfileCard({ user, click, ...rest }) {
|
|
1054
1101
|
var _a2, _b2, _c2;
|
|
1055
1102
|
const { session } = useSessionContext();
|
|
@@ -1059,7 +1106,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1059
1106
|
chatUrl = "";
|
|
1060
1107
|
}
|
|
1061
1108
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1062
|
-
Box,
|
|
1109
|
+
material.Box,
|
|
1063
1110
|
{
|
|
1064
1111
|
sx: {
|
|
1065
1112
|
boxSizing: "border-box",
|
|
@@ -1074,11 +1121,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1074
1121
|
},
|
|
1075
1122
|
...rest,
|
|
1076
1123
|
children: [
|
|
1077
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, cursor: "pointer" }, onClick: click, children: [
|
|
1124
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 2, cursor: "pointer" }, onClick: click, children: [
|
|
1078
1125
|
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { did: user.did, src: user.avatar, size: 44, shape: "circle", variant: "circle" }),
|
|
1079
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", flex: 1, overflow: "hidden" }, children: [
|
|
1126
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, overflow: "hidden" }, children: [
|
|
1080
1127
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1081
|
-
Box,
|
|
1128
|
+
material.Box,
|
|
1082
1129
|
{
|
|
1083
1130
|
component: "span",
|
|
1084
1131
|
sx: {
|
|
@@ -1088,9 +1135,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1088
1135
|
lineHeight: 1.3
|
|
1089
1136
|
},
|
|
1090
1137
|
children: [
|
|
1091
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { fontWeight: "bold" }, children: user.fullName }),
|
|
1138
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { fontWeight: "bold" }, children: user.fullName }),
|
|
1092
1139
|
user.role && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1093
|
-
Box,
|
|
1140
|
+
material.Box,
|
|
1094
1141
|
{
|
|
1095
1142
|
sx: {
|
|
1096
1143
|
px: 1.25,
|
|
@@ -1117,13 +1164,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1117
1164
|
did: user.did
|
|
1118
1165
|
}
|
|
1119
1166
|
),
|
|
1120
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { passports: (user == null ? void 0 : user.passports) || [], pointInfo: (user == null ? void 0 : user.pointInfo) || {}, did: user == null ? void 0 : user.did }) })
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { passports: (user == null ? void 0 : user.passports) || [], pointInfo: (user == null ? void 0 : user.pointInfo) || {}, did: user == null ? void 0 : user.did }) })
|
|
1121
1168
|
] })
|
|
1122
1169
|
] }),
|
|
1123
1170
|
chatUrl && (user == null ? void 0 : user.did) !== window.blocklet.appId && ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did) && ((_c2 = session == null ? void 0 : session.user) == null ? void 0 : _c2.did) !== user.did && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1124
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1125
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1126
|
-
Button,
|
|
1171
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { my: 2, borderTop: "1px solid #eee" } }),
|
|
1172
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1173
|
+
material.Button,
|
|
1127
1174
|
{
|
|
1128
1175
|
component: reactRouterDom.Link,
|
|
1129
1176
|
to: chatUrl,
|
|
@@ -1139,53 +1186,58 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1139
1186
|
}
|
|
1140
1187
|
);
|
|
1141
1188
|
}
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1189
|
+
const HtmlTooltip$2 = material.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1190
|
+
Tooltip,
|
|
1191
|
+
{
|
|
1192
|
+
PopperProps: {
|
|
1193
|
+
disablePortal: true
|
|
1194
|
+
},
|
|
1195
|
+
...props,
|
|
1196
|
+
classes: { popper: className }
|
|
1197
|
+
}
|
|
1198
|
+
))(() => ({
|
|
1199
|
+
[`& .${Tooltip.tooltipClasses.tooltip}`]: {
|
|
1200
|
+
backgroundColor: "transparent",
|
|
1201
|
+
maxWidth: "initial"
|
|
1202
|
+
}
|
|
1203
|
+
}));
|
|
1204
|
+
function ProfileCardTooltip({ user, children }) {
|
|
1144
1205
|
const navigate = reactRouterDom.useNavigate();
|
|
1145
|
-
const
|
|
1146
|
-
const
|
|
1147
|
-
const
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
}
|
|
1156
|
-
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1157
|
-
const isWebNavbar = react.useMemo(() => {
|
|
1158
|
-
try {
|
|
1159
|
-
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
1160
|
-
return isInArcSphere2 || !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
1161
|
-
} catch (e) {
|
|
1162
|
-
console.error(e);
|
|
1163
|
-
return false;
|
|
1164
|
-
}
|
|
1165
|
-
}, [walletVersion, mobile, isInArcSphere2]);
|
|
1166
|
-
const navigateToChat = ({ id: id2, title }) => {
|
|
1167
|
-
if (isChatInWalletV2) {
|
|
1168
|
-
navigate(`/chat-in-wallet/${id2}`);
|
|
1206
|
+
const [open, setOpen] = react.useState(false);
|
|
1207
|
+
const { mobile } = reactHooks.useBrowser();
|
|
1208
|
+
const { chatInWallet } = useChatInWallet();
|
|
1209
|
+
const click = (e) => {
|
|
1210
|
+
var _a2, _b2;
|
|
1211
|
+
(_a2 = e == null ? void 0 : e.stopPropagation) == null ? void 0 : _a2.call(e);
|
|
1212
|
+
(_b2 = e == null ? void 0 : e.preventDefault) == null ? void 0 : _b2.call(e);
|
|
1213
|
+
setOpen(false);
|
|
1214
|
+
if (chatInWallet) {
|
|
1215
|
+
openProfile(user == null ? void 0 : user.did, true);
|
|
1169
1216
|
} else {
|
|
1170
|
-
|
|
1217
|
+
setTimeout(() => {
|
|
1218
|
+
if (isInDiscussKitApp) {
|
|
1219
|
+
navigate(`/profile?did=${user == null ? void 0 : user.did}`);
|
|
1220
|
+
} else {
|
|
1221
|
+
openProfile(user == null ? void 0 : user.did);
|
|
1222
|
+
}
|
|
1223
|
+
}, 100);
|
|
1171
1224
|
}
|
|
1172
1225
|
};
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
};
|
|
1226
|
+
if (mobile.any) {
|
|
1227
|
+
return children;
|
|
1228
|
+
}
|
|
1229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1230
|
+
HtmlTooltip$2,
|
|
1231
|
+
{
|
|
1232
|
+
open,
|
|
1233
|
+
onClose: () => setOpen(false),
|
|
1234
|
+
onOpen: () => setOpen(true),
|
|
1235
|
+
PopperProps: { disablePortal: false },
|
|
1236
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(ProfileCard, { user, click }),
|
|
1237
|
+
children
|
|
1238
|
+
}
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1189
1241
|
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1190
1242
|
Tooltip,
|
|
1191
1243
|
{
|
|
@@ -1474,6 +1526,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1474
1526
|
.ContentEditable__root {
|
|
1475
1527
|
padding: 0;
|
|
1476
1528
|
}
|
|
1529
|
+
.be-editable > p:last-child {
|
|
1530
|
+
margin-bottom: 0;
|
|
1531
|
+
}
|
|
1477
1532
|
`;
|
|
1478
1533
|
const innerHeight = parseInt(String(window.innerHeight / 3), 10);
|
|
1479
1534
|
function PostContent({
|
|
@@ -1533,6 +1588,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1533
1588
|
}
|
|
1534
1589
|
) }) });
|
|
1535
1590
|
}
|
|
1591
|
+
const tablerArrowForwardUp = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
1592
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m15 14l4-4l-4-4" }),
|
|
1593
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 10H8a4 4 0 1 0 0 8h1" })
|
|
1594
|
+
] }) });
|
|
1536
1595
|
const StyledMuiMenu = Theme.styled(MuiMenu)`
|
|
1537
1596
|
.MuiMenuItem-root {
|
|
1538
1597
|
min-height: 32px;
|
|
@@ -1687,6 +1746,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1687
1746
|
AuthorInfo,
|
|
1688
1747
|
{
|
|
1689
1748
|
size: "sm",
|
|
1749
|
+
avatarSize: 32,
|
|
1690
1750
|
user: post.author,
|
|
1691
1751
|
createdAt: renderTime(),
|
|
1692
1752
|
showProfileCard,
|
|
@@ -1696,24 +1756,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1696
1756
|
),
|
|
1697
1757
|
/* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
|
1698
1758
|
] }),
|
|
1699
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { ml:
|
|
1700
|
-
post.replyTo && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1701
|
-
|
|
1759
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { ml: 5.5 }, children: [
|
|
1760
|
+
post.replyTo && /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { pt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(ProfileCardTooltip, { user: post.replyTo, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1761
|
+
material.Stack,
|
|
1702
1762
|
{
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1763
|
+
direction: "row",
|
|
1764
|
+
alignItems: "center",
|
|
1765
|
+
gap: 0.5,
|
|
1766
|
+
sx: {
|
|
1767
|
+
display: "inline-flex",
|
|
1768
|
+
color: "text.secondary",
|
|
1769
|
+
cursor: "pointer",
|
|
1770
|
+
".did-address-text": { color: "primary.light" }
|
|
1771
|
+
},
|
|
1708
1772
|
children: [
|
|
1709
|
-
|
|
1710
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1711
|
-
|
|
1712
|
-
/* @__PURE__ */ jsxRuntime.jsx(DIDAddress, { copyable: false, responsive: false, compact: true, inline: true, children: post.replyTo.did }),
|
|
1713
|
-
")"
|
|
1773
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerArrowForwardUp }),
|
|
1774
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Reply to" }),
|
|
1775
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: post.replyTo.fullName })
|
|
1714
1776
|
]
|
|
1715
1777
|
}
|
|
1716
|
-
),
|
|
1778
|
+
) }) }),
|
|
1717
1779
|
showSystemTip && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1718
1780
|
Box,
|
|
1719
1781
|
{
|
|
@@ -1728,7 +1790,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1728
1790
|
children: systemTip
|
|
1729
1791
|
}
|
|
1730
1792
|
),
|
|
1731
|
-
!showSystemTip && !post.deletedAt && /* @__PURE__ */ jsxRuntime.jsx(Box, {
|
|
1793
|
+
!showSystemTip && !post.deletedAt && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1732
1794
|
PostContent,
|
|
1733
1795
|
{
|
|
1734
1796
|
content: post.content,
|
|
@@ -2095,9 +2157,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2095
2157
|
borderColor: "divider",
|
|
2096
2158
|
borderRadius: 1,
|
|
2097
2159
|
cursor: "pointer",
|
|
2160
|
+
bgcolor: "transparent",
|
|
2161
|
+
"&:hover": {
|
|
2162
|
+
bgcolor: "grey.100"
|
|
2163
|
+
},
|
|
2098
2164
|
...selected && {
|
|
2099
|
-
borderColor: "
|
|
2100
|
-
bgcolor: (theme) => material.alpha(theme.palette.
|
|
2165
|
+
borderColor: "warning.light",
|
|
2166
|
+
bgcolor: (theme) => material.alpha(theme.palette.warning.light, 0.2)
|
|
2101
2167
|
}
|
|
2102
2168
|
},
|
|
2103
2169
|
onClick: () => toggleRate(option.value),
|
|
@@ -2114,7 +2180,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2114
2180
|
alignItems: "center",
|
|
2115
2181
|
gap: 3,
|
|
2116
2182
|
".github-reaction-icon": {
|
|
2117
|
-
|
|
2183
|
+
width: "1em",
|
|
2184
|
+
height: "1em",
|
|
2185
|
+
fontSize: 20,
|
|
2186
|
+
color: "text.secondary",
|
|
2118
2187
|
cursor: "pointer"
|
|
2119
2188
|
},
|
|
2120
2189
|
".github-reaction-icon:hover": {
|
|
@@ -2136,14 +2205,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2136
2205
|
},
|
|
2137
2206
|
onClick: handleOpen,
|
|
2138
2207
|
children: [
|
|
2139
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2140
|
-
material.Box,
|
|
2141
|
-
{
|
|
2142
|
-
className: "github-reaction-icon",
|
|
2143
|
-
component: tablerMoodPlus,
|
|
2144
|
-
sx: { width: "1em", height: "1em", fontSize: 18 }
|
|
2145
|
-
}
|
|
2146
|
-
),
|
|
2208
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "github-reaction-icon", component: tablerMoodPlus }),
|
|
2147
2209
|
open && /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2148
2210
|
material.Box,
|
|
2149
2211
|
{
|
|
@@ -2375,10 +2437,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2375
2437
|
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2376
2438
|
Box,
|
|
2377
2439
|
{
|
|
2440
|
+
component: tablerMessageCircle,
|
|
2378
2441
|
className: "github-reaction-icon",
|
|
2379
2442
|
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2380
|
-
sx: { lineHeight: 1 }
|
|
2381
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerMessageCircle, sx: { width: "1em", height: "1em", fontSize: 18 } })
|
|
2443
|
+
sx: { lineHeight: 1 }
|
|
2382
2444
|
}
|
|
2383
2445
|
),
|
|
2384
2446
|
renderDonation && renderDonation(post)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.192",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcblock/bridge": "^2.12.
|
|
22
|
-
"@arcblock/react-hooks": "^2.12.
|
|
21
|
+
"@arcblock/bridge": "^2.12.12",
|
|
22
|
+
"@arcblock/react-hooks": "^2.12.12",
|
|
23
23
|
"@arcblock/ws": "^1.19.15",
|
|
24
24
|
"@blocklet/uploader": "^0.1.71",
|
|
25
25
|
"@emotion/css": "^11.13.0",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ufo": "^1.5.4",
|
|
46
46
|
"unstated-next": "^1.1.0",
|
|
47
47
|
"url-join": "^4.0.1",
|
|
48
|
-
"@blocklet/editor": "^2.1.
|
|
49
|
-
"@blocklet/labels": "^2.1.
|
|
48
|
+
"@blocklet/editor": "^2.1.192",
|
|
49
|
+
"@blocklet/labels": "^2.1.192"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@arcblock/did-connect": "^2.10.36",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
65
65
|
"@babel/core": "^7.25.2",
|
|
66
|
-
"@blocklet/sdk": "^1.16.40-beta-
|
|
66
|
+
"@blocklet/sdk": "^1.16.40-beta-20250310-113951-17556f90",
|
|
67
67
|
"@iconify-json/iconoir": "^1.2.1",
|
|
68
68
|
"@iconify-json/material-symbols": "^1.2.1",
|
|
69
69
|
"@iconify-json/mdi": "^1.2.0",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
-
import { default as ProfileCard } from './profile-card';
|
|
3
|
-
declare const _default: ComponentMeta<typeof ProfileCard>;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const Basic: ComponentStory<typeof ProfileCard>;
|