chore: code changes based of review

This commit is contained in:
Ephraim Atta-Duncan
2024-11-21 21:21:42 +00:00
parent 31dc403500
commit 2b1b042097
10 changed files with 61 additions and 54 deletions

View File

@ -100,9 +100,7 @@ export const ResendDocumentActionItem = ({
});
setIsOpen(false);
} catch (err) {
console.log(err);
} catch {
toast({
title: _(msg`Something went wrong`),
description: _(msg`This document could not be re-sent at this time. Please try again.`),

View File

@ -2,7 +2,7 @@
import { useState } from 'react';
import { msg } from '@lingui/macro';
import { Trans, msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { Input } from '@documenso/ui/primitives/input';
@ -25,12 +25,14 @@ export const DocumentExpirySettings = ({ onChange }: DocumentExpirySettingsProps
const handleExpiryValueChange = (value: string) => {
const parsedValue = parseInt(value, 10);
if (isNaN(parsedValue)) {
if (Number.isNaN(parsedValue) || parsedValue <= 0) {
setExpiryValue(undefined);
return;
} else {
setExpiryValue(parsedValue);
onChange(parsedValue, expiryUnit);
}
onChange(parsedValue, expiryUnit);
};
const handleExpiryUnitChange = (value: 'day' | 'week' | 'month') => {
@ -50,12 +52,18 @@ export const DocumentExpirySettings = ({ onChange }: DocumentExpirySettingsProps
/>
<Select value={expiryUnit} onValueChange={handleExpiryUnitChange}>
<SelectTrigger className="text-muted-foreground">
<SelectValue placeholder="Select..." />
<SelectValue placeholder={_(msg`Select...`)} />
</SelectTrigger>
<SelectContent>
<SelectItem value="day">Day</SelectItem>
<SelectItem value="week">Week</SelectItem>
<SelectItem value="month">Month</SelectItem>
<SelectItem value="day">
<Trans>Day</Trans>
</SelectItem>
<SelectItem value="week">
<Trans>Week</Trans>
</SelectItem>
<SelectItem value="month">
<Trans>Month</Trans>
</SelectItem>
</SelectContent>
</Select>
</div>