Skip to content

Commit

Permalink
fix: nit picks
Browse files Browse the repository at this point in the history
  • Loading branch information
MacQSL committed Jun 17, 2024
1 parent ea520a6 commit d04b466
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ export const EditCapturePage = () => {
capture_id: values.capture.capture_id,
capture_date: values.capture.capture_date,
capture_time: values.capture.capture_time || undefined,
release_date: values.capture.release_date || undefined,
release_time: values.capture.release_time || undefined,
release_date: values.capture.release_date || values.capture.capture_date || undefined,
release_time: values.capture.release_time || values.capture.release_date || undefined,
capture_comment: values.capture.capture_comment || undefined,
release_comment: values.capture.release_comment || undefined,
capture_location: captureLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ interface ICaptureDetailsProps {
export const CaptureDetails = (props: ICaptureDetailsProps) => {
const { capture } = props;

const captureTimestamp = capture.capture_date;
const captureDate = capture.capture_date;

Check warning on line 21 in app/src/features/surveys/animals/profile/captures/components/capture-card-details/components/CaptureDetails.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/components/capture-card-details/components/CaptureDetails.tsx#L21

Added line #L21 was not covered by tests
const captureLocation = capture.capture_location;
const captureComment = capture.capture_comment;

if (!captureTimestamp && (!captureLocation.latitude || !captureLocation.longitude) && !captureComment) {
if (!captureDate && (!captureLocation.latitude || !captureLocation.longitude) && !captureComment) {
return null;
}

Expand All @@ -38,7 +38,7 @@ export const CaptureDetails = (props: ICaptureDetailsProps) => {
Capture time
</Typography>
<Typography color="textSecondary" variant="body2">
{getFormattedDate(DATE_FORMAT.MediumDateTimeFormat, captureTimestamp)}
{getFormattedDate(DATE_FORMAT.MediumDateTimeFormat, captureDate)}
</Typography>
</Box>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ interface IReleaseDetailsProps {
export const ReleaseDetails = (props: IReleaseDetailsProps) => {
const { capture } = props;

const releaseTimestamp = capture.release_date;
const releaseDate = capture.release_date;

Check warning on line 21 in app/src/features/surveys/animals/profile/captures/components/capture-card-details/components/ReleaseDetails.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/features/surveys/animals/profile/captures/components/capture-card-details/components/ReleaseDetails.tsx#L21

Added line #L21 was not covered by tests
const releaseLocation = capture.release_location;
const releaseComment = capture.release_comment;

if (!releaseTimestamp && !releaseLocation && !releaseComment) {
if (!releaseDate && !releaseLocation && !releaseComment) {
return null;
}

return (
<Stack gap={2}>
<Stack direction="row" spacing={3}>
{releaseTimestamp && (
{releaseDate && (
<Box>
<Typography
color="textSecondary"
Expand All @@ -39,7 +39,7 @@ export const ReleaseDetails = (props: IReleaseDetailsProps) => {
Release time
</Typography>
<Typography color="textSecondary" variant="body2">
{getFormattedDate(DATE_FORMAT.MediumDateTimeFormat, releaseTimestamp)}
{getFormattedDate(DATE_FORMAT.MediumDateTimeFormat, releaseDate)}
</Typography>
</Box>
)}
Expand Down
2 changes: 1 addition & 1 deletion app/src/interfaces/useCritterApi.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export interface IMarkingPostData {

export interface ICapturePostData {
capture_id: string;
capture_date: string;
capture_method_id: string | null;
capture_date: string;
capture_time?: string | null;
release_date?: string | null;
release_time?: string | null;
Expand Down

0 comments on commit d04b466

Please sign in to comment.