This commit is contained in:
aet
2021-12-19 02:06:15 -05:00
parent e16202f8b2
commit 7362222f16
3 changed files with 28 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import styled from "@emotion/styled"
import type { ItemSection, ItemField } from "opvault.js"
import { FieldType } from "opvault.js"
import { useCallback, useMemo, useState } from "react"
import { useTranslate } from "../i18n"
import { parseMonthYear } from "../utils"
import { BigTextView } from "./BigTextView"
import { ErrorBoundary } from "./ErrorBoundary"
@ -31,6 +32,7 @@ export { Password as PasswordFieldView }
const Password: React.FC<{
field: Pick<ItemSection.Concealed, "v">
}> = ({ field }) => {
const t = useTranslate()
const [show, setShow] = useState(false)
const [bigText, showBigText] = useState(false)
@ -59,9 +61,11 @@ const Password: React.FC<{
</Container>
{bigText && <BigTextView onClose={onCloseBigText}>{field.v}</BigTextView>}
<ContextMenuContainer>
<Item onClick={onCopy}>Copier</Item>
<Item onClick={onToggle}>{show ? "Cacher" : "Afficher"}</Item>
{!bigText && <Item onClick={onOpenBigText}>Afficher en gros caractères</Item>}
<Item onClick={onCopy}>{t.action.copy}</Item>
<Item onClick={onToggle}>{show ? t.action.hide : t.action.show}</Item>
{!bigText && (
<Item onClick={onOpenBigText}>{t.action.show_in_big_characters}</Item>
)}
</ContextMenuContainer>
</>
)