mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
fix: autocomplete on create share modal
This commit is contained in:
parent
4df8dea5cc
commit
d4e8d4f58b
2 changed files with 14 additions and 12 deletions
|
@ -23,7 +23,7 @@ import showCompletedReverseShareModal from "./showCompletedReverseShareModal";
|
||||||
const showCreateReverseShareModal = (
|
const showCreateReverseShareModal = (
|
||||||
modals: ModalsContextProps,
|
modals: ModalsContextProps,
|
||||||
showSendEmailNotificationOption: boolean,
|
showSendEmailNotificationOption: boolean,
|
||||||
getReverseShares: () => void,
|
getReverseShares: () => void
|
||||||
) => {
|
) => {
|
||||||
return modals.openModal({
|
return modals.openModal({
|
||||||
title: "Create reverse share",
|
title: "Create reverse share",
|
||||||
|
@ -64,7 +64,7 @@ const Body = ({
|
||||||
values.expiration_num + values.expiration_unit,
|
values.expiration_num + values.expiration_unit,
|
||||||
values.maxShareSize,
|
values.maxShareSize,
|
||||||
values.maxUseCount,
|
values.maxUseCount,
|
||||||
values.sendEmailNotification,
|
values.sendEmailNotification
|
||||||
)
|
)
|
||||||
.then(({ link }) => {
|
.then(({ link }) => {
|
||||||
modals.closeAll();
|
modals.closeAll();
|
||||||
|
@ -150,7 +150,7 @@ const Body = ({
|
||||||
expiresOn: t("account.reverseShare.expires-on"),
|
expiresOn: t("account.reverseShare.expires-on"),
|
||||||
neverExpires: t("account.reverseShare.never-expires"),
|
neverExpires: t("account.reverseShare.never-expires"),
|
||||||
},
|
},
|
||||||
form,
|
form
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
@ -174,7 +174,7 @@ const Body = ({
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
label={t("account.reverseShares.modal.send-email")}
|
label={t("account.reverseShares.modal.send-email")}
|
||||||
description={t(
|
description={t(
|
||||||
"account.reverseShares.modal.send-email.description",
|
"account.reverseShares.modal.send-email.description"
|
||||||
)}
|
)}
|
||||||
{...form.getInputProps("sendEmailNotification", {
|
{...form.getInputProps("sendEmailNotification", {
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
|
|
|
@ -38,7 +38,7 @@ const showCreateUploadModal = (
|
||||||
allowUnauthenticatedShares: boolean;
|
allowUnauthenticatedShares: boolean;
|
||||||
enableEmailRecepients: boolean;
|
enableEmailRecepients: boolean;
|
||||||
},
|
},
|
||||||
uploadCallback: (createShare: CreateShare) => void,
|
uploadCallback: (createShare: CreateShare) => void
|
||||||
) => {
|
) => {
|
||||||
const t = translateOutsideContext();
|
const t = translateOutsideContext();
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ const CreateUploadModalBody = ({
|
||||||
"link",
|
"link",
|
||||||
Buffer.from(Math.random().toString(), "utf8")
|
Buffer.from(Math.random().toString(), "utf8")
|
||||||
.toString("base64")
|
.toString("base64")
|
||||||
.substr(10, 7),
|
.substr(10, 7)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -251,7 +251,7 @@ const CreateUploadModalBody = ({
|
||||||
neverExpires: t("upload.modal.completed.never-expires"),
|
neverExpires: t("upload.modal.completed.never-expires"),
|
||||||
expiresOn: t("upload.modal.completed.expires-on"),
|
expiresOn: t("upload.modal.completed.expires-on"),
|
||||||
},
|
},
|
||||||
form,
|
form
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
|
@ -266,7 +266,7 @@ const CreateUploadModalBody = ({
|
||||||
<Textarea
|
<Textarea
|
||||||
variant="filled"
|
variant="filled"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
"upload.modal.accordion.description.placeholder",
|
"upload.modal.accordion.description.placeholder"
|
||||||
)}
|
)}
|
||||||
{...form.getInputProps("description")}
|
{...form.getInputProps("description")}
|
||||||
/>
|
/>
|
||||||
|
@ -283,14 +283,14 @@ const CreateUploadModalBody = ({
|
||||||
data={form.values.recipients}
|
data={form.values.recipients}
|
||||||
placeholder={t("upload.modal.accordion.email.placeholder")}
|
placeholder={t("upload.modal.accordion.email.placeholder")}
|
||||||
searchable
|
searchable
|
||||||
{...form.getInputProps("recipients")}
|
|
||||||
creatable
|
creatable
|
||||||
|
autoComplete="email-recipients"
|
||||||
getCreateLabel={(query) => `+ ${query}`}
|
getCreateLabel={(query) => `+ ${query}`}
|
||||||
onCreate={(query) => {
|
onCreate={(query) => {
|
||||||
if (!query.match(/^\S+@\S+\.\S+$/)) {
|
if (!query.match(/^\S+@\S+\.\S+$/)) {
|
||||||
form.setFieldError(
|
form.setFieldError(
|
||||||
"recipients",
|
"recipients",
|
||||||
t("upload.modal.accordion.email.invalid-email"),
|
t("upload.modal.accordion.email.invalid-email")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
form.setFieldError("recipients", null);
|
form.setFieldError("recipients", null);
|
||||||
|
@ -301,6 +301,7 @@ const CreateUploadModalBody = ({
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
{...form.getInputProps("recipients")}
|
||||||
/>
|
/>
|
||||||
</Accordion.Panel>
|
</Accordion.Panel>
|
||||||
</Accordion.Item>
|
</Accordion.Item>
|
||||||
|
@ -315,9 +316,10 @@ const CreateUploadModalBody = ({
|
||||||
<PasswordInput
|
<PasswordInput
|
||||||
variant="filled"
|
variant="filled"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
"upload.modal.accordion.security.password.placeholder",
|
"upload.modal.accordion.security.password.placeholder"
|
||||||
)}
|
)}
|
||||||
label={t("upload.modal.accordion.security.password.label")}
|
label={t("upload.modal.accordion.security.password.label")}
|
||||||
|
autoComplete="off"
|
||||||
{...form.getInputProps("password")}
|
{...form.getInputProps("password")}
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
@ -325,7 +327,7 @@ const CreateUploadModalBody = ({
|
||||||
type="number"
|
type="number"
|
||||||
variant="filled"
|
variant="filled"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
"upload.modal.accordion.security.max-views.placeholder",
|
"upload.modal.accordion.security.max-views.placeholder"
|
||||||
)}
|
)}
|
||||||
label={t("upload.modal.accordion.security.max-views.label")}
|
label={t("upload.modal.accordion.security.max-views.label")}
|
||||||
{...form.getInputProps("maxViews")}
|
{...form.getInputProps("maxViews")}
|
||||||
|
|
Loading…
Add table
Reference in a new issue