Skip to content

Commit

Permalink
fix reload (#1406)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut authored Aug 4, 2021
1 parent 2db0874 commit bbb7065
Showing 1 changed file with 76 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,94 +387,6 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) =>
</div>
), [classes.loadingContainer, isDownloading, isUploading])

const Step1CreateSharedFolder = useCallback(() => (
<>
<div className={clsx(classes.modalFlexItem, classes.titleWrapper)}>
<TextInput
className={classes.shareFolderNameInput}
labelClassName={classes.inputLabel}
label={t`Shared Folder Name`}
value={sharedFolderName}
autoFocus
onChange={onNameChange}
state={nameError ? "error" : "normal"}
/>
{nameError && (
<Typography
component="p"
variant="body1"
className={classes.errorText}
>
{nameError}
</Typography>
)}
</div>
<div className={classes.modalFlexItem}>
<TagsInput
onChange={(values) => onNewUsers(values, "read")}
label={t`Give view-only permission to:`}
labelClassName={classes.inputLabel}
value={sharedFolderReaders}
fetchTags={(inputVal) => handleLookupUser(inputVal, "read")}
placeholder={t`Add by sharing address, username or wallet address`}
styles={{
control: (provided) => ({
...provided,
minHeight: 90,
alignContent: "start"
})
}}/>
</div>
<div className={classes.modalFlexItem}>
<TagsInput
onChange={(values) => onNewUsers(values, "write")}
label={t`Give edit permission to:`}
labelClassName={classes.inputLabel}
value={sharedFolderWriters}
fetchTags={(inputVal) => handleLookupUser(inputVal, "write")}
placeholder={t`Add by sharing address, username or wallet address`}
styles={{
control: (provided) => ({
...provided,
minHeight: 90,
alignContent: "start"
})
}}/>
</div>
{!!usersError && (
<Typography
component="p"
variant="body1"
className={classes.errorText}
>
{usersError}
</Typography>
)}
</>
), [
classes,
handleLookupUser,
nameError,
onNameChange,
onNewUsers,
sharedFolderName,
sharedFolderReaders,
sharedFolderWriters,
usersError
])

const Step1ExistingSharedFolder = useCallback(() => (
<div className={clsx(classes.modalFlexItem, classes.inputWrapper)}>
<SelectInput
label={t`Select an existing shared folder`}
labelClassName={classes.inputLabel}
options={bucketsOptions}
value={destinationBucket?.id}
onChange={(val: string) => setDestinationBucket(buckets.find((bu) => bu.id === val))}
/>
</div>
), [buckets, bucketsOptions, classes.inputLabel, classes.inputWrapper, classes.modalFlexItem, destinationBucket])

return (
<CustomModal
className={classes.modalRoot}
Expand Down Expand Up @@ -507,8 +419,82 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) =>
<div className={classes.modalFlexItem}>
{currentStep === "1_SHARED_FOLDER_SELECTION_CREATION" && (
isUsingCurrentBucket
? <Step1ExistingSharedFolder />
: <Step1CreateSharedFolder />
? (
<div className={clsx(classes.modalFlexItem, classes.inputWrapper)}>
<SelectInput
label={t`Select an existing shared folder`}
labelClassName={classes.inputLabel}
options={bucketsOptions}
value={destinationBucket?.id}
onChange={(val: string) => setDestinationBucket(buckets.find((bu) => bu.id === val))}
/>
</div>
)
: (
<>
<div className={clsx(classes.modalFlexItem, classes.titleWrapper)}>
<TextInput
className={classes.shareFolderNameInput}
labelClassName={classes.inputLabel}
label={t`Shared Folder Name`}
value={sharedFolderName}
autoFocus
onChange={onNameChange}
state={nameError ? "error" : "normal"}
/>
{nameError && (
<Typography
component="p"
variant="body1"
className={classes.errorText}
>
{nameError}
</Typography>
)}
</div>
<div className={classes.modalFlexItem}>
<TagsInput
onChange={(values) => onNewUsers(values, "read")}
label={t`Give view-only permission to:`}
labelClassName={classes.inputLabel}
value={sharedFolderReaders}
fetchTags={(inputVal) => handleLookupUser(inputVal, "read")}
placeholder={t`Add by sharing address, username or wallet address`}
styles={{
control: (provided) => ({
...provided,
minHeight: 90,
alignContent: "start"
})
}}/>
</div>
<div className={classes.modalFlexItem}>
<TagsInput
onChange={(values) => onNewUsers(values, "write")}
label={t`Give edit permission to:`}
labelClassName={classes.inputLabel}
value={sharedFolderWriters}
fetchTags={(inputVal) => handleLookupUser(inputVal, "write")}
placeholder={t`Add by sharing address, username or wallet address`}
styles={{
control: (provided) => ({
...provided,
minHeight: 90,
alignContent: "start"
})
}}/>
</div>
{!!usersError && (
<Typography
component="p"
variant="body1"
className={classes.errorText}
>
{usersError}
</Typography>
)}
</>
)
)}
</div>
{currentStep === "1_SHARED_FOLDER_SELECTION_CREATION" && (
Expand Down

0 comments on commit bbb7065

Please sign in to comment.