mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-27 18:06:12 +01:00
* I18n with next-intl * package-lock * Finnish translations * Development fix * Use locale for positioning currency symbol * Translations: Expenses.ActiveUserModal * Translations: group 404 * Better translation for ExpenseCard * Apply translations in CategorySelect search * Fix for Finnish translation * Translations for ExpenseDocumentsInput * Translations for CreateFromReceipt * Fix for Finnish translation * Translations for schema errors * Fix for Finnish translation * Fixes for Finnish translations * Prettier --------- Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
'use client'
|
|
import { CopyButton } from '@/components/copy-button'
|
|
import { ShareUrlButton } from '@/components/share-url-button'
|
|
import { Button } from '@/components/ui/button'
|
|
import { Input } from '@/components/ui/input'
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from '@/components/ui/popover'
|
|
import { useBaseUrl } from '@/lib/hooks'
|
|
import { Group } from '@prisma/client'
|
|
import { Share } from 'lucide-react'
|
|
import { useTranslations } from 'next-intl'
|
|
|
|
type Props = {
|
|
group: Group
|
|
}
|
|
|
|
export function ShareButton({ group }: Props) {
|
|
const t = useTranslations('Share')
|
|
const baseUrl = useBaseUrl()
|
|
const url = baseUrl && `${baseUrl}/groups/${group.id}/expenses?ref=share`
|
|
|
|
return (
|
|
<Popover>
|
|
<PopoverTrigger asChild>
|
|
<Button title={t('title')} size="icon" className="flex-shrink-0">
|
|
<Share className="w-4 h-4" />
|
|
</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent align="end" className="[&_p]:text-sm flex flex-col gap-3">
|
|
<p>{t('description')}</p>
|
|
{url && (
|
|
<div className="flex gap-2">
|
|
<Input className="flex-1" defaultValue={url} readOnly />
|
|
<CopyButton text={url} />
|
|
<ShareUrlButton
|
|
text={`Join my group ${group.name} on Spliit`}
|
|
url={url}
|
|
/>
|
|
</div>
|
|
)}
|
|
<p>
|
|
<strong>{t('warning')}</strong> {t('warningHelp')}
|
|
</p>
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|