Skip to content

Commit

Permalink
feat(frontend): add navigateToLink button for CopyTextField. close #372
Browse files Browse the repository at this point in the history
…. (#376)

* feat(frontend): add navigateToLink button for CopyTextField. close #372.

* chore(frontend): remove unused props for CopyTextField.
  • Loading branch information
IvanLi-CN authored Jan 9, 2024
1 parent eb7216b commit d775008
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
28 changes: 22 additions & 6 deletions frontend/src/components/upload/CopyTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ActionIcon, TextInput } from "@mantine/core";
import { ActionIcon, TextInput, Tooltip } from "@mantine/core";
import { useClipboard } from "@mantine/hooks";
import { useRef, useState } from "react";
import { TbCheck, TbCopy } from "react-icons/tb";
import { IoOpenOutline } from "react-icons/io5";
import useTranslate from "../../hooks/useTranslate.hook";
import toast from "../../utils/toast.util";

Expand Down Expand Up @@ -37,12 +38,27 @@ function CopyTextField(props: { link: string }) {
setTextClicked(true);
}
}}
rightSectionWidth={62}
rightSection={
window.isSecureContext && (
<ActionIcon onClick={copyLink}>
{checkState ? <TbCheck /> : <TbCopy />}
</ActionIcon>
)
<>
<Tooltip
label={t("common.text.navigate-to-link")}
position="top"
offset={-2}
openDelay={200}
>
<a href={props.link}>
<ActionIcon>
<IoOpenOutline />
</ActionIcon>
</a>
</Tooltip>
{window.isSecureContext && (
<ActionIcon onClick={copyLink}>
{checkState ? <TbCheck /> : <TbCopy />}
</ActionIcon>
)}
</>
}
/>
);
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/components/upload/modals/showCreateUploadModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ const CreateUploadModalBody = ({
/>
</Col>
</Grid>
{ options.maxExpirationInHours == 0 && <Checkbox
label={t("upload.modal.expires.never-long")}
{...form.getInputProps("never_expires")}
/>
}
{options.maxExpirationInHours == 0 && (
<Checkbox
label={t("upload.modal.expires.never-long")}
{...form.getInputProps("never_expires")}
/>
)}
<Text
italic
size="xs"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/translations/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ export default {
"common.button.generate": "Generate",
"common.button.done": "Done",
"common.text.link": "Link",
"common.text.navigate-to-link": "Go to the link",
"common.text.or": "or",
"common.button.go-back": "Go back",
"common.notify.copied": "Your link was copied to the clipboard",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/translations/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ export default {
"common.button.generate": "生成",
"common.button.done": "完成",
"common.text.link": "链接",
"common.text.navigate-to-link": "访问链接",
"common.text.or": "或",
"common.button.go-back": "返回",
"common.notify.copied": "已复制到剪贴板",
Expand Down

0 comments on commit d775008

Please sign in to comment.