refactor: migrate web-app to use shared-code package

Update web-app to use @evidencija-rezija/shared-code for common types
and utilities instead of maintaining duplicate copies.

Changes:
- Add shared-code dependency to package.json
- Update all imports across 35+ files to use @evidencija-rezija/shared-code
- Remove duplicate db-types.ts and shareChecksum.ts files

This ensures type consistency between web-app and email-worker and
reduces maintenance burden.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-12-30 18:30:00 +01:00
parent 625e468951
commit 4bac7f4677
31 changed files with 34 additions and 263 deletions

View File

@@ -1,7 +1,7 @@
"use client";
import { PlusCircleIcon, HomeIcon } from "@heroicons/react/24/outline";
import { YearMonth } from "../lib/db-types";
import { YearMonth } from '@evidencija-rezija/shared-code';
import { formatYearMonth } from "../lib/format";
import Link from "next/link";
import { useTranslations } from 'next-intl';

View File

@@ -3,7 +3,7 @@
import { PlusCircleIcon, CalendarDaysIcon } from "@heroicons/react/24/outline";
import React from "react";
import { formatYearMonth } from "../lib/format";
import { YearMonth } from "../lib/db-types";
import { YearMonth } from '@evidencija-rezija/shared-code';
import Link from "next/link";
import { useLocale, useTranslations } from 'next-intl';

View File

@@ -1,5 +1,5 @@
import { FC } from "react"
import { Bill } from "@/app/lib/db-types"
import { Bill } from "@evidencija-rezija/shared-code"
import Link from "next/link"
import { TicketIcon } from "@heroicons/react/24/outline"

View File

@@ -1,7 +1,7 @@
"use client";
import { FC, ReactNode, useState } from "react";
import { Bill, BillingLocation } from "../lib/db-types";
import { Bill, BillingLocation } from '@evidencija-rezija/shared-code';
import { useFormState } from "react-dom";
import { Main } from "./Main";
import { deleteBillById } from "../lib/actions/billActions";

View File

@@ -1,7 +1,7 @@
"use client";
import { DocumentIcon, TicketIcon, TrashIcon } from "@heroicons/react/24/outline";
import { Bill, BilledTo, BillingLocation } from "../lib/db-types";
import { Bill, BilledTo, BillingLocation } from '@evidencija-rezija/shared-code';
import React, { FC, useEffect } from "react";
import { useFormState } from "react-dom";
import { updateOrAddBill } from "../lib/actions/billActions";

View File

@@ -1,7 +1,7 @@
import { fetchAllLocations } from '@/app/lib/actions/locationActions';
import { fetchAvailableYears } from '@/app/lib/actions/monthActions';
import { getUserSettings } from '@/app/lib/actions/userSettingsActions';
import { BillingLocation, YearMonth } from '@/app/lib/db-types';
import { BillingLocation, YearMonth } from '@evidencija-rezija/shared-code';
import { FC } from 'react';
import { MonthLocationList } from '@/app/ui/MonthLocationList';

View File

@@ -3,7 +3,7 @@
import { CheckCircleIcon, Cog8ToothIcon, PlusCircleIcon, ShareIcon, BanknotesIcon, EyeIcon, TicketIcon, ShoppingCartIcon, EnvelopeIcon, ExclamationTriangleIcon, ClockIcon, XCircleIcon } from "@heroicons/react/24/outline";
import { FC } from "react";
import { BillBadge } from "./BillBadge";
import { BillingLocation, EmailStatus } from "../lib/db-types";
import { BillingLocation, EmailStatus } from '@evidencija-rezija/shared-code';
import { formatYearMonth } from "../lib/format";
import { formatCurrency } from "../lib/formatStrings";
import Link from "next/link";

View File

@@ -1,7 +1,7 @@
"use client";
import { FC, ReactNode, useState } from "react";
import { BillingLocation } from "../lib/db-types";
import { BillingLocation } from '@evidencija-rezija/shared-code';
import { deleteLocationById } from "../lib/actions/locationActions";
import { useFormState } from "react-dom";
import Link from "next/link";

View File

@@ -2,7 +2,7 @@
import { TrashIcon, ExclamationTriangleIcon, ClockIcon, EnvelopeIcon, CheckCircleIcon, PencilSquareIcon, XCircleIcon } from "@heroicons/react/24/outline";
import { FC, useState } from "react";
import { BillingLocation, UserSettings, YearMonth, EmailStatus } from "../lib/db-types";
import { BillingLocation, UserSettings, YearMonth, EmailStatus } from '@evidencija-rezija/shared-code';
import { updateOrAddLocation } from "../lib/actions/locationActions";
import { useFormState } from "react-dom";
import Link from "next/link";

View File

@@ -2,7 +2,7 @@
import { FC, useEffect, useRef } from "react";
import { formatYearMonth } from "../lib/format";
import { YearMonth } from "../lib/db-types";
import { YearMonth } from '@evidencija-rezija/shared-code';
import { formatCurrency } from "../lib/formatStrings";
import { useTranslations } from "next-intl";

View File

@@ -7,7 +7,7 @@ import { MonthCard } from "./MonthCard";
import Pagination from "./Pagination";
import { LocationCard } from "./LocationCard";
import { PrintButton } from "./PrintButton";
import { BillingLocation, UserSettings, YearMonth } from "../lib/db-types";
import { BillingLocation, UserSettings, YearMonth } from '@evidencija-rezija/shared-code';
import { useRouter, useSearchParams } from "next/navigation";
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

View File

@@ -2,7 +2,7 @@
import { PrinterIcon } from '@heroicons/react/24/outline';
import { useTranslations } from 'next-intl';
import { YearMonth } from '../lib/db-types';
import { YearMonth } from '@evidencija-rezija/shared-code';
export interface PrintButtonProps {
yearMonth: YearMonth;

View File

@@ -1,7 +1,7 @@
"use client";
import { FC, useState } from "react";
import { UserSettings } from "../lib/db-types";
import { UserSettings } from '@evidencija-rezija/shared-code';
import { updateUserSettings } from "../lib/actions/userSettingsActions";
import { useFormState, useFormStatus } from "react-dom";
import { useLocale, useTranslations } from "next-intl";

View File

@@ -1,5 +1,5 @@
import { FC } from "react";
import { Bill } from "@/app/lib/db-types";
import { Bill } from "@evidencija-rezija/shared-code";
import Link from "next/link";
import { TicketIcon } from "@heroicons/react/24/outline";
import { useLocale } from "next-intl";

View File

@@ -1,7 +1,7 @@
"use client";
import { TicketIcon, CheckCircleIcon, XCircleIcon, DocumentIcon } from "@heroicons/react/24/outline";
import { Bill, BillingLocation } from "../lib/db-types";
import { Bill, BillingLocation } from '@evidencija-rezija/shared-code';
import { FC, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";

View File

@@ -1,7 +1,7 @@
'use client';
import { FC, useMemo, useState } from "react";
import { BilledTo, BillingLocation, UserSettings } from "../lib/db-types";
import { BilledTo, BillingLocation, UserSettings } from '@evidencija-rezija/shared-code';
import { formatYearMonth } from "../lib/format";
import { formatCurrency, formatIban } from "../lib/formatStrings";
import { useTranslations } from "next-intl";