mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-29 16:11:13 -05:00
translate copy link buttons
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
import { ComponentProps, useState } from 'react'
|
||||
import { copyToClipboard } from 'web/lib/util/copy'
|
||||
import { track } from 'web/lib/service/analytics'
|
||||
import { Tooltip } from '../widgets/tooltip'
|
||||
import {ComponentProps, useState} from 'react'
|
||||
import {copyToClipboard} from 'web/lib/util/copy'
|
||||
import {track} from 'web/lib/service/analytics'
|
||||
import {Tooltip} from '../widgets/tooltip'
|
||||
import clsx from 'clsx'
|
||||
import {
|
||||
Button,
|
||||
ColorType,
|
||||
IconButton,
|
||||
SizeType,
|
||||
} from 'web/components/buttons/button'
|
||||
import {Button, ColorType, IconButton, SizeType,} from 'web/components/buttons/button'
|
||||
import toast from 'react-hot-toast'
|
||||
import LinkIcon from 'web/lib/icons/link-icon.svg'
|
||||
import {
|
||||
CheckIcon,
|
||||
ClipboardCopyIcon,
|
||||
DuplicateIcon,
|
||||
} from '@heroicons/react/outline'
|
||||
import {CheckIcon, ClipboardCopyIcon, DuplicateIcon,} from '@heroicons/react/outline'
|
||||
import {useT} from "web/lib/locale";
|
||||
|
||||
export function CopyLinkOrShareButton(props: {
|
||||
url: string
|
||||
@@ -33,6 +25,7 @@ export function CopyLinkOrShareButton(props: {
|
||||
const { url, size, children, className, iconClassName, tooltip, color } =
|
||||
props
|
||||
const [isSuccess, setIsSuccess] = useState(false)
|
||||
const t = useT()
|
||||
|
||||
const onClick = () => {
|
||||
if (!url) return
|
||||
@@ -41,12 +34,12 @@ export function CopyLinkOrShareButton(props: {
|
||||
setTimeout(() => setIsSuccess(false), 2000) // Reset after 2 seconds
|
||||
}
|
||||
|
||||
const content = isSuccess ? 'Copied!' : children
|
||||
const content = isSuccess ? t('about.settings.copied', 'Copied!') : children
|
||||
|
||||
return (
|
||||
<ToolTipOrDiv
|
||||
hasChildren={!!children}
|
||||
text={tooltip ?? 'Copy link'}
|
||||
text={tooltip ?? t('copy_link_button.copy_link', 'Copy link')}
|
||||
noTap
|
||||
placement="bottom"
|
||||
>
|
||||
@@ -103,6 +96,7 @@ export const CopyLinkRow = (props: {
|
||||
// "copied" success state animations
|
||||
const [bgPressed, setBgPressed] = useState(false)
|
||||
const [iconPressed, setIconPressed] = useState(false)
|
||||
const t = useT()
|
||||
|
||||
const onClick = () => {
|
||||
if (!url) return
|
||||
@@ -112,7 +106,7 @@ export const CopyLinkRow = (props: {
|
||||
setTimeout(() => setBgPressed(false), 300)
|
||||
setTimeout(() => setIconPressed(false), 1000)
|
||||
copyToClipboard(url)
|
||||
toast.success('Link copied!')
|
||||
toast.success(t('copy_link_button.link_copied', 'Link copied!'))
|
||||
}
|
||||
|
||||
// remove any http:// prefix
|
||||
@@ -152,18 +146,19 @@ export function SimpleCopyTextButton(props: {
|
||||
className?: string
|
||||
}) {
|
||||
const { text, eventTrackingName, className, tooltip } = props
|
||||
const t = useT()
|
||||
|
||||
const onClick = () => {
|
||||
if (!text) return
|
||||
|
||||
copyToClipboard(text)
|
||||
toast.success('Link copied!')
|
||||
toast.success(t('copy_link_button.link_copied', 'Link copied!'))
|
||||
track(eventTrackingName, { text })
|
||||
}
|
||||
|
||||
return (
|
||||
<IconButton onClick={onClick} className={className} disabled={!text}>
|
||||
<Tooltip text={tooltip ?? 'Copy link'} noTap placement="bottom">
|
||||
<Tooltip text={tooltip ?? t('copy_link_button.copy_link', 'Copy link')} noTap placement="bottom">
|
||||
<ClipboardCopyIcon className={'h-5'} aria-hidden="true" />
|
||||
</Tooltip>
|
||||
</IconButton>
|
||||
|
||||
@@ -310,7 +310,8 @@ export const Search = (props: {
|
||||
/>
|
||||
</Row>
|
||||
{(profileCount ?? 0) > 0 && (
|
||||
<Tooltip text={t('search.include_short_bios_tooltip', 'To list all the profiles, tick "Include Short Bios"')}
|
||||
<Tooltip
|
||||
text={!filters.shortBio && t('search.include_short_bios_tooltip', 'To list all the profiles, tick "Include Short Bios"')}
|
||||
noTap>
|
||||
<Row className="text-sm text-ink-500 gap-2">
|
||||
<p>{profileCount} {(profileCount ?? 0) > 1 ? t('common.people', 'people') : t('common.person', 'person')}</p>
|
||||
|
||||
@@ -263,6 +263,8 @@
|
||||
"home.subtitle": "Finden Sie Menschen, die Ihre Werte, Ideen und Absichten teilen — nicht nur Ihre Fotos.",
|
||||
"home.title": "Schluss mit Swipen.",
|
||||
"home.typewriter": "Suchen.",
|
||||
"copy_link_button.copy_link": "Link kopieren",
|
||||
"copy_link_button.link_copied": "Link kopiert!",
|
||||
"search.include_short_bios_tooltip": "Um alle Profile aufzulisten, aktivieren Sie \"Kurze Bios einbeziehen\"",
|
||||
"more_options_user.more_options": "Weitere Optionen",
|
||||
"more_options_user.banning": "Sperre...",
|
||||
|
||||
@@ -263,6 +263,8 @@
|
||||
"home.subtitle": "Trouvez des personnes qui partagent vos valeurs, idées et intentions — pas seulement vos photos.",
|
||||
"home.title": "Fini les swipes.",
|
||||
"home.typewriter": "Cherche.",
|
||||
"copy_link_button.copy_link": "Copier le lien",
|
||||
"copy_link_button.link_copied": "Lien copié !",
|
||||
"search.include_short_bios_tooltip": "Pour lister tous les profils, cochez \"Inclure les bios courtes\"",
|
||||
"more_options_user.more_options": "Plus d'options",
|
||||
"more_options_user.banning": "Bannissement...",
|
||||
|
||||
Reference in New Issue
Block a user