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

View File

@ -103,6 +103,26 @@ action:
fr: Déverouiller fr: Déverouiller
ja: ロック解除 ja: ロック解除
copy:
en: Copy
fr: Copier
ja: コピー
hide:
en: Hide
fr: Cacher
ja: 非表示
show:
en: Show
fr: Afficher
ja: 表示
show_in_big_characters:
en: Show in large characters
fr: Afficher en gros caractères
ja: 大きく表示
go_back: go_back:
en: Back en: Back
fr: Revenir fr: Revenir

View File

@ -158,7 +158,7 @@ export const VaultView: React.FC<{ vault: Vault; onLock(): void }> = ({
<TabButton onClick={onLock} title={t.action.lock}> <TabButton onClick={onLock} title={t.action.lock}>
<FiLock /> <FiLock />
</TabButton> </TabButton>
<TabButton onClick={() => setShowSettings(true)}> <TabButton onClick={() => setShowSettings(true)} title={t.label.settings}>
<BsGear /> <BsGear />
</TabButton> </TabButton>
</TabContainer> </TabContainer>