From 8e171825f741aee47ad4094ceb2b60384f3bc24a Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Wed, 12 Mar 2025 09:57:45 +0100 Subject: [PATCH 01/35] Rename FDM to MINAS2 --- .changeset/warm-dryers-start.md | 5 +++++ fdm-app/app/components/custom/sidebar-app.tsx | 4 +++- fdm-app/app/routes/api.auth.$.tsx | 4 ++-- fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx | 4 ++-- ....create.$b_id_farm.cultivations.$b_lu_catalogue.tsx | 4 ++-- .../app/routes/farm.create.$b_id_farm.cultivations.tsx | 4 ++-- .../app/routes/farm.create.$b_id_farm.fields.$b_id.tsx | 10 +++++++--- fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx | 4 ++-- fdm-app/app/routes/farm.create._index.tsx | 4 ++-- fdm-app/app/routes/farm.tsx | 4 ++-- fdm-app/app/routes/signin.tsx | 6 +++--- 11 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 .changeset/warm-dryers-start.md diff --git a/.changeset/warm-dryers-start.md b/.changeset/warm-dryers-start.md new file mode 100644 index 000000000..2aeb08a02 --- /dev/null +++ b/.changeset/warm-dryers-start.md @@ -0,0 +1,5 @@ +--- +"@svenvw/fdm-app": minor +--- + +Rename `FDM` to `MINAS2` diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 1a48eb495..6743864a1 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -138,7 +138,9 @@ export function SidebarApp(props: SideBarAppType) {
- FDM + + MINAS2 + {/* 2024 */}
diff --git a/fdm-app/app/routes/api.auth.$.tsx b/fdm-app/app/routes/api.auth.$.tsx index 5f56446ab..5a255d8be 100644 --- a/fdm-app/app/routes/api.auth.$.tsx +++ b/fdm-app/app/routes/api.auth.$.tsx @@ -8,8 +8,8 @@ import type { export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index f76993d60..975e7b60b 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -55,8 +55,8 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index c5e0d164c..42636da59 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -20,8 +20,8 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx index 82b0f16b8..45338af46 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx @@ -26,8 +26,8 @@ import { Outlet, useLoaderData } from "react-router" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index 6d4b3c9fb..698c65acf 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -58,8 +58,8 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } @@ -200,7 +200,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) { // Get the available cultivations let cultivationOptions = [] - const cultivationsCatalogue = await getCultivationsFromCatalogue(fdm, session.principal_id, b_id_farm) + const cultivationsCatalogue = await getCultivationsFromCatalogue( + fdm, + session.principal_id, + b_id_farm, + ) cultivationOptions = cultivationsCatalogue .filter( (cultivation) => diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx index dbe9785ad..ecf68938a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx @@ -31,8 +31,8 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 3df2f86ae..28f1cf402 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -32,8 +32,8 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index e4042ac5e..3c0c2465a 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -12,8 +12,8 @@ import { Outlet, useLoaderData } from "react-router" export const meta: MetaFunction = () => { return [ - { title: "FDM App" }, - { name: "description", content: "Welcome to FDM!" }, + { title: "MINAS2 App" }, + { name: "description", content: "Welcome to MINAS2!" }, ] } diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index c43f391e9..6d616a8c1 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -70,8 +70,8 @@ export default function SignIn() {
- {/* Logo FDM */} -

FDM

+ {/* Logo MINAS2 */} +

MINAS2

Maak een account aan en krijg toegang tot:

@@ -262,7 +262,7 @@ export default function SignIn() {
From 05bc116ab4c81e110b41d72ef91fff164f434ee0 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Wed, 12 Mar 2025 10:54:35 +0100 Subject: [PATCH 02/35] Add titles and descriptions to pages --- .changeset/all-schools-lay.md | 5 +++++ fdm-app/app/routes/api.auth.$.tsx | 8 ++++++-- .../farm.$b_id_farm.atlas.elevation.tsx | 12 ++++++++++++ .../routes/farm.$b_id_farm.atlas.fields.tsx | 12 ++++++++++++ .../app/routes/farm.$b_id_farm.atlas.soil.tsx | 12 ++++++++++++ fdm-app/app/routes/farm.$b_id_farm.atlas.tsx | 12 ++++++++++++ .../farm.$b_id_farm.field.$b_id.atlas.tsx | 12 ++++++++++++ ...m.field.$b_id.cultivation.$b_lu._index.tsx | 12 ++++++++++++ ...ivation.$b_lu.harvest.$b_id_harvesting.tsx | 15 +++++++++++++-- ...$b_id.cultivation.$b_lu.harvest._index.tsx | 12 ++++++++++++ ...id_farm.field.$b_id.cultivation._index.tsx | 16 ++++++++++++++-- ...farm.$b_id_farm.field.$b_id.fertilizer.tsx | 12 ++++++++++++ .../farm.$b_id_farm.field.$b_id.norm.tsx | 14 +++++++++++++- .../farm.$b_id_farm.field.$b_id.overview.tsx | 12 ++++++++++++ .../farm.$b_id_farm.field.$b_id.soil.tsx | 11 +++++++++++ .../routes/farm.$b_id_farm.field.$b_id.tsx | 12 ++++++++++++ .../routes/farm.$b_id_farm.field._index.tsx | 14 +++++++++++++- .../farm.$b_id_farm.settings._index.tsx | 13 ++++++++++++- .../farm.$b_id_farm.settings.access.tsx | 12 ++++++++++++ .../farm.$b_id_farm.settings.delete.tsx | 12 ++++++++++++ .../farm.$b_id_farm.settings.properties.tsx | 12 ++++++++++++ .../app/routes/farm.$b_id_farm.settings.tsx | 12 ++++++++++++ fdm-app/app/routes/farm.$b_id_farm.tsx | 14 +++++++++++++- fdm-app/app/routes/farm._index.tsx | 13 ++++++++++++- .../routes/farm.create.$b_id_farm.atlas.tsx | 8 ++++++-- ...cultivations.$b_lu_catalogue.covercrop.tsx | 14 ++++++++++++++ ...ltivations.$b_lu_catalogue.crop._index.tsx | 19 ++++++++++++++++++- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 12 ++++++++++++ ...ns.$b_lu_catalogue.crop.harvest._index.tsx | 13 +++++++++++++ ...ltivations.$b_lu_catalogue.fertilizers.tsx | 12 ++++++++++++ ...b_id_farm.cultivations.$b_lu_catalogue.tsx | 8 ++++++-- ....create.$b_id_farm.cultivations._index.tsx | 14 +++++++++++++- .../farm.create.$b_id_farm.cultivations.tsx | 7 +++++-- .../farm.create.$b_id_farm.fields.$b_id.tsx | 8 ++++++-- .../farm.create.$b_id_farm.fields._index.tsx | 18 +++++++++++++++++- .../routes/farm.create.$b_id_farm.fields.tsx | 8 ++++++-- fdm-app/app/routes/farm.create._index.tsx | 9 ++++++--- fdm-app/app/routes/farm.tsx | 8 ++++++-- fdm-app/app/routes/signin.tsx | 13 ++++++++++++- 39 files changed, 432 insertions(+), 30 deletions(-) create mode 100644 .changeset/all-schools-lay.md diff --git a/.changeset/all-schools-lay.md b/.changeset/all-schools-lay.md new file mode 100644 index 000000000..ea0aaacda --- /dev/null +++ b/.changeset/all-schools-lay.md @@ -0,0 +1,5 @@ +--- +"@svenvw/fdm-app": minor +--- + +Add titles and descriptions to pages diff --git a/fdm-app/app/routes/api.auth.$.tsx b/fdm-app/app/routes/api.auth.$.tsx index 5a255d8be..566671444 100644 --- a/fdm-app/app/routes/api.auth.$.tsx +++ b/fdm-app/app/routes/api.auth.$.tsx @@ -8,8 +8,12 @@ import type { export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Authenticatie | FDM" }, + { + name: "description", + content: + "Beveiligde authenticatie voor toegang tot het FDM platform.", + }, ] } diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx index e59eba202..48c675c6b 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx @@ -6,11 +6,23 @@ import { fdm } from "@/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, NavLink, data, useLoaderData, } from "react-router" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Hoogte - Kaart | MINAS2" }, + { + name: "description", + content: "Bekijk hoogtegegevens op de kaart.", + }, + ] +} + /** * Loads farm field data and a Mapbox token for the elevation feature. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index a41537b6e..2ce1457d4 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -20,6 +20,18 @@ import { fdm } from "@/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" +import type { MetaFunction } from "@remix-run/node" + +export const meta: MetaFunction = () => { + return [ + { title: "Percelen - Kaart | MINAS2" }, + { + name: "description", + content: + "Bekijk alle percelen van uw bedrijf op één interactieve kaart. Visualiseer de geografische spreiding en onderlinge relaties tussen uw percelen.", + }, + ] +} /** * Loads and processes farm field data along with Mapbox configuration for rendering the farm atlas. diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index c21842721..b7e12a801 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -6,11 +6,23 @@ import { fdm } from "@/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, NavLink, data, useLoaderData, } from "react-router" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bodem - Kaart | MINAS2" }, + { + name: "description", + content: "Bekijk bodemgegevens op de kaart.", + }, + ] +} + /** * Loads farm fields as a GeoJSON FeatureCollection along with a Mapbox token. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx index 8f8c17624..7424be277 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx @@ -8,6 +8,7 @@ import { fdm } from "@/lib/fdm.server" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, Outlet, data, redirect, @@ -16,6 +17,17 @@ import { } from "react-router" import { ClientOnly } from "remix-utils/client-only" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Kaarten | MINAS2" }, + { + name: "description", + content: "Bekijk informatie op de kaart.", + }, + ] +} + /** * Retrieves farm details, user farm options, and layer configuration based on the farm ID in the URL parameters. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index 6fa6f9fe7..177534da0 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -21,6 +21,18 @@ import { useLoaderData, } from "react-router" import { ClientOnly } from "remix-utils/client-only" +import type { MetaFunction } from "@remix-run/node" + +export const meta: MetaFunction = () => { + return [ + { title: "Kaart - Perceel MINAS2" }, + { + name: "description", + content: + "Bekijk uw perceel op de kaart met interactieve visualisatie van de locatie, grenzen en geografische kenmerken.", + }, + ] +} /** * Loads field data and Mapbox configuration for rendering a farm field on the map. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx index 88f8ec6ec..c69ee9a0e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx @@ -19,6 +19,7 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, NavLink, data, useFetcher, @@ -26,6 +27,17 @@ import { } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Gewas - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de gegevens van je gewas.", + }, + ] +} + /** * Loads and prepares data for the farm fields overview page. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index 1c788ca55..0f834aaee 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -10,12 +10,23 @@ import { addHarvest, getCultivation, getHarvest } from "@svenvw/fdm-core" import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, NavLink, data, - useFetcher, useLoaderData, } from "react-router" -import { dataWithError, redirectWithSuccess } from "remix-toast" +import { redirectWithSuccess } from "remix-toast" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Oogst - Gewas - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de oogst van je gewas.", + }, + ] +} /** * Retrieves cultivation and harvest data based on provided URL parameters. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx index e0d26fb1d..6ec4fe41b 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx @@ -15,12 +15,24 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, NavLink, data, useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Oogsten - Gewas - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de oogsten van je gewas.", + }, + ] +} + /** * Loads the necessary data for the harvest page. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx index ca7c8e95b..2b70cebc9 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx @@ -17,12 +17,24 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useLoaderData, useLocation, } from "react-router" -import { dataWithError, dataWithSuccess, dataWithWarning } from "remix-toast" -import { toast } from "sonner" +import {dataWithSuccess } from "remix-toast" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Gewas - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de gewassen van je perceel.", + }, + ] +} + /** * Loads data required for rendering the overview of a specific farm field. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx index 71b1a40d1..6a7b49fbf 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx @@ -18,6 +18,7 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useFetcher, useLoaderData, @@ -25,6 +26,17 @@ import { } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bemesting - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de bemestinggegevens van je perceel.", + }, + ] +} + /** * Loads data necessary for managing fertilizer applications for a specific field. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx index 6c1e9873f..0412d029e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx @@ -3,7 +3,19 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getField } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" +import { type LoaderFunctionArgs, type MetaFunction, data, useLoaderData } from "react-router" + + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Gebruiksnormen - Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de gebruiksnormen van je perceel.", + }, + ] +} /** * Loads field details using the farm and field IDs from route parameters. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx index f5ec7730a..bc59fc489 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx @@ -43,6 +43,18 @@ import { import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" +import type { MetaFunction } from "@remix-run/node" + +export const meta: MetaFunction = () => { + return [ + { title: "Overzicht - Perceel | MINAS2" }, + { + name: "description", + content: + "Bekijk en beheer de algemene informatie van uw perceel, inclusief naam, eigendomsgegevens en tijdsperiode.", + }, + ] +} /** * Loads farm field details for the overview page. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx index 56f2008b9..9defd5e09 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx @@ -4,6 +4,17 @@ import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" +import type { MetaFunction } from "@remix-run/node" + +export const meta: MetaFunction = () => { + return [ + { title: "Bodemanalyse - Perceel | FDM" }, + { + name: "description", + content: "Bekijk en bewerk de bodemanalyses van je perceel.", + }, + ] +} /** * Retrieves details of a specific farm field. diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx index 04c98c6f1..695116cb5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx @@ -8,12 +8,24 @@ import { fdm } from "@/lib/fdm.server" import { getFarms, getField, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, Outlet, data, redirect, useLoaderData, } from "react-router" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Perceel | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de gegevens van je perceel.", + }, + ] +} + /** * Loads data required to render the farm field index page. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx index aecbfa95b..20a8105de 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx @@ -22,11 +22,23 @@ import { redirect, useLoaderData, } from "react-router" +import type { MetaFunction } from "@remix-run/node" + +export const meta: MetaFunction = () => { + return [ + { title: "Perceel | MINAS2" }, + { + name: "description", + content: + "Beheer al uw percelen op één plek. Bekijk een overzicht van alle percelen binnen uw bedrijf met hun belangrijkste kenmerken.", + }, + ] +} /** * Retrieves and processes farm and field options for the specified farm ID based on the current user session. * - * This loader function extracts the active farm ID from the route parameters and uses the user’s session to: + * This loader function extracts the active farm ID from the route parameters and uses the user's session to: * - Fetch all farms associated with the user, redirecting to the farms overview if none exist. * - Validate and map the farms into selectable options. * - Retrieve and validate the fields for the active farm, rounding each field's area and sorting the fields alphabetically. diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx index 549dfe2aa..40bd4747e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx @@ -1,4 +1,15 @@ -import { redirect } from "react-router" +import { type MetaFunction, redirect } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Instellingen - Bedrijf | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de instellingen van je bedrijf.", + }, + ] +} export async function loader() { // Redirect to properties page diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index 193e61cc4..664afbc20 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -1,4 +1,16 @@ import { Separator } from "@/components/ui/separator" +import type { MetaFunction } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "toegang - Instellingen - Bedrijf | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de toegang tot je bedrijf.", + }, + ] +} export default function FarmSettingsAccessBlock() { return ( diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx index 1ca5795d7..367c8cc18 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx @@ -1,4 +1,16 @@ import { Separator } from "@/components/ui/separator" +import type { MetaFunction } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Verwijderen - Instellingen - Bedrijf | MINAS2" }, + { + name: "description", + content: "Verwijder de gegevens van je bedrijf.", + }, + ] +} export default function FarmSettingsDeleteBlock() { return ( diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx index 0ace8048a..c07ddf5d5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx @@ -22,6 +22,7 @@ import { Form } from "react-hook-form" import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useLoaderData, } from "react-router" @@ -31,6 +32,17 @@ import validator from "validator" import { z } from "zod" const { isPostalCode } = validator +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Eigenschappen - Instellingen - Bedrijf | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de eigenschappen van je bedrijf.", + }, + ] +} + /** * Retrieves the details of a farm using the farm ID from the URL parameters and the user's session. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index d55f67959..9f5a7eab1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -9,11 +9,23 @@ import { fdm } from "@/lib/fdm.server" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, Outlet, data, useLoaderData, } from "react-router" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Instellingen - Bedrijf | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de instellingen van je bedrijf.", + }, + ] +} + /** * Loads farm details, farm options, and sidebar navigation items for a given farm. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.tsx b/fdm-app/app/routes/farm.$b_id_farm.tsx index 132e78baf..3ef46dd2f 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.tsx @@ -1,6 +1,18 @@ import { getSession } from "@/lib/auth.server" import { handleActionError } from "@/lib/error" -import { type LoaderFunctionArgs, data } from "react-router" +import { type LoaderFunctionArgs, type MetaFunction, data } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bedrijf | MINAS2" }, + { + name: "description", + content: "Bekijk en bewerk de gegevens van je bedrijf.", + }, + ] +} + /** * Processes a request to retrieve a farm's session details. diff --git a/fdm-app/app/routes/farm._index.tsx b/fdm-app/app/routes/farm._index.tsx index 1ef09f672..79fc84e78 100644 --- a/fdm-app/app/routes/farm._index.tsx +++ b/fdm-app/app/routes/farm._index.tsx @@ -15,7 +15,18 @@ import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getTimeBasedGreeting } from "@/lib/greetings" import { getFarms } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, NavLink, useLoaderData } from "react-router" +import { type LoaderFunctionArgs, type MetaFunction, NavLink, useLoaderData } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bedrijf | MINAS2" }, + { + name: "description", + content: "Selecteer een bedrijf.", + }, + ] +} /** * Retrieves the user session and associated farms data. diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 975e7b60b..255c5ebfd 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -55,8 +55,12 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Kaart - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Bekijk en bewerk je percelen op een interactieve kaart. Pas perceelgrenzen aan en bekijk satellietbeelden.", + }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx index bbc8b461d..5bb702baf 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,3 +1,17 @@ +import type { MetaFunction } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Vanggewas - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Bekijk en selecteer het vanggewas uit je bouwplan.", + }, + ] +} + export default function Index() { return (
diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx index 0c3980a69..e3a83c2aa 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx @@ -16,12 +16,25 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useFetcher, useLoaderData, } from "react-router" import { dataWithSuccess } from "remix-toast" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Gewas- Bouwplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", + }, + ] +} + /** * Loads and prepares cultivation and harvest data for a specified farm and catalogue. * @@ -54,7 +67,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) { // Get the available cultivations let cultivationOptions = [] let b_lu_harvestable: HarvestableType = "none" - const cultivationsCatalogue = await getCultivationsFromCatalogue(fdm, session.principal_id, b_id_farm) + const cultivationsCatalogue = await getCultivationsFromCatalogue( + fdm, + session.principal_id, + b_id_farm, + ) cultivationOptions = cultivationsCatalogue .filter( (cultivation) => diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index ec71f575c..21a0a1ff2 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -9,11 +9,23 @@ import { } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, + type MetaFunction, NavLink, data, useLoaderData, } from "react-router" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Oogst - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", + }, + ] +} + /** * Loads harvest details for a specific cultivation plan. * diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index f9da1decf..8e7ff9e4f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -13,11 +13,24 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, NavLink, data, } from "react-router" import { redirectWithSuccess } from "remix-toast" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Oogst- Bouwplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Bekijk en selecteer de oogsten van een gewas uit je bouwplan.", + }, + ] +} + /** * Retrieves required harvest and cultivation details for rendering the harvest addition form. * diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx index e3ad4e65c..aad034450 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -16,6 +16,7 @@ import { import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useFetcher, useLoaderData, @@ -24,6 +25,17 @@ import { import { dataWithSuccess } from "remix-toast" import { fdm } from "../lib/fdm.server" +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bemesting - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: "Bekijk en voeg bemestingen toe aan je bouwplan.", + }, + ] +} + /** * Loads fertilizer and cultivation data for a given farm and cultivation catalogue. * diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index 42636da59..fdce3efee 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -20,11 +20,15 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Bowupland - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: "Bekijk en selecteer een gewas uit je bouwplan.", + }, ] } + /** * Loads cultivation details for a specific farm and catalogue. * diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx index fda892dca..6e482ad39 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx @@ -2,7 +2,19 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getCultivationPlan } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, redirect } from "react-router" +import { type LoaderFunctionArgs, type MetaFunction, redirect } from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Bowupland - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: "Bekijk en selecteer een gewas uit je bouwplan.", + }, + ] +} + /** * Loads data for a farm and redirects to the crop page of its first cultivation. diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx index 45338af46..1ae2d0db1 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx @@ -26,8 +26,11 @@ import { Outlet, useLoaderData } from "react-router" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Bowuplan - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: "Beheer de gewassen op je percelen.", + }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index 698c65acf..4b394c953 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -58,8 +58,12 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Perceel bewerken - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Bekijk en bewerk de details van een nieuw toe te voegen perceel, inclusief bodemgegevens en gewassen.", + }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx index 0b765cd39..6c2ec2f52 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx @@ -2,7 +2,23 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, redirect } from "react-router" +import { + type LoaderFunctionArgs, + type MetaFunction, + redirect, +} from "react-router" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: "Percelen beheren - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Beheer de percelen van je bedrijf. Pas namen aan en bekijk perceelsinformatie.", + }, + ] +} /** * Loads the user's session and associated fields for a specified farm, redirecting to the route of the first field. diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx index ecf68938a..306709416 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx @@ -31,8 +31,12 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Percelen beheren - Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Beheer de percelen van je bedrijf. Pas namen aan en bekijk perceelsinformatie.", + }, ] } diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 28f1cf402..29fa9b58c 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -17,7 +17,6 @@ import { enableCultivationCatalogue, enableFertilizerCatalogue, getFertilizersFromCatalogue, - PrincipalId, } from "@svenvw/fdm-core" import type { ActionFunctionArgs, @@ -32,8 +31,12 @@ import { fdm } from "../lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Bedrijf toevoegen | MINAS2" }, + { + name: "description", + content: + "Voeg een nieuw bedrijf toe aan MINAS2.", + }, ] } diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index 3c0c2465a..0a7b3899d 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -12,8 +12,12 @@ import { Outlet, useLoaderData } from "react-router" export const meta: MetaFunction = () => { return [ - { title: "MINAS2 App" }, - { name: "description", content: "Welcome to MINAS2!" }, + { title: "Dashboard | MINAS2" }, + { + name: "description", + content: + "Beheer je bedrijfsgegevens, percelen en gewassen in één overzichtelijk dashboard.", + }, ] } diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 6d616a8c1..489e8907c 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -15,6 +15,7 @@ import { Check, MoveDown } from "lucide-react" import type { LoaderFunctionArgs } from "react-router" import { redirect } from "react-router" import { toast } from "sonner" +import type { MetaFunction } from "react-router" /** * Checks for an existing user session and redirects authenticated users. @@ -59,7 +60,7 @@ export async function loader({ request }: LoaderFunctionArgs) { * @returns A React element representing the sign-in page. */ export default function SignIn() { - const handleSignInError = (provider: string, error: Error) => { + const handleSignInError = (provider: string, error: unknown) => { toast( `Er is helaas iets misgegaan bij het aanmelden met ${provider}. Probeer het opnieuw.`, ) @@ -280,3 +281,13 @@ export default function SignIn() {
) } + +export const meta: MetaFunction = () => { + return [ + { title: "Aanmelden | MINAS2" }, + { + name: "description", + content: "Meld je aan bij MINAS2!", + }, + ] +} From 199cba4d855fcd99722697c2ff25a4aefed2d09b Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Wed, 12 Mar 2025 11:02:18 +0100 Subject: [PATCH 03/35] Add message at signin page that the app is still in development --- .changeset/fluffy-hotels-switch.md | 5 +++++ fdm-app/app/routes/signin.tsx | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .changeset/fluffy-hotels-switch.md diff --git a/.changeset/fluffy-hotels-switch.md b/.changeset/fluffy-hotels-switch.md new file mode 100644 index 000000000..040129869 --- /dev/null +++ b/.changeset/fluffy-hotels-switch.md @@ -0,0 +1,5 @@ +--- +"@svenvw/fdm-app": minor +--- + +Add message at signin page that the app is still in development diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 489e8907c..c377a4fd8 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -11,11 +11,12 @@ import { signIn } from "@/lib/auth-client" import { auth } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" import { cn } from "@/lib/utils" -import { Check, MoveDown } from "lucide-react" +import { Check, MoveDown, Info } from "lucide-react" import type { LoaderFunctionArgs } from "react-router" import { redirect } from "react-router" import { toast } from "sonner" import type { MetaFunction } from "react-router" +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" /** * Checks for an existing user session and redirects authenticated users. @@ -138,6 +139,20 @@ export default function SignIn() {
+ + + +

+ Let op! +

+
+ +

+ MINAS2 is nog in ontwikkeling. Functionaliteiten + kunnen nog ontbreken of veranderen. +

+
+
Aanmelden From 04feb27ff73856d70cbe23d54cd75b0b046b3e39 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Wed, 12 Mar 2025 15:45:27 +0100 Subject: [PATCH 04/35] Update fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Sven Verweij <37927107+SvenVw@users.noreply.github.com> --- fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx index 9defd5e09..be80f68fc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx @@ -8,7 +8,7 @@ import type { MetaFunction } from "@remix-run/node" export const meta: MetaFunction = () => { return [ - { title: "Bodemanalyse - Perceel | FDM" }, + { title: "Bodemanalyse - Perceel | MINAS2" }, { name: "description", content: "Bekijk en bewerk de bodemanalyses van je perceel.", From 2be80c97daac2e956b39505853391b41dfd04c9f Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Wed, 12 Mar 2025 15:49:44 +0100 Subject: [PATCH 05/35] Nitpicks --- .changeset/fluffy-hotels-switch.md | 2 +- fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx | 2 +- fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx | 2 +- fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.field.$b_id.overview.tsx | 2 +- fdm-app/app/routes/farm.$b_id_farm.field._index.tsx | 2 +- fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx | 2 +- ...rm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx | 1 - .../farm.create.$b_id_farm.cultivations._index.tsx | 9 ++++++--- 9 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.changeset/fluffy-hotels-switch.md b/.changeset/fluffy-hotels-switch.md index 040129869..80f283263 100644 --- a/.changeset/fluffy-hotels-switch.md +++ b/.changeset/fluffy-hotels-switch.md @@ -2,4 +2,4 @@ "@svenvw/fdm-app": minor --- -Add message at signin page that the app is still in development +Add a message at signin page that the app is still in development diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index 2ce1457d4..daab4a1bc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -20,7 +20,7 @@ import { fdm } from "@/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" -import type { MetaFunction } from "@remix-run/node" +import type { MetaFunction } from "react-router" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index b7e12a801..11278ab73 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -15,7 +15,7 @@ import { // Meta export const meta: MetaFunction = () => { return [ - { title: "Bodem - Kaart | MINAS2" }, + { title: "Bodem - Kaart | MINAS2" }, { name: "description", content: "Bekijk bodemgegevens op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index 177534da0..a4684eff7 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -21,11 +21,11 @@ import { useLoaderData, } from "react-router" import { ClientOnly } from "remix-utils/client-only" -import type { MetaFunction } from "@remix-run/node" +import type { MetaFunction } from "react-router" export const meta: MetaFunction = () => { return [ - { title: "Kaart - Perceel MINAS2" }, + { title: "Kaart - Perceel | MINAS2" }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx index bc59fc489..b6317d25e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx @@ -43,7 +43,7 @@ import { import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" -import type { MetaFunction } from "@remix-run/node" +import type { MetaFunction } from "react-router" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx index 20a8105de..c4dc324ae 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx @@ -22,7 +22,7 @@ import { redirect, useLoaderData, } from "react-router" -import type { MetaFunction } from "@remix-run/node" +import type { MetaFunction } from "react-router" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index 664afbc20..6c0b2f294 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -4,7 +4,7 @@ import type { MetaFunction } from "react-router" // Meta export const meta: MetaFunction = () => { return [ - { title: "toegang - Instellingen - Bedrijf | MINAS2" }, + { title: "Toegang - Instellingen - Bedrijf | MINAS2" }, { name: "description", content: "Bekijk en bewerk de toegang tot je bedrijf.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index fdce3efee..2726f1e06 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -28,7 +28,6 @@ export const meta: MetaFunction = () => { ] } - /** * Loads cultivation details for a specific farm and catalogue. * diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx index 6e482ad39..00f8c3152 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx @@ -2,12 +2,16 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getCultivationPlan } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, type MetaFunction, redirect } from "react-router" +import { + type LoaderFunctionArgs, + type MetaFunction, + redirect, +} from "react-router" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bowupland - Bedrijf toevoegen | MINAS2" }, + { title: "Bouwplan - Bedrijf toevoegen | MINAS2" }, { name: "description", content: "Bekijk en selecteer een gewas uit je bouwplan.", @@ -15,7 +19,6 @@ export const meta: MetaFunction = () => { ] } - /** * Loads data for a farm and redirects to the crop page of its first cultivation. * From f16f3a7a4d308251defc53f1e109366c427d475e Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 21 Mar 2025 17:28:53 +0100 Subject: [PATCH 06/35] Setup a first configuration file --- fdm-app/fdm.config.ts | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 fdm-app/fdm.config.ts diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts new file mode 100644 index 000000000..7fc448885 --- /dev/null +++ b/fdm-app/fdm.config.ts @@ -0,0 +1,62 @@ +export const config: Config = { + // Site name + name: "FDM", + favicon: "/favicon.ico", + logo: "/logo.svg", + + // Authentication + auth: { + fdm_session_secret: String(process.env.FDM_SESSION_SECRET), + better_auth_secret: String(process.env.BETTER_AUTH_SECRET), + google: { + clientId: String(process.env.GOOGLE_CLIENT_ID), + clientSecret: String(process.env.GOOGLE_CLIENT_SECRET), + }, + microsoft: { + clientId: String(process.env.MICROSOFT_CLIENT_ID), + clientSecret: String(process.env.MICROSOFT_CLIENT_SECRET), + }, + }, + + // Database + database: { + password: String(process.env.DB_PASSWORD), + user: String(process.env.DB_USER), + database: String(process.env.DB_DATABASE), + host: String(process.env.DB_HOST), + port: Number(process.env.DB_PORT), + }, + + // Sentry + sentry: { + dsn: String(process.env.SENTRY_DSN), + }, +} + +interface Config { + name: string + favicon: string + logo: string + auth: { + fdm_session_secret: string + better_auth_secret: string + google?: { + clientId: string + clientSecret: string + } | null + microsoft?: { + clientId: string + clientSecret: string + } | null + } + database: { + password: string + user: string + database: string + host: string + port: number + } + sentry?: { + dsn: string + } | null +} From 7f914f84bd69d40c0f54d840fcce51071626ee50 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:55:33 +0100 Subject: [PATCH 07/35] Use name from config file --- fdm-app/app/components/custom/sidebar-app.tsx | 3 +- fdm-app/app/root.tsx | 2 +- fdm-app/app/routes/api.auth.$.tsx | 5 +-- .../farm.$b_id_farm.atlas.elevation.tsx | 3 +- .../routes/farm.$b_id_farm.atlas.fields.tsx | 3 +- .../app/routes/farm.$b_id_farm.atlas.soil.tsx | 3 +- fdm-app/app/routes/farm.$b_id_farm.atlas.tsx | 3 +- .../farm.$b_id_farm.field.$b_id.atlas.tsx | 3 +- ...m.field.$b_id.cultivation.$b_lu._index.tsx | 3 +- ...ivation.$b_lu.harvest.$b_id_harvesting.tsx | 3 +- ...$b_id.cultivation.$b_lu.harvest._index.tsx | 3 +- ...id_farm.field.$b_id.cultivation._index.tsx | 3 +- ...farm.$b_id_farm.field.$b_id.fertilizer.tsx | 3 +- .../farm.$b_id_farm.field.$b_id.norm.tsx | 4 +-- .../farm.$b_id_farm.field.$b_id.overview.tsx | 3 +- .../farm.$b_id_farm.field.$b_id.soil.tsx | 5 +-- .../routes/farm.$b_id_farm.field.$b_id.tsx | 3 +- .../routes/farm.$b_id_farm.field._index.tsx | 3 +- .../farm.$b_id_farm.settings._index.tsx | 3 +- .../farm.$b_id_farm.settings.access.tsx | 3 +- .../farm.$b_id_farm.settings.delete.tsx | 3 +- .../farm.$b_id_farm.settings.properties.tsx | 3 +- .../app/routes/farm.$b_id_farm.settings.tsx | 3 +- fdm-app/app/routes/farm.$b_id_farm.tsx | 4 +-- fdm-app/app/routes/farm._index.tsx | 3 +- fdm-app/app/routes/farm.account.tsx | 26 +++++++++++++--- .../routes/farm.create.$b_id_farm.atlas.tsx | 5 +-- ...cultivations.$b_lu_catalogue.covercrop.tsx | 3 +- ...ltivations.$b_lu_catalogue.crop._index.tsx | 3 +- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 3 +- ...ns.$b_lu_catalogue.crop.harvest._index.tsx | 3 +- ...ltivations.$b_lu_catalogue.fertilizers.tsx | 5 +-- ...b_id_farm.cultivations.$b_lu_catalogue.tsx | 5 +-- ....create.$b_id_farm.cultivations._index.tsx | 3 +- .../farm.create.$b_id_farm.cultivations.tsx | 3 +- .../farm.create.$b_id_farm.fields.$b_id.tsx | 5 +-- .../farm.create.$b_id_farm.fields._index.tsx | 3 +- .../routes/farm.create.$b_id_farm.fields.tsx | 5 +-- fdm-app/app/routes/farm.create._index.tsx | 7 +++-- fdm-app/app/routes/farm.tsx | 3 +- fdm-app/app/routes/farm.whats-new.tsx | 23 +++++++++++--- fdm-app/app/routes/signin.tsx | 31 ++++++++++--------- fdm-app/fdm.config.ts | 3 +- fdm-app/tsconfig.json | 2 +- 44 files changed, 146 insertions(+), 75 deletions(-) diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 2f76ca17c..3a79bab28 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -47,6 +47,7 @@ import { useEffect, useState } from "react" import { Form, NavLink } from "react-router" import { toast } from "sonner" import { useFarm } from "@/context/farm-context" +import config from "~/fdm.config" interface SideBarAppType { user: { @@ -152,7 +153,7 @@ export function SidebarApp(props: SideBarAppType) {
- MINAS2 + {config.name} {/* 2024 */}
diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index 0f558c0bf..9635a3799 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -78,7 +78,7 @@ export function Layout() { }, [toast]) return ( - + { return [ - { title: "Authenticatie | FDM" }, + { title: `Authenticatie | ${config.name}` }, { name: "description", content: - "Beveiligde authenticatie voor toegang tot het FDM platform.", + "Beveiligde authenticatie voor toegang tot het platform.", }, ] } diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx index 48c675c6b..20a36e159 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx @@ -11,11 +11,12 @@ import { data, useLoaderData, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Hoogte - Kaart | MINAS2" }, + { title: `Hoogte - Kaart | ${config.name}` }, { name: "description", content: "Bekijk hoogtegegevens op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index daab4a1bc..657e47741 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -21,10 +21,11 @@ import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Percelen - Kaart | MINAS2" }, + { title: `Percelen - Kaart | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index 11278ab73..e1af81476 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -11,11 +11,12 @@ import { data, useLoaderData, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bodem - Kaart | MINAS2" }, + { title: `Bodem - Kaart | ${config.name}` }, { name: "description", content: "Bekijk bodemgegevens op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx index 7424be277..ab672ce20 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx @@ -16,11 +16,12 @@ import { useLocation, } from "react-router" import { ClientOnly } from "remix-utils/client-only" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Kaarten | MINAS2" }, + { title: `Kaarten | ${config.name}` }, { name: "description", content: "Bekijk informatie op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index a4684eff7..940ba1ff1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -22,10 +22,11 @@ import { } from "react-router" import { ClientOnly } from "remix-utils/client-only" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Kaart - Perceel | MINAS2" }, + { title: `Kaart - Perceel | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx index c69ee9a0e..21ff82606 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx @@ -26,11 +26,12 @@ import { useLoaderData, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Gewas - Perceel | MINAS2" }, + { title: `Gewas - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index 0f834aaee..8e2a9dfb7 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -16,11 +16,12 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Oogst - Gewas - Perceel | MINAS2" }, + { title: `Oogst - Gewas - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de oogst van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx index 6ec4fe41b..c69d71f66 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx @@ -21,11 +21,12 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Oogsten - Gewas - Perceel | MINAS2" }, + { title: `Oogsten - Gewas - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de oogsten van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx index 2b70cebc9..fe776e2fc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx @@ -23,11 +23,12 @@ import { useLocation, } from "react-router" import {dataWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Gewas - Perceel | MINAS2" }, + { title: `Gewas - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de gewassen van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx index 6a7b49fbf..330a30f8d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx @@ -25,11 +25,12 @@ import { useLocation, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bemesting - Perceel | MINAS2" }, + { title: `Bemesting - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de bemestinggegevens van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx index 0412d029e..755c4f6af 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx @@ -4,12 +4,12 @@ import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, data, useLoaderData } from "react-router" - +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Gebruiksnormen - Perceel | MINAS2" }, + { title: `Gebruiksnormen - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de gebruiksnormen van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx index b6317d25e..7b6809fe5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx @@ -44,10 +44,11 @@ import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Overzicht - Perceel | MINAS2" }, + { title: `Overzicht - Perceel | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx index be80f68fc..12d6ea8dd 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx @@ -4,11 +4,12 @@ import { handleLoaderError } from "@/lib/error" import { fdm } from "@/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" -import type { MetaFunction } from "@remix-run/node" +import type { MetaFunction } from "react-router" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Bodemanalyse - Perceel | MINAS2" }, + { title: `Bodemanalyse - Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de bodemanalyses van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx index 695116cb5..984d7025c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx @@ -14,11 +14,12 @@ import { redirect, useLoaderData, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Perceel | MINAS2" }, + { title: `Perceel | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx index f06c388f8..910acc106 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx @@ -23,10 +23,11 @@ import { useLoaderData, } from "react-router" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Perceel | MINAS2" }, + { title: `Perceel | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx index 40bd4747e..da6161308 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx @@ -1,9 +1,10 @@ import { type MetaFunction, redirect } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Instellingen - Bedrijf | MINAS2" }, + { title: `Instellingen - Bedrijf | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de instellingen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index 6c0b2f294..3042b8a20 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -1,10 +1,11 @@ import { Separator } from "@/components/ui/separator" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Toegang - Instellingen - Bedrijf | MINAS2" }, + { title: `Toegang - Instellingen - Bedrijf | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de toegang tot je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx index 367c8cc18..f972eb25c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx @@ -1,10 +1,11 @@ import { Separator } from "@/components/ui/separator" import type { MetaFunction } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Verwijderen - Instellingen - Bedrijf | MINAS2" }, + { title: `Verwijderen - Instellingen - Bedrijf | ${config.name}` }, { name: "description", content: "Verwijder de gegevens van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx index c07ddf5d5..8a6592de1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx @@ -31,11 +31,12 @@ import { dataWithSuccess } from "remix-toast" import validator from "validator" import { z } from "zod" const { isPostalCode } = validator +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Eigenschappen - Instellingen - Bedrijf | MINAS2" }, + { title: `Eigenschappen - Instellingen - Bedrijf | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de eigenschappen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index 9f5a7eab1..0a96abaf4 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -14,11 +14,12 @@ import { data, useLoaderData, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Instellingen - Bedrijf | MINAS2" }, + { title: `Instellingen - Bedrijf | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de instellingen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.tsx b/fdm-app/app/routes/farm.$b_id_farm.tsx index 3ef46dd2f..f7974dfbc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.tsx @@ -1,11 +1,12 @@ import { getSession } from "@/lib/auth.server" import { handleActionError } from "@/lib/error" import { type LoaderFunctionArgs, type MetaFunction, data } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bedrijf | MINAS2" }, + { title: `Bedrijf | ${config.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je bedrijf.", @@ -13,7 +14,6 @@ export const meta: MetaFunction = () => { ] } - /** * Processes a request to retrieve a farm's session details. * diff --git a/fdm-app/app/routes/farm._index.tsx b/fdm-app/app/routes/farm._index.tsx index 79fc84e78..bf0a3dcef 100644 --- a/fdm-app/app/routes/farm._index.tsx +++ b/fdm-app/app/routes/farm._index.tsx @@ -16,11 +16,12 @@ import { fdm } from "@/lib/fdm.server" import { getTimeBasedGreeting } from "@/lib/greetings" import { getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, NavLink, useLoaderData } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bedrijf | MINAS2" }, + { title: `Bedrijf | ${config.name}` }, { name: "description", content: "Selecteer een bedrijf.", diff --git a/fdm-app/app/routes/farm.account.tsx b/fdm-app/app/routes/farm.account.tsx index cc24ed726..b42f4bf9d 100644 --- a/fdm-app/app/routes/farm.account.tsx +++ b/fdm-app/app/routes/farm.account.tsx @@ -1,6 +1,6 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" -import { type LoaderFunctionArgs, useLoaderData } from "react-router" +import { type LoaderFunctionArgs, type MetaFunction, useLoaderData } from "react-router" import { Card, CardContent, @@ -18,6 +18,18 @@ import { } from "@/components/ui/breadcrumb" import { FarmTitle } from "@/components/custom/farm/farm-title" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" +import config from "~/fdm.config" + +// Meta +export const meta: MetaFunction = () => { + return [ + { title: `Account | ${config.name}` }, + { + name: "description", + content: "Bekijk en bewerk de gegevens van je account.", + }, + ] +} /** * Retrieves the user session data. @@ -36,7 +48,7 @@ export async function loader({ request }: LoaderFunctionArgs) { // Return user information from loader return { user: session.user, - initials: session.initials + initials: session.initials, } } catch (error) { throw handleLoaderError(error) @@ -101,10 +113,16 @@ export default function Account() {

- Voornaam: {user.firstname} + Voornaam:{" "} + + {user.firstname} +

- Achternaam: {user.surname} + Achternaam:{" "} + + {user.surname} +

diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 255c5ebfd..28ab47943 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -50,12 +50,13 @@ import { } from "react-router" import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Kaart - Bedrijf toevoegen | MINAS2" }, + { title: `Kaart - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx index 5bb702baf..c52825a56 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,9 +1,10 @@ import type { MetaFunction } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Vanggewas - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Vanggewas - Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx index e3a83c2aa..454e9c449 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx @@ -22,11 +22,12 @@ import { useLoaderData, } from "react-router" import { dataWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Gewas- Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Gewas- Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index 21a0a1ff2..67d82742f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -14,11 +14,12 @@ import { data, useLoaderData, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Oogst - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Oogst - Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index 8e7ff9e4f..ccc0774c7 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -18,11 +18,12 @@ import { data, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Oogst- Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Oogst- Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx index aad034450..8445da5dc 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -23,12 +23,13 @@ import { useLocation, } from "react-router" import { dataWithSuccess } from "remix-toast" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bemesting - Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Bemesting - Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: "Bekijk en voeg bemestingen toe aan je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index 2726f1e06..621284707 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -15,12 +15,13 @@ import { useLocation, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bowupland - Bedrijf toevoegen | MINAS2" }, + { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: "Bekijk en selecteer een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx index 00f8c3152..c96a45e4a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx @@ -7,11 +7,12 @@ import { type MetaFunction, redirect, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bouwplan - Bedrijf toevoegen | MINAS2" }, + { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: "Bekijk en selecteer een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx index 1ae2d0db1..43ad4fd26 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx @@ -22,11 +22,12 @@ import { data, } from "react-router" import { Outlet, useLoaderData } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bowuplan - Bedrijf toevoegen | MINAS2" }, + { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: "Beheer de gewassen op je percelen.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index 87dc4546d..7dc3f8ce4 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -53,13 +53,14 @@ import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" import { z } from "zod" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" import { useEffect } from "react" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Perceel bewerken - Bedrijf toevoegen | MINAS2" }, + { title: `Perceel bewerken - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx index 6c2ec2f52..d1123ff40 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx @@ -7,11 +7,12 @@ import { type MetaFunction, redirect, } from "react-router" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Percelen beheren - Bedrijf toevoegen | MINAS2" }, + { title: `Percelen beheren - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx index 306709416..4606e533c 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx @@ -26,12 +26,13 @@ import { data, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Percelen beheren - Bedrijf toevoegen | MINAS2" }, + { title: `Percelen beheren - Bedrijf toevoegen | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 29fa9b58c..6dcbb59ce 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -26,16 +26,17 @@ import type { import { useLoaderData } from "react-router" import { redirectWithSuccess } from "remix-toast" import { z } from "zod" -import { fdm } from "../lib/fdm.server" +import { fdm } from "@/lib/fdm.server" +import config from "~/fdm.config" // Meta export const meta: MetaFunction = () => { return [ - { title: "Bedrijf toevoegen | MINAS2" }, + { title: `Bedrijf toevoegen | ${config.name}` }, { name: "description", content: - "Voeg een nieuw bedrijf toe aan MINAS2.", + "Voeg een nieuw bedrijf toe.", }, ] } diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index aed21de22..ffc4b55e1 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -15,10 +15,11 @@ import WhatsNew from "./farm.whats-new" import Account from "./farm.account" import { SidebarInset } from "@/components/ui/sidebar" import { Outlet } from "react-router-dom" +import config from "~/fdm.config" export const meta: MetaFunction = () => { return [ - { title: "Dashboard | MINAS2" }, + { title: `Dashboard | ${config.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index 57083a3d2..c16fd233e 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -1,6 +1,10 @@ import { getSession } from "@/lib/auth.server" import { handleLoaderError } from "@/lib/error" -import { type LoaderFunctionArgs, useLoaderData } from "react-router" +import { + type LoaderFunctionArgs, + type MetaFunction, + useLoaderData, +} from "react-router" import { formatDistanceToNow } from "date-fns" import { nl } from "date-fns/locale" import { FarmTitle } from "@/components/custom/farm/farm-title" @@ -16,6 +20,17 @@ import { import { SidebarTrigger } from "@/components/ui/sidebar" import ReactMarkdown from "react-markdown" import remarkGfm from "remark-gfm" +import config from "~/fdm.config" + +export const meta: MetaFunction = () => { + return [ + { title: `Wat is er nieuw? | ${config.name}` }, + { + name: "description", + content: `Blijf op de hoogte van de laatste ontwikkelingen en verbeteringen van ${config.name}.`, + }, + ] +} // Define the structure for a single update post export interface UpdatePost { @@ -26,12 +41,12 @@ export interface UpdatePost { isNew?: boolean } -// Sample data for update posts (replace with a database or CMS later) +// Dta for update posts export const updatePosts: UpdatePost[] = [ { id: "update-1", - title: "Lancering MINAS2 🎉", - description: `MINAS2 is gelanceerd! Vanaf nu kun je bedrijven aanmaken, percelen toevoegen en bemestingen invullen. + title: `Lancering ${config.name} 🎉`, + description: `${config.name} is gelanceerd! Vanaf nu kun je bedrijven aanmaken, percelen toevoegen en bemestingen invullen. **Nieuwe features:** - Account aanmaken diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index c377a4fd8..bd5f23bda 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -17,6 +17,17 @@ import { redirect } from "react-router" import { toast } from "sonner" import type { MetaFunction } from "react-router" import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" +import config from "~/fdm.config" + +export const meta: MetaFunction = () => { + return [ + { title: `Aanmelden | ${config.name}` }, + { + name: "description", + content: `Meld je aan bij ${config.name} om toegang te krijgen tot je dashboard en je bedrijfsgegevens te beheren.`, + }, + ] +} /** * Checks for an existing user session and redirects authenticated users. @@ -72,8 +83,8 @@ export default function SignIn() {
- {/* Logo MINAS2 */} -

MINAS2

+ {/* Logo ${config.name} */} +

${config.name}

Maak een account aan en krijg toegang tot:

@@ -148,8 +159,8 @@ export default function SignIn() {

- MINAS2 is nog in ontwikkeling. Functionaliteiten - kunnen nog ontbreken of veranderen. + {`${config.name} is nog in ontwikkeling. Functionaliteiten + kunnen nog ontbreken of veranderen.`}

@@ -278,7 +289,7 @@ export default function SignIn() {
@@ -296,13 +307,3 @@ export default function SignIn() {
) } - -export const meta: MetaFunction = () => { - return [ - { title: "Aanmelden | MINAS2" }, - { - name: "description", - content: "Meld je aan bij MINAS2!", - }, - ] -} diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 7fc448885..c1cd0640f 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -1,4 +1,4 @@ -export const config: Config = { +const config: Config = { // Site name name: "FDM", favicon: "/favicon.ico", @@ -33,6 +33,7 @@ export const config: Config = { }, } +export default config interface Config { name: string favicon: string diff --git a/fdm-app/tsconfig.json b/fdm-app/tsconfig.json index 145dff5ef..dfa503401 100644 --- a/fdm-app/tsconfig.json +++ b/fdm-app/tsconfig.json @@ -27,7 +27,7 @@ "baseUrl": ".", "paths": { "@/*": ["./app/*"], - "~/*": ["./app/*"] + "~/*": ["./*"] }, "rootDirs": [".", "./.react-router/types"], From 9e18bf4b58781b6a2129e3aa7f0ba83bd999e74e Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:05:42 +0100 Subject: [PATCH 08/35] Standardize use of of paths --- fdm-app/app/components/blocks/farm.tsx | 9 +- fdm-app/app/components/blocks/fields.tsx | 20 ++-- .../components/custom/atlas/atlas-panels.tsx | 10 +- fdm-app/app/components/custom/combobox.tsx | 11 +-- .../components/custom/cultivation/form.tsx | 10 +- .../components/custom/cultivation/list.tsx | 2 +- .../components/custom/farm/farm-content.tsx | 2 +- .../components/custom/farm/farm-header.tsx | 12 +-- .../custom/farm/farm-pagination.tsx | 2 +- .../app/components/custom/farm/farm-title.tsx | 2 +- .../custom/fertilizer-applications.tsx | 16 +-- .../custom/fertilizer-applications/cards.tsx | 6 +- .../custom/fertilizer-applications/form.tsx | 12 +-- .../custom/fertilizer-applications/list.tsx | 2 +- .../app/components/custom/harvest/form.tsx | 12 +-- .../app/components/custom/harvest/list.tsx | 2 +- .../app/components/custom/loadingspinner.tsx | 2 +- .../app/components/custom/multi-select.tsx | 10 +- fdm-app/app/components/custom/sidebar-app.tsx | 17 ++-- .../app/components/custom/sidebar-page.tsx | 4 +- fdm-app/app/entry.client.tsx | 98 ++++++++++--------- fdm-app/app/lib/auth.server.ts | 2 +- fdm-app/app/root.tsx | 3 +- fdm-app/app/routes/api.auth.$.tsx | 6 +- .../farm.$b_id_farm.atlas.elevation.tsx | 12 +-- .../routes/farm.$b_id_farm.atlas.fields.tsx | 20 ++-- .../app/routes/farm.$b_id_farm.atlas.soil.tsx | 12 +-- fdm-app/app/routes/farm.$b_id_farm.atlas.tsx | 16 +-- .../farm.$b_id_farm.field.$b_id.atlas.tsx | 20 ++-- ...m.field.$b_id.cultivation.$b_lu._index.tsx | 23 ++--- ...ivation.$b_lu.harvest.$b_id_harvesting.tsx | 19 ++-- ...$b_id.cultivation.$b_lu.harvest._index.tsx | 19 ++-- ...id_farm.field.$b_id.cultivation._index.tsx | 18 ++-- ...farm.$b_id_farm.field.$b_id.fertilizer.tsx | 20 ++-- .../farm.$b_id_farm.field.$b_id.norm.tsx | 10 +- .../farm.$b_id_farm.field.$b_id.overview.tsx | 28 +++--- .../farm.$b_id_farm.field.$b_id.soil.tsx | 10 +- .../routes/farm.$b_id_farm.field.$b_id.tsx | 16 +-- .../routes/farm.$b_id_farm.field._index.tsx | 22 ++--- .../farm.$b_id_farm.settings._index.tsx | 2 +- .../farm.$b_id_farm.settings.access.tsx | 4 +- .../farm.$b_id_farm.settings.delete.tsx | 4 +- .../farm.$b_id_farm.settings.properties.tsx | 22 ++--- .../app/routes/farm.$b_id_farm.settings.tsx | 18 ++-- fdm-app/app/routes/farm.$b_id_farm.tsx | 6 +- fdm-app/app/routes/farm._index.tsx | 22 ++--- fdm-app/app/routes/farm.account.tsx | 18 ++-- .../routes/farm.create.$b_id_farm.atlas.tsx | 30 +++--- ...cultivations.$b_lu_catalogue.covercrop.tsx | 2 +- ...ltivations.$b_lu_catalogue.crop._index.tsx | 20 ++-- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 12 +-- ...ns.$b_lu_catalogue.crop.harvest._index.tsx | 16 +-- ...ltivations.$b_lu_catalogue.fertilizers.tsx | 20 ++-- ...b_id_farm.cultivations.$b_lu_catalogue.tsx | 10 +- ....create.$b_id_farm.cultivations._index.tsx | 8 +- .../farm.create.$b_id_farm.cultivations.tsx | 22 ++--- .../farm.create.$b_id_farm.fields.$b_id.tsx | 34 +++---- .../farm.create.$b_id_farm.fields._index.tsx | 8 +- .../routes/farm.create.$b_id_farm.fields.tsx | 20 ++-- fdm-app/app/routes/farm.create._index.tsx | 18 ++-- fdm-app/app/routes/farm.tsx | 14 +-- fdm-app/app/routes/farm.whats-new.tsx | 16 +-- fdm-app/app/routes/signin.tsx | 16 +-- fdm-app/tsconfig.json | 9 +- 64 files changed, 455 insertions(+), 453 deletions(-) diff --git a/fdm-app/app/components/blocks/farm.tsx b/fdm-app/app/components/blocks/farm.tsx index e13c9cebb..87eaa4d19 100644 --- a/fdm-app/app/components/blocks/farm.tsx +++ b/fdm-app/app/components/blocks/farm.tsx @@ -2,8 +2,7 @@ import { zodResolver } from "@hookform/resolvers/zod" import { Form } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import type { z } from "zod" - -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -11,7 +10,7 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" +} from "~/components/ui/card" import { FormControl, FormDescription, @@ -19,8 +18,8 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { LoadingSpinner } from "../custom/loadingspinner" export interface fertilizersListType { diff --git a/fdm-app/app/components/blocks/fields.tsx b/fdm-app/app/components/blocks/fields.tsx index aa89c08f4..8e0bd5b53 100644 --- a/fdm-app/app/components/blocks/fields.tsx +++ b/fdm-app/app/components/blocks/fields.tsx @@ -1,10 +1,8 @@ import type { FeatureCollection } from "geojson" import { useEffect, useState } from "react" import { Form, useNavigation } from "react-router" - -import { FieldMap } from "@/components/blocks/field-map" -// Components -import { Button } from "@/components/ui/button" +import { FieldMap } from "~/components/blocks/field-map" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -12,7 +10,7 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" +} from "~/components/ui/card" import { Command, CommandEmpty, @@ -20,23 +18,23 @@ import { CommandInput, CommandItem, CommandList, -} from "@/components/ui/command" -import { Input } from "@/components/ui/input" -import { Label } from "@/components/ui/label" +} from "~/components/ui/command" +import { Input } from "~/components/ui/input" +import { Label } from "~/components/ui/label" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" +} from "~/components/ui/popover" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" +} from "~/components/ui/select" import { useToast } from "@/hooks/use-toast" -import { cn } from "@/lib/utils" +import { cn } from "~/lib/utils" import { Check, ChevronsUpDown } from "lucide-react" import { ClientOnly } from "remix-utils/client-only" import { Skeleton } from "../ui/skeleton" diff --git a/fdm-app/app/components/custom/atlas/atlas-panels.tsx b/fdm-app/app/components/custom/atlas/atlas-panels.tsx index 950026f2f..99919bdff 100644 --- a/fdm-app/app/components/custom/atlas/atlas-panels.tsx +++ b/fdm-app/app/components/custom/atlas/atlas-panels.tsx @@ -1,6 +1,6 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" -import { Button } from "@/components/ui/button" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -8,8 +8,8 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" -import { cn } from "@/lib/utils" +} from "~/components/ui/card" +import { cn } from "~/lib/utils" import type { FeatureCollection } from "geojson" import throttle from "lodash.throttle" import { Check, Info } from "lucide-react" diff --git a/fdm-app/app/components/custom/combobox.tsx b/fdm-app/app/components/custom/combobox.tsx index e7b785297..b39eba614 100644 --- a/fdm-app/app/components/custom/combobox.tsx +++ b/fdm-app/app/components/custom/combobox.tsx @@ -1,6 +1,5 @@ import { type ReactNode, useMemo, useState } from "react" - -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { Command, CommandEmpty, @@ -8,7 +7,7 @@ import { CommandInput, CommandItem, CommandList, -} from "@/components/ui/command" +} from "~/components/ui/command" import { FormControl, FormDescription, @@ -16,13 +15,13 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" +} from "~/components/ui/form" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { cn } from "@/lib/utils" +} from "~/components/ui/popover" +import { cn } from "~/lib/utils" import { Check, ChevronsUpDown } from "lucide-react" type optionType = { diff --git a/fdm-app/app/components/custom/cultivation/form.tsx b/fdm-app/app/components/custom/cultivation/form.tsx index c41c575f7..6ade23e4c 100644 --- a/fdm-app/app/components/custom/cultivation/form.tsx +++ b/fdm-app/app/components/custom/cultivation/form.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -7,13 +7,13 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" +} from "~/components/ui/form" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { cn } from "@/lib/utils" +} from "~/components/ui/popover" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns/format" import { nl } from "date-fns/locale/nl" diff --git a/fdm-app/app/components/custom/cultivation/list.tsx b/fdm-app/app/components/custom/cultivation/list.tsx index 35ed9ce8a..67ed61463 100644 --- a/fdm-app/app/components/custom/cultivation/list.tsx +++ b/fdm-app/app/components/custom/cultivation/list.tsx @@ -1,4 +1,4 @@ -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { format } from "date-fns/format" import { Pencil, Trash2 } from "lucide-react" import { NavLink, useFetcher } from "react-router" diff --git a/fdm-app/app/components/custom/farm/farm-content.tsx b/fdm-app/app/components/custom/farm/farm-content.tsx index 34acb31c5..18171b484 100644 --- a/fdm-app/app/components/custom/farm/farm-content.tsx +++ b/fdm-app/app/components/custom/farm/farm-content.tsx @@ -1,7 +1,7 @@ import { SidebarPage, type SidebarPageProps, -} from "@/components/custom/sidebar-page" +} from "~/components/custom/sidebar-page" import type { ReactNode } from "react" import { Outlet } from "react-router" diff --git a/fdm-app/app/components/custom/farm/farm-header.tsx b/fdm-app/app/components/custom/farm/farm-header.tsx index 9fdc249af..83461827c 100644 --- a/fdm-app/app/components/custom/farm/farm-header.tsx +++ b/fdm-app/app/components/custom/farm/farm-header.tsx @@ -4,18 +4,18 @@ import { BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, -} from "@/components/ui/breadcrumb" -import { Separator } from "@/components/ui/separator" -import { SidebarTrigger } from "@/components/ui/sidebar" +} from "~/components/ui/breadcrumb" +import { Separator } from "~/components/ui/separator" +import { SidebarTrigger } from "~/components/ui/sidebar" -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu" -import { cn } from "@/lib/utils" +} from "~/components/ui/dropdown-menu" +import { cn } from "~/lib/utils" import { ChevronDown } from "lucide-react" import { NavLink } from "react-router" import type { diff --git a/fdm-app/app/components/custom/farm/farm-pagination.tsx b/fdm-app/app/components/custom/farm/farm-pagination.tsx index bf34254e4..c8311d5b8 100644 --- a/fdm-app/app/components/custom/farm/farm-pagination.tsx +++ b/fdm-app/app/components/custom/farm/farm-pagination.tsx @@ -3,7 +3,7 @@ import { PaginationContent, PaginationItem, PaginationLink, -} from "@/components/ui/pagination" +} from "~/components/ui/pagination" import type { PaginationItems } from "./farm.d" interface PaginationLayoutProps { diff --git a/fdm-app/app/components/custom/farm/farm-title.tsx b/fdm-app/app/components/custom/farm/farm-title.tsx index e4946e7d2..4dc581312 100644 --- a/fdm-app/app/components/custom/farm/farm-title.tsx +++ b/fdm-app/app/components/custom/farm/farm-title.tsx @@ -1,4 +1,4 @@ -import { Separator } from "@/components/ui/separator" +import { Separator } from "~/components/ui/separator" interface FarmTitleProps { title: string diff --git a/fdm-app/app/components/custom/fertilizer-applications.tsx b/fdm-app/app/components/custom/fertilizer-applications.tsx index a104116a2..e87a779e7 100644 --- a/fdm-app/app/components/custom/fertilizer-applications.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications.tsx @@ -1,6 +1,6 @@ -import { Combobox } from "@/components/custom/combobox" -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { Combobox } from "~/components/custom/combobox" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -8,15 +8,15 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { Separator } from "@/components/ui/separator" -import { cn } from "@/lib/utils" +} from "~/components/ui/popover" +import { Separator } from "~/components/ui/separator" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" import { CalendarIcon } from "lucide-react" diff --git a/fdm-app/app/components/custom/fertilizer-applications/cards.tsx b/fdm-app/app/components/custom/fertilizer-applications/cards.tsx index e828ad273..b0956fdee 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/cards.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/cards.tsx @@ -1,11 +1,11 @@ -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, -} from "@/components/ui/tooltip" -import { cn } from "@/lib/utils" +} from "~/components/ui/tooltip" +import { cn } from "~/lib/utils" import type { Dose } from "@svenvw/fdm-calculator" import { Lightbulb, Scale } from "lucide-react" import type { FertilizerApplicationsCardProps } from "./types.d" diff --git a/fdm-app/app/components/custom/fertilizer-applications/form.tsx b/fdm-app/app/components/custom/fertilizer-applications/form.tsx index d87d42524..ef4b61c96 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/form.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/form.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -7,14 +7,14 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { cn } from "@/lib/utils" +} from "~/components/ui/popover" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" import { nl } from "date-fns/locale/nl" diff --git a/fdm-app/app/components/custom/fertilizer-applications/list.tsx b/fdm-app/app/components/custom/fertilizer-applications/list.tsx index 585002496..2b87e7b1d 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/list.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/list.tsx @@ -1,4 +1,4 @@ -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { format } from "date-fns" import { LoadingSpinner } from "../loadingspinner" import type { FertilizerApplication } from "./types.d" diff --git a/fdm-app/app/components/custom/harvest/form.tsx b/fdm-app/app/components/custom/harvest/form.tsx index 4bb6b6dfc..1fe7eaed9 100644 --- a/fdm-app/app/components/custom/harvest/form.tsx +++ b/fdm-app/app/components/custom/harvest/form.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -7,14 +7,14 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { cn } from "@/lib/utils" +} from "~/components/ui/popover" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns/format" import { nl } from "date-fns/locale/nl" diff --git a/fdm-app/app/components/custom/harvest/list.tsx b/fdm-app/app/components/custom/harvest/list.tsx index 60ca8524e..ed986540d 100644 --- a/fdm-app/app/components/custom/harvest/list.tsx +++ b/fdm-app/app/components/custom/harvest/list.tsx @@ -1,4 +1,4 @@ -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { format } from "date-fns/format" import { Eye, Trash2 } from "lucide-react" import { NavLink, useFetcher } from "react-router" diff --git a/fdm-app/app/components/custom/loadingspinner.tsx b/fdm-app/app/components/custom/loadingspinner.tsx index 391ee3aae..ffc53039b 100644 --- a/fdm-app/app/components/custom/loadingspinner.tsx +++ b/fdm-app/app/components/custom/loadingspinner.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "~/lib/utils" export interface ISVGProps extends React.SVGProps { size?: number diff --git a/fdm-app/app/components/custom/multi-select.tsx b/fdm-app/app/components/custom/multi-select.tsx index 54bf98374..af4b12510 100644 --- a/fdm-app/app/components/custom/multi-select.tsx +++ b/fdm-app/app/components/custom/multi-select.tsx @@ -10,8 +10,8 @@ import { } from "lucide-react" import * as React from "react" -import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" +import { Badge } from "~/components/ui/badge" +import { Button } from "~/components/ui/button" import { Command, CommandEmpty, @@ -20,13 +20,13 @@ import { CommandItem, CommandList, CommandSeparator, -} from "@/components/ui/command" +} from "~/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" -import { Separator } from "@/components/ui/separator" +} from "~/components/ui/popover" +import { Separator } from "~/components/ui/separator" import { cn } from "~/lib/utils" /** diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 3a79bab28..36c34bfb0 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -1,5 +1,5 @@ -import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" -import { Badge } from "@/components/ui/badge" +import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" +import { Badge } from "~/components/ui/badge" import { DropdownMenu, DropdownMenuContent, @@ -8,7 +8,7 @@ import { DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu" +} from "~/components/ui/dropdown-menu" import { Sidebar, SidebarContent, @@ -21,7 +21,7 @@ import { SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, -} from "@/components/ui/sidebar" +} from "~/components/ui/sidebar" import * as Sentry from "@sentry/react" import { ArrowRightLeft, @@ -40,14 +40,13 @@ import { Sprout, Square, } from "lucide-react" - -import { Button } from "@/components/ui/button" -import { useIsMobile } from "@/hooks/use-mobile" +import { Button } from "~/components/ui/button" +import { useIsMobile } from "~/hooks/use-mobile" import { useEffect, useState } from "react" import { Form, NavLink } from "react-router" import { toast } from "sonner" -import { useFarm } from "@/context/farm-context" -import config from "~/fdm.config" +import { useFarm } from "~/context/farm-context" +import config from "@/fdm.config" interface SideBarAppType { user: { diff --git a/fdm-app/app/components/custom/sidebar-page.tsx b/fdm-app/app/components/custom/sidebar-page.tsx index 83b347403..df81a49ab 100644 --- a/fdm-app/app/components/custom/sidebar-page.tsx +++ b/fdm-app/app/components/custom/sidebar-page.tsx @@ -1,7 +1,7 @@ import { NavLink, useLocation } from "react-router" -import { buttonVariants } from "@/components/ui/button" -import { cn } from "@/lib/utils" +import { buttonVariants } from "~/components/ui/button" +import { cn } from "~/lib/utils" export interface SidebarPageProps extends React.HTMLAttributes { items: { diff --git a/fdm-app/app/entry.client.tsx b/fdm-app/app/entry.client.tsx index 86d4173bc..ae2a6c383 100644 --- a/fdm-app/app/entry.client.tsx +++ b/fdm-app/app/entry.client.tsx @@ -8,57 +8,61 @@ import * as Sentry from "@sentry/react" import { StrictMode, startTransition } from "react" import { hydrateRoot } from "react-dom/client" import { HydratedRouter } from "react-router/dom" +import config from "@/fdm.config" -Sentry.init({ - dsn: import.meta.env.VITE_SENTRY_DSN, - environment: import.meta.env.NODE_ENV, - integrations: [ - Sentry.browserTracingIntegration(), - Sentry.replayIntegration(), - Sentry.feedbackIntegration({ - autoInject: false, - colorScheme: "system", - isNameRequired: true, - isEmailRequired: true, - enableScreenshot: true, - showBranding: false, - triggerLabel: "Geef feedback", - formTitle: "Geef feedback", - submitButtonLabel: "Verstuur", - cancelButtonLabel: "Annuleer", - confirmButtonLabel: "Bevestig", - addScreenshotButtonLabel: "Voeg een screenshot toe", - removeScreenshotButtonLabel: "Verwijder screenshot", - nameLabel: "Naam", - namePlaceholder: "Uw naam", - emailLabel: "E-mailadres", - emailPlaceholder: "Uw e-mailadres", - isRequiredLabel: "(vereist)", - messageLabel: "Beschrijving", - messagePlaceholder: - "Wat is uw feedback? Gaat er iets mis of zou u iets toegevoegd willen zien?", - successMessageText: "Bedankt voor uw feedback!", - useSentryUser: { - name: "fullName", - email: "email", - }, - }), - ], - // beforeSend(event, hint) { - // if (event.exception && event.event_id) { - // Sentry.showReportDialog({ eventId: event.event_id, lang: "nl" }) - // } - // return event - // }, +if (config.sentry) { + Sentry.init({ + dsn: import.meta.env.VITE_SENTRY_DSN, + environment: import.meta.env.NODE_ENV, + integrations: [ + Sentry.browserTracingIntegration(), + Sentry.replayIntegration(), + Sentry.feedbackIntegration({ + autoInject: false, + colorScheme: "system", + isNameRequired: true, + isEmailRequired: true, + enableScreenshot: true, + showBranding: false, + triggerLabel: "Geef feedback", + formTitle: "Geef feedback", + submitButtonLabel: "Verstuur", + cancelButtonLabel: "Annuleer", + confirmButtonLabel: "Bevestig", + addScreenshotButtonLabel: "Voeg een screenshot toe", + removeScreenshotButtonLabel: "Verwijder screenshot", + nameLabel: "Naam", + namePlaceholder: "Uw naam", + emailLabel: "E-mailadres", + emailPlaceholder: "Uw e-mailadres", + isRequiredLabel: "(vereist)", + messageLabel: "Beschrijving", + messagePlaceholder: + "Wat is uw feedback? Gaat er iets mis of zou u iets toegevoegd willen zien?", + successMessageText: "Bedankt voor uw feedback!", + useSentryUser: { + name: "fullName", + email: "email", + }, + }), + ], + // beforeSend(event, hint) { + // if (event.exception && event.event_id) { + // Sentry.showReportDialog({ eventId: event.event_id, lang: "nl" }) + // } + // return event + // }, - tracesSampleRate: import.meta.env.VITE_SENTRY_TRACE_SAMPLE_RATE, + tracesSampleRate: import.meta.env.VITE_SENTRY_TRACE_SAMPLE_RATE, - tracePropagationTargets: ["localhost"], + tracePropagationTargets: [window.location.hostname], - replaysSessionSampleRate: import.meta.env.VITE_SENTRY_REPLAY_SAMPLE_RATE, - replaysOnErrorSampleRate: import.meta.env - .VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR, -}) + replaysSessionSampleRate: import.meta.env + .VITE_SENTRY_REPLAY_SAMPLE_RATE, + replaysOnErrorSampleRate: import.meta.env + .VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR, + }) +} startTransition(() => { hydrateRoot( diff --git a/fdm-app/app/lib/auth.server.ts b/fdm-app/app/lib/auth.server.ts index 56616ac3b..91045f5ba 100644 --- a/fdm-app/app/lib/auth.server.ts +++ b/fdm-app/app/lib/auth.server.ts @@ -1,4 +1,4 @@ -import { fdm } from "@/lib/fdm.server" +import { fdm } from "~/lib/fdm.server" import { createFdmAuth } from "@svenvw/fdm-core" import type { Session, User } from "better-auth" diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index 9635a3799..ef1990714 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -1,6 +1,6 @@ import * as Sentry from "@sentry/react" -import { Toaster } from "@/components/ui/sonner" +import { Toaster } from "~/components/ui/sonner" import mapBoxStyle from "mapbox-gl/dist/mapbox-gl.css?url" import { useEffect } from "react" import { @@ -59,7 +59,6 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { export function Layout() { const loaderData = useLoaderData() const toast = loaderData?.toast - const location = useLocation() // Hook to show the toasts useEffect(() => { diff --git a/fdm-app/app/routes/api.auth.$.tsx b/fdm-app/app/routes/api.auth.$.tsx index 698521454..f402b7809 100644 --- a/fdm-app/app/routes/api.auth.$.tsx +++ b/fdm-app/app/routes/api.auth.$.tsx @@ -1,11 +1,11 @@ -import { auth } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" +import { auth } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" import type { ActionFunctionArgs, LoaderFunctionArgs, MetaFunction, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx index 20a36e159..eb775494c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx @@ -1,8 +1,8 @@ -import { getMapboxToken } from "@/components/custom/atlas/atlas-mapbox" -import { Button } from "@/components/ui/button" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { getMapboxToken } from "~/components/custom/atlas/atlas-mapbox" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -11,7 +11,7 @@ import { data, useLoaderData, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index 657e47741..d688a8aef 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -5,23 +5,23 @@ import { NavigationControl, } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" -import { ZOOM_LEVEL_FIELDS } from "@/components/custom/atlas/atlas" +import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { getMapboxStyle, getMapboxToken, -} from "@/components/custom/atlas/atlas-mapbox" -import { FieldsPanelHover } from "@/components/custom/atlas/atlas-panels" -import { FieldsSourceNotClickable } from "@/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "@/components/custom/atlas/atlas-styles" -import { getViewState } from "@/components/custom/atlas/atlas-viewstate" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +} from "~/components/custom/atlas/atlas-mapbox" +import { FieldsPanelHover } from "~/components/custom/atlas/atlas-panels" +import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index e1af81476..561dfdae0 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -1,8 +1,8 @@ -import { getMapboxToken } from "@/components/custom/atlas/atlas-mapbox" -import { Button } from "@/components/ui/button" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { getMapboxToken } from "~/components/custom/atlas/atlas-mapbox" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -11,7 +11,7 @@ import { data, useLoaderData, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx index ab672ce20..2e98909ce 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx @@ -1,10 +1,10 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { SidebarInset } from "@/components/ui/sidebar" -import { Skeleton } from "@/components/ui/skeleton" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -16,7 +16,7 @@ import { useLocation, } from "react-router" import { ClientOnly } from "remix-utils/client-only" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index 940ba1ff1..cff6ef5a4 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -3,15 +3,15 @@ import "mapbox-gl/dist/mapbox-gl.css" import { getMapboxStyle, getMapboxToken, -} from "@/components/custom/atlas/atlas-mapbox" -import { FieldsSourceNotClickable } from "@/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "@/components/custom/atlas/atlas-styles" -import { getViewState } from "@/components/custom/atlas/atlas-viewstate" -import { Separator } from "@/components/ui/separator" -import { Skeleton } from "@/components/ui/skeleton" -import { getSession } from "@/lib/auth.server" -import { handleActionError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +} from "~/components/custom/atlas/atlas-mapbox" +import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { Separator } from "~/components/ui/separator" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" +import { handleActionError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { @@ -22,7 +22,7 @@ import { } from "react-router" import { ClientOnly } from "remix-utils/client-only" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx index 21ff82606..36cdb0f87 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx @@ -1,13 +1,13 @@ -import { CultivationForm } from "@/components/custom/cultivation/form" -import { FormSchema } from "@/components/custom/cultivation/schema" -import { HarvestsList } from "@/components/custom/harvest/list" -import type { HarvestableType } from "@/components/custom/harvest/types" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { HarvestsList } from "~/components/custom/harvest/list" +import type { HarvestableType } from "~/components/custom/harvest/types" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { getCultivation, getCultivationsFromCatalogue, @@ -26,12 +26,13 @@ import { useLoaderData, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { return [ { title: `Gewas - Perceel | ${config.name}` }, + { name: "description", content: "Bekijk en bewerk de gegevens van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index 8e2a9dfb7..aa45e1a3f 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -1,11 +1,11 @@ -import { HarvestForm } from "@/components/custom/harvest/form" -import { FormSchema } from "@/components/custom/harvest/schema" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addHarvest, getCultivation, getHarvest } from "@svenvw/fdm-core" import { type ActionFunctionArgs, @@ -16,7 +16,7 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { @@ -24,6 +24,7 @@ export const meta: MetaFunction = () => { { title: `Oogst - Gewas - Perceel | ${config.name}` }, { name: "description", + content: "Bekijk en bewerk de oogst van je gewas.", }, ] diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx index c69d71f66..a47a4ec1d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx @@ -1,11 +1,11 @@ -import { HarvestForm } from "@/components/custom/harvest/form" -import { FormSchema } from "@/components/custom/harvest/schema" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addHarvest, getCultivation, @@ -21,7 +21,7 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { @@ -32,6 +32,7 @@ export const meta: MetaFunction = () => { content: "Bekijk en bewerk de oogsten van je gewas.", }, ] + } /** diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx index fe776e2fc..2c387c1d3 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx @@ -1,11 +1,11 @@ -import { CultivationForm } from "@/components/custom/cultivation/form" -import { CultivationList } from "@/components/custom/cultivation/list" -import { FormSchema } from "@/components/custom/cultivation/schema" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { CultivationList } from "~/components/custom/cultivation/list" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addCultivation, getCultivations, @@ -23,7 +23,7 @@ import { useLocation, } from "react-router" import {dataWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx index 330a30f8d..839bf0832 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx @@ -1,12 +1,12 @@ -import { FertilizerApplicationsCards } from "@/components/custom/fertilizer-applications/cards" -import { FertilizerApplicationForm } from "@/components/custom/fertilizer-applications/form" -import { FormSchema } from "@/components/custom/fertilizer-applications/formschema" -import { FertilizerApplicationsList } from "@/components/custom/fertilizer-applications/list" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" +import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, @@ -25,7 +25,7 @@ import { useLocation, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx index 755c4f6af..e550c9ee0 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx @@ -1,10 +1,10 @@ -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, data, useLoaderData } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx index 7b6809fe5..24b792cb6 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx @@ -1,6 +1,6 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -8,26 +8,26 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" +} from "~/components/ui/popover" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" -import { cn } from "@/lib/utils" +} from "~/components/ui/select" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import { getField, updateField } from "@svenvw/fdm-core" import { format } from "date-fns" @@ -44,7 +44,7 @@ import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx index 12d6ea8dd..bd281eac5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx @@ -1,11 +1,11 @@ -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx index 984d7025c..0d73915db 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx @@ -1,10 +1,10 @@ -import { FarmContent } from "@/components/custom/farm/farm-content" -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { FarmContent } from "~/components/custom/farm/farm-content" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFarms, getField, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -14,7 +14,7 @@ import { redirect, useLoaderData, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx index 910acc106..bdcba0718 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx @@ -1,19 +1,19 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { Button } from "@/components/ui/button" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { Button } from "~/components/ui/button" import { Card, CardContent, CardDescription, CardFooter, CardHeader, -} from "@/components/ui/card" -import { Separator } from "@/components/ui/separator" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { getTimeBasedGreeting } from "@/lib/greetings" +} from "~/components/ui/card" +import { Separator } from "~/components/ui/separator" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { getTimeBasedGreeting } from "~/lib/greetings" import { getFarms, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -23,7 +23,7 @@ import { useLoaderData, } from "react-router" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx index da6161308..2a8047c68 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx @@ -1,5 +1,5 @@ import { type MetaFunction, redirect } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index 3042b8a20..e93b39076 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -1,6 +1,6 @@ -import { Separator } from "@/components/ui/separator" +import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx index f972eb25c..2f56f4995 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx @@ -1,6 +1,6 @@ -import { Separator } from "@/components/ui/separator" +import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx index 8a6592de1..037546ad3 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx @@ -1,5 +1,5 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Button } from "@/components/ui/button" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" import { FormControl, FormDescription, @@ -7,14 +7,14 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" -import { Separator } from "@/components/ui/separator" -import { Textarea } from "@/components/ui/textarea" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" +import { Separator } from "~/components/ui/separator" +import { Textarea } from "~/components/ui/textarea" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { getFarm, updateFarm } from "@svenvw/fdm-core" import { useEffect } from "react" @@ -31,7 +31,7 @@ import { dataWithSuccess } from "remix-toast" import validator from "validator" import { z } from "zod" const { isPostalCode } = validator -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index 0a96abaf4..5d0e54852 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -1,11 +1,11 @@ -import { FarmContent } from "@/components/custom/farm/farm-content" -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { SidebarInset } from "@/components/ui/sidebar" -import { Toaster } from "@/components/ui/sonner" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { FarmContent } from "~/components/custom/farm/farm-content" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { Toaster } from "~/components/ui/sonner" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -14,7 +14,7 @@ import { data, useLoaderData, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.tsx b/fdm-app/app/routes/farm.$b_id_farm.tsx index f7974dfbc..8a166cd36 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.tsx @@ -1,7 +1,7 @@ -import { getSession } from "@/lib/auth.server" -import { handleActionError } from "@/lib/error" +import { getSession } from "~/lib/auth.server" +import { handleActionError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, data } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm._index.tsx b/fdm-app/app/routes/farm._index.tsx index bf0a3dcef..951312a0e 100644 --- a/fdm-app/app/routes/farm._index.tsx +++ b/fdm-app/app/routes/farm._index.tsx @@ -1,22 +1,22 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { Button } from "@/components/ui/button" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { Button } from "~/components/ui/button" import { Card, CardContent, CardDescription, CardFooter, CardHeader, -} from "@/components/ui/card" -import { Separator } from "@/components/ui/separator" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { getTimeBasedGreeting } from "@/lib/greetings" +} from "~/components/ui/card" +import { Separator } from "~/components/ui/separator" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { getTimeBasedGreeting } from "~/lib/greetings" import { getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, NavLink, useLoaderData } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.account.tsx b/fdm-app/app/routes/farm.account.tsx index b42f4bf9d..7436f791a 100644 --- a/fdm-app/app/routes/farm.account.tsx +++ b/fdm-app/app/routes/farm.account.tsx @@ -1,5 +1,5 @@ -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, useLoaderData } from "react-router" import { Card, @@ -7,18 +7,18 @@ import { CardDescription, CardHeader, CardTitle, -} from "@/components/ui/card" -import { Separator } from "@/components/ui/separator" -import { SidebarTrigger } from "@/components/ui/sidebar" +} from "~/components/ui/card" +import { Separator } from "~/components/ui/separator" +import { SidebarTrigger } from "~/components/ui/sidebar" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, -} from "@/components/ui/breadcrumb" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" -import config from "~/fdm.config" +} from "~/components/ui/breadcrumb" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 28ab47943..13e0e09a6 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -1,32 +1,32 @@ -import { ZOOM_LEVEL_FIELDS } from "@/components/custom/atlas/atlas" -import { generateFeatureClass } from "@/components/custom/atlas/atlas-functions" +import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" +import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" import { getMapboxStyle, getMapboxToken, -} from "@/components/custom/atlas/atlas-mapbox" +} from "~/components/custom/atlas/atlas-mapbox" import { FieldsPanelHover, FieldsPanelSelection, FieldsPanelZoom, -} from "@/components/custom/atlas/atlas-panels" +} from "~/components/custom/atlas/atlas-panels" import { FieldsSourceAvailable, FieldsSourceSelected, -} from "@/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "@/components/custom/atlas/atlas-styles" -import { getViewState } from "@/components/custom/atlas/atlas-viewstate" +} from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, -} from "@/components/ui/breadcrumb" -import { Separator } from "@/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar" -import { Skeleton } from "@/components/ui/skeleton" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" +} from "~/components/ui/breadcrumb" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" import { addCultivation, addField, @@ -50,8 +50,8 @@ import { } from "react-router" import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" -import { fdm } from "@/lib/fdm.server" -import config from "~/fdm.config" +import { fdm } from "~/lib/fdm.server" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx index c52825a56..4620a2027 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,5 +1,5 @@ import type { MetaFunction } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx index 454e9c449..51d49dcd2 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx @@ -1,12 +1,12 @@ -import { CultivationForm } from "@/components/custom/cultivation/form" -import { FormSchema } from "@/components/custom/cultivation/schema" -import { HarvestsList } from "@/components/custom/harvest/list" -import type { HarvestableType } from "@/components/custom/harvest/types" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { HarvestsList } from "~/components/custom/harvest/list" +import type { HarvestableType } from "~/components/custom/harvest/types" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { getCultivationPlan, getCultivationsFromCatalogue, @@ -22,7 +22,7 @@ import { useLoaderData, } from "react-router" import { dataWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index 67d82742f..ff4d21fad 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -1,8 +1,8 @@ -import { HarvestForm } from "@/components/custom/harvest/form" -import { Button } from "@/components/ui/button" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { HarvestForm } from "~/components/custom/harvest/form" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getCultivationPlan, getCultivationsFromCatalogue, @@ -14,7 +14,7 @@ import { data, useLoaderData, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index ccc0774c7..2a9761728 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -1,10 +1,10 @@ -import { HarvestForm } from "@/components/custom/harvest/form" -import { FormSchema } from "@/components/custom/harvest/schema" -import { Button } from "@/components/ui/button" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addHarvest, getCultivationPlan, @@ -18,7 +18,7 @@ import { data, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx index 8445da5dc..d0c46bef0 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -1,11 +1,11 @@ -import { FertilizerApplicationsCards } from "@/components/custom/fertilizer-applications/cards" -import { FertilizerApplicationForm } from "@/components/custom/fertilizer-applications/form" -import { FormSchema } from "@/components/custom/fertilizer-applications/formschema" -import { FertilizerApplicationsList } from "@/components/custom/fertilizer-applications/list" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { extractFormValuesFromRequest } from "@/lib/form" +import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" +import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { extractFormValuesFromRequest } from "~/lib/form" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, @@ -23,8 +23,8 @@ import { useLocation, } from "react-router" import { dataWithSuccess } from "remix-toast" -import { fdm } from "@/lib/fdm.server" -import config from "~/fdm.config" +import { fdm } from "~/lib/fdm.server" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index 621284707..a4d0805cd 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -3,9 +3,9 @@ import { PaginationContent, PaginationItem, PaginationLink, -} from "@/components/ui/pagination" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" +} from "~/components/ui/pagination" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -15,8 +15,8 @@ import { useLocation, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "@/lib/fdm.server" -import config from "~/fdm.config" +import { fdm } from "~/lib/fdm.server" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx index c96a45e4a..719daf1b8 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx @@ -1,13 +1,13 @@ -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, redirect, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx index 43ad4fd26..8336e9f8e 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx @@ -1,19 +1,19 @@ -import { SidebarPage } from "@/components/custom/sidebar-page" +import { SidebarPage } from "~/components/custom/sidebar-page" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, -} from "@/components/ui/breadcrumb" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar" -import { Toaster } from "@/components/ui/sonner" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { cn } from "@/lib/utils" +} from "~/components/ui/breadcrumb" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { Toaster } from "~/components/ui/sonner" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { cn } from "~/lib/utils" import { getCultivationPlan, getFarm } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -22,7 +22,7 @@ import { data, } from "react-router" import { Outlet, useLoaderData } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index 7dc3f8ce4..930436be1 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -1,14 +1,14 @@ import { getMapboxStyle, getMapboxToken, -} from "@/components/custom/atlas/atlas-mapbox" -import { FieldsSourceNotClickable } from "@/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "@/components/custom/atlas/atlas-styles" -import { getViewState } from "@/components/custom/atlas/atlas-viewstate" -import { Combobox } from "@/components/custom/combobox" -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Button } from "@/components/ui/button" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +} from "~/components/custom/atlas/atlas-mapbox" +import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { Combobox } from "~/components/custom/combobox" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" import { FormControl, FormDescription, @@ -16,19 +16,19 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" -import { Skeleton } from "@/components/ui/skeleton" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { extractFormValuesFromRequest } from "@/lib/form" +} from "~/components/ui/select" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { addSoilAnalysis, @@ -53,9 +53,9 @@ import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" import { z } from "zod" -import { fdm } from "@/lib/fdm.server" +import { fdm } from "~/lib/fdm.server" import { useEffect } from "react" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx index d1123ff40..0f094272f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx @@ -1,13 +1,13 @@ -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, redirect, } from "react-router" -import config from "~/fdm.config" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx index 4606e533c..555badd30 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx @@ -1,17 +1,17 @@ -import { SidebarPage } from "@/components/custom/sidebar-page" +import { SidebarPage } from "~/components/custom/sidebar-page" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, -} from "@/components/ui/breadcrumb" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { cn } from "@/lib/utils" +} from "~/components/ui/breadcrumb" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { cn } from "~/lib/utils" import { getCultivationsFromCatalogue, getFarm, @@ -26,8 +26,8 @@ import { data, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "@/lib/fdm.server" -import config from "~/fdm.config" +import { fdm } from "~/lib/fdm.server" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 6dcbb59ce..82a681fe8 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -1,16 +1,16 @@ -import { Farm } from "@/components/blocks/farm" +import { Farm } from "~/components/blocks/farm" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbSeparator, -} from "@/components/ui/breadcrumb" -import { Separator } from "@/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleActionError } from "@/lib/error" -import { extractFormValuesFromRequest } from "@/lib/form" +} from "~/components/ui/breadcrumb" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError } from "~/lib/error" +import { extractFormValuesFromRequest } from "~/lib/form" import { addFarm, addFertilizer, @@ -26,8 +26,8 @@ import type { import { useLoaderData } from "react-router" import { redirectWithSuccess } from "remix-toast" import { z } from "zod" -import { fdm } from "@/lib/fdm.server" -import config from "~/fdm.config" +import { fdm } from "~/lib/fdm.server" +import config from "@/fdm.config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index ffc4b55e1..90b5a8036 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -1,7 +1,7 @@ -import { SidebarApp } from "@/components/custom/sidebar-app" -import { SidebarProvider } from "@/components/ui/sidebar" -import { auth, getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" +import { SidebarApp } from "~/components/custom/sidebar-app" +import { SidebarProvider } from "~/components/ui/sidebar" +import { auth, getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" import type { ActionFunctionArgs, LoaderFunctionArgs, @@ -9,13 +9,13 @@ import type { } from "react-router" import { redirect, useRoutes } from "react-router" import { useLoaderData, useMatches } from "react-router" -import { FarmContext } from "@/context/farm-context" +import { FarmContext } from "~/context/farm-context" import { useState, useEffect } from "react" import WhatsNew from "./farm.whats-new" import Account from "./farm.account" -import { SidebarInset } from "@/components/ui/sidebar" +import { SidebarInset } from "~/components/ui/sidebar" import { Outlet } from "react-router-dom" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index c16fd233e..bbaa6f6f3 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -1,5 +1,5 @@ -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, @@ -7,20 +7,20 @@ import { } from "react-router" import { formatDistanceToNow } from "date-fns" import { nl } from "date-fns/locale" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Separator } from "@/components/ui/separator" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" +import { Separator } from "~/components/ui/separator" import { Sparkles } from "lucide-react" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, -} from "@/components/ui/breadcrumb" -import { SidebarTrigger } from "@/components/ui/sidebar" +} from "~/components/ui/breadcrumb" +import { SidebarTrigger } from "~/components/ui/sidebar" import ReactMarkdown from "react-markdown" import remarkGfm from "remark-gfm" -import config from "~/fdm.config" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index bd5f23bda..21d5be478 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -1,4 +1,4 @@ -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -6,18 +6,18 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" -import { signIn } from "@/lib/auth-client" -import { auth } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { cn } from "@/lib/utils" +} from "~/components/ui/card" +import { signIn } from "~/lib/auth-client" +import { auth } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { cn } from "~/lib/utils" import { Check, MoveDown, Info } from "lucide-react" import type { LoaderFunctionArgs } from "react-router" import { redirect } from "react-router" import { toast } from "sonner" import type { MetaFunction } from "react-router" -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" -import config from "~/fdm.config" +import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" +import config from "@/fdm.config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/tsconfig.json b/fdm-app/tsconfig.json index dfa503401..7cb10fd38 100644 --- a/fdm-app/tsconfig.json +++ b/fdm-app/tsconfig.json @@ -8,8 +8,9 @@ "**/.client/**/*.tsx", ".react-router/types/**/*", "app/routes/*.tsx", - "app/components/**/*.tsx" -, "app/lib/fdm-migrate.server.js" ], + "app/components/**/*.tsx", + "app/lib/fdm-migrate.server.js" + ], "compilerOptions": { "lib": ["DOM", "DOM.Iterable", "ES2022"], "types": ["@react-router/node", "vite/client"], @@ -26,8 +27,8 @@ "forceConsistentCasingInFileNames": true, "baseUrl": ".", "paths": { - "@/*": ["./app/*"], - "~/*": ["./*"] + "@/*": ["./*"], + "~/*": ["./app/*"] }, "rootDirs": [".", "./.react-router/types"], From 3fbd91e5b205c8f3f3243eeb93bc25ffe84df233 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 13:35:11 +0200 Subject: [PATCH 09/35] Enable split between client and server config --- fdm-app/app/lib/config.ts | 58 +++++++++++++++++++++++++++++++++++++++ fdm-app/fdm.config.ts | 40 ++++++--------------------- 2 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 fdm-app/app/lib/config.ts diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts new file mode 100644 index 000000000..1baf6edb2 --- /dev/null +++ b/fdm-app/app/lib/config.ts @@ -0,0 +1,58 @@ +import config from "@/fdm.config" + +// Export the full config for server-side use +export const serverConfig = config + +// Create the client-safe config object +export const clientConfig: ClientConfig = { + name: config.name, + favicon: config.favicon, + logo: config.logo, + analytics: { + sentry: config.analytics.sentry + ? { dsn: config.analytics.sentry.dsn } + : null, + }, +} + +export interface Config { + name: string + favicon: string + logo: string + auth: { + fdm_session_secret: string + better_auth_secret: string + google?: { + clientId: string + clientSecret: string + } | null + microsoft?: { + clientId: string + clientSecret: string + } | null + } + database: { + password: string + user: string + database: string + host: string + port: number + } + analytics: { + sentry?: { + dsn: string + } | null + } +} + +// Define the structure for client-safe configuration +interface ClientConfig { + name: string + favicon: string + logo: string + analytics: { + sentry?: { + dsn: string + } | null + } +} diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index c1cd0640f..6e518ec97 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -1,8 +1,10 @@ +import type { Config } from "~/lib/config" + const config: Config = { // Site name name: "FDM", favicon: "/favicon.ico", - logo: "/logo.svg", + logo: "/logo.svg", // Authentication auth: { @@ -27,37 +29,13 @@ const config: Config = { port: Number(process.env.DB_PORT), }, - // Sentry - sentry: { - dsn: String(process.env.SENTRY_DSN), + // Analytics + analytics: { + // Sentry + sentry: { + dsn: String(process.env.SENTRY_DSN), + }, }, } export default config -interface Config { - name: string - favicon: string - logo: string - auth: { - fdm_session_secret: string - better_auth_secret: string - google?: { - clientId: string - clientSecret: string - } | null - microsoft?: { - clientId: string - clientSecret: string - } | null - } - database: { - password: string - user: string - database: string - host: string - port: number - } - sentry?: { - dsn: string - } | null -} From 07a63ce6631cecb1bc413fedab88d091ef5ebfd4 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 13:49:22 +0200 Subject: [PATCH 10/35] Update importing the config for meta --- fdm-app/app/routes/api.auth.$.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.atlas.elevation.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.atlas.fields.tsx | 4 ++-- fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx | 4 ++-- fdm-app/app/routes/farm.$b_id_farm.atlas.tsx | 4 ++-- .../routes/farm.$b_id_farm.field.$b_id.atlas.tsx | 4 ++-- ...d_farm.field.$b_id.cultivation.$b_lu._index.tsx | 4 ++-- ....cultivation.$b_lu.harvest.$b_id_harvesting.tsx | 4 ++-- ...ield.$b_id.cultivation.$b_lu.harvest._index.tsx | 4 ++-- ...m.$b_id_farm.field.$b_id.cultivation._index.tsx | 4 ++-- .../farm.$b_id_farm.field.$b_id.fertilizer.tsx | 4 ++-- .../routes/farm.$b_id_farm.field.$b_id.norm.tsx | 4 ++-- .../farm.$b_id_farm.field.$b_id.overview.tsx | 4 ++-- .../routes/farm.$b_id_farm.field.$b_id.soil.tsx | 4 ++-- fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.field._index.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.settings._index.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.settings.access.tsx | 4 ++-- .../app/routes/farm.$b_id_farm.settings.delete.tsx | 4 ++-- .../routes/farm.$b_id_farm.settings.properties.tsx | 4 ++-- fdm-app/app/routes/farm.$b_id_farm.settings.tsx | 4 ++-- fdm-app/app/routes/farm.$b_id_farm.tsx | 4 ++-- fdm-app/app/routes/farm._index.tsx | 4 ++-- fdm-app/app/routes/farm.account.tsx | 4 ++-- .../app/routes/farm.create.$b_id_farm.atlas.tsx | 4 ++-- ...farm.cultivations.$b_lu_catalogue.covercrop.tsx | 4 ++-- ...rm.cultivations.$b_lu_catalogue.crop._index.tsx | 4 ++-- ..._lu_catalogue.crop.harvest.$b_id_harvesting.tsx | 4 ++-- ...vations.$b_lu_catalogue.crop.harvest._index.tsx | 4 ++-- ...rm.cultivations.$b_lu_catalogue.fertilizers.tsx | 4 ++-- ...ate.$b_id_farm.cultivations.$b_lu_catalogue.tsx | 4 ++-- .../farm.create.$b_id_farm.cultivations._index.tsx | 4 ++-- .../routes/farm.create.$b_id_farm.cultivations.tsx | 4 ++-- .../routes/farm.create.$b_id_farm.fields.$b_id.tsx | 4 ++-- .../farm.create.$b_id_farm.fields._index.tsx | 4 ++-- .../app/routes/farm.create.$b_id_farm.fields.tsx | 4 ++-- fdm-app/app/routes/farm.create._index.tsx | 4 ++-- fdm-app/app/routes/farm.tsx | 4 ++-- fdm-app/app/routes/farm.whats-new.tsx | 10 +++++----- fdm-app/app/routes/signin.tsx | 14 +++++++------- fdm-app/fdm.config.ts | 3 ++- 41 files changed, 90 insertions(+), 89 deletions(-) diff --git a/fdm-app/app/routes/api.auth.$.tsx b/fdm-app/app/routes/api.auth.$.tsx index f402b7809..9bee8a89d 100644 --- a/fdm-app/app/routes/api.auth.$.tsx +++ b/fdm-app/app/routes/api.auth.$.tsx @@ -5,11 +5,11 @@ import type { LoaderFunctionArgs, MetaFunction, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Authenticatie | ${config.name}` }, + { title: `Authenticatie | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx index eb775494c..fd8d0cc8c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx @@ -11,12 +11,12 @@ import { data, useLoaderData, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Hoogte - Kaart | ${config.name}` }, + { title: `Hoogte - Kaart | ${clientConfig.name}` }, { name: "description", content: "Bekijk hoogtegegevens op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index d688a8aef..bf169b44c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -21,11 +21,11 @@ import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Percelen - Kaart | ${config.name}` }, + { title: `Percelen - Kaart | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index 561dfdae0..e07b93d97 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -11,12 +11,12 @@ import { data, useLoaderData, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bodem - Kaart | ${config.name}` }, + { title: `Bodem - Kaart | ${clientConfig.name}` }, { name: "description", content: "Bekijk bodemgegevens op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx index 2e98909ce..100e977d6 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.tsx @@ -16,12 +16,12 @@ import { useLocation, } from "react-router" import { ClientOnly } from "remix-utils/client-only" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Kaarten | ${config.name}` }, + { title: `Kaarten | ${clientConfig.name}` }, { name: "description", content: "Bekijk informatie op de kaart.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index cff6ef5a4..70876bc6a 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -22,11 +22,11 @@ import { } from "react-router" import { ClientOnly } from "remix-utils/client-only" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Kaart - Perceel | ${config.name}` }, + { title: `Kaart - Perceel | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx index 36cdb0f87..e3d38bb82 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu._index.tsx @@ -26,12 +26,12 @@ import { useLoaderData, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Gewas - Perceel | ${config.name}` }, + { title: `Gewas - Perceel | ${clientConfig.name}` }, { name: "description", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index aa45e1a3f..e352d7890 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -16,12 +16,12 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Oogst - Gewas - Perceel | ${config.name}` }, + { title: `Oogst - Gewas - Perceel | ${clientConfig.name}` }, { name: "description", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx index a47a4ec1d..71a1966cc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation.$b_lu.harvest._index.tsx @@ -21,12 +21,12 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Oogsten - Gewas - Perceel | ${config.name}` }, + { title: `Oogsten - Gewas - Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de oogsten van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx index 2c387c1d3..b0e643a46 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.cultivation._index.tsx @@ -23,12 +23,12 @@ import { useLocation, } from "react-router" import {dataWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Gewas - Perceel | ${config.name}` }, + { title: `Gewas - Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de gewassen van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx index 839bf0832..3595df399 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.fertilizer.tsx @@ -25,12 +25,12 @@ import { useLocation, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bemesting - Perceel | ${config.name}` }, + { title: `Bemesting - Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de bemestinggegevens van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx index e550c9ee0..88272263e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.norm.tsx @@ -4,12 +4,12 @@ import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, data, useLoaderData } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Gebruiksnormen - Perceel | ${config.name}` }, + { title: `Gebruiksnormen - Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de gebruiksnormen van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx index 24b792cb6..9a3b7d255 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.overview.tsx @@ -44,11 +44,11 @@ import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Overzicht - Perceel | ${config.name}` }, + { title: `Overzicht - Perceel | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx index bd281eac5..ff13699b1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.soil.tsx @@ -5,11 +5,11 @@ import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Bodemanalyse - Perceel | ${config.name}` }, + { title: `Bodemanalyse - Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de bodemanalyses van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx index 0d73915db..facdf9f3b 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.tsx @@ -14,12 +14,12 @@ import { redirect, useLoaderData, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Perceel | ${config.name}` }, + { title: `Perceel | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je perceel.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx index bdcba0718..d2e2d5324 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field._index.tsx @@ -23,11 +23,11 @@ import { useLoaderData, } from "react-router" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Perceel | ${config.name}` }, + { title: `Perceel | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx index 2a8047c68..845f83212 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx @@ -1,10 +1,10 @@ import { type MetaFunction, redirect } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Instellingen - Bedrijf | ${config.name}` }, + { title: `Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de instellingen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index e93b39076..046b8f327 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -1,11 +1,11 @@ import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Toegang - Instellingen - Bedrijf | ${config.name}` }, + { title: `Toegang - Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de toegang tot je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx index 2f56f4995..b3121a2d0 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx @@ -1,11 +1,11 @@ import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Verwijderen - Instellingen - Bedrijf | ${config.name}` }, + { title: `Verwijderen - Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Verwijder de gegevens van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx index 037546ad3..5f5663c73 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx @@ -31,12 +31,12 @@ import { dataWithSuccess } from "remix-toast" import validator from "validator" import { z } from "zod" const { isPostalCode } = validator -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Eigenschappen - Instellingen - Bedrijf | ${config.name}` }, + { title: `Eigenschappen - Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de eigenschappen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index 5d0e54852..fbeb4ae00 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -14,12 +14,12 @@ import { data, useLoaderData, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Instellingen - Bedrijf | ${config.name}` }, + { title: `Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de instellingen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.tsx b/fdm-app/app/routes/farm.$b_id_farm.tsx index 8a166cd36..c4e08cb7d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.tsx @@ -1,12 +1,12 @@ import { getSession } from "~/lib/auth.server" import { handleActionError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, data } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bedrijf | ${config.name}` }, + { title: `Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je bedrijf.", diff --git a/fdm-app/app/routes/farm._index.tsx b/fdm-app/app/routes/farm._index.tsx index 951312a0e..d156e89c8 100644 --- a/fdm-app/app/routes/farm._index.tsx +++ b/fdm-app/app/routes/farm._index.tsx @@ -16,12 +16,12 @@ import { fdm } from "~/lib/fdm.server" import { getTimeBasedGreeting } from "~/lib/greetings" import { getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, NavLink, useLoaderData } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bedrijf | ${config.name}` }, + { title: `Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Selecteer een bedrijf.", diff --git a/fdm-app/app/routes/farm.account.tsx b/fdm-app/app/routes/farm.account.tsx index 7436f791a..02da518fe 100644 --- a/fdm-app/app/routes/farm.account.tsx +++ b/fdm-app/app/routes/farm.account.tsx @@ -18,12 +18,12 @@ import { } from "~/components/ui/breadcrumb" import { FarmTitle } from "~/components/custom/farm/farm-title" import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Account | ${config.name}` }, + { title: `Account | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de gegevens van je account.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 13e0e09a6..695699069 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -51,12 +51,12 @@ import { import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" import { fdm } from "~/lib/fdm.server" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Kaart - Bedrijf toevoegen | ${config.name}` }, + { title: `Kaart - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx index 4620a2027..b74da468c 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,10 +1,10 @@ import type { MetaFunction } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Vanggewas - Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Vanggewas - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx index 51d49dcd2..57a239009 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop._index.tsx @@ -22,12 +22,12 @@ import { useLoaderData, } from "react-router" import { dataWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Gewas- Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Gewas- Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index ff4d21fad..fcbaa99b4 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -14,12 +14,12 @@ import { data, useLoaderData, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Oogst - Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Oogst - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index 2a9761728..77d24ece4 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -18,12 +18,12 @@ import { data, } from "react-router" import { redirectWithSuccess } from "remix-toast" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Oogst- Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Oogst- Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx index d0c46bef0..70318664a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -24,12 +24,12 @@ import { } from "react-router" import { dataWithSuccess } from "remix-toast" import { fdm } from "~/lib/fdm.server" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bemesting - Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Bemesting - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: "Bekijk en voeg bemestingen toe aan je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx index a4d0805cd..3d246f2af 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.$b_lu_catalogue.tsx @@ -16,12 +16,12 @@ import { } from "react-router" import { useLoaderData } from "react-router" import { fdm } from "~/lib/fdm.server" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: "Bekijk en selecteer een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx index 719daf1b8..e9a3cd1dd 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations._index.tsx @@ -7,12 +7,12 @@ import { type MetaFunction, redirect, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: "Bekijk en selecteer een gewas uit je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx index 8336e9f8e..bd2f2b150 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.cultivations.tsx @@ -22,12 +22,12 @@ import { data, } from "react-router" import { Outlet, useLoaderData } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bouwplan - Bedrijf toevoegen | ${config.name}` }, + { title: `Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: "Beheer de gewassen op je percelen.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index 930436be1..cc2457664 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -55,12 +55,12 @@ import { ClientOnly } from "remix-utils/client-only" import { z } from "zod" import { fdm } from "~/lib/fdm.server" import { useEffect } from "react" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Perceel bewerken - Bedrijf toevoegen | ${config.name}` }, + { title: `Perceel bewerken - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx index 0f094272f..1b2e2e0ff 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields._index.tsx @@ -7,12 +7,12 @@ import { type MetaFunction, redirect, } from "react-router" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Percelen beheren - Bedrijf toevoegen | ${config.name}` }, + { title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx index 555badd30..01c6d0cf2 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.tsx @@ -27,12 +27,12 @@ import { } from "react-router" import { useLoaderData } from "react-router" import { fdm } from "~/lib/fdm.server" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Percelen beheren - Bedrijf toevoegen | ${config.name}` }, + { title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 82a681fe8..6fb80053b 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -27,12 +27,12 @@ import { useLoaderData } from "react-router" import { redirectWithSuccess } from "remix-toast" import { z } from "zod" import { fdm } from "~/lib/fdm.server" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bedrijf toevoegen | ${config.name}` }, + { title: `Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index 90b5a8036..b2ee249a2 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -15,11 +15,11 @@ import WhatsNew from "./farm.whats-new" import Account from "./farm.account" import { SidebarInset } from "~/components/ui/sidebar" import { Outlet } from "react-router-dom" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Dashboard | ${config.name}` }, + { title: `Dashboard | ${clientConfig.name}` }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index bbaa6f6f3..342c509ba 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -20,14 +20,14 @@ import { import { SidebarTrigger } from "~/components/ui/sidebar" import ReactMarkdown from "react-markdown" import remarkGfm from "remark-gfm" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Wat is er nieuw? | ${config.name}` }, + { title: `Wat is er nieuw? | ${clientConfig.name}` }, { name: "description", - content: `Blijf op de hoogte van de laatste ontwikkelingen en verbeteringen van ${config.name}.`, + content: `Blijf op de hoogte van de laatste ontwikkelingen en verbeteringen van ${clientConfig.name}.`, }, ] } @@ -45,8 +45,8 @@ export interface UpdatePost { export const updatePosts: UpdatePost[] = [ { id: "update-1", - title: `Lancering ${config.name} 🎉`, - description: `${config.name} is gelanceerd! Vanaf nu kun je bedrijven aanmaken, percelen toevoegen en bemestingen invullen. + title: `Lancering ${clientConfig.name} 🎉`, + description: `${clientConfig.name} is gelanceerd! Vanaf nu kun je bedrijven aanmaken, percelen toevoegen en bemestingen invullen. **Nieuwe features:** - Account aanmaken diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 21d5be478..b7761cf88 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -17,14 +17,14 @@ import { redirect } from "react-router" import { toast } from "sonner" import type { MetaFunction } from "react-router" import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ - { title: `Aanmelden | ${config.name}` }, + { title: `Aanmelden | ${clientConfig.name}` }, { name: "description", - content: `Meld je aan bij ${config.name} om toegang te krijgen tot je dashboard en je bedrijfsgegevens te beheren.`, + content: `Meld je aan bij ${clientConfig.name} om toegang te krijgen tot je dashboard en je bedrijfsgegevens te beheren.`, }, ] } @@ -83,8 +83,8 @@ export default function SignIn() {
- {/* Logo ${config.name} */} -

${config.name}

+ {/* Logo ${clientConfig.name} */} +

${clientConfig.name}

Maak een account aan en krijg toegang tot:

@@ -159,7 +159,7 @@ export default function SignIn() {

- {`${config.name} is nog in ontwikkeling. Functionaliteiten + {`${clientConfig.name} is nog in ontwikkeling. Functionaliteiten kunnen nog ontbreken of veranderen.`}

@@ -289,7 +289,7 @@ export default function SignIn() {
diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 6e518ec97..ad79e9639 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -2,7 +2,8 @@ import type { Config } from "~/lib/config" const config: Config = { // Site name - name: "FDM", + name: process.env.FDM_NAME || "FDM", + // Site logo favicon: "/favicon.ico", logo: "/logo.svg", From 2b3e5502c208cc6f18f5da18676306b22c359bd8 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:06:00 +0200 Subject: [PATCH 11/35] Use config for Senty --- fdm-app/app/entry.client.tsx | 15 +++++++-------- fdm-app/app/entry.server.tsx | 2 -- fdm-app/app/lib/cache.server.ts | 15 +++++++-------- fdm-app/app/lib/config.ts | 30 +++++++++++++++++++++++++++++- fdm-app/fdm.config.ts | 15 +++++++++++++++ fdm-app/vite.config.ts | 20 +++++++++++--------- 6 files changed, 69 insertions(+), 28 deletions(-) diff --git a/fdm-app/app/entry.client.tsx b/fdm-app/app/entry.client.tsx index ae2a6c383..7fb03467c 100644 --- a/fdm-app/app/entry.client.tsx +++ b/fdm-app/app/entry.client.tsx @@ -8,11 +8,12 @@ import * as Sentry from "@sentry/react" import { StrictMode, startTransition } from "react" import { hydrateRoot } from "react-dom/client" import { HydratedRouter } from "react-router/dom" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" -if (config.sentry) { +if (clientConfig.analytics.sentry) { + const sentryConfig = clientConfig.analytics.sentry Sentry.init({ - dsn: import.meta.env.VITE_SENTRY_DSN, + dsn: sentryConfig.dsn, environment: import.meta.env.NODE_ENV, integrations: [ Sentry.browserTracingIntegration(), @@ -53,14 +54,12 @@ if (config.sentry) { // return event // }, - tracesSampleRate: import.meta.env.VITE_SENTRY_TRACE_SAMPLE_RATE, + tracesSampleRate: sentryConfig.trace_sample_rate, tracePropagationTargets: [window.location.hostname], - replaysSessionSampleRate: import.meta.env - .VITE_SENTRY_REPLAY_SAMPLE_RATE, - replaysOnErrorSampleRate: import.meta.env - .VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR, + replaysSessionSampleRate: sentryConfig.replay_sample_rate, + replaysOnErrorSampleRate: sentryConfig.replay_sample_rate_on_error, }) } diff --git a/fdm-app/app/entry.server.tsx b/fdm-app/app/entry.server.tsx index 1314a55a5..aa5be8a47 100644 --- a/fdm-app/app/entry.server.tsx +++ b/fdm-app/app/entry.server.tsx @@ -4,9 +4,7 @@ * For more information, see https://remix.run/file-conventions/entry.server */ import * as Sentry from "@sentry/node" - import { PassThrough } from "node:stream" - import { createReadableStreamFromReadable } from "@react-router/node" import { isbot } from "isbot" import { renderToPipeableStream } from "react-dom/server" diff --git a/fdm-app/app/lib/cache.server.ts b/fdm-app/app/lib/cache.server.ts index b1788e667..7073f512a 100644 --- a/fdm-app/app/lib/cache.server.ts +++ b/fdm-app/app/lib/cache.server.ts @@ -1,4 +1,5 @@ import type { EntryContext } from "react-router" +import { clientConfig } from "./config" type CacheControl = { maxAge: number @@ -123,11 +124,11 @@ export function getCacheControlHeaders( * Add security headers to the response */ export function addSecurityHeaders(headers: Headers): Headers { - const sentryReportUri = process.env.VITE_SENTRY_SECURITY_REPORT_URI - if (!sentryReportUri) { - throw new Error( - "VITE_SENTRY_SECURITY_REPORT_URI environment variable is required", - ) + let reportUri = "" + if (clientConfig.analytics.sentry) { + reportUri = clientConfig.analytics.sentry.security_report_uri + .replace(/\s+/g, " ") + .trim() } headers.set( @@ -145,9 +146,7 @@ export function addSecurityHeaders(headers: Headers): Headers { base-uri 'self'; form-action 'self'; frame-ancestors 'none'; - report-uri ${sentryReportUri}` - .replace(/\s+/g, " ") - .trim(), + report-uri ${reportUri};`, ) headers.set("X-Content-Type-Options", "nosniff") headers.set("X-Frame-Options", "DENY") diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts index 1baf6edb2..e4f8926b9 100644 --- a/fdm-app/app/lib/config.ts +++ b/fdm-app/app/lib/config.ts @@ -10,7 +10,20 @@ export const clientConfig: ClientConfig = { logo: config.logo, analytics: { sentry: config.analytics.sentry - ? { dsn: config.analytics.sentry.dsn } + ? { + dsn: config.analytics.sentry.dsn, + organization: config.analytics.sentry.organization, + project: config.analytics.sentry.project, + trace_sample_rate: config.analytics.sentry.trace_sample_rate, + replay_sample_rate: + config.analytics.sentry.replay_sample_rate, + replay_sample_rate_on_error: + config.analytics.sentry.replay_sample_rate_on_error, + profile_sample_rate: + config.analytics.sentry.profile_sample_rate, + security_report_uri: + config.analytics.sentry.security_report_uri, + } : null, }, } @@ -41,6 +54,14 @@ export interface Config { analytics: { sentry?: { dsn: string + organization: string + project: string + auth_token: string + trace_sample_rate: number + replay_sample_rate: number + replay_sample_rate_on_error: number + profile_sample_rate: number + security_report_uri: string } | null } } @@ -53,6 +74,13 @@ interface ClientConfig { analytics: { sentry?: { dsn: string + organization: string + project: string + trace_sample_rate: number + replay_sample_rate: number + replay_sample_rate_on_error: number + profile_sample_rate: number + security_report_uri: string } | null } } diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index ad79e9639..4cbfeb488 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -35,6 +35,21 @@ const config: Config = { // Sentry sentry: { dsn: String(process.env.SENTRY_DSN), + organization: String(process.env.VITE_SENTRY_ORG), + project: String(process.env.VITE_SENTRY_PROJECT), + auth_token: String(process.env.SENTRY_AUTH_TOKEN), + trace_sample_rate: + Number(process.env.VITE_SENTRY_TRACE_SAMPLE_RATE) || 1, + replay_sample_rate: + Number(process.env.VITE_SENTRY_REPLAY_SAMPLE_RATE) || 0, + replay_sample_rate_on_error: + Number(process.env.VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR) || + 1, + profile_sample_rate: + Number(process.env.VITE_SENTRY_PROFILE_SAMPLE_RATE) || 1, + security_report_uri: String( + process.env.VITE_SENTRY_SECURITY_REPORT_URI, + ), }, }, } diff --git a/fdm-app/vite.config.ts b/fdm-app/vite.config.ts index 81b4c44b9..c31026bb8 100644 --- a/fdm-app/vite.config.ts +++ b/fdm-app/vite.config.ts @@ -2,17 +2,19 @@ import { reactRouter } from "@react-router/dev/vite" import { sentryVitePlugin } from "@sentry/vite-plugin" import { defineConfig } from "vite" import tsconfigPaths from "vite-tsconfig-paths" +import { serverConfig } from "~/lib/config" + +let pluginSentry: any +if (serverConfig.analytics.sentry) { + pluginSentry = sentryVitePlugin({ + org: serverConfig.analytics.sentry.organization, + authToken: serverConfig.analytics.sentry.auth_token, + project: serverConfig.analytics.sentry.project, + }) +} export default defineConfig({ - plugins: [ - reactRouter(), - tsconfigPaths(), - sentryVitePlugin({ - org: process.env.SENTRY_ORG, - authToken: process.env.SENTRY_AUTH_TOKEN, - project: process.env.SENTRY_PROJECT, - }), - ], + plugins: [reactRouter(), tsconfigPaths(), pluginSentry], define: { global: {}, }, From 58822a2c867f534bf5ee06c09f8956199da20b41 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:15:25 +0200 Subject: [PATCH 12/35] Use config for db connection --- fdm-app/app/lib/fdm-migrate.server.js | 12 +++++++----- fdm-app/app/lib/fdm.server.tsx | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fdm-app/app/lib/fdm-migrate.server.js b/fdm-app/app/lib/fdm-migrate.server.js index a0a9ceaac..d1ced1218 100644 --- a/fdm-app/app/lib/fdm-migrate.server.js +++ b/fdm-app/app/lib/fdm-migrate.server.js @@ -5,33 +5,35 @@ import { } from "@svenvw/fdm-core" import { drizzle } from "drizzle-orm/postgres-js" import postgres from "postgres" +import { serverConfig } from "~/lib/config" // Get credentials to connect to db const host = - process.env.POSTGRES_HOST ?? + serverConfig.database.host ?? (() => { throw new Error("POSTGRES_HOST environment variable is required") })() const port = - Number(process.env.POSTGRES_PORT) || + serverConfig.database.port || (() => { throw new Error("POSTGRES_PORT environment variable is required") })() const user = - process.env.POSTGRES_USER ?? + serverConfig.database.user ?? (() => { throw new Error("POSTGRES_USER environment variable is required") })() const password = - process.env.POSTGRES_PASSWORD ?? + serverConfig.database.password ?? (() => { throw new Error("POSTGRES_PASSWORD environment variable is required") })() const database = - process.env.POSTGRES_DB ?? + serverConfig.database.database ?? (() => { throw new Error("POSTGRES_DB environment variable is required") })() + const migrationsFolderPath = "node_modules/@svenvw/fdm-core/dist/db/migrations" const client = postgres({ diff --git a/fdm-app/app/lib/fdm.server.tsx b/fdm-app/app/lib/fdm.server.tsx index a884271ac..b8faf312c 100644 --- a/fdm-app/app/lib/fdm.server.tsx +++ b/fdm-app/app/lib/fdm.server.tsx @@ -1,29 +1,30 @@ import { fdmSchema as schema } from "@svenvw/fdm-core" import { drizzle } from "drizzle-orm/postgres-js" +import { serverConfig } from "~/lib/config" // Get credentials to connect to db const host = - process.env.POSTGRES_HOST ?? + serverConfig.database.host ?? (() => { throw new Error("POSTGRES_HOST environment variable is required") })() const port = - Number(process.env.POSTGRES_PORT) || + serverConfig.database.port || (() => { throw new Error("POSTGRES_PORT environment variable is required") })() const user = - process.env.POSTGRES_USER ?? + serverConfig.database.user ?? (() => { throw new Error("POSTGRES_USER environment variable is required") })() const password = - process.env.POSTGRES_PASSWORD ?? + serverConfig.database.password ?? (() => { throw new Error("POSTGRES_PASSWORD environment variable is required") })() const database = - process.env.POSTGRES_DB ?? + serverConfig.database.database ?? (() => { throw new Error("POSTGRES_DB environment variable is required") })() From 18f4436ea773028a5b057a901431c56a4f1c93a0 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:36:27 +0200 Subject: [PATCH 13/35] Convert mapbox into an integration --- .../atlas/atlas-mapbox.tsx => integrations/mapbox.ts} | 4 +++- fdm-app/app/lib/config.ts | 8 ++++++++ fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx | 2 +- fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx | 5 +---- fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx | 2 +- .../app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx | 5 +---- fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx | 5 +---- .../app/routes/farm.create.$b_id_farm.fields.$b_id.tsx | 9 ++++----- fdm-app/fdm.config.ts | 10 ++++++++++ 9 files changed, 30 insertions(+), 20 deletions(-) rename fdm-app/app/{components/custom/atlas/atlas-mapbox.tsx => integrations/mapbox.ts} (70%) diff --git a/fdm-app/app/components/custom/atlas/atlas-mapbox.tsx b/fdm-app/app/integrations/mapbox.ts similarity index 70% rename from fdm-app/app/components/custom/atlas/atlas-mapbox.tsx rename to fdm-app/app/integrations/mapbox.ts index b2cc52ae5..1cbb679fc 100644 --- a/fdm-app/app/components/custom/atlas/atlas-mapbox.tsx +++ b/fdm-app/app/integrations/mapbox.ts @@ -1,5 +1,7 @@ +import { serverConfig } from "@/app/lib/config" + export function getMapboxToken() { - const mapboxToken = process.env.MAPBOX_TOKEN as string | undefined + const mapboxToken = serverConfig.integrations.mapbox.token if (!mapboxToken || mapboxToken.length === 0) { throw new Error("MAPBOX_TOKEN is not set") } diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts index e4f8926b9..2dcf279f2 100644 --- a/fdm-app/app/lib/config.ts +++ b/fdm-app/app/lib/config.ts @@ -51,6 +51,14 @@ export interface Config { host: string port: number } + integrations: { + mapbox: { + token: string + } + nmi?: { + api_key: string + } + } analytics: { sentry?: { dsn: string diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx index fd8d0cc8c..317af0494 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.elevation.tsx @@ -1,4 +1,4 @@ -import { getMapboxToken } from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxToken } from "@/app/integrations/mapbox" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx index bf169b44c..9addb4120 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.fields.tsx @@ -6,10 +6,7 @@ import { } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" -import { - getMapboxStyle, - getMapboxToken, -} from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" import { FieldsPanelHover } from "~/components/custom/atlas/atlas-panels" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" diff --git a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx index e07b93d97..df84d8628 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.atlas.soil.tsx @@ -1,4 +1,4 @@ -import { getMapboxToken } from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxToken } from "@/app/integrations/mapbox" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" diff --git a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx index 70876bc6a..949528690 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.field.$b_id.atlas.tsx @@ -1,9 +1,6 @@ import { Layer, Map as MapGL } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" -import { - getMapboxStyle, - getMapboxToken, -} from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 695699069..3c856543e 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -1,9 +1,6 @@ import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" -import { - getMapboxStyle, - getMapboxToken, -} from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" import { FieldsPanelHover, FieldsPanelSelection, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx index cc2457664..3c833f4bc 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.tsx @@ -1,7 +1,4 @@ -import { - getMapboxStyle, - getMapboxToken, -} from "~/components/custom/atlas/atlas-mapbox" +import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" @@ -60,7 +57,9 @@ import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Perceel bewerken - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Perceel bewerken - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", content: diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 4cbfeb488..970bc5ef8 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -30,6 +30,16 @@ const config: Config = { port: Number(process.env.DB_PORT), }, + // Integrations + integrations: { + mapbox: { + token: String(process.env.MAPBOX_TOKEN) + }, + nmi: { + api_key: String(process.env.NMI_API_KEY) + } + }, + // Analytics analytics: { // Sentry From f3e86159a1b6eb8b4137e39906c3401dce87432a Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:49:34 +0200 Subject: [PATCH 14/35] Add integration with NMI API --- fdm-app/app/integrations/nmi.ts | 58 +++++++++++++++++++ fdm-app/app/lib/nmi.ts | 0 .../routes/farm.create.$b_id_farm.atlas.tsx | 49 +++++----------- 3 files changed, 72 insertions(+), 35 deletions(-) create mode 100644 fdm-app/app/integrations/nmi.ts create mode 100644 fdm-app/app/lib/nmi.ts diff --git a/fdm-app/app/integrations/nmi.ts b/fdm-app/app/integrations/nmi.ts new file mode 100644 index 000000000..42c3f57c2 --- /dev/null +++ b/fdm-app/app/integrations/nmi.ts @@ -0,0 +1,58 @@ +import { serverConfig } from "@/app/lib/config" +import centroid from "@turf/centroid" +import type { Feature } from "geojson" + +export function getNmiApiKey() { + if (!serverConfig.integrations.nmi) { + return undefined + } + + const nmiApiKey = serverConfig.integrations.nmi.api_key + return nmiApiKey +} + +export async function getSoilParameterEstimates( + field: Feature, + nmiApiKey: string | undefined, +): Promise<{ + a_p_al: number + a_p_cc: number + a_som_loi: number + b_soiltype_agr: string + b_gwl_class: string + a_source: string + a_depth: number +}> { + if (!nmiApiKey) { + throw new Error("Please provide a NMI API key") + } + + const fieldCentroid = centroid(field.geometry) + const a_lon = fieldCentroid.geometry.coordinates[0] + const a_lat = fieldCentroid.geometry.coordinates[1] + + const responseApi = await fetch( + `https://api.nmi-agro.nl/estimates?${new URLSearchParams({ + a_lat: a_lat.toString(), + a_lon: a_lon.toString(), + })}`, + { + method: "GET", + headers: { + Authorization: `Bearer ${nmiApiKey}`, + }, + }, + ) + + if (!responseApi.ok) { + throw new Error("Request to NMI API failed") + } + + const result = await responseApi.json() + const response = result.data + + response.a_source = "NMI" + response.a_depth = 0.3 + + return response +} diff --git a/fdm-app/app/lib/nmi.ts b/fdm-app/app/lib/nmi.ts new file mode 100644 index 000000000..e69de29bb diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx index 3c856543e..a40fd7dc5 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.atlas.tsx @@ -49,6 +49,7 @@ import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" import { fdm } from "~/lib/fdm.server" import { clientConfig } from "~/lib/config" +import { getNmiApiKey, getSoilParameterEstimates } from "../integrations/nmi" // Meta export const meta: MetaFunction = () => { @@ -261,6 +262,8 @@ export async function action({ request, params }: ActionFunctionArgs) { // Get the session const session = await getSession(request) + const nmiApiKey = getNmiApiKey() + const selectedFields = JSON.parse( String(formData.get("selected_fields")), ) @@ -300,50 +303,26 @@ export async function action({ request, params }: ActionFunctionArgs) { b_lu_end, ) - if (process.env.NMI_API_KEY) { - const fieldCentroid = centroid(field.geometry) - const a_lon = fieldCentroid.geometry.coordinates[0] - const a_lat = fieldCentroid.geometry.coordinates[1] - - const responseApi = await fetch( - `https://api.nmi-agro.nl/estimates?${new URLSearchParams( - { - a_lat: a_lat.toString(), - a_lon: a_lon.toString(), - }, - )}`, - { - method: "GET", - headers: { - Authorization: `Bearer ${process.env.NMI_API_KEY}`, - }, - }, + if (nmiApiKey) { + const estimates = await getSoilParameterEstimates( + field, + nmiApiKey, ) - if (!responseApi.ok) { - throw data(responseApi.statusText, { - status: responseApi.status, - statusText: responseApi.statusText, - }) - } - - const result = await responseApi.json() - const response = result.data - await addSoilAnalysis( fdm, session.principal_id, defaultDate, - "NMI", + estimates.a_source, b_id, - 30, + estimates.a_depth, defaultDate, { - a_p_al: response.a_p_al, - a_p_cc: response.a_p_cc, - a_som_loi: response.a_som_loi, - b_soiltype_agr: response.b_soiltype_agr, - b_gwl_class: response.b_gwl_class, + a_p_al: estimates.a_p_al, + a_p_cc: estimates.a_p_cc, + a_som_loi: estimates.a_som_loi, + b_soiltype_agr: estimates.b_soiltype_agr, + b_gwl_class: estimates.b_gwl_class, }, ) } From b02af68de45995b9fb49c978f18ad5e0d7b8878a Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:26:34 +0200 Subject: [PATCH 15/35] Various merge fixes --- .../components/custom/atlas/atlas-panels.tsx | 2 +- .../components/custom/atlas/atlas-sources.tsx | 4 +- .../app/components/custom/atlas/atlas.d.tsx | 2 +- fdm-app/app/components/custom/banner.tsx | 4 +- .../components/custom/cultivation/form.tsx | 4 +- .../components/custom/cultivation/list.tsx | 2 +- fdm-app/app/components/custom/error.tsx | 2 +- .../components/custom/farm/farm-header.tsx | 3 +- .../custom/fertilizer-applications.tsx | 6 +- .../custom/fertilizer/column-header.tsx | 7 +- .../components/custom/fertilizer/columns.tsx | 4 +- .../app/components/custom/fertilizer/form.tsx | 14 ++-- .../components/custom/fertilizer/table.tsx | 6 +- fdm-app/app/components/custom/sidebar-app.tsx | 71 ++++++++++--------- .../app/components/custom/sidebar-page.tsx | 1 - fdm-app/app/lib/cache.server.ts | 2 +- fdm-app/app/root.tsx | 6 +- ...m.$b_id_farm.$calendar.atlas.elevation.tsx | 4 +- ...farm.$b_id_farm.$calendar.atlas.fields.tsx | 4 +- .../farm.$b_id_farm.$calendar.atlas.soil.tsx | 4 +- ...$b_id_farm.$calendar.field.$b_id.atlas.tsx | 2 +- ...r.field.$b_id.cultivation.$b_lu._index.tsx | 2 +- ...alendar.field.$b_id.cultivation._index.tsx | 2 +- ..._farm.$calendar.field.$b_id.fertilizer.tsx | 2 +- ...farm.$calendar.field.$b_id.soil._index.tsx | 18 ++--- ...lendar.field.$b_id.soil.analysis.$a_id.tsx | 16 ++--- ...calendar.field.$b_id.soil.analysis.new.tsx | 16 ++--- .../farm.$b_id_farm.$calendar.field.$b_id.tsx | 4 +- ...farm.$b_id_farm.$calendar.field._index.tsx | 2 +- .../farm.$b_id_farm.fertilizers.$p_id.tsx | 18 ++--- .../farm.$b_id_farm.fertilizers._index.tsx | 16 ++--- .../farm.$b_id_farm.fertilizers.new.tsx | 23 +++--- .../app/routes/farm.$b_id_farm.settings.tsx | 2 +- fdm-app/app/routes/farm.account.tsx | 10 ++- ...farm.create.$b_id_farm.$calendar.atlas.tsx | 6 +- ...ltivations.$b_lu_catalogue.crop._index.tsx | 4 +- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 2 +- ...ns.$b_lu_catalogue.crop.harvest._index.tsx | 3 +- ...ltivations.$b_lu_catalogue.fertilizers.tsx | 2 +- ...$calendar.cultivations.$b_lu_catalogue.tsx | 3 +- ..._id_farm.$calendar.cultivations._index.tsx | 2 +- ...eate.$b_id_farm.$calendar.cultivations.tsx | 2 +- ...eate.$b_id_farm.$calendar.fields.$b_id.tsx | 5 +- ...ate.$b_id_farm.$calendar.fields._index.tsx | 3 +- ...arm.create.$b_id_farm.$calendar.fields.tsx | 3 +- ....create.$b_id_farm.fields.$b_id._index.tsx | 35 +++++---- ...e.$b_id_farm.fields.$b_id.new_analysis.tsx | 16 ++--- fdm-app/app/routes/farm.tsx | 6 +- fdm-app/app/routes/farm.whats-new.tsx | 1 - 49 files changed, 182 insertions(+), 196 deletions(-) diff --git a/fdm-app/app/components/custom/atlas/atlas-panels.tsx b/fdm-app/app/components/custom/atlas/atlas-panels.tsx index 99919bdff..0806cccac 100644 --- a/fdm-app/app/components/custom/atlas/atlas-panels.tsx +++ b/fdm-app/app/components/custom/atlas/atlas-panels.tsx @@ -16,7 +16,7 @@ import { Check, Info } from "lucide-react" import { useEffect, useState } from "react" import { useMap } from "react-map-gl" import type { MapBoxZoomEvent, MapEvent, MapMouseEvent } from "react-map-gl" -import { useFetcher } from "react-router" +import { data, useFetcher } from "react-router" export function FieldsPanelHover({ zoomLevelFields, diff --git a/fdm-app/app/components/custom/atlas/atlas-sources.tsx b/fdm-app/app/components/custom/atlas/atlas-sources.tsx index fdefd63c1..333b6b160 100644 --- a/fdm-app/app/components/custom/atlas/atlas-sources.tsx +++ b/fdm-app/app/components/custom/atlas/atlas-sources.tsx @@ -4,7 +4,7 @@ import throttle from "lodash.throttle" import { type Dispatch, type SetStateAction, useEffect, useState } from "react" import { Source, useMap } from "react-map-gl" import { generateFeatureClass } from "./atlas-functions" -import type { fieldsAvailableUrlType } from "./atlas.d" +import type { FieldsAvailableUrlType } from "./atlas.d" export function FieldsSourceNotClickable({ id, @@ -108,7 +108,7 @@ export function FieldsSourceAvailable({ children, }: { id: string - url: fieldsAvailableUrlType + url: FieldsAvailableUrlType zoomLevelFields: number children: JSX.Element }) { diff --git a/fdm-app/app/components/custom/atlas/atlas.d.tsx b/fdm-app/app/components/custom/atlas/atlas.d.tsx index f5a76b5c5..656643560 100644 --- a/fdm-app/app/components/custom/atlas/atlas.d.tsx +++ b/fdm-app/app/components/custom/atlas/atlas.d.tsx @@ -7,7 +7,7 @@ export interface MapFieldsProps { mapboxToken: string mapStyle: "mapbox://styles/mapbox/satellite-streets-v12" fieldsSelected: FeatureCollection | null - fieldsAvailableUrl: fieldsAvailableUrlType + fieldsAvailableUrl: FieldsAvailableUrlType fieldsSaved: FeatureCollection | null } diff --git a/fdm-app/app/components/custom/banner.tsx b/fdm-app/app/components/custom/banner.tsx index 10e5d6d14..863f4fc21 100644 --- a/fdm-app/app/components/custom/banner.tsx +++ b/fdm-app/app/components/custom/banner.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/components/ui/button" -import { Cookie, CookieIcon, X } from "lucide-react" +import { Button } from "~/components/ui/button" +import { Cookie, X } from "lucide-react" import posthog from "posthog-js" import { useEffect, useState } from "react" diff --git a/fdm-app/app/components/custom/cultivation/form.tsx b/fdm-app/app/components/custom/cultivation/form.tsx index 6ade23e4c..106c555de 100644 --- a/fdm-app/app/components/custom/cultivation/form.tsx +++ b/fdm-app/app/components/custom/cultivation/form.tsx @@ -22,8 +22,8 @@ import { useEffect } from "react" import { Form } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import type { z } from "zod" -import { Combobox } from "../combobox" -import { LoadingSpinner } from "../loadingspinner" +import { Combobox } from "~/components/custom/combobox" +import { LoadingSpinner } from "~/components/custom/loadingspinner" import { FormSchema } from "./schema" import type { CultivationsFormProps } from "./types" diff --git a/fdm-app/app/components/custom/cultivation/list.tsx b/fdm-app/app/components/custom/cultivation/list.tsx index 67ed61463..54f2b97aa 100644 --- a/fdm-app/app/components/custom/cultivation/list.tsx +++ b/fdm-app/app/components/custom/cultivation/list.tsx @@ -2,7 +2,7 @@ import { Button } from "~/components/ui/button" import { format } from "date-fns/format" import { Pencil, Trash2 } from "lucide-react" import { NavLink, useFetcher } from "react-router" -import { LoadingSpinner } from "../loadingspinner" +import { LoadingSpinner } from "~/components/custom/loadingspinner" import type { Cultivation } from "./types" interface Harvest { diff --git a/fdm-app/app/components/custom/error.tsx b/fdm-app/app/components/custom/error.tsx index 871bb1a4a..4206dc1e9 100644 --- a/fdm-app/app/components/custom/error.tsx +++ b/fdm-app/app/components/custom/error.tsx @@ -1,7 +1,7 @@ import { ArrowLeft, Copy, Home } from "lucide-react" import { useEffect, useState } from "react" import { NavLink } from "react-router" -import { Button } from "../ui/button" +import { Button } from "~/components/ui/button" /** * Displays a full-screen error block with tailored messaging and navigation options. diff --git a/fdm-app/app/components/custom/farm/farm-header.tsx b/fdm-app/app/components/custom/farm/farm-header.tsx index b48e14bca..22a7196ce 100644 --- a/fdm-app/app/components/custom/farm/farm-header.tsx +++ b/fdm-app/app/components/custom/farm/farm-header.tsx @@ -7,7 +7,6 @@ import { } from "~/components/ui/breadcrumb" import { Separator } from "~/components/ui/separator" import { SidebarTrigger } from "~/components/ui/sidebar" - import { Button } from "~/components/ui/button" import { DropdownMenu, @@ -16,7 +15,7 @@ import { DropdownMenuTrigger, } from "~/components/ui/dropdown-menu" import { cn } from "~/lib/utils" -import { useCalendarStore } from "@/store/calendar" +import { useCalendarStore } from "~/store/calendar" import { ChevronDown } from "lucide-react" import { NavLink } from "react-router" import type { diff --git a/fdm-app/app/components/custom/fertilizer-applications.tsx b/fdm-app/app/components/custom/fertilizer-applications.tsx index e87a779e7..c7be93bec 100644 --- a/fdm-app/app/components/custom/fertilizer-applications.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications.tsx @@ -24,9 +24,9 @@ import { useEffect } from "react" import { Form, useFetcher } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import type { z } from "zod" -import { FormSchema } from "./fertilizer-applications/formschema" -import type { FertilizerApplicationsFormProps } from "./fertilizer-applications/types.d" -import { LoadingSpinner } from "./loadingspinner" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import type { FertilizerApplicationsFormProps } from "~/components/custom/fertilizer-applications/types.d" +import { LoadingSpinner } from "~/components/custom/loadingspinner" export function FertilizerApplicationsForm( props: FertilizerApplicationsFormProps, diff --git a/fdm-app/app/components/custom/fertilizer/column-header.tsx b/fdm-app/app/components/custom/fertilizer/column-header.tsx index dff88df81..27922207e 100644 --- a/fdm-app/app/components/custom/fertilizer/column-header.tsx +++ b/fdm-app/app/components/custom/fertilizer/column-header.tsx @@ -1,15 +1,14 @@ import type { Column } from "@tanstack/react-table" import { ArrowDown, ArrowUp, ChevronsUpDown, EyeOff } from "lucide-react" - -import { Button } from "@/components/ui/button" +import { Button } from "~/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu" -import { cn } from "@/lib/utils" +} from "~/components/ui/dropdown-menu" +import { cn } from "~/lib/utils" interface DataTableColumnHeaderProps extends React.HTMLAttributes { diff --git a/fdm-app/app/components/custom/fertilizer/columns.tsx b/fdm-app/app/components/custom/fertilizer/columns.tsx index 1d228c4d1..b3b8557c1 100644 --- a/fdm-app/app/components/custom/fertilizer/columns.tsx +++ b/fdm-app/app/components/custom/fertilizer/columns.tsx @@ -1,10 +1,10 @@ -import { Badge } from "@/components/ui/badge" +import { Badge } from "~/components/ui/badge" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, -} from "@/components/ui/tooltip" +} from "~/components/ui/tooltip" import type { ColumnDef } from "@tanstack/react-table" import { ArrowRight, Pencil, SquareArrowOutUpRight } from "lucide-react" import { NavLink } from "react-router-dom" diff --git a/fdm-app/app/components/custom/fertilizer/form.tsx b/fdm-app/app/components/custom/fertilizer/form.tsx index 09c63da16..e5614d517 100644 --- a/fdm-app/app/components/custom/fertilizer/form.tsx +++ b/fdm-app/app/components/custom/fertilizer/form.tsx @@ -1,6 +1,6 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Badge } from "~/components/ui/badge" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -8,22 +8,22 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" +} from "~/components/ui/card" import { FormControl, FormDescription, FormField, FormItem, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" +} from "~/components/ui/select" import type { UseFormReturn } from "react-hook-form" import { Form } from "react-router" import { RemixFormProvider } from "remix-hook-form" diff --git a/fdm-app/app/components/custom/fertilizer/table.tsx b/fdm-app/app/components/custom/fertilizer/table.tsx index b2c3752d8..9c82fd8f5 100644 --- a/fdm-app/app/components/custom/fertilizer/table.tsx +++ b/fdm-app/app/components/custom/fertilizer/table.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/components/ui/button" -import { Input } from "@/components/ui/input" +import { Button } from "~/components/ui/button" +import { Input } from "~/components/ui/input" import { Table, TableBody, @@ -7,7 +7,7 @@ import { TableHead, TableHeader, TableRow, -} from "@/components/ui/table" +} from "~/components/ui/table" import { type ColumnDef, type ColumnFiltersState, diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index f12fa1f63..becc89a6e 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -4,7 +4,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger, -} from "@/components/ui/collapsible" +} from "~/components/ui/collapsible" import { DropdownMenu, DropdownMenuContent, @@ -26,10 +26,13 @@ import { SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, + SidebarMenuSub, + SidebarMenuSubButton, + SidebarMenuSubItem, } from "~/components/ui/sidebar" -import { useFarmStore } from "@/store/farm" -import { useCalendarStore } from "@/store/calendar" -import { getCalendarSelection } from "@/lib/calendar" +import { useFarmStore } from "~/store/farm" +import { useCalendarStore } from "~/store/calendar" +import { getCalendarSelection } from "~/lib/calendar" import * as Sentry from "@sentry/react" import { ArrowRightLeft, @@ -50,7 +53,6 @@ import { Settings, Shapes, Sparkles, - Sprout, Square, } from "lucide-react" import posthog from "posthog-js" @@ -58,7 +60,8 @@ import { useIsMobile } from "~/hooks/use-mobile" import { useEffect, useState } from "react" import { Form, NavLink, useLocation } from "react-router" import { toast } from "sonner" -import config from "@/fdm.config" +import { clientConfig } from "~/lib/config" +import { Button } from "~/components/ui/button" interface SideBarAppType { user: { @@ -137,26 +140,29 @@ export function SidebarApp(props: SideBarAppType) { const omBalanceLink = undefined const baatLink = undefined - try { - Sentry.setUser({ - fullName: user.name, - email: user.email, - }) - } catch (error) { - Sentry.captureException(error) + if (clientConfig.analytics.sentry) { + try { + Sentry.setUser({ + fullName: user.name, + email: user.email, + }) + } catch (error) { + Sentry.captureException(error) + } } + const [feedback, setFeedback] = useState() const [isLoading, setIsLoading] = useState(true) + if (isLoading) { + return null + } + useEffect(() => { setFeedback(Sentry.getFeedback()) setIsLoading(false) }, []) - if (isLoading) { - return null - } - const openFeedbackForm = async () => { try { const form = await feedback.createForm() @@ -192,14 +198,13 @@ export function SidebarApp(props: SideBarAppType) { FDM
- {config.name} + {clientConfig.name} - {/* 2024 */}
@@ -448,18 +453,20 @@ export function SidebarApp(props: SideBarAppType) { Ondersteuning - - - - - Feedback - - - + {clientConfig.analytics.sentry ? ( + + + + + Feedback + + + + ) : null} diff --git a/fdm-app/app/components/custom/sidebar-page.tsx b/fdm-app/app/components/custom/sidebar-page.tsx index df81a49ab..ca95df5e6 100644 --- a/fdm-app/app/components/custom/sidebar-page.tsx +++ b/fdm-app/app/components/custom/sidebar-page.tsx @@ -1,5 +1,4 @@ import { NavLink, useLocation } from "react-router" - import { buttonVariants } from "~/components/ui/button" import { cn } from "~/lib/utils" diff --git a/fdm-app/app/lib/cache.server.ts b/fdm-app/app/lib/cache.server.ts index b8412137f..84225af08 100644 --- a/fdm-app/app/lib/cache.server.ts +++ b/fdm-app/app/lib/cache.server.ts @@ -1,5 +1,5 @@ import type { EntryContext } from "react-router" -import { clientConfig } from "./config" +import { clientConfig } from "~/lib/config" type CacheControl = { maxAge: number diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index 7b95af8e5..6f9acf3a0 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -1,7 +1,5 @@ import * as Sentry from "@sentry/react" - -import { Banner } from "@/components/custom/banner" -import { CookieSettingsFooter } from "@/components/custom/cookie-settings-footer" +import { Banner } from "~/components/custom/banner" import { Toaster } from "~/components/ui/sonner" import mapBoxStyle from "mapbox-gl/dist/mapbox-gl.css?url" import posthog from "posthog-js" @@ -23,7 +21,7 @@ import { getToast } from "remix-toast" import { toast as notify } from "sonner" import styles from "~/tailwind.css?url" import type { Route } from "./+types/root" -import { ErrorBlock } from "./components/custom/error" +import { ErrorBlock } from "~/components/custom/error" export const links: LinksFunction = () => [ { rel: "stylesheet", href: styles }, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx index f2713a753..906881bf0 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx @@ -1,9 +1,9 @@ -import { getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxToken } from "~/integrations/mapbox" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx index e5d6106ff..618e4d0f1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx @@ -6,7 +6,7 @@ import { } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" -import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { FieldsPanelHover } from "~/components/custom/atlas/atlas-panels" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" @@ -14,7 +14,7 @@ import { getViewState } from "~/components/custom/atlas/atlas-viewstate" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx index 8e06e7227..432fb287f 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx @@ -1,9 +1,9 @@ -import { getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxToken } from "~/integrations/mapbox" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx index 949528690..276f13071 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx @@ -1,6 +1,6 @@ import { Layer, Map as MapGL } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" -import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx index 6aaecc1fa..b545f6dbc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx @@ -8,7 +8,7 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getCultivation, getCultivationsFromCatalogue, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx index 61cffb3b4..2a28e0570 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx @@ -6,7 +6,7 @@ import { getSession } from "~/lib/auth.server" import { handleActionError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { addCultivation, getCultivations, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx index 56c04248d..394916701 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx @@ -7,7 +7,7 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx index e6194ebc7..7ec4966cc 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx @@ -1,12 +1,12 @@ -import { SoilDataCards } from "@/components/custom/soil/cards" -import { SoilAnalysesList } from "@/components/custom/soil/list" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" -import { getSession } from "@/lib/auth.server" -import { getTimeframe } from "@/lib/calendar" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +import { SoilDataCards } from "~/components/custom/soil/cards" +import { SoilAnalysesList } from "~/components/custom/soil/list" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { Timeframe, getField, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx index 27a9d573a..cc3510d1d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx @@ -1,11 +1,11 @@ -import { SoilAnalysisForm } from "@/components/custom/soil/form" -import { FormSchema } from "@/components/custom/soil/formschema" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { getField, getSoilAnalysis, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx index e87804eba..8d6079147 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx @@ -1,11 +1,11 @@ -import { SoilAnalysisForm } from "@/components/custom/soil/form" -import { FormSchema } from "@/components/custom/soil/formschema" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addSoilAnalysis, getField, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx index 46db50459..3289d7737 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx @@ -5,8 +5,8 @@ import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { useCalendarStore } from "@/store/calendar" -import { getCalendar, getTimeframe } from "@/lib/calendar" +import { useCalendarStore } from "~/store/calendar" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { getFarms, getField, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx index f4b333d29..a9fcb35c8 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx @@ -14,7 +14,7 @@ import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { getTimeBasedGreeting } from "~/lib/greetings" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getFarms, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx index 0bf7b0928..30dc98aef 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx @@ -1,12 +1,12 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { FertilizerForm } from "@/components/custom/fertilizer/form" -import { FormSchema } from "@/components/custom/fertilizer/formschema" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { FertilizerForm } from "~/components/custom/fertilizer/form" +import { FormSchema } from "~/components/custom/fertilizer/formschema" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { getFarm, diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx index 233618224..18c477560 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx @@ -1,14 +1,14 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" import { type Fertilizer, columns, -} from "@/components/custom/fertilizer/columns" -import { DataTable } from "@/components/custom/fertilizer/table" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" +} from "~/components/custom/fertilizer/columns" +import { DataTable } from "~/components/custom/fertilizer/table" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getFarm, getFarms, getFertilizers } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx index e503335d4..16ea05f6d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx @@ -1,22 +1,19 @@ -import { FarmHeader } from "@/components/custom/farm/farm-header" -import { FarmTitle } from "@/components/custom/farm/farm-title" -import { FertilizerForm } from "@/components/custom/fertilizer/form" -import { FormSchema } from "@/components/custom/fertilizer/formschema" -import { SidebarInset } from "@/components/ui/sidebar" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { FertilizerForm } from "~/components/custom/fertilizer/form" +import { FormSchema } from "~/components/custom/fertilizer/formschema" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { addFertilizerToCatalogue, getFarm, getFarms, - getFertilizer, getFertilizers, } from "@svenvw/fdm-core" -import { updateFertilizerFromCatalogue } from "@svenvw/fdm-core" -import { UndoIcon } from "lucide-react" import { useEffect } from "react" import { type ActionFunctionArgs, @@ -25,7 +22,7 @@ import { useLoaderData, } from "react-router" import { useRemixForm } from "remix-hook-form" -import { dataWithSuccess, redirectWithSuccess } from "remix-toast" +import { redirectWithSuccess } from "remix-toast" import type { z } from "zod" export async function loader({ request, params }: LoaderFunctionArgs) { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index 4dd44feda..e597012c5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -6,7 +6,7 @@ import { Toaster } from "~/components/ui/sonner" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { useCalendarStore } from "@/store/calendar" +import { useCalendarStore } from "~/store/calendar" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.account.tsx b/fdm-app/app/routes/farm.account.tsx index 9b857a312..0e48c6e0c 100644 --- a/fdm-app/app/routes/farm.account.tsx +++ b/fdm-app/app/routes/farm.account.tsx @@ -1,12 +1,10 @@ import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" -import { type LoaderFunctionArgs, type MetaFunction, useLoaderData } from "react-router" import { - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - BreadcrumbList, -} from "@/components/ui/breadcrumb" + type LoaderFunctionArgs, + type MetaFunction, + useLoaderData, +} from "react-router" import { Card, CardContent, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx index 83d580a9f..2f32d1ae3 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx @@ -1,6 +1,6 @@ import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" -import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxStyle, getMapboxToken } from "~/app/integrations/mapbox" import { FieldsPanelHover, FieldsPanelSelection, @@ -24,15 +24,13 @@ import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { Skeleton } from "~/components/ui/skeleton" import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" -import { getCalendar, getTimeframe } from "@/lib/calendar" -import { useCalendarStore } from "@/store/calendar" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { addCultivation, addField, addSoilAnalysis, getFarm, } from "@svenvw/fdm-core" -import { centroid } from "@turf/centroid" import { useState } from "react" import { GeolocateControl, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx index 3248d24df..ecdd789fa 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx @@ -7,9 +7,7 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { extractFormValuesFromRequest } from "@/lib/form" -import { useCalendarStore } from "@/store/calendar" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan, getCultivationsFromCatalogue, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index b6c1e96f1..33cf5222f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -3,7 +3,7 @@ import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan, getCultivationsFromCatalogue, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index abb2ae632..10117e9e9 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -5,8 +5,7 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { useCalendarStore } from "@/store/calendar" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { addHarvest, getCultivationPlan, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx index be2e2f0c8..a29e51c36 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -6,7 +6,7 @@ import { Separator } from "~/components/ui/separator" import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx index a9b88f00f..87216c5e1 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx @@ -6,8 +6,7 @@ import { } from "~/components/ui/pagination" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" -import { useCalendarStore } from "@/store/calendar" -import { getCalendar, getTimeframe } from "@/lib/calendar" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx index 70f21c30f..ef5fadfe5 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx @@ -1,7 +1,7 @@ import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx index 18b3e1d3f..35d38157c 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx @@ -14,7 +14,7 @@ import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { cn } from "~/lib/utils" -import { getCalendar, getTimeframe } from "@/lib/calendar" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { getCultivationPlan, getFarm } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx index 4e52d9139..e8bc6bde1 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx @@ -1,4 +1,4 @@ -import { getMapboxStyle, getMapboxToken } from "@/app/integrations/mapbox" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" @@ -26,8 +26,7 @@ import { Skeleton } from "~/components/ui/skeleton" import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "@/lib/calendar" -import { useCalendarStore } from "@/store/calendar" +import { getTimeframe } from "~/lib/calendar" import { zodResolver } from "@hookform/resolvers/zod" import { addSoilAnalysis, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx index 1b04816ec..2f0d97e63 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx @@ -1,8 +1,7 @@ import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { useCalendarStore } from "@/store/calendar" -import { getTimeframe } from "@/lib/calendar" +import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx index f232b4c1e..eed3c06d4 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx @@ -12,8 +12,7 @@ import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { cn } from "~/lib/utils" -import { getCalendar, getTimeframe } from "@/lib/calendar" -import { useCalendarStore } from "@/store/calendar" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { getCultivationsFromCatalogue, getFarm, diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx index 0b4bb2f87..42d34dec1 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx @@ -1,14 +1,14 @@ import { getMapboxStyle, getMapboxToken, -} from "@/components/custom/atlas/atlas-mapbox" -import { FieldsSourceNotClickable } from "@/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "@/components/custom/atlas/atlas-styles" -import { getViewState } from "@/components/custom/atlas/atlas-viewstate" -import { Combobox } from "@/components/custom/combobox" -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { SoilDataCards } from "@/components/custom/soil/cards" -import { Button } from "@/components/ui/button" +} from "~/components/custom/atlas/atlas-mapbox" +import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { Combobox } from "~/components/custom/combobox" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { SoilDataCards } from "~/components/custom/soil/cards" +import { Button } from "~/components/ui/button" import { Card, CardContent, @@ -16,7 +16,7 @@ import { CardFooter, CardHeader, CardTitle, -} from "@/components/ui/card" +} from "~/components/ui/card" import { FormControl, FormDescription, @@ -24,13 +24,13 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" -import { Separator } from "@/components/ui/separator" -import { Skeleton } from "@/components/ui/skeleton" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { extractFormValuesFromRequest } from "@/lib/form" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" +import { Separator } from "~/components/ui/separator" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { getCultivations, @@ -56,9 +56,8 @@ import { import { useLoaderData } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" -import { ClientOnly } from "remix-utils/client-only" import { z } from "zod" -import { fdm } from "../lib/fdm.server" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx index f9b52320c..ffc10dfed 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx @@ -1,11 +1,11 @@ -import { SoilAnalysisForm } from "@/components/custom/soil/form" -import { FormSchema } from "@/components/custom/soil/formschema" -import { Button } from "@/components/ui/button" -import { Separator } from "@/components/ui/separator" -import { getSession } from "@/lib/auth.server" -import { handleActionError, handleLoaderError } from "@/lib/error" -import { fdm } from "@/lib/fdm.server" -import { extractFormValuesFromRequest } from "@/lib/form" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" import { addSoilAnalysis, getField, diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index 7eeddbefc..db405d218 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -3,8 +3,8 @@ import { SidebarProvider } from "~/components/ui/sidebar" import { auth, getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import posthog from "posthog-js" -import { useCalendarStore } from "@/store/calendar" -import { useFarmStore } from "@/store/farm" +import { useCalendarStore } from "~/store/calendar" +import { useFarmStore } from "~/store/farm" import type { ActionFunctionArgs, LoaderFunctionArgs, @@ -12,7 +12,7 @@ import type { } from "react-router" import { redirect, useRoutes } from "react-router" import { useLoaderData, useMatches } from "react-router" -import { useState, useEffect } from "react" +import { useEffect } from "react" import WhatsNew from "./farm.whats-new" import Account from "./farm.account" import { SidebarInset } from "~/components/ui/sidebar" diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index b8407b5fa..342c509ba 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -19,7 +19,6 @@ import { } from "~/components/ui/breadcrumb" import { SidebarTrigger } from "~/components/ui/sidebar" import ReactMarkdown from "react-markdown" -import { type LoaderFunctionArgs, useLoaderData } from "react-router" import remarkGfm from "remark-gfm" import { clientConfig } from "~/lib/config" From e4baba579b7332aae2da3e5b4b864303060002b9 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:27:25 +0200 Subject: [PATCH 16/35] Format the code --- fdm-app/app/components/blocks/fields.tsx | 6 +- .../components/custom/atlas/atlas-panels.tsx | 14 ++--- fdm-app/app/components/custom/banner.tsx | 2 +- fdm-app/app/components/custom/combobox.tsx | 2 +- .../components/custom/cultivation/form.tsx | 20 +++---- .../components/custom/cultivation/list.tsx | 2 +- .../components/custom/farm/farm-content.tsx | 4 +- .../components/custom/farm/farm-header.tsx | 8 +-- .../custom/fertilizer-applications.tsx | 20 +++---- .../custom/fertilizer-applications/cards.tsx | 4 +- .../custom/fertilizer-applications/form.tsx | 16 ++--- .../custom/fertilizer-applications/list.tsx | 2 +- .../components/custom/fertilizer/columns.tsx | 6 +- .../app/components/custom/fertilizer/form.tsx | 8 +-- .../components/custom/fertilizer/table.tsx | 20 +++---- .../app/components/custom/harvest/form.tsx | 14 ++--- .../app/components/custom/harvest/list.tsx | 2 +- fdm-app/app/components/custom/sidebar-app.tsx | 60 +++++++++---------- fdm-app/app/entry.server.tsx | 4 +- fdm-app/app/lib/auth.server.ts | 2 +- fdm-app/app/root.tsx | 6 +- fdm-app/app/routes/api.auth.$.tsx | 7 +-- ...m.$b_id_farm.$calendar.atlas.elevation.tsx | 12 ++-- ...farm.$b_id_farm.$calendar.atlas.fields.tsx | 14 ++--- .../farm.$b_id_farm.$calendar.atlas.soil.tsx | 12 ++-- .../farm.$b_id_farm.$calendar.atlas.tsx | 14 ++--- ...$b_id_farm.$calendar.field.$b_id.atlas.tsx | 20 +++---- ...r.field.$b_id.cultivation.$b_lu._index.tsx | 24 ++++---- ...ivation.$b_lu.harvest.$b_id_harvesting.tsx | 18 +++--- ...$b_id.cultivation.$b_lu.harvest._index.tsx | 17 +++--- ...alendar.field.$b_id.cultivation._index.tsx | 21 ++++--- ..._farm.$calendar.field.$b_id.fertilizer.tsx | 20 +++---- ....$b_id_farm.$calendar.field.$b_id.norm.tsx | 11 +++- ...id_farm.$calendar.field.$b_id.overview.tsx | 34 +++++------ ...farm.$calendar.field.$b_id.soil._index.tsx | 18 +++--- ...lendar.field.$b_id.soil.analysis.$a_id.tsx | 16 ++--- ...calendar.field.$b_id.soil.analysis.new.tsx | 16 ++--- .../farm.$b_id_farm.$calendar.field.$b_id.tsx | 18 +++--- ...farm.$b_id_farm.$calendar.field._index.tsx | 22 +++---- .../farm.$b_id_farm.fertilizers.$p_id.tsx | 18 +++--- .../farm.$b_id_farm.fertilizers._index.tsx | 4 +- .../farm.$b_id_farm.fertilizers.new.tsx | 18 +++--- .../farm.$b_id_farm.settings.access.tsx | 2 +- .../farm.$b_id_farm.settings.delete.tsx | 6 +- .../farm.$b_id_farm.settings.properties.tsx | 34 ++++++----- .../app/routes/farm.$b_id_farm.settings.tsx | 18 +++--- fdm-app/app/routes/farm.$b_id_farm.tsx | 4 +- fdm-app/app/routes/farm._index.tsx | 11 +++- fdm-app/app/routes/farm.account.tsx | 20 +++---- ...farm.create.$b_id_farm.$calendar.atlas.tsx | 50 ++++++++-------- ...cultivations.$b_lu_catalogue.covercrop.tsx | 7 ++- ...ltivations.$b_lu_catalogue.crop._index.tsx | 20 +++---- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 19 +++--- ...ns.$b_lu_catalogue.crop.harvest._index.tsx | 16 ++--- ...ltivations.$b_lu_catalogue.fertilizers.tsx | 24 ++++---- ...$calendar.cultivations.$b_lu_catalogue.tsx | 20 +++---- ..._id_farm.$calendar.cultivations._index.tsx | 8 +-- ...eate.$b_id_farm.$calendar.cultivations.tsx | 20 +++---- ...eate.$b_id_farm.$calendar.fields.$b_id.tsx | 60 +++++++++---------- ...ate.$b_id_farm.$calendar.fields._index.tsx | 12 ++-- ...arm.create.$b_id_farm.$calendar.fields.tsx | 36 +++++------ ....create.$b_id_farm.fields.$b_id._index.tsx | 54 ++++++++--------- ...e.$b_id_farm.fields.$b_id.new_analysis.tsx | 16 ++--- fdm-app/app/routes/farm.create._index.tsx | 31 +++++----- fdm-app/app/routes/farm.tsx | 20 +++---- fdm-app/app/routes/farm.whats-new.tsx | 18 +++--- fdm-app/app/routes/signin.tsx | 14 ++--- fdm-app/fdm.config.ts | 6 +- 68 files changed, 571 insertions(+), 551 deletions(-) diff --git a/fdm-app/app/components/blocks/fields.tsx b/fdm-app/app/components/blocks/fields.tsx index 8e0bd5b53..987a94ddb 100644 --- a/fdm-app/app/components/blocks/fields.tsx +++ b/fdm-app/app/components/blocks/fields.tsx @@ -1,6 +1,9 @@ +import { useToast } from "@/hooks/use-toast" import type { FeatureCollection } from "geojson" +import { Check, ChevronsUpDown } from "lucide-react" import { useEffect, useState } from "react" import { Form, useNavigation } from "react-router" +import { ClientOnly } from "remix-utils/client-only" import { FieldMap } from "~/components/blocks/field-map" import { Button } from "~/components/ui/button" import { @@ -33,10 +36,7 @@ import { SelectTrigger, SelectValue, } from "~/components/ui/select" -import { useToast } from "@/hooks/use-toast" import { cn } from "~/lib/utils" -import { Check, ChevronsUpDown } from "lucide-react" -import { ClientOnly } from "remix-utils/client-only" import { Skeleton } from "../ui/skeleton" interface CultivationOption { diff --git a/fdm-app/app/components/custom/atlas/atlas-panels.tsx b/fdm-app/app/components/custom/atlas/atlas-panels.tsx index 0806cccac..d24023d03 100644 --- a/fdm-app/app/components/custom/atlas/atlas-panels.tsx +++ b/fdm-app/app/components/custom/atlas/atlas-panels.tsx @@ -1,3 +1,10 @@ +import type { FeatureCollection } from "geojson" +import throttle from "lodash.throttle" +import { Check, Info } from "lucide-react" +import { useEffect, useState } from "react" +import { useMap } from "react-map-gl" +import type { MapBoxZoomEvent, MapEvent, MapMouseEvent } from "react-map-gl" +import { data, useFetcher } from "react-router" import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" import { Button } from "~/components/ui/button" @@ -10,13 +17,6 @@ import { CardTitle, } from "~/components/ui/card" import { cn } from "~/lib/utils" -import type { FeatureCollection } from "geojson" -import throttle from "lodash.throttle" -import { Check, Info } from "lucide-react" -import { useEffect, useState } from "react" -import { useMap } from "react-map-gl" -import type { MapBoxZoomEvent, MapEvent, MapMouseEvent } from "react-map-gl" -import { data, useFetcher } from "react-router" export function FieldsPanelHover({ zoomLevelFields, diff --git a/fdm-app/app/components/custom/banner.tsx b/fdm-app/app/components/custom/banner.tsx index 863f4fc21..f669955af 100644 --- a/fdm-app/app/components/custom/banner.tsx +++ b/fdm-app/app/components/custom/banner.tsx @@ -1,7 +1,7 @@ -import { Button } from "~/components/ui/button" import { Cookie, X } from "lucide-react" import posthog from "posthog-js" import { useEffect, useState } from "react" +import { Button } from "~/components/ui/button" type ConsentType = "yes" | "no" | "undecided" diff --git a/fdm-app/app/components/custom/combobox.tsx b/fdm-app/app/components/custom/combobox.tsx index b39eba614..0f69d5fca 100644 --- a/fdm-app/app/components/custom/combobox.tsx +++ b/fdm-app/app/components/custom/combobox.tsx @@ -1,3 +1,4 @@ +import { Check, ChevronsUpDown } from "lucide-react" import { type ReactNode, useMemo, useState } from "react" import { Button } from "~/components/ui/button" import { @@ -22,7 +23,6 @@ import { PopoverTrigger, } from "~/components/ui/popover" import { cn } from "~/lib/utils" -import { Check, ChevronsUpDown } from "lucide-react" type optionType = { value: string diff --git a/fdm-app/app/components/custom/cultivation/form.tsx b/fdm-app/app/components/custom/cultivation/form.tsx index 106c555de..504a3c84c 100644 --- a/fdm-app/app/components/custom/cultivation/form.tsx +++ b/fdm-app/app/components/custom/cultivation/form.tsx @@ -1,3 +1,13 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { format } from "date-fns/format" +import { nl } from "date-fns/locale/nl" +import { CalendarIcon } from "lucide-react" +import { useEffect } from "react" +import { Form } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import type { z } from "zod" +import { Combobox } from "~/components/custom/combobox" +import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" import { @@ -14,16 +24,6 @@ import { PopoverTrigger, } from "~/components/ui/popover" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import { format } from "date-fns/format" -import { nl } from "date-fns/locale/nl" -import { CalendarIcon } from "lucide-react" -import { useEffect } from "react" -import { Form } from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import type { z } from "zod" -import { Combobox } from "~/components/custom/combobox" -import { LoadingSpinner } from "~/components/custom/loadingspinner" import { FormSchema } from "./schema" import type { CultivationsFormProps } from "./types" diff --git a/fdm-app/app/components/custom/cultivation/list.tsx b/fdm-app/app/components/custom/cultivation/list.tsx index 54f2b97aa..c8ebaca67 100644 --- a/fdm-app/app/components/custom/cultivation/list.tsx +++ b/fdm-app/app/components/custom/cultivation/list.tsx @@ -1,8 +1,8 @@ -import { Button } from "~/components/ui/button" import { format } from "date-fns/format" import { Pencil, Trash2 } from "lucide-react" import { NavLink, useFetcher } from "react-router" import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" import type { Cultivation } from "./types" interface Harvest { diff --git a/fdm-app/app/components/custom/farm/farm-content.tsx b/fdm-app/app/components/custom/farm/farm-content.tsx index 0e151f900..8f578f607 100644 --- a/fdm-app/app/components/custom/farm/farm-content.tsx +++ b/fdm-app/app/components/custom/farm/farm-content.tsx @@ -1,9 +1,9 @@ +import type { ReactNode } from "react" +import { Outlet } from "react-router" import { SidebarPage, type SidebarPageProps, } from "~/components/custom/sidebar-page" -import type { ReactNode } from "react" -import { Outlet } from "react-router" interface FarmContentProps { sidebarItems?: SidebarPageProps["items"] diff --git a/fdm-app/app/components/custom/farm/farm-header.tsx b/fdm-app/app/components/custom/farm/farm-header.tsx index 22a7196ce..ce5c41f3b 100644 --- a/fdm-app/app/components/custom/farm/farm-header.tsx +++ b/fdm-app/app/components/custom/farm/farm-header.tsx @@ -1,3 +1,5 @@ +import { ChevronDown } from "lucide-react" +import { NavLink } from "react-router" import { Breadcrumb, BreadcrumbItem, @@ -5,8 +7,6 @@ import { BreadcrumbList, BreadcrumbSeparator, } from "~/components/ui/breadcrumb" -import { Separator } from "~/components/ui/separator" -import { SidebarTrigger } from "~/components/ui/sidebar" import { Button } from "~/components/ui/button" import { DropdownMenu, @@ -14,10 +14,10 @@ import { DropdownMenuContent, DropdownMenuTrigger, } from "~/components/ui/dropdown-menu" +import { Separator } from "~/components/ui/separator" +import { SidebarTrigger } from "~/components/ui/sidebar" import { cn } from "~/lib/utils" import { useCalendarStore } from "~/store/calendar" -import { ChevronDown } from "lucide-react" -import { NavLink } from "react-router" import type { FarmOptions, FertilizerOption, diff --git a/fdm-app/app/components/custom/fertilizer-applications.tsx b/fdm-app/app/components/custom/fertilizer-applications.tsx index c7be93bec..5aaa72066 100644 --- a/fdm-app/app/components/custom/fertilizer-applications.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications.tsx @@ -1,4 +1,14 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { format } from "date-fns" +import { CalendarIcon } from "lucide-react" +import { useEffect } from "react" +import { Form, useFetcher } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import type { z } from "zod" import { Combobox } from "~/components/custom/combobox" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import type { FertilizerApplicationsFormProps } from "~/components/custom/fertilizer-applications/types.d" +import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" import { @@ -17,16 +27,6 @@ import { } from "~/components/ui/popover" import { Separator } from "~/components/ui/separator" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import { format } from "date-fns" -import { CalendarIcon } from "lucide-react" -import { useEffect } from "react" -import { Form, useFetcher } from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import type { z } from "zod" -import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" -import type { FertilizerApplicationsFormProps } from "~/components/custom/fertilizer-applications/types.d" -import { LoadingSpinner } from "~/components/custom/loadingspinner" export function FertilizerApplicationsForm( props: FertilizerApplicationsFormProps, diff --git a/fdm-app/app/components/custom/fertilizer-applications/cards.tsx b/fdm-app/app/components/custom/fertilizer-applications/cards.tsx index 3907e91f5..84c3d4755 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/cards.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/cards.tsx @@ -1,3 +1,5 @@ +import type { Dose } from "@svenvw/fdm-calculator" +import { Lightbulb, Scale } from "lucide-react" import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" import { Tooltip, @@ -6,8 +8,6 @@ import { TooltipTrigger, } from "~/components/ui/tooltip" import { cn } from "~/lib/utils" -import type { Dose } from "@svenvw/fdm-calculator" -import { Lightbulb, Scale } from "lucide-react" import type { FertilizerApplicationsCardProps } from "./types.d" function FertilizerApplicationsCard({ diff --git a/fdm-app/app/components/custom/fertilizer-applications/form.tsx b/fdm-app/app/components/custom/fertilizer-applications/form.tsx index ef4b61c96..8874a1f25 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/form.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/form.tsx @@ -1,3 +1,11 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { format } from "date-fns" +import { nl } from "date-fns/locale/nl" +import { CalendarIcon } from "lucide-react" +import { useEffect } from "react" +import { Form } from "react-hook-form" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import type { z } from "zod" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" import { @@ -15,14 +23,6 @@ import { PopoverTrigger, } from "~/components/ui/popover" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import { format } from "date-fns" -import { nl } from "date-fns/locale/nl" -import { CalendarIcon } from "lucide-react" -import { useEffect } from "react" -import { Form } from "react-hook-form" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import type { z } from "zod" import { Combobox } from "../combobox" import { LoadingSpinner } from "../loadingspinner" import { FormSchema } from "./formschema" diff --git a/fdm-app/app/components/custom/fertilizer-applications/list.tsx b/fdm-app/app/components/custom/fertilizer-applications/list.tsx index 2b87e7b1d..fdefcf577 100644 --- a/fdm-app/app/components/custom/fertilizer-applications/list.tsx +++ b/fdm-app/app/components/custom/fertilizer-applications/list.tsx @@ -1,5 +1,5 @@ -import { Button } from "~/components/ui/button" import { format } from "date-fns" +import { Button } from "~/components/ui/button" import { LoadingSpinner } from "../loadingspinner" import type { FertilizerApplication } from "./types.d" diff --git a/fdm-app/app/components/custom/fertilizer/columns.tsx b/fdm-app/app/components/custom/fertilizer/columns.tsx index b3b8557c1..7ac621530 100644 --- a/fdm-app/app/components/custom/fertilizer/columns.tsx +++ b/fdm-app/app/components/custom/fertilizer/columns.tsx @@ -1,3 +1,6 @@ +import type { ColumnDef } from "@tanstack/react-table" +import { ArrowRight, Pencil, SquareArrowOutUpRight } from "lucide-react" +import { NavLink } from "react-router-dom" import { Badge } from "~/components/ui/badge" import { Tooltip, @@ -5,9 +8,6 @@ import { TooltipProvider, TooltipTrigger, } from "~/components/ui/tooltip" -import type { ColumnDef } from "@tanstack/react-table" -import { ArrowRight, Pencil, SquareArrowOutUpRight } from "lucide-react" -import { NavLink } from "react-router-dom" import { DataTableColumnHeader } from "./column-header" export type Fertilizer = { diff --git a/fdm-app/app/components/custom/fertilizer/form.tsx b/fdm-app/app/components/custom/fertilizer/form.tsx index e5614d517..ccf9f0bab 100644 --- a/fdm-app/app/components/custom/fertilizer/form.tsx +++ b/fdm-app/app/components/custom/fertilizer/form.tsx @@ -1,3 +1,7 @@ +import type { UseFormReturn } from "react-hook-form" +import { Form } from "react-router" +import { RemixFormProvider } from "remix-hook-form" +import type { ZodType, z } from "zod" import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Badge } from "~/components/ui/badge" import { Button } from "~/components/ui/button" @@ -24,10 +28,6 @@ import { SelectTrigger, SelectValue, } from "~/components/ui/select" -import type { UseFormReturn } from "react-hook-form" -import { Form } from "react-router" -import { RemixFormProvider } from "remix-hook-form" -import type { ZodType, z } from "zod" import type { Fertilizer } from "./columns" export function FertilizerForm({ diff --git a/fdm-app/app/components/custom/fertilizer/table.tsx b/fdm-app/app/components/custom/fertilizer/table.tsx index 9c82fd8f5..a0aea0003 100644 --- a/fdm-app/app/components/custom/fertilizer/table.tsx +++ b/fdm-app/app/components/custom/fertilizer/table.tsx @@ -1,13 +1,3 @@ -import { Button } from "~/components/ui/button" -import { Input } from "~/components/ui/input" -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "~/components/ui/table" import { type ColumnDef, type ColumnFiltersState, @@ -21,6 +11,16 @@ import { import { Plus } from "lucide-react" import { useState } from "react" import { NavLink } from "react-router" +import { Button } from "~/components/ui/button" +import { Input } from "~/components/ui/input" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "~/components/ui/table" interface DataTableProps { columns: ColumnDef[] diff --git a/fdm-app/app/components/custom/harvest/form.tsx b/fdm-app/app/components/custom/harvest/form.tsx index 7aa51022f..96d3bbec4 100644 --- a/fdm-app/app/components/custom/harvest/form.tsx +++ b/fdm-app/app/components/custom/harvest/form.tsx @@ -1,3 +1,10 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { format } from "date-fns/format" +import { nl } from "date-fns/locale/nl" +import { CalendarIcon } from "lucide-react" +import { Form } from "react-hook-form" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import type { z } from "zod" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" import { @@ -15,13 +22,6 @@ import { PopoverTrigger, } from "~/components/ui/popover" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import { format } from "date-fns/format" -import { nl } from "date-fns/locale/nl" -import { CalendarIcon } from "lucide-react" -import { Form } from "react-hook-form" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import type { z } from "zod" import { LoadingSpinner } from "../loadingspinner" import { FormSchema } from "./schema" diff --git a/fdm-app/app/components/custom/harvest/list.tsx b/fdm-app/app/components/custom/harvest/list.tsx index 1d11b6ae7..0da3f76fc 100644 --- a/fdm-app/app/components/custom/harvest/list.tsx +++ b/fdm-app/app/components/custom/harvest/list.tsx @@ -1,7 +1,7 @@ -import { Button } from "~/components/ui/button" import { format } from "date-fns/format" import { Eye, Trash2 } from "lucide-react" import { NavLink, useFetcher } from "react-router" +import { Button } from "~/components/ui/button" import { LoadingSpinner } from "../loadingspinner" import type { Harvest, HarvestableType } from "./types" diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index becc89a6e..8d45ff554 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -1,5 +1,32 @@ +import * as Sentry from "@sentry/react" +import { + ArrowRightLeft, + BadgeCheck, + Calendar, + Check, + ChevronRight, + ChevronsUpDown, + Cookie, + GitPullRequestArrow, + House, + Languages, + LifeBuoy, + LogOut, + Map as MapIcon, + Scale, + Send, + Settings, + Shapes, + Sparkles, + Square, +} from "lucide-react" +import posthog from "posthog-js" +import { useEffect, useState } from "react" +import { Form, NavLink, useLocation } from "react-router" +import { toast } from "sonner" import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" import { Badge } from "~/components/ui/badge" +import { Button } from "~/components/ui/button" import { Collapsible, CollapsibleContent, @@ -30,38 +57,11 @@ import { SidebarMenuSubButton, SidebarMenuSubItem, } from "~/components/ui/sidebar" -import { useFarmStore } from "~/store/farm" -import { useCalendarStore } from "~/store/calendar" -import { getCalendarSelection } from "~/lib/calendar" -import * as Sentry from "@sentry/react" -import { - ArrowRightLeft, - BadgeCheck, - Calendar, - Check, - ChevronRight, - ChevronsUpDown, - Cookie, - GitPullRequestArrow, - House, - Languages, - LifeBuoy, - LogOut, - Map as MapIcon, - Scale, - Send, - Settings, - Shapes, - Sparkles, - Square, -} from "lucide-react" -import posthog from "posthog-js" import { useIsMobile } from "~/hooks/use-mobile" -import { useEffect, useState } from "react" -import { Form, NavLink, useLocation } from "react-router" -import { toast } from "sonner" +import { getCalendarSelection } from "~/lib/calendar" import { clientConfig } from "~/lib/config" -import { Button } from "~/components/ui/button" +import { useCalendarStore } from "~/store/calendar" +import { useFarmStore } from "~/store/farm" interface SideBarAppType { user: { diff --git a/fdm-app/app/entry.server.tsx b/fdm-app/app/entry.server.tsx index aa5be8a47..91ea9ce88 100644 --- a/fdm-app/app/entry.server.tsx +++ b/fdm-app/app/entry.server.tsx @@ -1,11 +1,11 @@ +import { PassThrough } from "node:stream" +import { createReadableStreamFromReadable } from "@react-router/node" /** * By default, Remix will handle generating the HTTP Response for you. * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ * For more information, see https://remix.run/file-conventions/entry.server */ import * as Sentry from "@sentry/node" -import { PassThrough } from "node:stream" -import { createReadableStreamFromReadable } from "@react-router/node" import { isbot } from "isbot" import { renderToPipeableStream } from "react-dom/server" import type { diff --git a/fdm-app/app/lib/auth.server.ts b/fdm-app/app/lib/auth.server.ts index 91045f5ba..c5a97324c 100644 --- a/fdm-app/app/lib/auth.server.ts +++ b/fdm-app/app/lib/auth.server.ts @@ -1,6 +1,6 @@ -import { fdm } from "~/lib/fdm.server" import { createFdmAuth } from "@svenvw/fdm-core" import type { Session, User } from "better-auth" +import { fdm } from "~/lib/fdm.server" // Initialize better-auth instance for FDM export const auth = createFdmAuth(fdm) diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index 6f9acf3a0..1f432cd54 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -1,6 +1,4 @@ import * as Sentry from "@sentry/react" -import { Banner } from "~/components/custom/banner" -import { Toaster } from "~/components/ui/sonner" import mapBoxStyle from "mapbox-gl/dist/mapbox-gl.css?url" import posthog from "posthog-js" import { useEffect } from "react" @@ -19,9 +17,11 @@ import { import type { LinksFunction, LoaderFunctionArgs } from "react-router" import { getToast } from "remix-toast" import { toast as notify } from "sonner" +import { Banner } from "~/components/custom/banner" +import { ErrorBlock } from "~/components/custom/error" +import { Toaster } from "~/components/ui/sonner" import styles from "~/tailwind.css?url" import type { Route } from "./+types/root" -import { ErrorBlock } from "~/components/custom/error" export const links: LinksFunction = () => [ { rel: "stylesheet", href: styles }, diff --git a/fdm-app/app/routes/api.auth.$.tsx b/fdm-app/app/routes/api.auth.$.tsx index 9bee8a89d..8a53e181b 100644 --- a/fdm-app/app/routes/api.auth.$.tsx +++ b/fdm-app/app/routes/api.auth.$.tsx @@ -1,19 +1,18 @@ -import { auth } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" import type { ActionFunctionArgs, LoaderFunctionArgs, MetaFunction, } from "react-router" +import { auth } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" export const meta: MetaFunction = () => { return [ { title: `Authenticatie | ${clientConfig.name}` }, { name: "description", - content: - "Beveiligde authenticatie voor toegang tot het platform.", + content: "Beveiligde authenticatie voor toegang tot het platform.", }, ] } diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx index 906881bf0..86ffcad71 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.elevation.tsx @@ -1,9 +1,3 @@ -import { getMapboxToken } from "~/integrations/mapbox" -import { Button } from "~/components/ui/button" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -12,7 +6,13 @@ import { data, useLoaderData, } from "react-router" +import { Button } from "~/components/ui/button" +import { getMapboxToken } from "~/integrations/mapbox" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx index 618e4d0f1..66e2482c2 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.fields.tsx @@ -5,21 +5,21 @@ import { NavigationControl, } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" +import { getFields } from "@svenvw/fdm-core" +import type { FeatureCollection } from "geojson" +import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" +import type { MetaFunction } from "react-router" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" -import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { FieldsPanelHover } from "~/components/custom/atlas/atlas-panels" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" import { getTimeframe } from "~/lib/calendar" -import { getFields } from "@svenvw/fdm-core" -import type { FeatureCollection } from "geojson" -import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" -import type { MetaFunction } from "react-router" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx index 432fb287f..2aaab87b9 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.soil.tsx @@ -1,9 +1,3 @@ -import { getMapboxToken } from "~/integrations/mapbox" -import { Button } from "~/components/ui/button" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -12,7 +6,13 @@ import { data, useLoaderData, } from "react-router" +import { Button } from "~/components/ui/button" +import { getMapboxToken } from "~/integrations/mapbox" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.tsx index 100e977d6..503285cb5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.atlas.tsx @@ -1,10 +1,3 @@ -import { FarmHeader } from "~/components/custom/farm/farm-header" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { SidebarInset } from "~/components/ui/sidebar" -import { Skeleton } from "~/components/ui/skeleton" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -16,7 +9,14 @@ import { useLocation, } from "react-router" import { ClientOnly } from "remix-utils/client-only" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { Skeleton } from "~/components/ui/skeleton" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx index 276f13071..addb933c4 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.atlas.tsx @@ -1,14 +1,5 @@ import { Layer, Map as MapGL } from "react-map-gl" import "mapbox-gl/dist/mapbox-gl.css" -import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" -import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" -import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" -import { getViewState } from "~/components/custom/atlas/atlas-viewstate" -import { Separator } from "~/components/ui/separator" -import { Skeleton } from "~/components/ui/skeleton" -import { getSession } from "~/lib/auth.server" -import { handleActionError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" import { getField } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { @@ -17,9 +8,18 @@ import { data, useLoaderData, } from "react-router" -import { ClientOnly } from "remix-utils/client-only" import type { MetaFunction } from "react-router" +import { ClientOnly } from "remix-utils/client-only" +import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" +import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" +import { getViewState } from "~/components/custom/atlas/atlas-viewstate" +import { Separator } from "~/components/ui/separator" +import { Skeleton } from "~/components/ui/skeleton" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx index b545f6dbc..298cf08db 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu._index.tsx @@ -1,14 +1,3 @@ -import { CultivationForm } from "~/components/custom/cultivation/form" -import { FormSchema } from "~/components/custom/cultivation/schema" -import { HarvestsList } from "~/components/custom/harvest/list" -import type { HarvestableType } from "~/components/custom/harvest/types" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { getCultivation, getCultivationsFromCatalogue, @@ -27,13 +16,24 @@ import { useLoaderData, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { HarvestsList } from "~/components/custom/harvest/list" +import type { HarvestableType } from "~/components/custom/harvest/types" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { return [ { title: `Gewas - Perceel | ${clientConfig.name}` }, - + { name: "description", content: "Bekijk en bewerk de gegevens van je gewas.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index e352d7890..0d0353ac6 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -1,11 +1,3 @@ -import { HarvestForm } from "~/components/custom/harvest/form" -import { FormSchema } from "~/components/custom/harvest/schema" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { addHarvest, getCultivation, getHarvest } from "@svenvw/fdm-core" import { type ActionFunctionArgs, @@ -16,7 +8,15 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { @@ -24,7 +24,7 @@ export const meta: MetaFunction = () => { { title: `Oogst - Gewas - Perceel | ${clientConfig.name}` }, { name: "description", - + content: "Bekijk en bewerk de oogst van je gewas.", }, ] diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest._index.tsx index 9246ad634..e26142d2c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest._index.tsx @@ -1,11 +1,3 @@ -import { HarvestForm } from "~/components/custom/harvest/form" -import { FormSchema } from "~/components/custom/harvest/schema" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { addHarvest, getCultivation, @@ -21,7 +13,15 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { @@ -32,7 +32,6 @@ export const meta: MetaFunction = () => { content: "Bekijk en bewerk de oogsten van je gewas.", }, ] - } /** diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx index 2a28e0570..610d42284 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation._index.tsx @@ -1,12 +1,3 @@ -import { CultivationForm } from "~/components/custom/cultivation/form" -import { CultivationList } from "~/components/custom/cultivation/list" -import { FormSchema } from "~/components/custom/cultivation/schema" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { addCultivation, getCultivations, @@ -23,8 +14,17 @@ import { useLoaderData, useLocation, } from "react-router" -import {dataWithSuccess } from "remix-toast" +import { dataWithSuccess } from "remix-toast" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { CultivationList } from "~/components/custom/cultivation/list" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { @@ -37,7 +37,6 @@ export const meta: MetaFunction = () => { ] } - /** * Loads data required for rendering the overview of a specific farm field. * diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx index 394916701..705dc57f6 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.fertilizer.tsx @@ -1,13 +1,3 @@ -import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" -import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" -import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" -import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, @@ -26,7 +16,17 @@ import { useLocation, } from "react-router" import { dataWithError, dataWithSuccess } from "remix-toast" +import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" +import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.norm.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.norm.tsx index 88272263e..240b61af3 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.norm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.norm.tsx @@ -1,10 +1,15 @@ +import { getField } from "@svenvw/fdm-core" +import { + type LoaderFunctionArgs, + type MetaFunction, + data, + useLoaderData, +} from "react-router" import { Separator } from "~/components/ui/separator" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getField } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, type MetaFunction, data, useLoaderData } from "react-router" -import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.overview.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.overview.tsx index 9a3b7d255..7d30ea4fb 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.overview.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.overview.tsx @@ -1,3 +1,19 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { getField, updateField } from "@svenvw/fdm-core" +import { format } from "date-fns" +import { CalendarIcon } from "lucide-react" +import { useEffect } from "react" +import { Form } from "react-hook-form" +import { + type ActionFunctionArgs, + type LoaderFunctionArgs, + data, + useLoaderData, +} from "react-router" +import type { MetaFunction } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import { dataWithSuccess } from "remix-toast" +import { z } from "zod" import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" @@ -24,27 +40,11 @@ import { } from "~/components/ui/select" import { Separator } from "~/components/ui/separator" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import { getField, updateField } from "@svenvw/fdm-core" -import { format } from "date-fns" -import { CalendarIcon } from "lucide-react" -import { useEffect } from "react" -import { Form } from "react-hook-form" -import { - type ActionFunctionArgs, - type LoaderFunctionArgs, - data, - useLoaderData, -} from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import { dataWithSuccess } from "remix-toast" -import { z } from "zod" -import type { MetaFunction } from "react-router" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx index 7ec4966cc..a7c45180e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil._index.tsx @@ -1,12 +1,3 @@ -import { SoilDataCards } from "~/components/custom/soil/cards" -import { SoilAnalysesList } from "~/components/custom/soil/list" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs" -import { getSession } from "~/lib/auth.server" -import { getTimeframe } from "~/lib/calendar" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" import { Timeframe, getField, @@ -25,6 +16,15 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { SoilDataCards } from "~/components/custom/soil/cards" +import { SoilAnalysesList } from "~/components/custom/soil/list" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" /** * Loader function for the soil data page of a specific farm field. diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx index cc3510d1d..8f2895a0e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.$a_id.tsx @@ -1,11 +1,3 @@ -import { SoilAnalysisForm } from "~/components/custom/soil/form" -import { FormSchema } from "~/components/custom/soil/formschema" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { getField, getSoilAnalysis, @@ -21,6 +13,14 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" /** * Loader function for the soil data page of a specific farm field. diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx index 8d6079147..d51e22446 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.tsx @@ -1,11 +1,3 @@ -import { SoilAnalysisForm } from "~/components/custom/soil/form" -import { FormSchema } from "~/components/custom/soil/formschema" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { addSoilAnalysis, getField, @@ -20,6 +12,14 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" /** * Loader function for the soil data page of a specific farm field. diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx index 3289d7737..5c1aaf67c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.tsx @@ -1,12 +1,3 @@ -import { FarmContent } from "~/components/custom/farm/farm-content" -import { FarmHeader } from "~/components/custom/farm/farm-header" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { SidebarInset } from "~/components/ui/sidebar" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { useCalendarStore } from "~/store/calendar" -import { getCalendar, getTimeframe } from "~/lib/calendar" import { getFarms, getField, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -16,7 +7,16 @@ import { redirect, useLoaderData, } from "react-router" +import { FarmContent } from "~/components/custom/farm/farm-content" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { useCalendarStore } from "~/store/calendar" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx index a9fcb35c8..0990c152b 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx @@ -1,3 +1,12 @@ +import { getFarms, getFields } from "@svenvw/fdm-core" +import { + type LoaderFunctionArgs, + NavLink, + data, + redirect, + useLoaderData, +} from "react-router" +import type { MetaFunction } from "react-router" import { FarmHeader } from "~/components/custom/farm/farm-header" import { FarmTitle } from "~/components/custom/farm/farm-title" import { Button } from "~/components/ui/button" @@ -11,20 +20,11 @@ import { import { Separator } from "~/components/ui/separator" import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { getTimeBasedGreeting } from "~/lib/greetings" -import { getTimeframe } from "~/lib/calendar" -import { getFarms, getFields } from "@svenvw/fdm-core" -import { - type LoaderFunctionArgs, - NavLink, - data, - redirect, - useLoaderData, -} from "react-router" -import type { MetaFunction } from "react-router" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx index 30dc98aef..c5c19a22d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx @@ -1,12 +1,3 @@ -import { FarmHeader } from "~/components/custom/farm/farm-header" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { FertilizerForm } from "~/components/custom/fertilizer/form" -import { FormSchema } from "~/components/custom/fertilizer/formschema" -import { SidebarInset } from "~/components/ui/sidebar" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { getFarm, @@ -25,6 +16,15 @@ import { import { useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import type { z } from "zod" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { FertilizerForm } from "~/components/custom/fertilizer/form" +import { FormSchema } from "~/components/custom/fertilizer/formschema" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx index 18c477560..0ab8a1d2d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx @@ -1,3 +1,5 @@ +import { getFarm, getFarms, getFertilizers } from "@svenvw/fdm-core" +import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" import { FarmHeader } from "~/components/custom/farm/farm-header" import { FarmTitle } from "~/components/custom/farm/farm-title" import { @@ -9,8 +11,6 @@ import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { getFarm, getFarms, getFertilizers } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx index 16ea05f6d..31bb344e8 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx @@ -1,12 +1,3 @@ -import { FarmHeader } from "~/components/custom/farm/farm-header" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { FertilizerForm } from "~/components/custom/fertilizer/form" -import { FormSchema } from "~/components/custom/fertilizer/formschema" -import { SidebarInset } from "~/components/ui/sidebar" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { zodResolver } from "@hookform/resolvers/zod" import { addFertilizerToCatalogue, @@ -24,6 +15,15 @@ import { import { useRemixForm } from "remix-hook-form" import { redirectWithSuccess } from "remix-toast" import type { z } from "zod" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { FertilizerForm } from "~/components/custom/fertilizer/form" +import { FormSchema } from "~/components/custom/fertilizer/formschema" +import { SidebarInset } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx index 046b8f327..6b0c37747 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.access.tsx @@ -1,5 +1,5 @@ -import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" +import { Separator } from "~/components/ui/separator" import { clientConfig } from "~/lib/config" // Meta diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx index b3121a2d0..69d79915d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.delete.tsx @@ -1,11 +1,13 @@ -import { Separator } from "~/components/ui/separator" import type { MetaFunction } from "react-router" +import { Separator } from "~/components/ui/separator" import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Verwijderen - Instellingen - Bedrijf | ${clientConfig.name}` }, + { + title: `Verwijderen - Instellingen - Bedrijf | ${clientConfig.name}`, + }, { name: "description", content: "Verwijder de gegevens van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx index 5f5663c73..d775ebe64 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.properties.tsx @@ -1,3 +1,18 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { getFarm, updateFarm } from "@svenvw/fdm-core" +import { useEffect } from "react" +import { Form } from "react-hook-form" +import { + type ActionFunctionArgs, + type LoaderFunctionArgs, + type MetaFunction, + data, + useLoaderData, +} from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import { dataWithSuccess } from "remix-toast" +import validator from "validator" +import { z } from "zod" import { LoadingSpinner } from "~/components/custom/loadingspinner" import { Button } from "~/components/ui/button" import { @@ -15,28 +30,15 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { zodResolver } from "@hookform/resolvers/zod" -import { getFarm, updateFarm } from "@svenvw/fdm-core" -import { useEffect } from "react" -import { Form } from "react-hook-form" -import { - type ActionFunctionArgs, - type LoaderFunctionArgs, - type MetaFunction, - data, - useLoaderData, -} from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import { dataWithSuccess } from "remix-toast" -import validator from "validator" -import { z } from "zod" const { isPostalCode } = validator import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Eigenschappen - Instellingen - Bedrijf | ${clientConfig.name}` }, + { + title: `Eigenschappen - Instellingen - Bedrijf | ${clientConfig.name}`, + }, { name: "description", content: "Bekijk en bewerk de eigenschappen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx index e597012c5..6bc537c7b 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings.tsx @@ -1,12 +1,3 @@ -import { FarmContent } from "~/components/custom/farm/farm-content" -import { FarmHeader } from "~/components/custom/farm/farm-header" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { SidebarInset } from "~/components/ui/sidebar" -import { Toaster } from "~/components/ui/sonner" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { useCalendarStore } from "~/store/calendar" import { getFarm, getFarms } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -15,7 +6,16 @@ import { data, useLoaderData, } from "react-router" +import { FarmContent } from "~/components/custom/farm/farm-content" +import { FarmHeader } from "~/components/custom/farm/farm-header" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { SidebarInset } from "~/components/ui/sidebar" +import { Toaster } from "~/components/ui/sonner" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { useCalendarStore } from "~/store/calendar" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.$b_id_farm.tsx b/fdm-app/app/routes/farm.$b_id_farm.tsx index c4e08cb7d..2d730cc13 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.tsx @@ -1,7 +1,7 @@ -import { getSession } from "~/lib/auth.server" -import { handleActionError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, data } from "react-router" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError } from "~/lib/error" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm._index.tsx b/fdm-app/app/routes/farm._index.tsx index d156e89c8..98824c8f6 100644 --- a/fdm-app/app/routes/farm._index.tsx +++ b/fdm-app/app/routes/farm._index.tsx @@ -1,3 +1,10 @@ +import { getFarms } from "@svenvw/fdm-core" +import { + type LoaderFunctionArgs, + type MetaFunction, + NavLink, + useLoaderData, +} from "react-router" import { FarmHeader } from "~/components/custom/farm/farm-header" import { FarmTitle } from "~/components/custom/farm/farm-title" import { Button } from "~/components/ui/button" @@ -11,12 +18,10 @@ import { import { Separator } from "~/components/ui/separator" import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { getTimeBasedGreeting } from "~/lib/greetings" -import { getFarms } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, type MetaFunction, NavLink, useLoaderData } from "react-router" -import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.account.tsx b/fdm-app/app/routes/farm.account.tsx index 0e48c6e0c..ae209e08c 100644 --- a/fdm-app/app/routes/farm.account.tsx +++ b/fdm-app/app/routes/farm.account.tsx @@ -1,10 +1,16 @@ -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" import { type LoaderFunctionArgs, type MetaFunction, useLoaderData, } from "react-router" +import { FarmTitle } from "~/components/custom/farm/farm-title" +import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, +} from "~/components/ui/breadcrumb" import { Card, CardContent, @@ -14,15 +20,9 @@ import { } from "~/components/ui/card" import { Separator } from "~/components/ui/separator" import { SidebarTrigger } from "~/components/ui/sidebar" -import { - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - BreadcrumbList, -} from "~/components/ui/breadcrumb" -import { FarmTitle } from "~/components/custom/farm/farm-title" -import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx index 2f32d1ae3..cacc4acb6 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx @@ -1,6 +1,28 @@ +import { + addCultivation, + addField, + addSoilAnalysis, + getFarm, +} from "@svenvw/fdm-core" +import { useState } from "react" +import { + GeolocateControl, + Layer, + Map as MapGL, + NavigationControl, +} from "react-map-gl" +import { + type ActionFunctionArgs, + type LoaderFunctionArgs, + type MetaFunction, + data, + useLoaderData, +} from "react-router" +import { redirectWithSuccess } from "remix-toast" +import { ClientOnly } from "remix-utils/client-only" +import { getMapboxStyle, getMapboxToken } from "~/app/integrations/mapbox" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" -import { getMapboxStyle, getMapboxToken } from "~/app/integrations/mapbox" import { FieldsPanelHover, FieldsPanelSelection, @@ -23,32 +45,10 @@ import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { Skeleton } from "~/components/ui/skeleton" import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" import { getCalendar, getTimeframe } from "~/lib/calendar" -import { - addCultivation, - addField, - addSoilAnalysis, - getFarm, -} from "@svenvw/fdm-core" -import { useState } from "react" -import { - GeolocateControl, - Layer, - Map as MapGL, - NavigationControl, -} from "react-map-gl" -import { - type ActionFunctionArgs, - type LoaderFunctionArgs, - type MetaFunction, - data, - useLoaderData, -} from "react-router" -import { redirectWithSuccess } from "remix-toast" -import { ClientOnly } from "remix-utils/client-only" -import { fdm } from "~/lib/fdm.server" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" import { getNmiApiKey, getSoilParameterEstimates } from "../integrations/nmi" // Meta diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx index b74da468c..c9db010ab 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx @@ -4,11 +4,12 @@ import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Vanggewas - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Vanggewas - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", - content: - "Bekijk en selecteer het vanggewas uit je bouwplan.", + content: "Bekijk en selecteer het vanggewas uit je bouwplan.", }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx index ecdd789fa..1af76b440 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop._index.tsx @@ -1,13 +1,3 @@ -import { CultivationForm } from "~/components/custom/cultivation/form" -import { FormSchema } from "~/components/custom/cultivation/schema" -import { HarvestsList } from "~/components/custom/harvest/list" -import type { HarvestableType } from "~/components/custom/harvest/types" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan, getCultivationsFromCatalogue, @@ -23,7 +13,17 @@ import { useLoaderData, } from "react-router" import { dataWithSuccess } from "remix-toast" +import { CultivationForm } from "~/components/custom/cultivation/form" +import { FormSchema } from "~/components/custom/cultivation/schema" +import { HarvestsList } from "~/components/custom/harvest/list" +import type { HarvestableType } from "~/components/custom/harvest/types" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index 33cf5222f..206aab06e 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -1,9 +1,3 @@ -import { HarvestForm } from "~/components/custom/harvest/form" -import { Button } from "~/components/ui/button" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan, getCultivationsFromCatalogue, @@ -15,15 +9,24 @@ import { data, useLoaderData, } from "react-router" +import { HarvestForm } from "~/components/custom/harvest/form" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: `Oogst - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Oogst - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", - content: "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", + content: + "Bekijk en selecteer de oogst van een gewas uit je bouwplan.", }, ] } diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx index 10117e9e9..fae5b57d0 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest._index.tsx @@ -1,11 +1,3 @@ -import { HarvestForm } from "~/components/custom/harvest/form" -import { FormSchema } from "~/components/custom/harvest/schema" -import { Button } from "~/components/ui/button" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { addHarvest, getCultivationPlan, @@ -19,7 +11,15 @@ import { data, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { HarvestForm } from "~/components/custom/harvest/form" +import { FormSchema } from "~/components/custom/harvest/schema" +import { Button } from "~/components/ui/button" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx index a29e51c36..b50d76609 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -1,12 +1,3 @@ -import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" -import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" -import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" -import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { extractFormValuesFromRequest } from "~/lib/form" -import { getTimeframe } from "~/lib/calendar" import { calculateDose } from "@svenvw/fdm-calculator" import { addFertilizerApplication, @@ -24,13 +15,24 @@ import { useLocation, } from "react-router" import { dataWithSuccess } from "remix-toast" -import { fdm } from "~/lib/fdm.server" +import { FertilizerApplicationsCards } from "~/components/custom/fertilizer-applications/cards" +import { FertilizerApplicationForm } from "~/components/custom/fertilizer-applications/form" +import { FormSchema } from "~/components/custom/fertilizer-applications/formschema" +import { FertilizerApplicationsList } from "~/components/custom/fertilizer-applications/list" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { return [ - { title: `Bemesting - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Bemesting - Bouwplan - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", content: "Bekijk en voeg bemestingen toe aan je bouwplan.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx index 87216c5e1..198260a50 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.tsx @@ -1,12 +1,3 @@ -import { - Pagination, - PaginationContent, - PaginationItem, - PaginationLink, -} from "~/components/ui/pagination" -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { getCalendar, getTimeframe } from "~/lib/calendar" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, @@ -16,8 +7,17 @@ import { useLocation, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "~/lib/fdm.server" +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, +} from "~/components/ui/pagination" +import { getSession } from "~/lib/auth.server" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx index ef5fadfe5..9d74f1c47 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx @@ -1,14 +1,14 @@ -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "~/lib/calendar" import { getCultivationPlan } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, redirect, } from "react-router" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx index 35d38157c..f36cd1e42 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx @@ -1,3 +1,11 @@ +import { getCultivationPlan, getFarm } from "@svenvw/fdm-core" +import { + type LoaderFunctionArgs, + type MetaFunction, + NavLink, + data, +} from "react-router" +import { Outlet, useLoaderData } from "react-router" import { SidebarPage } from "~/components/custom/sidebar-page" import { Breadcrumb, @@ -11,19 +19,11 @@ import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { Toaster } from "~/components/ui/sonner" import { getSession } from "~/lib/auth.server" +import { getCalendar, getTimeframe } from "~/lib/calendar" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { cn } from "~/lib/utils" -import { getCalendar, getTimeframe } from "~/lib/calendar" -import { getCultivationPlan, getFarm } from "@svenvw/fdm-core" -import { - type LoaderFunctionArgs, - type MetaFunction, - NavLink, - data, -} from "react-router" -import { Outlet, useLoaderData } from "react-router" -import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx index e8bc6bde1..8a999f119 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx @@ -1,4 +1,29 @@ -import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" +import { zodResolver } from "@hookform/resolvers/zod" +import { + addSoilAnalysis, + getCultivations, + getCultivationsFromCatalogue, + getField, + getSoilAnalysis, + updateCultivation, + updateField, +} from "@svenvw/fdm-core" +import type { FeatureCollection } from "geojson" +import { useEffect } from "react" +import { useEffect } from "react" +import { Form } from "react-hook-form" +import { Layer, Map as MapGL } from "react-map-gl" +import { + type ActionFunctionArgs, + type LoaderFunctionArgs, + type MetaFunction, + data, +} from "react-router" +import { useLoaderData } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import { dataWithSuccess } from "remix-toast" +import { ClientOnly } from "remix-utils/client-only" +import { z } from "zod" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" @@ -23,38 +48,13 @@ import { SelectValue, } from "~/components/ui/select" import { Skeleton } from "~/components/ui/skeleton" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { extractFormValuesFromRequest } from "~/lib/form" import { getTimeframe } from "~/lib/calendar" -import { zodResolver } from "@hookform/resolvers/zod" -import { - addSoilAnalysis, - getCultivations, - getCultivationsFromCatalogue, - getField, - getSoilAnalysis, - updateCultivation, - updateField, -} from "@svenvw/fdm-core" -import type { FeatureCollection } from "geojson" -import { useEffect } from "react" -import { Form } from "react-hook-form" -import { Layer, Map as MapGL } from "react-map-gl" -import { - type ActionFunctionArgs, - type LoaderFunctionArgs, - type MetaFunction, - data, -} from "react-router" -import { useLoaderData } from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import { dataWithSuccess } from "remix-toast" -import { ClientOnly } from "remix-utils/client-only" -import { z } from "zod" -import { fdm } from "~/lib/fdm.server" -import { useEffect } from "react" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx index 2f0d97e63..5025f6343 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields._index.tsx @@ -1,19 +1,21 @@ -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { getTimeframe } from "~/lib/calendar" import { getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, type MetaFunction, redirect, } from "react-router" +import { getSession } from "~/lib/auth.server" +import { getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" // Meta export const meta: MetaFunction = () => { return [ - { title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx index eed3c06d4..4e977be2f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx @@ -1,18 +1,3 @@ -import { SidebarPage } from "~/components/custom/sidebar-page" -import { - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - BreadcrumbList, - BreadcrumbSeparator, -} from "~/components/ui/breadcrumb" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { cn } from "~/lib/utils" -import { getCalendar, getTimeframe } from "~/lib/calendar" import { getCultivationsFromCatalogue, getFarm, @@ -27,13 +12,30 @@ import { data, } from "react-router" import { useLoaderData } from "react-router" -import { fdm } from "~/lib/fdm.server" +import { SidebarPage } from "~/components/custom/sidebar-page" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbSeparator, +} from "~/components/ui/breadcrumb" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" +import { getCalendar, getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { cn } from "~/lib/utils" // Meta export const meta: MetaFunction = () => { return [ - { title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}` }, + { + title: `Percelen beheren - Bedrijf toevoegen | ${clientConfig.name}`, + }, { name: "description", content: diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx index 42d34dec1..a2e2b6145 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx @@ -1,3 +1,29 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { + getCultivations, + getCultivationsFromCatalogue, + getCurrentSoilData, + getField, + getSoilParametersDescription, + updateCultivation, + updateField, +} from "@svenvw/fdm-core" +import type { FeatureCollection } from "geojson" +import { Plus } from "lucide-react" +import { useEffect, useRef, useState } from "react" +import { Layer, Map as MapGL } from "react-map-gl" +import { Form } from "react-router" +import { + type ActionFunctionArgs, + type LoaderFunctionArgs, + type MetaFunction, + NavLink, + data, +} from "react-router" +import { useLoaderData } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import { dataWithSuccess } from "remix-toast" +import { z } from "zod" import { getMapboxStyle, getMapboxToken, @@ -30,34 +56,8 @@ import { Separator } from "~/components/ui/separator" import { Skeleton } from "~/components/ui/skeleton" import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" -import { extractFormValuesFromRequest } from "~/lib/form" -import { zodResolver } from "@hookform/resolvers/zod" -import { - getCultivations, - getCultivationsFromCatalogue, - getCurrentSoilData, - getField, - getSoilParametersDescription, - updateCultivation, - updateField, -} from "@svenvw/fdm-core" -import type { FeatureCollection } from "geojson" -import { Plus } from "lucide-react" -import { useEffect, useRef, useState } from "react" -import { Layer, Map as MapGL } from "react-map-gl" -import { Form } from "react-router" -import { - type ActionFunctionArgs, - type LoaderFunctionArgs, - type MetaFunction, - NavLink, - data, -} from "react-router" -import { useLoaderData } from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import { dataWithSuccess } from "remix-toast" -import { z } from "zod" import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx index ffc10dfed..30a8d6838 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id.new_analysis.tsx @@ -1,11 +1,3 @@ -import { SoilAnalysisForm } from "~/components/custom/soil/form" -import { FormSchema } from "~/components/custom/soil/formschema" -import { Button } from "~/components/ui/button" -import { Separator } from "~/components/ui/separator" -import { getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" -import { fdm } from "~/lib/fdm.server" -import { extractFormValuesFromRequest } from "~/lib/form" import { addSoilAnalysis, getField, @@ -20,6 +12,14 @@ import { useLoaderData, } from "react-router" import { redirectWithSuccess } from "remix-toast" +import { SoilAnalysisForm } from "~/components/custom/soil/form" +import { FormSchema } from "~/components/custom/soil/formschema" +import { Button } from "~/components/ui/button" +import { Separator } from "~/components/ui/separator" +import { getSession } from "~/lib/auth.server" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" /** * Loader function for the soil data page of a specific farm field. diff --git a/fdm-app/app/routes/farm.create._index.tsx b/fdm-app/app/routes/farm.create._index.tsx index 362136053..ddbfa2aac 100644 --- a/fdm-app/app/routes/farm.create._index.tsx +++ b/fdm-app/app/routes/farm.create._index.tsx @@ -1,16 +1,3 @@ -import { Farm } from "~/components/blocks/farm" -import { - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - BreadcrumbList, - BreadcrumbSeparator, -} from "~/components/ui/breadcrumb" -import { Separator } from "~/components/ui/separator" -import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" -import { getSession } from "~/lib/auth.server" -import { handleActionError } from "~/lib/error" -import { extractFormValuesFromRequest } from "~/lib/form" import { PrincipalId, addFarm, @@ -27,8 +14,21 @@ import type { import { useLoaderData } from "react-router" import { redirectWithSuccess } from "remix-toast" import { z } from "zod" -import { fdm } from "~/lib/fdm.server" +import { Farm } from "~/components/blocks/farm" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbSeparator, +} from "~/components/ui/breadcrumb" +import { Separator } from "~/components/ui/separator" +import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError } from "~/lib/error" +import { fdm } from "~/lib/fdm.server" +import { extractFormValuesFromRequest } from "~/lib/form" // Meta export const meta: MetaFunction = () => { @@ -36,8 +36,7 @@ export const meta: MetaFunction = () => { { title: `Bedrijf toevoegen | ${clientConfig.name}` }, { name: "description", - content: - "Voeg een nieuw bedrijf toe.", + content: "Voeg een nieuw bedrijf toe.", }, ] } diff --git a/fdm-app/app/routes/farm.tsx b/fdm-app/app/routes/farm.tsx index db405d218..4afdec394 100644 --- a/fdm-app/app/routes/farm.tsx +++ b/fdm-app/app/routes/farm.tsx @@ -1,10 +1,5 @@ -import { SidebarApp } from "~/components/custom/sidebar-app" -import { SidebarProvider } from "~/components/ui/sidebar" -import { auth, getSession } from "~/lib/auth.server" -import { handleActionError, handleLoaderError } from "~/lib/error" import posthog from "posthog-js" -import { useCalendarStore } from "~/store/calendar" -import { useFarmStore } from "~/store/farm" +import { useEffect } from "react" import type { ActionFunctionArgs, LoaderFunctionArgs, @@ -12,12 +7,17 @@ import type { } from "react-router" import { redirect, useRoutes } from "react-router" import { useLoaderData, useMatches } from "react-router" -import { useEffect } from "react" -import WhatsNew from "./farm.whats-new" -import Account from "./farm.account" -import { SidebarInset } from "~/components/ui/sidebar" import { Outlet } from "react-router-dom" +import { SidebarApp } from "~/components/custom/sidebar-app" +import { SidebarProvider } from "~/components/ui/sidebar" +import { SidebarInset } from "~/components/ui/sidebar" +import { auth, getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleActionError, handleLoaderError } from "~/lib/error" +import { useCalendarStore } from "~/store/calendar" +import { useFarmStore } from "~/store/farm" +import Account from "./farm.account" +import WhatsNew from "./farm.whats-new" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index 342c509ba..46a51c93d 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -1,26 +1,26 @@ -import { getSession } from "~/lib/auth.server" -import { handleLoaderError } from "~/lib/error" +import { formatDistanceToNow } from "date-fns" +import { nl } from "date-fns/locale" +import { Sparkles } from "lucide-react" +import ReactMarkdown from "react-markdown" import { type LoaderFunctionArgs, type MetaFunction, useLoaderData, } from "react-router" -import { formatDistanceToNow } from "date-fns" -import { nl } from "date-fns/locale" +import remarkGfm from "remark-gfm" import { FarmTitle } from "~/components/custom/farm/farm-title" -import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" -import { Separator } from "~/components/ui/separator" -import { Sparkles } from "lucide-react" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, } from "~/components/ui/breadcrumb" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" +import { Separator } from "~/components/ui/separator" import { SidebarTrigger } from "~/components/ui/sidebar" -import ReactMarkdown from "react-markdown" -import remarkGfm from "remark-gfm" +import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" +import { handleLoaderError } from "~/lib/error" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 61cb0c6bb..06026bcbf 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -1,3 +1,9 @@ +import { Check, Info, MoveDown } from "lucide-react" +import type { LoaderFunctionArgs } from "react-router" +import { redirect } from "react-router" +import type { MetaFunction } from "react-router" +import { toast } from "sonner" +import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" import { Button } from "~/components/ui/button" import { Card, @@ -9,15 +15,9 @@ import { } from "~/components/ui/card" import { signIn } from "~/lib/auth-client" import { auth } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { cn } from "~/lib/utils" -import { Check, MoveDown, Info } from "lucide-react" -import type { LoaderFunctionArgs } from "react-router" -import { redirect } from "react-router" -import { toast } from "sonner" -import type { MetaFunction } from "react-router" -import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 970bc5ef8..cb846ad26 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -33,11 +33,11 @@ const config: Config = { // Integrations integrations: { mapbox: { - token: String(process.env.MAPBOX_TOKEN) + token: String(process.env.MAPBOX_TOKEN), }, nmi: { - api_key: String(process.env.NMI_API_KEY) - } + api_key: String(process.env.NMI_API_KEY), + }, }, // Analytics From 823da9121a5b2379832d9b46770950e6e95cade0 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:51:10 +0200 Subject: [PATCH 17/35] js file does not support loading config yet --- fdm-app/app/lib/fdm-migrate.server.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fdm-app/app/lib/fdm-migrate.server.js b/fdm-app/app/lib/fdm-migrate.server.js index e2160d22a..3061e54c2 100644 --- a/fdm-app/app/lib/fdm-migrate.server.js +++ b/fdm-app/app/lib/fdm-migrate.server.js @@ -5,35 +5,33 @@ import { } from "@svenvw/fdm-core" import { drizzle } from "drizzle-orm/postgres-js" import postgres from "postgres" -import { serverConfig } from "~/lib/config" // Get credentials to connect to db const host = - serverConfig.database.host ?? + process.env.POSTGRES_HOST ?? (() => { throw new Error("POSTGRES_HOST environment variable is required") })() const port = - serverConfig.database.port || + Number(process.env.POSTGRES_PORT) || (() => { throw new Error("POSTGRES_PORT environment variable is required") })() const user = - serverConfig.database.user ?? + process.env.POSTGRES_USER ?? (() => { throw new Error("POSTGRES_USER environment variable is required") })() const password = - serverConfig.database.password ?? + process.env.POSTGRES_PASSWORD ?? (() => { throw new Error("POSTGRES_PASSWORD environment variable is required") })() const database = - serverConfig.database.database ?? + process.env.POSTGRES_DB ?? (() => { throw new Error("POSTGRES_DB environment variable is required") })() - const migrationsFolderPath = "node_modules/@svenvw/fdm-core/dist/db/migrations" const client = postgres({ From fde253e27cc6939cc60645f8025f61d0db3498a0 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:08:01 +0200 Subject: [PATCH 18/35] Fix loading config at build --- fdm-app/vite.config.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fdm-app/vite.config.ts b/fdm-app/vite.config.ts index fb4194c9e..b67b97ae6 100644 --- a/fdm-app/vite.config.ts +++ b/fdm-app/vite.config.ts @@ -2,14 +2,15 @@ import { reactRouter } from "@react-router/dev/vite" import { sentryVitePlugin } from "@sentry/vite-plugin" import { defineConfig } from "vite" import tsconfigPaths from "vite-tsconfig-paths" -import { serverConfig } from "~/lib/config" +import fdmConfig from "./fdm.config" let pluginSentry: any -if (serverConfig.analytics.sentry) { +if (fdmConfig.analytics.sentry) { pluginSentry = sentryVitePlugin({ - org: serverConfig.analytics.sentry.organization, - authToken: serverConfig.analytics.sentry.auth_token, - project: serverConfig.analytics.sentry.project, + org: fdmConfig.analytics.sentry.organization, + authToken: fdmConfig.analytics.sentry.auth_token, + project: fdmConfig.analytics.sentry.project, + telemetry: false, }) } From a298559399e57bb5f2a87013a436da7537f2f367 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:08:17 +0200 Subject: [PATCH 19/35] Fix loading environmentals --- fdm-app/fdm.config.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index cb846ad26..4c27ac279 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -16,18 +16,18 @@ const config: Config = { clientSecret: String(process.env.GOOGLE_CLIENT_SECRET), }, microsoft: { - clientId: String(process.env.MICROSOFT_CLIENT_ID), - clientSecret: String(process.env.MICROSOFT_CLIENT_SECRET), + clientId: String(process.env.MS_CLIENT_ID), + clientSecret: String(process.env.MS_CLIENT_SECRET), }, }, // Database database: { - password: String(process.env.DB_PASSWORD), - user: String(process.env.DB_USER), - database: String(process.env.DB_DATABASE), - host: String(process.env.DB_HOST), - port: Number(process.env.DB_PORT), + password: String(process.env.POSTGRES_PASSWORD), + user: String(process.env.POSTGRES_USER), + database: String(process.env.POSTGRES_DATABASE), + host: String(process.env.POSTGRES_HOST), + port: Number(process.env.POSTGRES_PORT), }, // Integrations From 189672a3f0bceb048bd97630ede5bef63abcdfb7 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:08:33 +0200 Subject: [PATCH 20/35] Fix merge issue at signin --- fdm-app/app/routes/signin.tsx | 72 ++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 06026bcbf..2ae07ba2a 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -1,4 +1,4 @@ -import { Check, Info, MoveDown } from "lucide-react" +import { Check, Cookie, Info, MoveDown } from "lucide-react" import type { LoaderFunctionArgs } from "react-router" import { redirect } from "react-router" import type { MetaFunction } from "react-router" @@ -170,20 +170,20 @@ export default function SignIn() {
- - - -

- Let op! -

-
- -

- {`${clientConfig.name} is nog in ontwikkeling. Functionaliteiten + + + +

+ Let op! +

+ + +

+ {`${clientConfig.name} is nog in ontwikkeling. Functionaliteiten kunnen nog ontbreken of veranderen.`} -

-
-
+

+ + Aanmelden @@ -291,27 +291,29 @@ export default function SignIn() { - - -

- Door verder te gaan, gaat u akkoord met het{" "} - - Privacybeleid - -

-
-
-
- + + +

+ Door verder te gaan, gaat u akkoord met het{" "} + + Privacybeleid + +

+
+ +
+ +
+
- ) + ); } From 1025f3faca2483dcf7daad3b4f0ee68d24e6dbdc Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:08:45 +0200 Subject: [PATCH 21/35] Remove not needed import --- fdm-app/app/lib/form.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/fdm-app/app/lib/form.ts b/fdm-app/app/lib/form.ts index e5aea621c..e18e86df8 100644 --- a/fdm-app/app/lib/form.ts +++ b/fdm-app/app/lib/form.ts @@ -1,4 +1,3 @@ -import { data } from "react-router" import type { ZodSchema, z } from "zod" import { handleActionError } from "./error" From 80c09af139e91596ae211300b7d34da738390919 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:31:50 +0200 Subject: [PATCH 22/35] Various fixes --- fdm-app/app/components/custom/soil/cards.tsx | 7 +++--- fdm-app/app/components/custom/soil/form.tsx | 21 +++++++++--------- fdm-app/app/components/custom/soil/list.tsx | 6 ++--- fdm-app/app/lib/cache.server.ts | 22 +++++++++++-------- fdm-app/app/root.tsx | 7 ++++-- ...farm.create.$b_id_farm.$calendar.atlas.tsx | 2 +- ...eate.$b_id_farm.$calendar.fields.$b_id.tsx | 1 - ....create.$b_id_farm.fields.$b_id._index.tsx | 2 +- fdm-app/fdm.config.ts | 4 ++-- 9 files changed, 38 insertions(+), 34 deletions(-) diff --git a/fdm-app/app/components/custom/soil/cards.tsx b/fdm-app/app/components/custom/soil/cards.tsx index e44c12c34..1fc522892 100644 --- a/fdm-app/app/components/custom/soil/cards.tsx +++ b/fdm-app/app/components/custom/soil/cards.tsx @@ -1,12 +1,11 @@ -import { Button } from "@/components/ui/button" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, -} from "@/components/ui/tooltip" -import { cn } from "@/lib/utils" +} from "~/components/ui/tooltip" +import { cn } from "~/lib/utils" import type { CurrentSoilData, SoilParameterDescription, diff --git a/fdm-app/app/components/custom/soil/form.tsx b/fdm-app/app/components/custom/soil/form.tsx index 448c2e3b2..da6d16e6e 100644 --- a/fdm-app/app/components/custom/soil/form.tsx +++ b/fdm-app/app/components/custom/soil/form.tsx @@ -1,6 +1,6 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Button } from "@/components/ui/button" -import { Calendar } from "@/components/ui/calendar" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" +import { Calendar } from "~/components/ui/calendar" import { FormControl, FormDescription, @@ -8,33 +8,32 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form" -import { Input } from "@/components/ui/input" +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover" +} from "~/components/ui/popover" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, -} from "@/components/ui/select" -import { cn } from "@/lib/utils" +} from "~/components/ui/select" +import { cn } from "~/lib/utils" import { zodResolver } from "@hookform/resolvers/zod" import type { SoilParameterDescription } from "@svenvw/fdm-core" import { format } from "date-fns" import { nl } from "date-fns/locale/nl" import { CalendarIcon } from "lucide-react" import { useEffect } from "react" -import { get } from "react-hook-form" import { Form } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import type { z } from "zod" -import { FormSchema } from "./formschema" -import type { SoilAnalysis } from "./types" +import { FormSchema } from "~/components/custom/soil/formschema" +import type { SoilAnalysis } from "~/components/custom/soil/types" export function SoilAnalysisForm(props: { soilAnalysis: SoilAnalysis | undefined diff --git a/fdm-app/app/components/custom/soil/list.tsx b/fdm-app/app/components/custom/soil/list.tsx index 0903eefdc..38948629b 100644 --- a/fdm-app/app/components/custom/soil/list.tsx +++ b/fdm-app/app/components/custom/soil/list.tsx @@ -1,6 +1,6 @@ -import { LoadingSpinner } from "@/components/custom/loadingspinner" -import { Button } from "@/components/ui/button" -import { cn } from "@/lib/utils" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" +import { cn } from "~/lib/utils" import { format } from "date-fns" import { nl } from "date-fns/locale/nl" import { NavLink } from "react-router" diff --git a/fdm-app/app/lib/cache.server.ts b/fdm-app/app/lib/cache.server.ts index 84225af08..679f6a97e 100644 --- a/fdm-app/app/lib/cache.server.ts +++ b/fdm-app/app/lib/cache.server.ts @@ -126,14 +126,13 @@ export function getCacheControlHeaders( export function addSecurityHeaders(headers: Headers): Headers { let reportUri = "" if (clientConfig.analytics.sentry) { - reportUri = clientConfig.analytics.sentry.security_report_uri - .replace(/\s+/g, " ") - .trim() + reportUri = encodeURIComponent( + clientConfig.analytics.sentry.security_report_uri.trim(), + ) } - headers.set( - "Content-Security-Policy", - `default-src 'self'; + // Construct the Content-Security-Policy + let csp = `default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.mapbox.com https://*.posthog.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://*.posthog.com; @@ -145,9 +144,14 @@ export function addSecurityHeaders(headers: Headers): Headers { object-src 'none'; base-uri 'self'; form-action 'self'; - frame-ancestors 'none'; - report-uri ${reportUri};`, - ) + frame-ancestors 'none';` + + // Add report-uri only if it exists + if (reportUri) { + csp += `report-uri ${reportUri};` + } + + headers.set("Content-Security-Policy", csp.replace(/\s+/g, " ").trim()) // Removing all double spaces headers.set("X-Content-Type-Options", "nosniff") headers.set("X-Frame-Options", "DENY") headers.set("X-XSS-Protection", "1; mode=block") diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index 1f432cd54..3f766d2f0 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -60,11 +60,14 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { export function Layout() { const loaderData = useLoaderData() const toast = loaderData?.toast + const location = useLocation() // Capture pagevies useEffect(() => { - posthog.capture("$pageview") - }, [location]) // Dependency on location ensures pageview is captured on every navigation + if (typeof window !== "undefined") { + posthog.capture("$pageview") + } + }, [location]); // Hook to show the toasts useEffect(() => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx index cacc4acb6..542427047 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx @@ -20,7 +20,7 @@ import { } from "react-router" import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" -import { getMapboxStyle, getMapboxToken } from "~/app/integrations/mapbox" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" import { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx index 8a999f119..b98c7eeff 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx @@ -10,7 +10,6 @@ import { } from "@svenvw/fdm-core" import type { FeatureCollection } from "geojson" import { useEffect } from "react" -import { useEffect } from "react" import { Form } from "react-hook-form" import { Layer, Map as MapGL } from "react-map-gl" import { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx index a2e2b6145..8c3a29ba8 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.fields.$b_id._index.tsx @@ -27,7 +27,7 @@ import { z } from "zod" import { getMapboxStyle, getMapboxToken, -} from "~/components/custom/atlas/atlas-mapbox" +} from "~/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 4c27ac279..2b5608eec 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -25,7 +25,7 @@ const config: Config = { database: { password: String(process.env.POSTGRES_PASSWORD), user: String(process.env.POSTGRES_USER), - database: String(process.env.POSTGRES_DATABASE), + database: String(process.env.POSTGRES_DB), host: String(process.env.POSTGRES_HOST), port: Number(process.env.POSTGRES_PORT), }, @@ -44,7 +44,7 @@ const config: Config = { analytics: { // Sentry sentry: { - dsn: String(process.env.SENTRY_DSN), + dsn: String(process.env.VITE_SENTRY_DSN), organization: String(process.env.VITE_SENTRY_ORG), project: String(process.env.VITE_SENTRY_PROJECT), auth_token: String(process.env.SENTRY_AUTH_TOKEN), From 962f0bf859123812b16117a3da3d262bee254c01 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 09:24:44 +0200 Subject: [PATCH 23/35] Improve config for logo --- fdm-app/app/lib/config.ts | 6 +++--- fdm-app/fdm.config.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts index 2dcf279f2..b64b175d9 100644 --- a/fdm-app/app/lib/config.ts +++ b/fdm-app/app/lib/config.ts @@ -6,8 +6,8 @@ export const serverConfig = config // Create the client-safe config object export const clientConfig: ClientConfig = { name: config.name, - favicon: config.favicon, logo: config.logo, + logomark: config.logomark, analytics: { sentry: config.analytics.sentry ? { @@ -30,8 +30,8 @@ export const clientConfig: ClientConfig = { export interface Config { name: string - favicon: string logo: string + logomark: string auth: { fdm_session_secret: string better_auth_secret: string @@ -77,8 +77,8 @@ export interface Config { // Define the structure for client-safe configuration interface ClientConfig { name: string - favicon: string logo: string + logomark: string analytics: { sentry?: { dsn: string diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts index 2b5608eec..5dfe7c1a1 100644 --- a/fdm-app/fdm.config.ts +++ b/fdm-app/fdm.config.ts @@ -4,8 +4,8 @@ const config: Config = { // Site name name: process.env.FDM_NAME || "FDM", // Site logo - favicon: "/favicon.ico", - logo: "/logo.svg", + logo: "/fdm-high-resolution-logo-transparent.png", + logomark: "/fdm-high-resolution-logo-transparent-no-text.png", // Authentication auth: { From fab4b6db4518655effd570f75e14521d2c884313 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 11:03:19 +0200 Subject: [PATCH 24/35] Fix config --- fdm-app/.env.example | 3 + fdm-app/app/lib/cache.server.ts | 2 +- fdm-app/app/lib/config.server.ts | 43 +++++++ fdm-app/app/lib/config.ts | 114 ++++-------------- fdm-app/app/lib/fdm.server.tsx | 2 +- ...cultivations.$b_lu_catalogue.covercrop.tsx | 2 +- ...atalogue.crop.harvest.$b_id_harvesting.tsx | 2 +- ...ltivations.$b_lu_catalogue.fertilizers.tsx | 2 +- ..._id_farm.$calendar.cultivations._index.tsx | 2 +- ...eate.$b_id_farm.$calendar.fields.$b_id.tsx | 2 +- ...arm.create.$b_id_farm.$calendar.fields.tsx | 2 +- fdm-app/app/types/config.d.ts | 51 ++++++++ fdm-app/fdm.config.ts | 67 ---------- fdm-app/vite.config.ts | 13 +- 14 files changed, 138 insertions(+), 169 deletions(-) create mode 100644 fdm-app/app/lib/config.server.ts create mode 100644 fdm-app/app/types/config.d.ts delete mode 100644 fdm-app/fdm.config.ts diff --git a/fdm-app/.env.example b/fdm-app/.env.example index eb5d3597e..19368de68 100644 --- a/fdm-app/.env.example +++ b/fdm-app/.env.example @@ -3,6 +3,9 @@ # Example: development, production NODE_ENV= +# Name of the application +VITE_FDM_NAME= + # Secret key used to sign session cookies. # Must be a strong, randomly generated string. Do not hardcode or commit this value to version control. Use a secure secret management system. # Rotate this key periodically. Compromising this secret can allow attackers to hijack user sessions. diff --git a/fdm-app/app/lib/cache.server.ts b/fdm-app/app/lib/cache.server.ts index 679f6a97e..c703f1007 100644 --- a/fdm-app/app/lib/cache.server.ts +++ b/fdm-app/app/lib/cache.server.ts @@ -125,7 +125,7 @@ export function getCacheControlHeaders( */ export function addSecurityHeaders(headers: Headers): Headers { let reportUri = "" - if (clientConfig.analytics.sentry) { + if (clientConfig.analytics?.sentry) { reportUri = encodeURIComponent( clientConfig.analytics.sentry.security_report_uri.trim(), ) diff --git a/fdm-app/app/lib/config.server.ts b/fdm-app/app/lib/config.server.ts new file mode 100644 index 000000000..51e1cc0bc --- /dev/null +++ b/fdm-app/app/lib/config.server.ts @@ -0,0 +1,43 @@ +import type { ServerConfig } from "~/types/config.d" + +// Export the full config for server-side use +export const serverConfig: ServerConfig = { + // Authentication + auth: { + fdm_session_secret: String(process.env.FDM_SESSION_SECRET), + better_auth_secret: String(process.env.BETTER_AUTH_SECRET), + google: { + clientSecret: String(process.env.GOOGLE_CLIENT_SECRET), + }, + microsoft: { + clientSecret: String(process.env.MS_CLIENT_SECRET), + }, + }, + + // Database + database: { + password: String(process.env.POSTGRES_PASSWORD), + user: String(process.env.POSTGRES_USER), + database: String(process.env.POSTGRES_DB), + host: String(process.env.POSTGRES_HOST), + port: Number(process.env.POSTGRES_PORT), + }, + + // Integrations + integrations: { + mapbox: { + token: String(process.env.MAPBOX_TOKEN), + }, + nmi: { + api_key: String(process.env.NMI_API_KEY), + }, + }, + + // Analytics + analytics: { + // Sentry + sentry: { + auth_token: String(process.env.SENTRY_AUTH_TOKEN), + }, + }, +} diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts index b64b175d9..25b211fc5 100644 --- a/fdm-app/app/lib/config.ts +++ b/fdm-app/app/lib/config.ts @@ -1,94 +1,30 @@ -import config from "@/fdm.config" +import type { ClientConfig } from "~/types/config.d" -// Export the full config for server-side use -export const serverConfig = config - -// Create the client-safe config object +// Export the client-safe config object export const clientConfig: ClientConfig = { - name: config.name, - logo: config.logo, - logomark: config.logomark, - analytics: { - sentry: config.analytics.sentry - ? { - dsn: config.analytics.sentry.dsn, - organization: config.analytics.sentry.organization, - project: config.analytics.sentry.project, - trace_sample_rate: config.analytics.sentry.trace_sample_rate, - replay_sample_rate: - config.analytics.sentry.replay_sample_rate, - replay_sample_rate_on_error: - config.analytics.sentry.replay_sample_rate_on_error, - profile_sample_rate: - config.analytics.sentry.profile_sample_rate, - security_report_uri: - config.analytics.sentry.security_report_uri, - } - : null, - }, -} + // Site name + name: import.meta.env.VITE_FDM_NAME || "FDM", + // Site logo + logo: "/fdm-high-resolution-logo-transparent.png", + logomark: "/fdm-high-resolution-logo-transparent-no-text.png", -export interface Config { - name: string - logo: string - logomark: string - auth: { - fdm_session_secret: string - better_auth_secret: string - google?: { - clientId: string - clientSecret: string - } | null - microsoft?: { - clientId: string - clientSecret: string - } | null - } - database: { - password: string - user: string - database: string - host: string - port: number - } - integrations: { - mapbox: { - token: string - } - nmi?: { - api_key: string - } - } analytics: { - sentry?: { - dsn: string - organization: string - project: string - auth_token: string - trace_sample_rate: number - replay_sample_rate: number - replay_sample_rate_on_error: number - profile_sample_rate: number - security_report_uri: string - } | null - } -} - -// Define the structure for client-safe configuration -interface ClientConfig { - name: string - logo: string - logomark: string - analytics: { - sentry?: { - dsn: string - organization: string - project: string - trace_sample_rate: number - replay_sample_rate: number - replay_sample_rate_on_error: number - profile_sample_rate: number - security_report_uri: string - } | null - } + sentry: { + dsn: String(import.meta.env.VITE_SENTRY_DSN), + organization: String(import.meta.env.VITE_SENTRY_ORG), + project: String(import.meta.env.VITE_SENTRY_PROJECT), + trace_sample_rate: + Number(import.meta.env.VITE_SENTRY_TRACE_SAMPLE_RATE) || 1, + replay_sample_rate: + Number(import.meta.env.VITE_SENTRY_REPLAY_SAMPLE_RATE) || 0, + replay_sample_rate_on_error: + Number(import.meta.env.VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR) || + 1, + profile_sample_rate: + Number(import.meta.env.VITE_SENTRY_PROFILE_SAMPLE_RATE) || 1, + security_report_uri: String( + import.meta.env.VITE_SENTRY_SECURITY_REPORT_URI, + ), + }, + }, } diff --git a/fdm-app/app/lib/fdm.server.tsx b/fdm-app/app/lib/fdm.server.tsx index b8faf312c..8ac2e19eb 100644 --- a/fdm-app/app/lib/fdm.server.tsx +++ b/fdm-app/app/lib/fdm.server.tsx @@ -1,6 +1,6 @@ import { fdmSchema as schema } from "@svenvw/fdm-core" import { drizzle } from "drizzle-orm/postgres-js" -import { serverConfig } from "~/lib/config" +import { serverConfig } from "~/lib/config.server" // Get credentials to connect to db const host = diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx index c9db010ab..cd6546772 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,5 +1,5 @@ import type { MetaFunction } from "react-router" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index 206aab06e..29b28685c 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -13,7 +13,7 @@ import { HarvestForm } from "~/components/custom/harvest/form" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx index b50d76609..09d3b9015 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -22,7 +22,7 @@ import { FertilizerApplicationsList } from "~/components/custom/fertilizer-appli import { Separator } from "~/components/ui/separator" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx index 9d74f1c47..c6cbe089a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx @@ -6,7 +6,7 @@ import { } from "react-router" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx index b98c7eeff..8104ac05a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.tsx @@ -50,7 +50,7 @@ import { Skeleton } from "~/components/ui/skeleton" import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx index 4e977be2f..8e417d44e 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx @@ -25,7 +25,7 @@ import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { getCalendar, getTimeframe } from "~/lib/calendar" -import { clientConfig } from "~/lib/config" +import { clientConfig } from "@/app/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { cn } from "~/lib/utils" diff --git a/fdm-app/app/types/config.d.ts b/fdm-app/app/types/config.d.ts new file mode 100644 index 000000000..ca268e06d --- /dev/null +++ b/fdm-app/app/types/config.d.ts @@ -0,0 +1,51 @@ +export interface ServerConfig { + auth: { + fdm_session_secret: string + better_auth_secret: string + google?: { + clientSecret: string + } | null + microsoft?: { + clientSecret: string + } | null + } + database: { + password: string + user: string + database: string + host: string + port: number + } + integrations: { + mapbox: { + token: string + } + nmi?: { + api_key: string + } + } + analytics: { + sentry?: { + auth_token: string + } | null + } +} + +// Define the structure for client-safe configuration +export interface ClientConfig { + name: string + logo: string + logomark: string + analytics: { + sentry?: { + dsn: string + organization: string + project: string + trace_sample_rate: number + replay_sample_rate: number + replay_sample_rate_on_error: number + profile_sample_rate: number + security_report_uri: string + } | null + } +} \ No newline at end of file diff --git a/fdm-app/fdm.config.ts b/fdm-app/fdm.config.ts deleted file mode 100644 index 5dfe7c1a1..000000000 --- a/fdm-app/fdm.config.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type { Config } from "~/lib/config" - -const config: Config = { - // Site name - name: process.env.FDM_NAME || "FDM", - // Site logo - logo: "/fdm-high-resolution-logo-transparent.png", - logomark: "/fdm-high-resolution-logo-transparent-no-text.png", - - // Authentication - auth: { - fdm_session_secret: String(process.env.FDM_SESSION_SECRET), - better_auth_secret: String(process.env.BETTER_AUTH_SECRET), - google: { - clientId: String(process.env.GOOGLE_CLIENT_ID), - clientSecret: String(process.env.GOOGLE_CLIENT_SECRET), - }, - microsoft: { - clientId: String(process.env.MS_CLIENT_ID), - clientSecret: String(process.env.MS_CLIENT_SECRET), - }, - }, - - // Database - database: { - password: String(process.env.POSTGRES_PASSWORD), - user: String(process.env.POSTGRES_USER), - database: String(process.env.POSTGRES_DB), - host: String(process.env.POSTGRES_HOST), - port: Number(process.env.POSTGRES_PORT), - }, - - // Integrations - integrations: { - mapbox: { - token: String(process.env.MAPBOX_TOKEN), - }, - nmi: { - api_key: String(process.env.NMI_API_KEY), - }, - }, - - // Analytics - analytics: { - // Sentry - sentry: { - dsn: String(process.env.VITE_SENTRY_DSN), - organization: String(process.env.VITE_SENTRY_ORG), - project: String(process.env.VITE_SENTRY_PROJECT), - auth_token: String(process.env.SENTRY_AUTH_TOKEN), - trace_sample_rate: - Number(process.env.VITE_SENTRY_TRACE_SAMPLE_RATE) || 1, - replay_sample_rate: - Number(process.env.VITE_SENTRY_REPLAY_SAMPLE_RATE) || 0, - replay_sample_rate_on_error: - Number(process.env.VITE_SENTRY_REPLAY_SAMPLE_RATE_ON_ERROR) || - 1, - profile_sample_rate: - Number(process.env.VITE_SENTRY_PROFILE_SAMPLE_RATE) || 1, - security_report_uri: String( - process.env.VITE_SENTRY_SECURITY_REPORT_URI, - ), - }, - }, -} - -export default config diff --git a/fdm-app/vite.config.ts b/fdm-app/vite.config.ts index b67b97ae6..980e12e6c 100644 --- a/fdm-app/vite.config.ts +++ b/fdm-app/vite.config.ts @@ -2,14 +2,17 @@ import { reactRouter } from "@react-router/dev/vite" import { sentryVitePlugin } from "@sentry/vite-plugin" import { defineConfig } from "vite" import tsconfigPaths from "vite-tsconfig-paths" -import fdmConfig from "./fdm.config" +// Vite does not support loading config files from `/lib/config`... +const org = process.env.VITE_SENTRY_ORG +const authToken = process.env.SENTRY_AUTH_TOKEN +const project = process.env.VITE_SENTRY_PROJECT let pluginSentry: any -if (fdmConfig.analytics.sentry) { +if (org && authToken && project) { pluginSentry = sentryVitePlugin({ - org: fdmConfig.analytics.sentry.organization, - authToken: fdmConfig.analytics.sentry.auth_token, - project: fdmConfig.analytics.sentry.project, + org: org, + authToken: authToken, + project: project, telemetry: false, }) } From a45ef0cb47cd9dbd0e1d6c41b99801b6acf2bc3e Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 11:22:31 +0200 Subject: [PATCH 25/35] Fix sidebar --- fdm-app/app/components/custom/sidebar-app.tsx | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 8d45ff554..05d1db6f8 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -151,19 +151,40 @@ export function SidebarApp(props: SideBarAppType) { } } - const [feedback, setFeedback] = useState() + const [feedback, setFeedback] = useState | null>(null) const [isLoading, setIsLoading] = useState(true) + useEffect(() => { + try { + const feedbackInstance = Sentry.getFeedback() + if (feedbackInstance) { + setFeedback(feedbackInstance) + } else { + console.warn("Sentry.getFeedback() returned null or undefined.") + } + } catch (error) { + console.error("Failed to initialize Sentry feedback:", error) + } finally { + setIsLoading(false) + } + }, []) + if (isLoading) { return null } - useEffect(() => { - setFeedback(Sentry.getFeedback()) - setIsLoading(false) - }, []) - const openFeedbackForm = async () => { + if (!feedback || typeof feedback.createForm !== "function") { + console.error( + "Feedback object not available or missing createForm method.", + ) + toast.error( + "Feedback formulier is nog niet beschikbaar. Probeer het opnieuw.", + ) + return + } try { const form = await feedback.createForm() form.appendToDom() From f7f4b9e2940568fd8a9a9f1775e0ec11410e5aa7 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 11:36:53 +0200 Subject: [PATCH 26/35] Enable posthog only when config for posthog is provided --- fdm-app/app/components/custom/banner.tsx | 4 ++- fdm-app/app/components/custom/sidebar-app.tsx | 29 +++++++++++-------- fdm-app/app/entry.client.tsx | 11 ++++--- fdm-app/app/lib/config.ts | 9 ++++-- fdm-app/app/root.tsx | 9 +++--- fdm-app/app/routes/farm.tsx | 3 +- fdm-app/app/types/config.d.ts | 6 +++- 7 files changed, 44 insertions(+), 27 deletions(-) diff --git a/fdm-app/app/components/custom/banner.tsx b/fdm-app/app/components/custom/banner.tsx index f669955af..1408dcd6c 100644 --- a/fdm-app/app/components/custom/banner.tsx +++ b/fdm-app/app/components/custom/banner.tsx @@ -2,6 +2,7 @@ import { Cookie, X } from "lucide-react" import posthog from "posthog-js" import { useEffect, useState } from "react" import { Button } from "~/components/ui/button" +import { clientConfig } from "~/lib/config" type ConsentType = "yes" | "no" | "undecided" @@ -36,7 +37,8 @@ export function Banner() { }, []) useEffect(() => { - if (consentGiven !== "undecided") { + // Set PostHog persistence based on consent, if PostHog is configured + if (clientConfig.analytics.posthog && consentGiven !== "undecided") { try { posthog.set_config({ persistence: diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 05d1db6f8..2de8469eb 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -63,15 +63,17 @@ import { clientConfig } from "~/lib/config" import { useCalendarStore } from "~/store/calendar" import { useFarmStore } from "~/store/farm" +interface SideBarAppUserType { + id: string + name: string // Full name from session.user + email: string + image?: string | null | undefined + // Other properties from session.user might exist but are not needed here +} + interface SideBarAppType { - user: { - firstname: string - surname: string - name: string - email: string - image: string | undefined - } - userName: string + user: SideBarAppUserType + userName: string // Display name, potentially different from user.name initials: string } @@ -503,7 +505,7 @@ export function SidebarApp(props: SideBarAppType) { > @@ -512,7 +514,7 @@ export function SidebarApp(props: SideBarAppType) {
- {`${user.firstname} ${user.surname}`} + {userName} {user.email} @@ -530,7 +532,6 @@ export function SidebarApp(props: SideBarAppType) {
- {/* */} {avatarInitials} @@ -595,7 +596,11 @@ export function SidebarApp(props: SideBarAppType) { -
-
- - - - -
- -
- - ) -} - -/** - * Processes the form submission to update field details. - * - * This function validates that the necessary URL parameters for the field and farm IDs are present. - * It extracts form data and session information from the incoming request, updates the field record, - * and, if applicable, updates the related cultivation data. If the submitted soil properties differ from - * the existing values, a new soil analysis entry is added. - * - * @param request - The HTTP request containing form submission and session data. - * @param params - An object with URL parameters including the field ID (b_id) and farm ID (b_id_farm). - * @returns A payload with a success message upon successful update. - * @throws {Error} If either the field ID or farm ID is missing. - */ -export async function action({ request, params }: ActionFunctionArgs) { - try { - const b_id = params.b_id - if (!b_id) { - throw new Error("missing: b_id") - } - const b_id_farm = params.b_id_farm - if (!b_id_farm) { - throw new Error("missing: b_id_farm") - } - - // Get the session - const session = await getSession(request) - - // Get timeframe from calendar store - const timeframe = getTimeframe(params) - - const formValues = await extractFormValuesFromRequest( - request, - FormSchema, - ) - - await updateField( - fdm, - session.principal_id, - b_id, - formValues.b_name, - undefined, - undefined, - undefined, - undefined, - undefined, - ) - - const cultivations = await getCultivations( - fdm, - session.principal_id, - b_id, - timeframe, - ) - if (cultivations && cultivations.length > 0) { - await updateCultivation( - fdm, - session.principal_id, - cultivations[0].b_lu, - formValues.b_lu_catalogue, - undefined, - undefined, - ) - - const currentSoilAnalysis = await getSoilAnalysis( - fdm, - session.principal_id, - b_id, - ) - const soilPropertiesChanged = - currentSoilAnalysis?.b_soiltype_agr !== - formValues.b_soiltype_agr || - currentSoilAnalysis?.b_gwl_class !== formValues.b_gwl_class || - currentSoilAnalysis?.a_p_al !== formValues.a_p_al || - currentSoilAnalysis?.a_p_cc !== formValues.a_p_cc || - currentSoilAnalysis?.a_som_loi !== formValues.a_som_loi - - if (soilPropertiesChanged) { - const currentYear = new Date().getFullYear() - const defaultDate = new Date(currentYear, 0, 1) - await addSoilAnalysis( - fdm, - session.principal_id, - defaultDate, - "user", - b_id, - 30, - defaultDate, - { - a_p_al: formValues.a_p_al, - a_p_cc: formValues.a_p_cc, - a_som_loi: formValues.a_som_loi, - b_soiltype_agr: formValues.b_soiltype_agr, - b_gwl_class: formValues.b_gwl_class, - }, - ) - } - - return dataWithSuccess("fields have been updated", { - message: `${formValues.b_name} is bijgewerkt! 🎉`, - }) - } - } catch (error) { - throw handleActionError(error) - } -} From f4d59a846a031bc65be85b01281033c8e0adb17b Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:08:58 +0200 Subject: [PATCH 31/35] Update changeset --- .changeset/warm-dryers-start.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/warm-dryers-start.md b/.changeset/warm-dryers-start.md index 2aeb08a02..2a5866116 100644 --- a/.changeset/warm-dryers-start.md +++ b/.changeset/warm-dryers-start.md @@ -2,4 +2,4 @@ "@svenvw/fdm-app": minor --- -Rename `FDM` to `MINAS2` +Make fdm-app configurable for various settings, including the name From 7594b4ae141591f09dc889fd0a78329b01a4d8df Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:09:59 +0200 Subject: [PATCH 32/35] Fix type --- fdm-app/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdm-app/vite.config.ts b/fdm-app/vite.config.ts index 980e12e6c..229735913 100644 --- a/fdm-app/vite.config.ts +++ b/fdm-app/vite.config.ts @@ -7,7 +7,7 @@ import tsconfigPaths from "vite-tsconfig-paths" const org = process.env.VITE_SENTRY_ORG const authToken = process.env.SENTRY_AUTH_TOKEN const project = process.env.VITE_SENTRY_PROJECT -let pluginSentry: any +let pluginSentry: ReturnType | undefined if (org && authToken && project) { pluginSentry = sentryVitePlugin({ org: org, From c3bf8555028503e5e20be165e5bbb269004334a0 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:20:02 +0200 Subject: [PATCH 33/35] Nitpicks --- fdm-app/app/integrations/nmi.ts | 2 +- fdm-app/app/root.tsx | 3 ++- ...tivation.$b_lu.harvest.$b_id_harvesting.tsx | 1 - .../farm.$b_id_farm.$calendar.field._index.tsx | 2 +- .../farm.$b_id_farm.fertilizers.$p_id.tsx | 13 +++++++++++++ .../farm.$b_id_farm.fertilizers._index.tsx | 18 +++++++++++++++++- .../routes/farm.$b_id_farm.fertilizers.new.tsx | 13 +++++++++++++ .../routes/farm.$b_id_farm.settings._index.tsx | 2 +- ....cultivations.$b_lu_catalogue.covercrop.tsx | 2 +- ...catalogue.crop.harvest.$b_id_harvesting.tsx | 2 +- ...ultivations.$b_lu_catalogue.fertilizers.tsx | 2 +- ...b_id_farm.$calendar.cultivations._index.tsx | 2 +- ...reate.$b_id_farm.$calendar.cultivations.tsx | 1 - ...farm.create.$b_id_farm.$calendar.fields.tsx | 2 +- fdm-app/app/routes/farm.whats-new.tsx | 2 +- 15 files changed, 54 insertions(+), 13 deletions(-) diff --git a/fdm-app/app/integrations/nmi.ts b/fdm-app/app/integrations/nmi.ts index 42c3f57c2..0653f2499 100644 --- a/fdm-app/app/integrations/nmi.ts +++ b/fdm-app/app/integrations/nmi.ts @@ -1,4 +1,4 @@ -import { serverConfig } from "@/app/lib/config" +import { serverConfig } from "~/lib/config.server" import centroid from "@turf/centroid" import type { Feature } from "geojson" diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index f6b2e1f2f..b828dda23 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -64,7 +64,8 @@ export function Layout() { const location = useLocation() // Capture pageviews if PostHog is configured - useEffect(() => { + // biome-ignore lint/correctness/useExhaustiveDependencies: This is a false positive: the useEffect should run whenever the location changes to capture new pageviews correctly + useEffect(() => { if (clientConfig.analytics.posthog && typeof window !== "undefined") { posthog.capture("$pageview") } diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx index 0d0353ac6..e434ac614 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.harvest.$b_id_harvesting.tsx @@ -24,7 +24,6 @@ export const meta: MetaFunction = () => { { title: `Oogst - Gewas - Perceel | ${clientConfig.name}` }, { name: "description", - content: "Bekijk en bewerk de oogst van je gewas.", }, ] diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx index 0990c152b..dd44fb0c6 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx @@ -2,11 +2,11 @@ import { getFarms, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, NavLink, + type MetaFunction, data, redirect, useLoaderData, } from "react-router" -import type { MetaFunction } from "react-router" import { FarmHeader } from "~/components/custom/farm/farm-header" import { FarmTitle } from "~/components/custom/farm/farm-title" import { Button } from "~/components/ui/button" diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx index c5c19a22d..edcfcc10d 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx @@ -10,6 +10,7 @@ import { useEffect } from "react" import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction, data, useLoaderData, } from "react-router" @@ -25,6 +26,18 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" +import { clientConfig } from "~/lib/config" + +export const meta: MetaFunction = () => { + return [ + { title: `Meststof | ${clientConfig.name}` }, + { + name: "description", + content: + "Bekij de details van deze meststof", + }, + ] +} export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx index 0ab8a1d2d..9a9682731 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx @@ -1,5 +1,10 @@ import { getFarm, getFarms, getFertilizers } from "@svenvw/fdm-core" -import { type LoaderFunctionArgs, data, useLoaderData } from "react-router" +import { + type LoaderFunctionArgs, + type MetaFunction, + data, + useLoaderData, +} from "react-router" import { FarmHeader } from "~/components/custom/farm/farm-header" import { FarmTitle } from "~/components/custom/farm/farm-title" import { @@ -11,6 +16,17 @@ import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" +import { clientConfig } from "~/lib/config" + +export const meta: MetaFunction = () => { + return [ + { title: `Meststoffen | ${clientConfig.name}` }, + { + name: "description", + content: "Bekij de lijst van meststoffen beschikbaar.", + }, + ] +} export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx index 31bb344e8..d36aa3ec3 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx @@ -9,6 +9,7 @@ import { useEffect } from "react" import { type ActionFunctionArgs, type LoaderFunctionArgs, + type MetaFunction data, useLoaderData, } from "react-router" @@ -24,6 +25,18 @@ import { getSession } from "~/lib/auth.server" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" +import { clientConfig } from "~/lib/config" + +export const meta: MetaFunction = () => { + return [ + { title: `Meststof toevoegen | ${clientConfig.name}` }, + { + name: "description", + content: + "Voeg een meststof toe om deze te gebruiken op dit bedrijf.", + }, + ] +} export async function loader({ request, params }: LoaderFunctionArgs) { try { diff --git a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx index 845f83212..c738c932c 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.settings._index.tsx @@ -4,7 +4,7 @@ import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { return [ - { title: `Instellingen - Bedrijf | ${clientConfig.name}` }, + { title: `Instellingen - Bedrijf | ${clientConfig.name}` }, { name: "description", content: "Bekijk en bewerk de instellingen van je bedrijf.", diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx index cd6546772..c9db010ab 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.covercrop.tsx @@ -1,5 +1,5 @@ import type { MetaFunction } from "react-router" -import { clientConfig } from "@/app/lib/config" +import { clientConfig } from "~/lib/config" // Meta export const meta: MetaFunction = () => { diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx index 29b28685c..206aab06e 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.crop.harvest.$b_id_harvesting.tsx @@ -13,7 +13,7 @@ import { HarvestForm } from "~/components/custom/harvest/form" import { Button } from "~/components/ui/button" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "@/app/lib/config" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx index 09d3b9015..b50d76609 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.$b_lu_catalogue.fertilizers.tsx @@ -22,7 +22,7 @@ import { FertilizerApplicationsList } from "~/components/custom/fertilizer-appli import { Separator } from "~/components/ui/separator" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "@/app/lib/config" +import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx index c6cbe089a..9d74f1c47 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations._index.tsx @@ -6,7 +6,7 @@ import { } from "react-router" import { getSession } from "~/lib/auth.server" import { getTimeframe } from "~/lib/calendar" -import { clientConfig } from "@/app/lib/config" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx index f36cd1e42..0c95ed27a 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.cultivations.tsx @@ -17,7 +17,6 @@ import { import { Button } from "~/components/ui/button" import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" -import { Toaster } from "~/components/ui/sonner" import { getSession } from "~/lib/auth.server" import { getCalendar, getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx index 8e417d44e..4e977be2f 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.tsx @@ -25,7 +25,7 @@ import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" import { getCalendar, getTimeframe } from "~/lib/calendar" -import { clientConfig } from "@/app/lib/config" +import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { cn } from "~/lib/utils" diff --git a/fdm-app/app/routes/farm.whats-new.tsx b/fdm-app/app/routes/farm.whats-new.tsx index 46a51c93d..ab7abef02 100644 --- a/fdm-app/app/routes/farm.whats-new.tsx +++ b/fdm-app/app/routes/farm.whats-new.tsx @@ -41,7 +41,7 @@ export interface UpdatePost { isNew?: boolean } -// Dta for update posts +// Data for update posts export const updatePosts: UpdatePost[] = [ { id: "update-1", From a60bc50a8a46d85d38ef854b41c07c7c02d7f255 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:22:24 +0200 Subject: [PATCH 34/35] Typo --- fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx index d36aa3ec3..8751817e3 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx @@ -9,7 +9,7 @@ import { useEffect } from "react" import { type ActionFunctionArgs, type LoaderFunctionArgs, - type MetaFunction + type MetaFunction, data, useLoaderData, } from "react-router" From ac88db4831ff2b67d77403edb309b22ae8fd86b3 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Fri, 4 Apr 2025 12:26:32 +0200 Subject: [PATCH 35/35] Format the code --- fdm-app/app/components/custom/sidebar-app.tsx | 7 ++++-- fdm-app/app/components/custom/soil/cards.tsx | 16 +++++++------- fdm-app/app/components/custom/soil/form.tsx | 22 +++++++++---------- fdm-app/app/components/custom/soil/list.tsx | 6 ++--- fdm-app/app/integrations/nmi.ts | 2 +- fdm-app/app/lib/config.ts | 5 ++--- fdm-app/app/root.tsx | 4 ++-- ...farm.$b_id_farm.$calendar.field._index.tsx | 2 +- .../farm.$b_id_farm.fertilizers.$p_id.tsx | 5 ++--- .../farm.$b_id_farm.fertilizers._index.tsx | 2 +- .../farm.$b_id_farm.fertilizers.new.tsx | 2 +- ...farm.create.$b_id_farm.$calendar.atlas.tsx | 2 +- ..._id_farm.$calendar.fields.$b_id._index.tsx | 2 +- fdm-app/app/routes/signin.tsx | 6 ++--- 14 files changed, 42 insertions(+), 41 deletions(-) diff --git a/fdm-app/app/components/custom/sidebar-app.tsx b/fdm-app/app/components/custom/sidebar-app.tsx index 2de8469eb..26a0d880c 100644 --- a/fdm-app/app/components/custom/sidebar-app.tsx +++ b/fdm-app/app/components/custom/sidebar-app.tsx @@ -505,7 +505,7 @@ export function SidebarApp(props: SideBarAppType) { > @@ -597,7 +597,10 @@ export function SidebarApp(props: SideBarAppType) { type="submit" variant="link" onClick={() => { - if (clientConfig.analytics.posthog) { + if ( + clientConfig.analytics + .posthog + ) { posthog.reset() } }} diff --git a/fdm-app/app/components/custom/soil/cards.tsx b/fdm-app/app/components/custom/soil/cards.tsx index 1fc522892..196b6d595 100644 --- a/fdm-app/app/components/custom/soil/cards.tsx +++ b/fdm-app/app/components/custom/soil/cards.tsx @@ -1,11 +1,3 @@ -import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "~/components/ui/tooltip" -import { cn } from "~/lib/utils" import type { CurrentSoilData, SoilParameterDescription, @@ -14,6 +6,14 @@ import { format } from "date-fns/format" import { nl } from "date-fns/locale/nl" import { Calendar, Microscope, Pencil, Sparkles, User } from "lucide-react" import { NavLink } from "react-router" +import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "~/components/ui/tooltip" +import { cn } from "~/lib/utils" function SoilDataCard({ title, diff --git a/fdm-app/app/components/custom/soil/form.tsx b/fdm-app/app/components/custom/soil/form.tsx index da6d16e6e..7339639cd 100644 --- a/fdm-app/app/components/custom/soil/form.tsx +++ b/fdm-app/app/components/custom/soil/form.tsx @@ -1,4 +1,15 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import type { SoilParameterDescription } from "@svenvw/fdm-core" +import { format } from "date-fns" +import { nl } from "date-fns/locale/nl" +import { CalendarIcon } from "lucide-react" +import { useEffect } from "react" +import { Form } from "react-router" +import { RemixFormProvider, useRemixForm } from "remix-hook-form" +import type { z } from "zod" import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { FormSchema } from "~/components/custom/soil/formschema" +import type { SoilAnalysis } from "~/components/custom/soil/types" import { Button } from "~/components/ui/button" import { Calendar } from "~/components/ui/calendar" import { @@ -23,17 +34,6 @@ import { SelectValue, } from "~/components/ui/select" import { cn } from "~/lib/utils" -import { zodResolver } from "@hookform/resolvers/zod" -import type { SoilParameterDescription } from "@svenvw/fdm-core" -import { format } from "date-fns" -import { nl } from "date-fns/locale/nl" -import { CalendarIcon } from "lucide-react" -import { useEffect } from "react" -import { Form } from "react-router" -import { RemixFormProvider, useRemixForm } from "remix-hook-form" -import type { z } from "zod" -import { FormSchema } from "~/components/custom/soil/formschema" -import type { SoilAnalysis } from "~/components/custom/soil/types" export function SoilAnalysisForm(props: { soilAnalysis: SoilAnalysis | undefined diff --git a/fdm-app/app/components/custom/soil/list.tsx b/fdm-app/app/components/custom/soil/list.tsx index 38948629b..14e0cbfe4 100644 --- a/fdm-app/app/components/custom/soil/list.tsx +++ b/fdm-app/app/components/custom/soil/list.tsx @@ -1,9 +1,9 @@ -import { LoadingSpinner } from "~/components/custom/loadingspinner" -import { Button } from "~/components/ui/button" -import { cn } from "~/lib/utils" import { format } from "date-fns" import { nl } from "date-fns/locale/nl" import { NavLink } from "react-router" +import { LoadingSpinner } from "~/components/custom/loadingspinner" +import { Button } from "~/components/ui/button" +import { cn } from "~/lib/utils" import type { SoilAnalysis } from "./types" export function SoilAnalysesList({ diff --git a/fdm-app/app/integrations/nmi.ts b/fdm-app/app/integrations/nmi.ts index 0653f2499..28ba80335 100644 --- a/fdm-app/app/integrations/nmi.ts +++ b/fdm-app/app/integrations/nmi.ts @@ -1,6 +1,6 @@ -import { serverConfig } from "~/lib/config.server" import centroid from "@turf/centroid" import type { Feature } from "geojson" +import { serverConfig } from "~/lib/config.server" export function getNmiApiKey() { if (!serverConfig.integrations.nmi) { diff --git a/fdm-app/app/lib/config.ts b/fdm-app/app/lib/config.ts index 54b5f90cf..a59cefb53 100644 --- a/fdm-app/app/lib/config.ts +++ b/fdm-app/app/lib/config.ts @@ -36,7 +36,6 @@ const posthogConfig = ? { key: posthogKey, host: posthogHost } : null - // Export the client-safe config object export const clientConfig: ClientConfig = { // Site name @@ -46,7 +45,7 @@ export const clientConfig: ClientConfig = { logomark: "/fdm-high-resolution-logo-transparent-no-text.png", analytics: { - sentry: sentryConfig, - posthog: posthogConfig, + sentry: sentryConfig, + posthog: posthogConfig, }, } diff --git a/fdm-app/app/root.tsx b/fdm-app/app/root.tsx index b828dda23..26075b4e1 100644 --- a/fdm-app/app/root.tsx +++ b/fdm-app/app/root.tsx @@ -19,8 +19,8 @@ import { getToast } from "remix-toast" import { toast as notify } from "sonner" import { Banner } from "~/components/custom/banner" import { ErrorBlock } from "~/components/custom/error" -import { clientConfig } from "~/lib/config" // Import clientConfig import { Toaster } from "~/components/ui/sonner" +import { clientConfig } from "~/lib/config" // Import clientConfig import styles from "~/tailwind.css?url" import type { Route } from "./+types/root" @@ -65,7 +65,7 @@ export function Layout() { // Capture pageviews if PostHog is configured // biome-ignore lint/correctness/useExhaustiveDependencies: This is a false positive: the useEffect should run whenever the location changes to capture new pageviews correctly - useEffect(() => { + useEffect(() => { if (clientConfig.analytics.posthog && typeof window !== "undefined") { posthog.capture("$pageview") } diff --git a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx index dd44fb0c6..37b8151b1 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.$calendar.field._index.tsx @@ -1,8 +1,8 @@ import { getFarms, getFields } from "@svenvw/fdm-core" import { type LoaderFunctionArgs, - NavLink, type MetaFunction, + NavLink, data, redirect, useLoaderData, diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx index edcfcc10d..c94a568d5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.$p_id.tsx @@ -23,18 +23,17 @@ import { FertilizerForm } from "~/components/custom/fertilizer/form" import { FormSchema } from "~/components/custom/fertilizer/formschema" import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ { title: `Meststof | ${clientConfig.name}` }, { name: "description", - content: - "Bekij de details van deze meststof", + content: "Bekij de details van deze meststof", }, ] } diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx index 9a9682731..df8a6488e 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers._index.tsx @@ -14,9 +14,9 @@ import { import { DataTable } from "~/components/custom/fertilizer/table" import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx index 8751817e3..4fce33fd5 100644 --- a/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx +++ b/fdm-app/app/routes/farm.$b_id_farm.fertilizers.new.tsx @@ -22,10 +22,10 @@ import { FertilizerForm } from "~/components/custom/fertilizer/form" import { FormSchema } from "~/components/custom/fertilizer/formschema" import { SidebarInset } from "~/components/ui/sidebar" import { getSession } from "~/lib/auth.server" +import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" import { fdm } from "~/lib/fdm.server" import { extractFormValuesFromRequest } from "~/lib/form" -import { clientConfig } from "~/lib/config" export const meta: MetaFunction = () => { return [ diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx index 542427047..e7a7bdd28 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.atlas.tsx @@ -20,7 +20,6 @@ import { } from "react-router" import { redirectWithSuccess } from "remix-toast" import { ClientOnly } from "remix-utils/client-only" -import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { ZOOM_LEVEL_FIELDS } from "~/components/custom/atlas/atlas" import { generateFeatureClass } from "~/components/custom/atlas/atlas-functions" import { @@ -44,6 +43,7 @@ import { import { Separator } from "~/components/ui/separator" import { SidebarInset, SidebarTrigger } from "~/components/ui/sidebar" import { Skeleton } from "~/components/ui/skeleton" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { getSession } from "~/lib/auth.server" import { getCalendar, getTimeframe } from "~/lib/calendar" import { clientConfig } from "~/lib/config" diff --git a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id._index.tsx b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id._index.tsx index 2501dad4a..ae67587ec 100644 --- a/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id._index.tsx +++ b/fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id._index.tsx @@ -24,7 +24,6 @@ import { useLoaderData } from "react-router" import { RemixFormProvider, useRemixForm } from "remix-hook-form" import { dataWithSuccess } from "remix-toast" import { z } from "zod" -import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { FieldsSourceNotClickable } from "~/components/custom/atlas/atlas-sources" import { getFieldsStyle } from "~/components/custom/atlas/atlas-styles" import { getViewState } from "~/components/custom/atlas/atlas-viewstate" @@ -51,6 +50,7 @@ import { import { Input } from "~/components/ui/input" import { Separator } from "~/components/ui/separator" import { Skeleton } from "~/components/ui/skeleton" +import { getMapboxStyle, getMapboxToken } from "~/integrations/mapbox" import { getSession } from "~/lib/auth.server" import { clientConfig } from "~/lib/config" import { handleActionError, handleLoaderError } from "~/lib/error" diff --git a/fdm-app/app/routes/signin.tsx b/fdm-app/app/routes/signin.tsx index 23cd2866b..b68ec7e79 100644 --- a/fdm-app/app/routes/signin.tsx +++ b/fdm-app/app/routes/signin.tsx @@ -309,11 +309,11 @@ export default function SignIn() {
-
- ); + ) }