mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
chore: implement feedback
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
|
import { Trans, useLingui } from '@lingui/react/macro';
|
||||||
import { Trash } from 'lucide-react';
|
import { Trash } from 'lucide-react';
|
||||||
import { useFieldArray, useForm } from 'react-hook-form';
|
import { useFieldArray, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ export type AttachmentFormProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
||||||
|
const { t } = useLingui();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
|
||||||
const { data: attachmentsData, refetch: refetchAttachments } =
|
const { data: attachmentsData, refetch: refetchAttachments } =
|
||||||
@ -97,8 +99,8 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Attachment(s) updated',
|
title: t`Attachment(s) updated`,
|
||||||
description: 'The attachment(s) have been updated successfully',
|
description: t`The attachment(s) have been updated successfully`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await refetchAttachments();
|
await refetchAttachments();
|
||||||
@ -106,8 +108,8 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Something went wrong',
|
title: t`Something went wrong`,
|
||||||
description: 'We encountered an unknown error while attempting to create the attachments.',
|
description: t`We encountered an unknown error while attempting to create the attachments.`,
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
});
|
});
|
||||||
@ -117,11 +119,15 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button variant="outline">Attachments</Button>
|
<Button variant="outline">
|
||||||
|
<Trans>Attachments</Trans>
|
||||||
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent position="center">
|
<DialogContent position="center">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Attachments</DialogTitle>
|
<DialogTitle>
|
||||||
|
<Trans>Attachments</Trans>
|
||||||
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||||
@ -133,9 +139,11 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
name={`attachments.${index}.label`}
|
name={`attachments.${index}.label`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormLabel required>Label</FormLabel>
|
<FormLabel required>
|
||||||
|
<Trans>Label</Trans>
|
||||||
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} placeholder="Attachment label" />
|
<Input {...field} placeholder={t`Attachment label`} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -147,7 +155,9 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
name={`attachments.${index}.url`}
|
name={`attachments.${index}.url`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormLabel required>URL</FormLabel>
|
<FormLabel required>
|
||||||
|
<Trans>URL</Trans>
|
||||||
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} placeholder="https://..." />
|
<Input {...field} placeholder="https://..." />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -169,9 +179,11 @@ export const AttachmentForm = ({ documentId }: AttachmentFormProps) => {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<DialogFooter className="mt-4">
|
<DialogFooter className="mt-4">
|
||||||
<Button type="button" variant="outline" onClick={onAddAttachment}>
|
<Button type="button" variant="outline" onClick={onAddAttachment}>
|
||||||
Add
|
<Trans>Add</Trans>
|
||||||
|
</Button>
|
||||||
|
<Button type="submit">
|
||||||
|
<Trans>Save</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit">Save</Button>
|
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
|
import { Trans, useLingui } from '@lingui/react/macro';
|
||||||
import { Trash } from 'lucide-react';
|
import { Trash } from 'lucide-react';
|
||||||
import { useFieldArray, useForm } from 'react-hook-form';
|
import { useFieldArray, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ export type AttachmentFormProps = {
|
|||||||
|
|
||||||
export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
const { t } = useLingui();
|
||||||
|
|
||||||
const { data: attachmentsData, refetch: refetchAttachments } =
|
const { data: attachmentsData, refetch: refetchAttachments } =
|
||||||
trpc.attachment.getTemplateAttachments.useQuery({
|
trpc.attachment.getTemplateAttachments.useQuery({
|
||||||
@ -97,8 +99,8 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Attachment(s) updated',
|
title: t`Attachment(s) updated`,
|
||||||
description: 'The attachment(s) have been updated successfully',
|
description: t`The attachment(s) have been updated successfully`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await refetchAttachments();
|
await refetchAttachments();
|
||||||
@ -106,8 +108,8 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Something went wrong',
|
title: t`Something went wrong`,
|
||||||
description: 'We encountered an unknown error while attempting to create the attachments.',
|
description: t`We encountered an unknown error while attempting to create the attachments.`,
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
});
|
});
|
||||||
@ -117,11 +119,15 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button variant="outline">Attachments</Button>
|
<Button variant="outline">
|
||||||
|
<Trans>Attachments</Trans>
|
||||||
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent position="center">
|
<DialogContent position="center">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Attachments</DialogTitle>
|
<DialogTitle>
|
||||||
|
<Trans>Attachments</Trans>
|
||||||
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||||
@ -133,9 +139,11 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
name={`attachments.${index}.label`}
|
name={`attachments.${index}.label`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormLabel required>Label</FormLabel>
|
<FormLabel required>
|
||||||
|
<Trans>Label</Trans>
|
||||||
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} placeholder="Attachment label" />
|
<Input {...field} placeholder={t`Attachment label`} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -147,9 +155,11 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
name={`attachments.${index}.url`}
|
name={`attachments.${index}.url`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="flex-1">
|
<FormItem className="flex-1">
|
||||||
<FormLabel required>URL</FormLabel>
|
<FormLabel required>
|
||||||
|
<Trans>URL</Trans>
|
||||||
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} placeholder="https://..." />
|
<Input {...field} placeholder={t`https://...`} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -169,9 +179,11 @@ export const AttachmentForm = ({ templateId }: AttachmentFormProps) => {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<DialogFooter className="mt-4">
|
<DialogFooter className="mt-4">
|
||||||
<Button type="button" variant="outline" onClick={onAddAttachment}>
|
<Button type="button" variant="outline" onClick={onAddAttachment}>
|
||||||
Add
|
<Trans>Add</Trans>
|
||||||
|
</Button>
|
||||||
|
<Button type="submit">
|
||||||
|
<Trans>Save</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit">Save</Button>
|
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
5
packages/lib/translations/.gitignore
vendored
5
packages/lib/translations/.gitignore
vendored
@ -1,5 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# Compiled translations.
|
|
||||||
*.js
|
|
||||||
*.mjs
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user