@blocklet/ui-react 2.10.64 → 2.10.66

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.
@@ -4,25 +4,27 @@ import { Box, Typography } from "@mui/material";
4
4
  import { SpaceCard, SessionConnectTo } from "@blocklet/did-space-react";
5
5
  import { useConfigUserSpaceContext } from "../../../contexts/config-user-space.js";
6
6
  import Action from "./action.js";
7
+ import useMobile from "../../../hooks/use-mobile.js";
7
8
  function Connected({ spaceGateway }) {
8
9
  const { t } = useLocaleContext();
9
10
  const { updateSpaceGateway, session } = useConfigUserSpaceContext();
11
+ const isMobile = useMobile();
10
12
  return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", children: [
11
13
  /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: "12px", children: [
12
14
  /* @__PURE__ */ jsx(Typography, { fontSize: "16px", fontWeight: "bold", children: t("storage.spaces.connected.title") }),
13
- /* @__PURE__ */ jsx(SessionConnectTo, { session, onConnected: updateSpaceGateway })
15
+ !isMobile && /* @__PURE__ */ jsx(SessionConnectTo, { session, onConnected: updateSpaceGateway })
14
16
  ] }),
15
17
  /* @__PURE__ */ jsx(Box, { children: spaceGateway && /* @__PURE__ */ jsx(
16
18
  SpaceCard,
17
19
  {
18
- sx: { marginTop: "12px", "&.selected": { borderColor: "primary.main" } },
19
20
  endpoint: spaceGateway.endpoint,
20
21
  deps: [spaceGateway],
21
22
  selected: true,
22
23
  action: (props) => /* @__PURE__ */ jsx(Action, { session, ...props })
23
24
  },
24
25
  spaceGateway.endpoint
25
- ) })
26
+ ) }),
27
+ isMobile && /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", marginTop: 2 }, children: /* @__PURE__ */ jsx(SessionConnectTo, { session, onConnected: updateSpaceGateway }) })
26
28
  ] });
27
29
  }
28
30
  export default Connected;
@@ -1,4 +1,4 @@
1
1
  import { Breakpoint } from '@mui/material';
2
- export default function useMobile({ key }: {
2
+ export default function useMobile({ key }?: {
3
3
  key?: number | Breakpoint;
4
4
  }): boolean;
@@ -1,5 +1,5 @@
1
1
  import { useTheme, useMediaQuery } from "@mui/material";
2
- export default function useMobile({ key = "sm" }) {
2
+ export default function useMobile({ key = "sm" } = {}) {
3
3
  const theme = useTheme();
4
4
  return useMediaQuery(theme.breakpoints.down(key));
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.10.64",
3
+ "version": "2.10.66",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "^2.10.64",
36
- "@arcblock/react-hooks": "^2.10.64",
35
+ "@arcblock/bridge": "^2.10.66",
36
+ "@arcblock/react-hooks": "^2.10.66",
37
37
  "@blocklet/did-space-react": "^0.5.65",
38
38
  "@iconify-icons/logos": "^1.2.36",
39
39
  "@iconify-icons/material-symbols": "^1.2.58",
@@ -80,5 +80,5 @@
80
80
  "jest": "^29.7.0",
81
81
  "unbuild": "^2.0.0"
82
82
  },
83
- "gitHead": "b5362da4f7e1caa78ed39a37f3844e193d9d289f"
83
+ "gitHead": "39618b5825c36e842a8c50af5967a95c19481341"
84
84
  }
@@ -3,10 +3,12 @@ import { Box, Typography } from '@mui/material';
3
3
  import { SpaceCard, SessionConnectTo } from '@blocklet/did-space-react';
4
4
  import { SpaceGateway, useConfigUserSpaceContext } from '../../../contexts/config-user-space';
5
5
  import Action from './action';
6
+ import useMobile from '../../../hooks/use-mobile';
6
7
 
7
8
  function Connected({ spaceGateway }: { spaceGateway: SpaceGateway | undefined }) {
8
9
  const { t } = useLocaleContext();
9
10
  const { updateSpaceGateway, session } = useConfigUserSpaceContext();
11
+ const isMobile = useMobile();
10
12
 
11
13
  return (
12
14
  <Box display="flex" flexDirection="column">
@@ -14,12 +16,11 @@ function Connected({ spaceGateway }: { spaceGateway: SpaceGateway | undefined })
14
16
  <Typography fontSize="16px" fontWeight="bold">
15
17
  {t('storage.spaces.connected.title')}
16
18
  </Typography>
17
- <SessionConnectTo session={session} onConnected={updateSpaceGateway} />
19
+ {!isMobile && <SessionConnectTo session={session} onConnected={updateSpaceGateway} />}
18
20
  </Box>
19
21
  <Box>
20
22
  {spaceGateway && (
21
23
  <SpaceCard
22
- sx={{ marginTop: '12px', '&.selected': { borderColor: 'primary.main' } }}
23
24
  key={spaceGateway.endpoint}
24
25
  endpoint={spaceGateway.endpoint}
25
26
  deps={[spaceGateway]}
@@ -29,6 +30,11 @@ function Connected({ spaceGateway }: { spaceGateway: SpaceGateway | undefined })
29
30
  />
30
31
  )}
31
32
  </Box>
33
+ {isMobile && (
34
+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginTop: 2 }}>
35
+ <SessionConnectTo session={session} onConnected={updateSpaceGateway} />
36
+ </Box>
37
+ )}
32
38
  </Box>
33
39
  );
34
40
  }
@@ -1,6 +1,6 @@
1
1
  import { Breakpoint, useTheme, useMediaQuery } from '@mui/material';
2
2
 
3
- export default function useMobile({ key = 'sm' }: { key?: number | Breakpoint }) {
3
+ export default function useMobile({ key = 'sm' }: { key?: number | Breakpoint } = {}) {
4
4
  const theme = useTheme();
5
5
  return useMediaQuery(theme.breakpoints.down(key));
6
6
  }