-
Notifications
You must be signed in to change notification settings - Fork 4
Add fdm-app Add new user management functions and update field handling features #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 f5bda16
Add shadcn/ui
SvenVw 2d1183e
Create a start page for fdm-app
SvenVw 6acb750
Add the MissingFarm block
SvenVw 7ac9a45
Setup a first add farm block
SvenVw 926d75e
Enable loading fertilizers from catalogue
SvenVw 6282adb
Fix clicking on 'x'
SvenVw 57dbfaf
Submit addFarm form to server
SvenVw e2f6f49
Redirect to next step in setup
SvenVw 40bb136
Restrucute to enable pages without sidebar like signup
SvenVw 8f0d944
Create basic layout for signup page
SvenVw 9b5dca6
Add simple session management for iam
SvenVw 3799273
Add function to signUp user
SvenVw dd45e4c
Add function to get user from session
SvenVw 7aff5c6
Update changeset
SvenVw 6cadc85
Add signup page
SvenVw fd9acbe
Redirect index to app page
SvenVw 3c4e6fd
Fix redirects
SvenVw 584c939
Fixes to signup
SvenVw 06375b4
Add support and feedback buttons
SvenVw 9f1e782
Add account information to sidebar
SvenVw b44b772
Add temporary redirect until iam is arranged
SvenVw b657f8b
Improve signup form
SvenVw 9e6ddc9
Add logout option
SvenVw f7829b4
Fix redirect
SvenVw a208897
Move fdm into services
SvenVw 1987142
Fix import/no-unresolved error
SvenVw fe5b354
Small improvements
SvenVw 801be79
Setup a map
SvenVw 51090f9
Add fields layer to map
SvenVw 919de74
Enable selection of a field (single only yet :( )
SvenVw b465e1b
Add LiveReload for dev server
SvenVw b5a5dcb
Enable selection of multiple fields
SvenVw 7aa9944
Enable deselection of fields
SvenVw 8b02a1f
Add button to save fields
SvenVw b155abe
Submit selected fields to server
SvenVw c5fd1dd
Add storage of geometry
SvenVw 4f8b143
Fix test
SvenVw c043857
Do not export fdmLocal as it does not support postgis yet
SvenVw 7557c15
Fix unit tests for fertilizers
SvenVw cdcaca6
Store field in db
SvenVw fe39686
Fix redirects
SvenVw 5fa0cdc
Update changeset
SvenVw 78a8e99
Add getFields function
SvenVw f9050b0
Setting arguments for `updateFields` to undefined won't update the va…
SvenVw 9964153
Add fields page
SvenVw b62c830
Fix: Warning: Each Child in a List Should Have a Unique 'key' Prop
SvenVw a869f9b
Rename Map icon import to avoid shadowing global Map object.
SvenVw 778a120
Update fdm-app/app/routes/app._index.tsx
SvenVw 86c2405
Update fdm-app/app/routes/app.addfarm.$b_farm_id.map.tsx
SvenVw 3aa108b
Solve mutating props directly
SvenVw 9fbdc91
Fix duplicate navigation link
SvenVw 624acd9
Make more clear that farm name is required
SvenVw a15a2bc
Add type for geojson
SvenVw f5563fc
Fix redirecting from signup
SvenVw 7242a7d
Improve mobile hook
SvenVw 7897dd6
Improve Map component implementation
SvenVw 5487f5c
Add loading and error states for Source component
SvenVw 4367b50
Fix environment variable configuration and add validation
SvenVw 4a314f6
Add environment variable validation
SvenVw f2d9569
Limit cookie age
SvenVw c956cb1
Add error handling and environment validation.
SvenVw 1d4880b
Improve action handler for updating fields
SvenVw a40c373
Fix incorrect error event type
SvenVw f8be2fb
Resolve Map naming conflict.tsx
SvenVw 22bdb68
Add error handling for bounds calculation
SvenVw d0f83f5
Fix merge conflict
SvenVw e9a2194
Improve type safety and add documentation.
SvenVw 3cc1186
Prevent potential memory leaks in timeout management
SvenVw 25944d8
Improve form submission handling.
SvenVw e742312
Fix environment variable validation syntax
SvenVw 1c870ec
Merge remote-tracking branch 'origin/initialize-fdm-app' into initial…
SvenVw 4bf8588
Remove obsolete LiveReload
SvenVw 6ddb627
Fix spacing
SvenVw 967c98f
Fix link to next page
SvenVw 8692eee
Fix using wrong type
SvenVw 9986b88
Fix preventing collapsing
SvenVw d3a80d5
Fix type
SvenVw 3649be1
Fix form submission handling conflict.
SvenVw 2e66e01
Bump version numbers and update changelog
SvenVw 1496880
Typo
SvenVw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| node_modules | ||
|
|
||
| /.cache | ||
| /build | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # fdm-app | ||
|
|
||
| This contains the application for the fdm-app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| <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> | ||
|
SvenVw marked this conversation as resolved.
|
||
| </DropdownMenuContent> | ||
| </DropdownMenu> | ||
| </SidebarMenuItem> | ||
| </SidebarMenu> | ||
| </SidebarFooter> | ||
| </Sidebar > | ||
| ) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
Also applies to: 131-135, 142-146