use dynamic translations
This commit is contained in:
parent
8d2cc0f47b
commit
5e96ab6955
7 changed files with 88 additions and 49 deletions
|
@ -3,6 +3,7 @@ import FancyTextEditor, { TextInputKeyDownEvent } from './inputs/FancyTextEditor
|
|||
import Button from './buttons/Button.tsx'
|
||||
import { openFileDialog } from '../utils/openFileDialog.ts'
|
||||
import makePica from 'pica'
|
||||
import { useTranslations } from '../app/i18n/useTranslations.ts'
|
||||
|
||||
interface NewPostWidgetProps {
|
||||
onSubmit: (
|
||||
|
@ -22,6 +23,7 @@ interface Attachment {
|
|||
}
|
||||
|
||||
export default function NewPostWidget({ onSubmit, isSubmitting = false }: NewPostWidgetProps) {
|
||||
const { t } = useTranslations()
|
||||
const [content, setContent] = useState('')
|
||||
const [attachments, setAttachments] = useState<Attachment[]>([])
|
||||
const [isPublic, setIsPublic] = useState(false)
|
||||
|
@ -72,7 +74,7 @@ export default function NewPostWidget({ onSubmit, isSubmitting = false }: NewPos
|
|||
onInput={onContentInput}
|
||||
onKeyDown={onInputKeyDown}
|
||||
className="mb-3"
|
||||
placeholder="write something..."
|
||||
placeholder={t('post.editor.placeholder')}
|
||||
/>
|
||||
|
||||
{attachments.length > 0 && (
|
||||
|
@ -93,7 +95,7 @@ export default function NewPostWidget({ onSubmit, isSubmitting = false }: NewPos
|
|||
<div className="flex justify-between items-center pt-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Button secondary onClick={onAddMediaClicked}>
|
||||
+ add media
|
||||
{t('post.add_media.cta')}
|
||||
</Button>
|
||||
<label className="flex items-center gap-1 cursor-pointer">
|
||||
<input
|
||||
|
@ -103,14 +105,14 @@ export default function NewPostWidget({ onSubmit, isSubmitting = false }: NewPos
|
|||
disabled={isSubmitting}
|
||||
className="form-checkbox h-4 w-4 text-blue-600"
|
||||
/>
|
||||
<span className="text-primary-500">public</span>
|
||||
<span className="text-primary-500">{t('post.public.label')}</span>
|
||||
</label>
|
||||
</div>
|
||||
<Button
|
||||
onClick={handleSubmit}
|
||||
disabled={isSubmitting || (content.trim() === '' && attachments.length === 0)}
|
||||
>
|
||||
post
|
||||
{t('post.submit.cta')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue