Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
bfbd5bf
Initialize fdm-app with remix
SvenVw Nov 5, 2024
f5bda16
Add shadcn/ui
SvenVw Nov 5, 2024
2d1183e
Create a start page for fdm-app
SvenVw Nov 5, 2024
6acb750
Add the MissingFarm block
SvenVw Nov 6, 2024
7ac9a45
Setup a first add farm block
SvenVw Nov 6, 2024
926d75e
Enable loading fertilizers from catalogue
SvenVw Nov 6, 2024
6282adb
Fix clicking on 'x'
SvenVw Nov 6, 2024
57dbfaf
Submit addFarm form to server
SvenVw Nov 6, 2024
e2f6f49
Redirect to next step in setup
SvenVw Nov 6, 2024
40bb136
Restrucute to enable pages without sidebar like signup
SvenVw Nov 7, 2024
8f0d944
Create basic layout for signup page
SvenVw Nov 7, 2024
9b5dca6
Add simple session management for iam
SvenVw Nov 7, 2024
3799273
Add function to signUp user
SvenVw Nov 7, 2024
dd45e4c
Add function to get user from session
SvenVw Nov 7, 2024
7aff5c6
Update changeset
SvenVw Nov 7, 2024
6cadc85
Add signup page
SvenVw Nov 8, 2024
fd9acbe
Redirect index to app page
SvenVw Nov 8, 2024
3c4e6fd
Fix redirects
SvenVw Nov 8, 2024
584c939
Fixes to signup
SvenVw Nov 8, 2024
06375b4
Add support and feedback buttons
SvenVw Nov 8, 2024
9f1e782
Add account information to sidebar
SvenVw Nov 8, 2024
b44b772
Add temporary redirect until iam is arranged
SvenVw Nov 8, 2024
b657f8b
Improve signup form
SvenVw Nov 8, 2024
9e6ddc9
Add logout option
SvenVw Nov 8, 2024
f7829b4
Fix redirect
SvenVw Nov 8, 2024
a208897
Move fdm into services
SvenVw Nov 8, 2024
1987142
Fix import/no-unresolved error
SvenVw Nov 8, 2024
fe5b354
Small improvements
SvenVw Nov 8, 2024
801be79
Setup a map
SvenVw Nov 8, 2024
51090f9
Add fields layer to map
SvenVw Nov 8, 2024
919de74
Enable selection of a field (single only yet :( )
SvenVw Nov 8, 2024
b465e1b
Add LiveReload for dev server
SvenVw Nov 11, 2024
b5a5dcb
Enable selection of multiple fields
SvenVw Nov 11, 2024
7aa9944
Enable deselection of fields
SvenVw Nov 11, 2024
8b02a1f
Add button to save fields
SvenVw Nov 11, 2024
b155abe
Submit selected fields to server
SvenVw Nov 12, 2024
c5fd1dd
Add storage of geometry
SvenVw Nov 12, 2024
4f8b143
Fix test
SvenVw Nov 12, 2024
c043857
Do not export fdmLocal as it does not support postgis yet
SvenVw Nov 12, 2024
7557c15
Fix unit tests for fertilizers
SvenVw Nov 14, 2024
cdcaca6
Store field in db
SvenVw Nov 14, 2024
fe39686
Fix redirects
SvenVw Nov 14, 2024
5fa0cdc
Update changeset
SvenVw Nov 14, 2024
78a8e99
Add getFields function
SvenVw Nov 14, 2024
f9050b0
Setting arguments for `updateFields` to undefined won't update the va…
SvenVw Nov 15, 2024
9964153
Add fields page
SvenVw Nov 15, 2024
b62c830
Fix: Warning: Each Child in a List Should Have a Unique 'key' Prop
SvenVw Nov 15, 2024
a869f9b
Rename Map icon import to avoid shadowing global Map object.
SvenVw Nov 15, 2024
778a120
Update fdm-app/app/routes/app._index.tsx
SvenVw Nov 15, 2024
86c2405
Update fdm-app/app/routes/app.addfarm.$b_farm_id.map.tsx
SvenVw Nov 15, 2024
3aa108b
Solve mutating props directly
SvenVw Nov 25, 2024
9fbdc91
Fix duplicate navigation link
SvenVw Nov 25, 2024
624acd9
Make more clear that farm name is required
SvenVw Nov 25, 2024
a15a2bc
Add type for geojson
SvenVw Nov 25, 2024
f5563fc
Fix redirecting from signup
SvenVw Nov 25, 2024
7242a7d
Improve mobile hook
SvenVw Nov 25, 2024
7897dd6
Improve Map component implementation
SvenVw Nov 25, 2024
5487f5c
Add loading and error states for Source component
SvenVw Nov 25, 2024
4367b50
Fix environment variable configuration and add validation
SvenVw Nov 25, 2024
4a314f6
Add environment variable validation
SvenVw Nov 25, 2024
f2d9569
Limit cookie age
SvenVw Nov 25, 2024
c956cb1
Add error handling and environment validation.
SvenVw Nov 25, 2024
1d4880b
Improve action handler for updating fields
SvenVw Nov 25, 2024
a40c373
Fix incorrect error event type
SvenVw Nov 25, 2024
f8be2fb
Resolve Map naming conflict.tsx
SvenVw Nov 25, 2024
22bdb68
Add error handling for bounds calculation
SvenVw Nov 25, 2024
d0f83f5
Fix merge conflict
SvenVw Nov 25, 2024
e9a2194
Improve type safety and add documentation.
SvenVw Nov 25, 2024
3cc1186
Prevent potential memory leaks in timeout management
SvenVw Nov 25, 2024
25944d8
Improve form submission handling.
SvenVw Nov 25, 2024
e742312
Fix environment variable validation syntax
SvenVw Nov 25, 2024
1c870ec
Merge remote-tracking branch 'origin/initialize-fdm-app' into initial…
SvenVw Nov 26, 2024
4bf8588
Remove obsolete LiveReload
SvenVw Nov 26, 2024
6ddb627
Fix spacing
SvenVw Nov 26, 2024
967c98f
Fix link to next page
SvenVw Nov 26, 2024
8692eee
Fix using wrong type
SvenVw Nov 26, 2024
9986b88
Fix preventing collapsing
SvenVw Nov 26, 2024
d3a80d5
Fix type
SvenVw Nov 26, 2024
3649be1
Fix form submission handling conflict.
SvenVw Nov 26, 2024
2e66e01
Bump version numbers and update changelog
SvenVw Nov 26, 2024
1496880
Typo
SvenVw Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions fdm-app/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
ignorePatterns: ["!**/.server", "!**/.client"],

// Base config
extends: ["eslint:recommended"],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
alias: {
map:[
["@/app", "~/"]

]
}
},
},
},

// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
},

// Node
{
files: [".eslintrc.cjs"],
env: {
node: true,
},
},
],
};
5 changes: 5 additions & 0 deletions fdm-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

/.cache
/build
.env
5 changes: 5 additions & 0 deletions fdm-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog fdm-app

## v.0.1.0

A first prototype of an application for fdm with minimal functions
3 changes: 3 additions & 0 deletions fdm-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# fdm-app

This contains the application for the fdm-app
251 changes: 251 additions & 0 deletions fdm-app/app/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
SidebarMenu,
SidebarMenuBadge,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar"
import { Badge } from "@/components/ui/badge"
import { ArrowRightLeft, BadgeCheck, ChevronsUpDown, GitPullRequestArrow, House, Languages, LifeBuoy, LogOut, Map as MapIcon, PawPrint, Scale, Send, Settings, Shapes, Sparkles, Sprout, Square } from "lucide-react"
import { Avatar, AvatarFallback } from "./ui/avatar"
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./ui/dropdown-menu"

import { useIsMobile } from '@/hooks/use-mobile'
import { Button } from "./ui/button"
import { Form } from "@remix-run/react"

interface SideBarType {
user: {
firstname: string
surname: string
email: string
avatar: string | null
}
}


export function AppSidebar(props: SideBarType) {

const user = props.user
const avatarInitials = props.user.firstname.slice(0, 1).toUpperCase() + props.user.surname.slice(0, 1).toUpperCase()
const isMobile = useIsMobile()

return (
<Sidebar>
<SidebarHeader >
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<a href="/">
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<Sprout className="size-4" />
</div>
<div className="flex flex-col gap-0.5 leading-none">
<span className="font-semibold">FDM</span>
{/* <span className="">2024</span> */}
</div>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Mijn bedrijf</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./farm">
<House />
<span>Bedrijf</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./map">
<MapIcon />
<span>Kaart</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./fields">
<Square />
<span>Percelen</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./cultivations">
<Sprout />
<span>Gewassen</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./fertilizers">
<Shapes />
<span>Meststoffen</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="./stable">
<PawPrint />
<span>Stal & dieren</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
<SidebarGroup>
<SidebarGroupLabel>Apps</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="#">
<ArrowRightLeft />
<span>MINAS2</span>
</a>
</SidebarMenuButton>
Comment on lines +120 to +124
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance accessibility for placeholder links.

Replace "#" hrefs with more meaningful paths or add proper ARIA attributes for better accessibility.

-<a href="#">
+<a 
+  href="/apps/minas2" 
+  aria-disabled="true"
+  aria-label="MINAS2 - Coming soon"
+>

Also applies to: 131-135, 142-146

<SidebarMenuBadge>
<Badge>Binnenkort</Badge>
</SidebarMenuBadge>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="#">
<Scale />
<span>OS Balans</span>
</a>
</SidebarMenuButton>
<SidebarMenuBadge>
<Badge>Binnenkort</Badge>
</SidebarMenuBadge>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href="#">
<GitPullRequestArrow />
<span>BAAT</span>
</a>
</SidebarMenuButton>
<SidebarMenuBadge>
<Badge>Binnenkort</Badge>
</SidebarMenuBadge>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
<SidebarGroup className="mt-auto">
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem key="support">
<SidebarMenuButton asChild size="sm">
<a href="#">
<LifeBuoy />
<span>Ondersteuning</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem key="feedback">
<SidebarMenuButton asChild size="sm">
<a href="#">
<Send />
<span>Feedback</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<SidebarMenuButton
size="lg"
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
<Avatar className="h-8 w-8 rounded-lg">
{/* <AvatarImage src={avatarInitials} alt={user.name} /> */}
<AvatarFallback className="rounded-lg">{avatarInitials}</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">{user.firstname + " " + user.surname}</span>
<span className="truncate text-xs">{user.email}</span>
</div>
<ChevronsUpDown className="ml-auto size-4" />
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg"
side={isMobile ? "bottom" : "right"}
align="end"
sideOffset={4}
>
<DropdownMenuLabel className="p-0 font-normal">
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<Avatar className="h-8 w-8 rounded-lg">
{/* <AvatarImage src={avatarInitials} alt={user.name} /> */}
<AvatarFallback className="rounded-lg">{avatarInitials}</AvatarFallback>
</Avatar>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">{user.firstname + " " + user.surname}</span>
<span className="truncate text-xs">{user.email}</span>
</div>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<Sparkles />
Wat is er nieuw?
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
<BadgeCheck />
Account
</DropdownMenuItem>
<DropdownMenuItem>
<Languages />
Taal
</DropdownMenuItem>
<DropdownMenuItem>
<Settings />
Instellingen
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem>
<LogOut />
<Form method="post" action="../app">
<Button type="submit" variant="link">Uitloggen</Button>
</Form>
</DropdownMenuItem>
Comment thread
SvenVw marked this conversation as resolved.
</DropdownMenuContent>
</DropdownMenu>
</SidebarMenuItem>
</SidebarMenu>
</SidebarFooter>
</Sidebar >
)
}
Loading