Merge branch 'release/1.25.4'

This commit is contained in:
2024-02-17 10:18:14 +01:00
9 changed files with 20 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ export type State = {
*/
const FormSchema = (t:IntlTemplateFn) => z.object({
_id: z.string(),
billName: z.coerce.string().min(1, t("validation.bill-name-required")),
billName: z.coerce.string().min(1, t("bill-name-required")),
billNotes: z.string(),
payedAmount: z.string().nullable().transform((val, ctx) => {
@@ -39,7 +39,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
if (isNaN(parsed)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: t("validation.not-a-number"),
message: t("not-a-number"),
});
// This is a special symbol you can use to
@@ -52,7 +52,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
if (parsed < 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: t("validation.negative-number")
message: t("negative-number")
});
// This is a special symbol you can use to
@@ -115,7 +115,7 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
const { id: userId } = user;
const t = await getTranslations("bill-edit-form");
const t = await getTranslations("bill-edit-form.validation");
// FormSchema
const validatedFields = FormSchema(t)
@@ -131,7 +131,7 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
console.log("updateBill.validation-error");
return({
errors: validatedFields.error.flatten().fieldErrors,
message: t("validation.form-error-message"),
message: t("form-error-message"),
});
}

View File

@@ -25,7 +25,7 @@ export type State = {
*/
const FormSchema = (t:IntlTemplateFn) => z.object({
_id: z.string(),
locationName: z.coerce.string().min(1, t("validation.location-name-required")),
locationName: z.coerce.string().min(1, t("location-name-required")),
locationNotes: z.string(),
})
// dont include the _id field in the response
@@ -42,7 +42,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
noStore();
const t = await getTranslations("location-edit-form");
const t = await getTranslations("location-edit-form.validation");
const validatedFields = FormSchema(t).safeParse({
locationName: formData.get('locationName'),

View File

@@ -11,11 +11,11 @@ export interface AddLocationButtonProps {
export const AddLocationButton:React.FC<AddLocationButtonProps> = ({yearMonth}) => {
const t = useTranslations("home-page");
const t = useTranslations("home-page.add-location-button");
return(
<div className="card card-compact card-bordered bg-base-100 shadow-s my-1">
<Link href={`/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("add-location-button.tooltip")}>
<Link href={`/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")}>
<span className='flex self-center mr-[-3em]'>
<HomeIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.6em] mt-[-.4em]" />

View File

@@ -1,3 +1,5 @@
"use client";
import { PlusCircleIcon, CalendarDaysIcon } from "@heroicons/react/24/outline";
import React from "react";
import { formatYearMonth } from "../lib/format";
@@ -11,12 +13,12 @@ export interface AddMonthButtonProps {
export const AddMonthButton:React.FC<AddMonthButtonProps> = ({ yearMonth }) => {
const t = useTranslations("home-page");
const t = useTranslations("home-page.add-month-button");
const locale = useLocale();
return(
<div className="card card-compact shadow-s mb-4">
<Link href={`/${locale}/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("add-month-button.tooltip")}>
<Link href={`/${locale}/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("tooltip")}>
<span className='flex self-center mr-[-3em]'>
<CalendarDaysIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.4em] mt-[-.4em]" />

View File

@@ -29,7 +29,7 @@ export const BillDeleteForm:FC<BillDeleteFormProps> = ({ bill, location }) => {
t.rich("text", {
bill_name:bill.name,
location_name:location.name,
strong: (chunks:ReactNode) => <strong>${chunks}</strong>,
strong: (chunks:ReactNode) => <strong>{chunks}</strong>,
})
}
</p>

View File

@@ -1,7 +1,7 @@
'client only';
'use client';
import { Cog8ToothIcon, PlusCircleIcon } from "@heroicons/react/24/outline";
import { FC, ReactNode } from "react";
import { FC } from "react";
import { BillBadge } from "./BillBadge";
import { BillingLocation } from "../lib/db-types";
import { formatYearMonth } from "../lib/format";
@@ -38,7 +38,7 @@ export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearM
{
monthlyExpense > 0 ?
<p>
{ t("payed-total") } <strong>${monthlyExpense}</strong>
{ t("payed-total") } <strong>${formatCurrency(monthlyExpense)}</strong>
</p>
: null
}

View File

@@ -32,7 +32,7 @@ export const LocationDeleteForm:FC<LocationDeleteFormProps> = ({ location }) =>
{
t.rich("text", {
name:location.name,
strong: (chunks:ReactNode) => `<strong>${chunks}</strong>`,
strong: (chunks:ReactNode) => <strong>{chunks}</strong>,
})
}
</p>

View File

@@ -12,5 +12,5 @@ export const SelectLanguage: React.FC = () => {
const secondLocale = locales.find((l) => l !== currentLocale) as string;
const secondLocalePathname = defaultLocale === currentLocale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${currentLocale}`, `/${secondLocale}`);
return (<Link className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</Link>);
return (<a className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</a>);
}

View File

@@ -9,7 +9,7 @@ networks:
services:
web-app:
image: utility-bills-tracker:1.25.3
image: utility-bills-tracker:1.25.4
networks:
- traefik-network
- mongo-network