Skip to content

Commit 3a5ebda

Browse files
authored
Merge pull request #1535 from pangeacyber/store_button_style
Password modal bug fix, button style update
2 parents 6892fed + c214840 commit 3a5ebda

File tree

11 files changed

+59
-15
lines changed

11 files changed

+59
-15
lines changed

packages/react-mui-store-file-viewer/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.69] - 2024-09-25
9+
10+
### Fixed
11+
12+
- Don't show password copy modal after Get Link modal
13+
14+
### Changed
15+
16+
- Updated "Share via Email" and "Get Link" button style to outlined
17+
818
## [0.0.68] - 2024-09-19
919

1020
### Fixed

packages/react-mui-store-file-viewer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pangeacyber/react-mui-store-file-viewer",
3-
"version": "0.0.68",
3+
"version": "0.0.69",
44
"description": "An extension of material ui data-grid for Pangea store file objects",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/CreateSharesButton/CreateShareModal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const CreateShareModal: FC<Props> = ({ object, open, onClose, onDone }) => {
8888

8989
const [settingsObj, setSettingsObj] = useState(obj);
9090
const [settingsError, setSettingsError] = useState(false);
91+
const [linkCreated, setLinkCreated] = useState(false);
9192

9293
useEffect(() => {
9394
var date = configurations?.settings?.defaultExpiresAt;
@@ -122,7 +123,7 @@ const CreateShareModal: FC<Props> = ({ object, open, onClose, onDone }) => {
122123
}, [isLarge, open]);
123124

124125
const handleClose = () => {
125-
const sharePassword = password;
126+
const sharePassword = shareType === "link" ? "" : password;
126127
resetContext();
127128
onClose(sharePassword);
128129
};
@@ -239,6 +240,7 @@ const CreateShareModal: FC<Props> = ({ object, open, onClose, onDone }) => {
239240
(v, k) => !!v && ShareCreateRequestFields.has(k)
240241
)
241242
).then((isSuccess) => {
243+
setLinkCreated(true);
242244
if (isSuccess && shareType === "email") {
243245
handleClose();
244246
}
@@ -297,7 +299,9 @@ const CreateShareModal: FC<Props> = ({ object, open, onClose, onDone }) => {
297299
}}
298300
disabled={loading || settingsError}
299301
clearable={true}
300-
clearButtonLabel={shareType === "link" ? "Done" : "Cancel"}
302+
clearButtonLabel={
303+
shareType === "link" && linkCreated ? "Done" : "Cancel"
304+
}
301305
onCancel={handleClose}
302306
autoSave={shareType === "link" ? true : false}
303307
// @ts-ignore

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/CreateSharesButton/ShareLinkDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const ShareLinkDetails = () => {
4343
":hover": {
4444
bgcolor: modify(theme.palette.info.main, 0.8),
4545
},
46+
textWrap: "nowrap",
4647
}}
4748
fullWidth
4849
data-testid={"Share-Copy-Btn"}

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/CreateSharesButton/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Box, Button, ButtonProps } from "@mui/material";
2-
import { FC, useEffect, useState } from "react";
1+
import { Button, ButtonProps } from "@mui/material";
2+
import { FC, useState } from "react";
33

