Skip to content

Commit

Permalink
Merge branch 'buildfix' into zodi18n
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeWilfried authored Feb 25, 2024
2 parents a88d97f + 9bbbb61 commit fb370a6
Show file tree
Hide file tree
Showing 30 changed files with 370 additions and 152 deletions.
4 changes: 4 additions & 0 deletions apps/marketing/src/app/(marketing)/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import { createTranslation } from '@documenso/lib/i18n/server';
export const metadata: Metadata = {
title: 'Blog',
};
export default async function BlogPage() {
const { t } = await createTranslation('marketing');


export default async function BlogPage() {
const { t } = await createTranslation('marketing');


const blogPosts = allBlogPosts.sort((a, b) => {
const dateA = new Date(a.date);
const dateB = new Date(b.date);
Expand Down
5 changes: 2 additions & 3 deletions apps/marketing/src/components/(marketing)/pricing-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {

<Button className="mt-6 rounded-full text-base" asChild>
<Link target="_blank" href={`${NEXT_PUBLIC_WEBAPP_URL()}/signup`}>{t('signup-now')}</Link>

</Button>

<div className="mt-8 flex w-full flex-col divide-y">
Expand All @@ -135,9 +134,9 @@ export const PricingTable = ({ className, ...props }: PricingTableProps) => {
<p className="text-foreground py-4">
<strong>
{' '}
<a href="https://documenso.com/blog/early-adopters" target="_blank">
{t('includes-all-upcoming-features')}
<a href="https://documenso.com/blog/early-adopters" rel="noreferrer" target="_blank">

{t('includes-all-upcoming-features')}
</a>
</strong>
</p>
Expand Down
4 changes: 3 additions & 1 deletion apps/marketing/src/components/(marketing)/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { Input } from '@documenso/ui/primitives/input';
import { SignaturePad } from '@documenso/ui/primitives/signature-pad';
import { useToast } from '@documenso/ui/primitives/use-toast';

import { useTranslation } from '@documenso/lib/i18n/client';
import { claimPlan } from '~/api/claim-plan/fetcher';

import { STEP } from '../constants';
Expand Down Expand Up @@ -324,6 +324,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {
<p className="text-muted-foreground block text-xs md:hidden">
{t('minimise-contract')}
</p>

</div>

<div className="bg-background relative mt-2.5 h-[2px] w-full">
Expand Down Expand Up @@ -407,6 +408,7 @@ export const Widget = ({ className, children, ...props }: WidgetProps) => {
<strong>{t('non-legally-binding-but-heartfelt-way')}</strong>. <br></br>
<br></br>
{t('you-also-unlock-the-option')}

</DialogDescription>

<SignaturePad
Expand Down
11 changes: 6 additions & 5 deletions apps/web/src/app/(dashboard)/admin/documents/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type DocumentsDataTableProps = {

export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
const [isPending, startTransition] = useTransition();
const { t } = useTranslation('web');

const updateSearchParams = useUpdateSearchParams();

Expand All @@ -45,12 +46,12 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
<DataTable
columns={[
{
header: 'Created',
header: t('created'),
accessorKey: 'createdAt',
cell: ({ row }) => <LocaleDate date={row.original.createdAt} />,
},
{
header: 'Title',
header: t('title'),
accessorKey: 'title',
cell: ({ row }) => {
return (
Expand All @@ -61,7 +62,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
},
},
{
header: 'Owner',
header: t('owner'),
accessorKey: 'owner',
cell: ({ row }) => {
const avatarFallbackText = row.original.User.name
Expand Down Expand Up @@ -96,12 +97,12 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => {
},
},
{
header: 'Last updated',
header: t('last-updated'),
accessorKey: 'updatedAt',
cell: ({ row }) => <LocaleDate date={row.original.updatedAt} />,
},
{
header: 'Status',
header: t('status'),
accessorKey: 'status',
cell: ({ row }) => <DocumentStatus status={row.original.status} />,
},
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/app/(dashboard)/admin/documents/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type DocumentsPageProps = {
export default async function Documents({ searchParams = {} }: DocumentsPageProps) {
const page = Number(searchParams.page) || 1;
const perPage = Number(searchParams.perPage) || 20;
const { t } = useTranslation('web');

const results = await findDocuments({
page,
Expand All @@ -20,7 +21,7 @@ export default async function Documents({ searchParams = {} }: DocumentsPageProp

return (
<div>
<h2 className="text-4xl font-semibold">Manage documents</h2>
<h2 className="text-4xl font-semibold">{t('manage-documents')}</h2>
<div className="mt-8">
<DocumentsDataTable results={results} />
</div>
Expand Down
9 changes: 5 additions & 4 deletions apps/web/src/app/(dashboard)/admin/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type AdminNavProps = HTMLAttributes<HTMLDivElement>;

export const AdminNav = ({ className, ...props }: AdminNavProps) => {
const pathname = usePathname();
const { t } = useTranslation('web');

return (
<div
Expand All @@ -33,7 +34,7 @@ export const AdminNav = ({ className, ...props }: AdminNavProps) => {
>
<Link href="/admin/stats">
<BarChart3 className="mr-2 h-5 w-5" />
Stats
{t('stats')}
</Link>
</Button>

Expand All @@ -47,7 +48,7 @@ export const AdminNav = ({ className, ...props }: AdminNavProps) => {
>
<Link href="/admin/users">
<User2 className="mr-2 h-5 w-5" />
Users
{t('users')}
</Link>
</Button>

Expand All @@ -61,7 +62,7 @@ export const AdminNav = ({ className, ...props }: AdminNavProps) => {
>
<Link href="/admin/documents">
<FileStack className="mr-2 h-5 w-5" />
Documents
{t('documents')}
</Link>
</Button>

Expand All @@ -75,7 +76,7 @@ export const AdminNav = ({ className, ...props }: AdminNavProps) => {
>
<Link href="/admin/subscriptions">
<Wallet2 className="mr-2 h-5 w-5" />
Subscriptions
{t('subscriptions')}
</Link>
</Button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type DataTableActionButtonProps = {
export const DataTableActionButton = ({ row, team }: DataTableActionButtonProps) => {
const { data: session } = useSession();
const { toast } = useToast();
const { t } = useTranslation('web');

if (!session) {
return null;
Expand Down Expand Up @@ -63,14 +64,14 @@ export const DataTableActionButton = ({ row, team }: DataTableActionButtonProps)
const documentData = document?.documentData;

if (!documentData) {
throw Error('No document available');
throw Error(t('no-document-available'));
}

await downloadPDF({ documentData, fileName: row.title });
} catch (err) {
toast({
title: 'Something went wrong',
description: 'An error occurred while downloading your document.',
title: t('something-went-wrong'),
description: t('an-error-occurred-while-downloading-your-document'),
variant: 'destructive',
});
}
Expand All @@ -96,7 +97,7 @@ export const DataTableActionButton = ({ row, team }: DataTableActionButtonProps)
<Button className="w-32" asChild>
<Link href={`${documentsPath}/${row.id}/edit`}>
<Edit className="-ml-1 mr-2 h-4 w-4" />
Edit
{t('edit')}
</Link>
</Button>
),
Expand All @@ -108,19 +109,19 @@ export const DataTableActionButton = ({ row, team }: DataTableActionButtonProps)
.with(RecipientRole.SIGNER, () => (
<>
<Pencil className="-ml-1 mr-2 h-4 w-4" />
Sign
{t('sign')}
</>
))
.with(RecipientRole.APPROVER, () => (
<>
<CheckCircle className="-ml-1 mr-2 h-4 w-4" />
Approve
{t('approve')}
</>
))
.otherwise(() => (
<>
<EyeIcon className="-ml-1 mr-2 h-4 w-4" />
View
{t('view')}
</>
))}
</Link>
Expand All @@ -129,13 +130,13 @@ export const DataTableActionButton = ({ row, team }: DataTableActionButtonProps)
.with({ isPending: true, isSigned: true }, () => (
<Button className="w-32" disabled={true}>
<EyeIcon className="-ml-1 mr-2 h-4 w-4" />
View
{t('view')}
</Button>
))
.with({ isComplete: true }, () => (
<Button className="w-32" onClick={onDownloadClick}>
<Download className="-ml-1 mr-2 inline h-4 w-4" />
Download
{t('download')}
</Button>
))
.otherwise(() => <div></div>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { useSession } from 'next-auth/react';

import { downloadPDF } from '@documenso/lib/client-only/download-pdf';
import { useTranslation } from '@documenso/lib/i18n/client';
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
import { DocumentStatus, RecipientRole } from '@documenso/prisma/client';
import type { Document, Recipient, Team, User } from '@documenso/prisma/client';
Expand Down Expand Up @@ -51,7 +52,7 @@ export type DataTableActionDropdownProps = {
export const DataTableActionDropdown = ({ row, team }: DataTableActionDropdownProps) => {
const { data: session } = useSession();
const { toast } = useToast();

const { t } = useTranslation('web');
const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [isDuplicateDialogOpen, setDuplicateDialogOpen] = useState(false);

Expand Down Expand Up @@ -96,8 +97,8 @@ export const DataTableActionDropdown = ({ row, team }: DataTableActionDropdownPr
await downloadPDF({ documentData, fileName: row.title });
} catch (err) {
toast({
title: 'Something went wrong',
description: 'An error occurred while downloading your document.',
title: t('something-went-wrong'),
description: t('an-error-occurred-while-downloading-your-document'),
variant: 'destructive',
});
}
Expand All @@ -112,29 +113,29 @@ export const DataTableActionDropdown = ({ row, team }: DataTableActionDropdownPr
</DropdownMenuTrigger>

<DropdownMenuContent className="w-52" align="start" forceMount>
<DropdownMenuLabel>Action</DropdownMenuLabel>
<DropdownMenuLabel>{t('action')}</DropdownMenuLabel>

{recipient && recipient?.role !== RecipientRole.CC && (
<DropdownMenuItem disabled={!recipient || isComplete} asChild>
<Link href={`/sign/${recipient?.token}`}>
{recipient?.role === RecipientRole.VIEWER && (
<>
<EyeIcon className="mr-2 h-4 w-4" />
View
{t('view')}
</>
)}

{recipient?.role === RecipientRole.SIGNER && (
<>
<Pencil className="mr-2 h-4 w-4" />
Sign
{t('sign')}
</>
)}

{recipient?.role === RecipientRole.APPROVER && (
<>
<CheckCircle className="mr-2 h-4 w-4" />
Approve
{t('approve')}
</>
)}
</Link>
Expand All @@ -144,31 +145,31 @@ export const DataTableActionDropdown = ({ row, team }: DataTableActionDropdownPr
<DropdownMenuItem disabled={(!isOwner && !isCurrentTeamDocument) || isComplete} asChild>
<Link href={`${documentsPath}/${row.id}/edit`}>
<Edit className="mr-2 h-4 w-4" />
Edit
{t('edit')}
</Link>
</DropdownMenuItem>

<DropdownMenuItem disabled={!isComplete} onClick={onDownloadClick}>
<Download className="mr-2 h-4 w-4" />
Download
{t('download')}
</DropdownMenuItem>

<DropdownMenuItem onClick={() => setDuplicateDialogOpen(true)}>
<Copy className="mr-2 h-4 w-4" />
Duplicate
{t('duplicate')}
</DropdownMenuItem>

<DropdownMenuItem disabled>
<XCircle className="mr-2 h-4 w-4" />
Void
{t('void')}
</DropdownMenuItem>

<DropdownMenuItem onClick={() => setDeleteDialogOpen(true)} disabled={!isDocumentDeletable}>
<Trash2 className="mr-2 h-4 w-4" />
Delete
{t('delete')}
</DropdownMenuItem>

<DropdownMenuLabel>Share</DropdownMenuLabel>
<DropdownMenuLabel>{t('share')}</DropdownMenuLabel>

<ResendDocumentActionItem document={row} recipients={nonSignedRecipients} team={team} />

Expand All @@ -179,7 +180,7 @@ export const DataTableActionDropdown = ({ row, team }: DataTableActionDropdownPr
<DropdownMenuItem disabled={disabled || isDraft} onSelect={(e) => e.preventDefault()}>
<div className="flex items-center">
{loading ? <Loader className="mr-2 h-4 w-4" /> : <Share className="mr-2 h-4 w-4" />}
Share Signing Card
{t('share-signing-card')}
</div>
</DropdownMenuItem>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { usePathname, useRouter, useSearchParams } from 'next/navigation';

import { useIsMounted } from '@documenso/lib/client-only/hooks/use-is-mounted';
import { useTranslation } from '@documenso/lib/i18n/client';
import { parseToIntegerArray } from '@documenso/lib/utils/params';
import { trpc } from '@documenso/trpc/react';
import { MultiSelectCombobox } from '@documenso/ui/primitives/multi-select-combobox';
Expand All @@ -12,6 +13,7 @@ type DataTableSenderFilterProps = {
};

export const DataTableSenderFilter = ({ teamId }: DataTableSenderFilterProps) => {
const { t } = useTranslation('web');
const pathname = usePathname();
const searchParams = useSearchParams();
const router = useRouter();
Expand Down Expand Up @@ -49,11 +51,11 @@ export const DataTableSenderFilter = ({ teamId }: DataTableSenderFilterProps) =>
<MultiSelectCombobox
emptySelectionPlaceholder={
<p className="text-muted-foreground font-normal">
<span className="text-muted-foreground/70">Sender:</span> All
<span className="text-muted-foreground/70">{t('senderlabel')}</span> {t('all')}
</p>
}
enableClearAllButton={true}
inputPlaceholder="Search"
inputPlaceholder={t('search')}
loading={!isMounted || isInitialLoading}
options={comboBoxOptions}
selectedValues={senderIds}
Expand Down
Loading

0 comments on commit fb370a6

Please sign in to comment.