44
import AddIcon from "@mui/icons-material/Add";
5+
import LinkIcon from "@mui/icons-material/Link";
56
import { ObjectStore } from "../../../types";
67
import { ShareCreateProvider } from "../../../hooks/context";
78
import CreateShareModal from "./CreateShareModal";
@@ -42,7 +43,13 @@ const CreateSharesButton: FC<Props> = ({
4243
<Button
4344
variant="text"
4445
{...ButtonProps}
45-
startIcon={<AddIcon fontSize="small" />}
46+
startIcon={
47+
shareType === "email" ? (
48+
<AddIcon fontSize="small" />
49+
) : (
50+
<LinkIcon fontSize="small" />
51+
)
52+
}
4653
data-testid="New-Share-Btn"
4754
onClick={() => setOpen(true)}
4855
>

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/GetEmailLinkField.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const UnControlledGetEmailLinkField: FC<FieldComponentProps> = ({
5353
<Typography variant="caption" color="textSecondary" mt={1}>
5454
Enter an email to protect the link with a one-time authentication code
5555
</Typography>
56-
<Stack width="100%" direction="row" spacing={1}>
56+
<Stack width="100%" direction="row" spacing={1} alignItems="flex-start">
5757
<TextField
5858
value={newValue}
5959
name="recipient_email"
@@ -82,7 +82,10 @@ const UnControlledGetEmailLinkField: FC<FieldComponentProps> = ({
8282
variant="outlined"
8383
onClick={handleSubmitValue}
8484
disabled={!newValue || !!newValueError || loading}
85-
sx={{ minWidth: "100px" }}
85+
sx={{
86+
minWidth: "100px",
87+
textWrap: "nowrap",
88+
}}
8689
>
8790
{loading ? "Saving..." : "Get Link"}
8891
</Button>

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/GetPasswordLinkField.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const UnControlledGetPasswordLinkField: FC<FieldComponentProps> = ({
6060
width="100%"
6161
direction="row"
6262
gap={1}
63+
alignItems="flex-start"
6364
sx={{
6465
"& .MuiFormGroup-root": {
6566
width: "calc(100% - 100px)",
@@ -77,7 +78,10 @@ const UnControlledGetPasswordLinkField: FC<FieldComponentProps> = ({
7778
variant="outlined"
7879
onClick={handleSubmitValue}
7980
disabled={!password || !!passwordError || error || loading}
80-
sx={{ minWidth: "100px" }}
81+
sx={{
82+
minWidth: "100px",
83+
textWrap: "nowrap",
84+
}}
8185
>
8286
{loading ? "Saving..." : "Get Link"}
8387
</Button>

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/GetPhoneLinkField.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const UnControlledGetPhoneLinkField: FC<FieldComponentProps> = ({
5959
Enter a phone number to protect the link with a one-time authentication
6060
code
6161
</Typography>
62-
<Stack width="100%" direction="row" spacing={1}>
62+
<Stack width="100%" direction="row" spacing={1} alignItems="flex-start">
6363
<TextField
6464
value={newValue}
6565
name="recipient_phone"
@@ -95,7 +95,10 @@ const UnControlledGetPhoneLinkField: FC<FieldComponentProps> = ({
9595
variant="outlined"
9696
onClick={handleSubmitValue}
9797
disabled={!newValue || !!newValueError || loading}
98-
sx={{ minWidth: "100px" }}
98+
sx={{
99+
minWidth: "100px",
100+
textWrap: "nowrap",
101+
}}
99102
>
100103
{loading ? "Saving..." : "Get Link"}
101104
</Button>

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/SharePasswordField.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ const UnControlledSharePasswordField: FC<FieldComponentProps> = ({
9999

100100
return (
101101
<Stack gap={1} width="100%">
102-
<Stack width="100%" direction="row" mt={1} gap={0.5}>
102+
<Stack
103+
width="100%"
104+
direction="row"
105+
mt={1}
106+
gap={0.5}
107+
alignItems="flex-start"
108+
>
103109
<TextField
104110
value={emailValue}
105111
name="recipient_email"

packages/react-mui-store-file-viewer/src/components/CreateNewShareButton/SharePhonesField.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,13 @@ const UnControlledSharePhonesField: FC<FieldComponentProps> = ({
133133

134134
return (
135135
<Stack gap={1} width="100%">
136-
<Stack width="100%" direction="row" mt={1} gap={0.5}>
136+
<Stack
137+
width="100%"
138+
direction="row"
139+
mt={1}
140+
gap={0.5}
141+
alignItems="flex-start"
142+
>
137143
<TextField
138144
value={emailValue}
139145
name="recipient_email"

0 commit comments

Comments
 (0)