From d46662e03861a1612283e384a0e009b924bc0137 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Mon, 22 Apr 2024 19:36:31 +0200 Subject: [PATCH] start of routing --- website/src/lib/components/Toolbar.svelte | 63 --------------- .../src/lib/components/toolbar/Routing.svelte | 80 +++++++++++++++++++ .../src/lib/components/toolbar/Toolbar.svelte | 77 ++++++++++++++++++ .../{ => toolbar}/ToolbarItem.svelte | 10 +-- .../components/toolbar/ToolbarItemMenu.svelte | 9 +++ .../ui/alert/alert-description.svelte | 13 +++ .../components/ui/alert/alert-title.svelte | 21 +++++ .../src/lib/components/ui/alert/alert.svelte | 17 ++++ website/src/lib/components/ui/alert/index.ts | 33 ++++++++ website/src/lib/components/ui/select/index.ts | 34 ++++++++ .../ui/select/select-content.svelte | 39 +++++++++ .../components/ui/select/select-item.svelte | 40 ++++++++++ .../components/ui/select/select-label.svelte | 16 ++++ .../ui/select/select-separator.svelte | 11 +++ .../ui/select/select-trigger.svelte | 27 +++++++ website/src/lib/components/ui/switch/index.ts | 7 ++ .../lib/components/ui/switch/switch.svelte | 28 +++++++ website/src/routes/+page.svelte | 4 +- 18 files changed, 455 insertions(+), 74 deletions(-) delete mode 100644 website/src/lib/components/Toolbar.svelte create mode 100644 website/src/lib/components/toolbar/Routing.svelte create mode 100644 website/src/lib/components/toolbar/Toolbar.svelte rename website/src/lib/components/{ => toolbar}/ToolbarItem.svelte (66%) create mode 100644 website/src/lib/components/toolbar/ToolbarItemMenu.svelte create mode 100644 website/src/lib/components/ui/alert/alert-description.svelte create mode 100644 website/src/lib/components/ui/alert/alert-title.svelte create mode 100644 website/src/lib/components/ui/alert/alert.svelte create mode 100644 website/src/lib/components/ui/alert/index.ts create mode 100644 website/src/lib/components/ui/select/index.ts create mode 100644 website/src/lib/components/ui/select/select-content.svelte create mode 100644 website/src/lib/components/ui/select/select-item.svelte create mode 100644 website/src/lib/components/ui/select/select-label.svelte create mode 100644 website/src/lib/components/ui/select/select-separator.svelte create mode 100644 website/src/lib/components/ui/select/select-trigger.svelte create mode 100644 website/src/lib/components/ui/switch/index.ts create mode 100644 website/src/lib/components/ui/switch/switch.svelte diff --git a/website/src/lib/components/Toolbar.svelte b/website/src/lib/components/Toolbar.svelte deleted file mode 100644 index 2c94325d..00000000 --- a/website/src/lib/components/Toolbar.svelte +++ /dev/null @@ -1,63 +0,0 @@ - - -
-
- - - Edit the track points - - - - Change time and speed data - - - - Reverse the file - - - - Merge with another file - - - - Extract the tracks or track segments to new files - - - - Create a new point of interest - - - - Reduce the number of track points - - - - Clean track points and points of interest with a rectangle selection - - - - Change the styling of the trace - - - - Manage the file structure - -
-
diff --git a/website/src/lib/components/toolbar/Routing.svelte b/website/src/lib/components/toolbar/Routing.svelte new file mode 100644 index 00000000..6e0667cb --- /dev/null +++ b/website/src/lib/components/toolbar/Routing.svelte @@ -0,0 +1,80 @@ + + + + + + Routing + + + +
+ + + + + + + {#each Object.keys(brouterProfiles) as profile} + {profile} + {/each} + + + +
+
+ + +
+
+ + +
+ + + + + {#if $selectedFiles.size > 1} +
Select a single file to use the routing tool
+ {:else if $selectedFiles.size == 0} +
Select a file to use the routing tool, or create a new file from the menu
+ {:else} +
Click on the map to plot a route
+ {/if} +
+
+
+
+
diff --git a/website/src/lib/components/toolbar/Toolbar.svelte b/website/src/lib/components/toolbar/Toolbar.svelte new file mode 100644 index 00000000..dc33b3a1 --- /dev/null +++ b/website/src/lib/components/toolbar/Toolbar.svelte @@ -0,0 +1,77 @@ + + +
+
+
+ { + currentTool = currentTool === 'routing' ? null : 'routing'; + }} + > + + Edit the track points + + + + Change time and speed data + + + + Reverse the file + + + + Merge with another file + + + + Extract the tracks or track segments to new files + + + + Create a new point of interest + + + + Reduce the number of track points + + + + Clean track points and points of interest with a rectangle selection + + + + Change the styling of the trace + + + + Manage the file structure + +
+ {#if currentTool == 'routing'} + + {/if} +
+
diff --git a/website/src/lib/components/ToolbarItem.svelte b/website/src/lib/components/toolbar/ToolbarItem.svelte similarity index 66% rename from website/src/lib/components/ToolbarItem.svelte rename to website/src/lib/components/toolbar/ToolbarItem.svelte index 1d6b4f94..4f270f11 100644 --- a/website/src/lib/components/ToolbarItem.svelte +++ b/website/src/lib/components/toolbar/ToolbarItem.svelte @@ -1,19 +1,11 @@ - diff --git a/website/src/lib/components/toolbar/ToolbarItemMenu.svelte b/website/src/lib/components/toolbar/ToolbarItemMenu.svelte new file mode 100644 index 00000000..ce3471a4 --- /dev/null +++ b/website/src/lib/components/toolbar/ToolbarItemMenu.svelte @@ -0,0 +1,9 @@ + + +
+
+ +
+
diff --git a/website/src/lib/components/ui/alert/alert-description.svelte b/website/src/lib/components/ui/alert/alert-description.svelte new file mode 100644 index 00000000..5bbc85ab --- /dev/null +++ b/website/src/lib/components/ui/alert/alert-description.svelte @@ -0,0 +1,13 @@ + + +
+ +
diff --git a/website/src/lib/components/ui/alert/alert-title.svelte b/website/src/lib/components/ui/alert/alert-title.svelte new file mode 100644 index 00000000..27953426 --- /dev/null +++ b/website/src/lib/components/ui/alert/alert-title.svelte @@ -0,0 +1,21 @@ + + + + + diff --git a/website/src/lib/components/ui/alert/alert.svelte b/website/src/lib/components/ui/alert/alert.svelte new file mode 100644 index 00000000..e1aa6df4 --- /dev/null +++ b/website/src/lib/components/ui/alert/alert.svelte @@ -0,0 +1,17 @@ + + + diff --git a/website/src/lib/components/ui/alert/index.ts b/website/src/lib/components/ui/alert/index.ts new file mode 100644 index 00000000..c21bc1e9 --- /dev/null +++ b/website/src/lib/components/ui/alert/index.ts @@ -0,0 +1,33 @@ +import { type VariantProps, tv } from "tailwind-variants"; + +import Root from "./alert.svelte"; +import Description from "./alert-description.svelte"; +import Title from "./alert-title.svelte"; + +export const alertVariants = tv({ + base: "relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, +}); + +export type Variant = VariantProps["variant"]; +export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; + +export { + Root, + Description, + Title, + // + Root as Alert, + Description as AlertDescription, + Title as AlertTitle, +}; diff --git a/website/src/lib/components/ui/select/index.ts b/website/src/lib/components/ui/select/index.ts new file mode 100644 index 00000000..327541c5 --- /dev/null +++ b/website/src/lib/components/ui/select/index.ts @@ -0,0 +1,34 @@ +import { Select as SelectPrimitive } from "bits-ui"; + +import Label from "./select-label.svelte"; +import Item from "./select-item.svelte"; +import Content from "./select-content.svelte"; +import Trigger from "./select-trigger.svelte"; +import Separator from "./select-separator.svelte"; + +const Root = SelectPrimitive.Root; +const Group = SelectPrimitive.Group; +const Input = SelectPrimitive.Input; +const Value = SelectPrimitive.Value; + +export { + Root, + Group, + Input, + Label, + Item, + Value, + Content, + Trigger, + Separator, + // + Root as Select, + Group as SelectGroup, + Input as SelectInput, + Label as SelectLabel, + Item as SelectItem, + Value as SelectValue, + Content as SelectContent, + Trigger as SelectTrigger, + Separator as SelectSeparator, +}; diff --git a/website/src/lib/components/ui/select/select-content.svelte b/website/src/lib/components/ui/select/select-content.svelte new file mode 100644 index 00000000..93d758e1 --- /dev/null +++ b/website/src/lib/components/ui/select/select-content.svelte @@ -0,0 +1,39 @@ + + + +
+ +
+
diff --git a/website/src/lib/components/ui/select/select-item.svelte b/website/src/lib/components/ui/select/select-item.svelte new file mode 100644 index 00000000..2cd00a78 --- /dev/null +++ b/website/src/lib/components/ui/select/select-item.svelte @@ -0,0 +1,40 @@ + + + + + + + + + + {label || value} + + diff --git a/website/src/lib/components/ui/select/select-label.svelte b/website/src/lib/components/ui/select/select-label.svelte new file mode 100644 index 00000000..d9664502 --- /dev/null +++ b/website/src/lib/components/ui/select/select-label.svelte @@ -0,0 +1,16 @@ + + + + + diff --git a/website/src/lib/components/ui/select/select-separator.svelte b/website/src/lib/components/ui/select/select-separator.svelte new file mode 100644 index 00000000..bc518e6e --- /dev/null +++ b/website/src/lib/components/ui/select/select-separator.svelte @@ -0,0 +1,11 @@ + + + diff --git a/website/src/lib/components/ui/select/select-trigger.svelte b/website/src/lib/components/ui/select/select-trigger.svelte new file mode 100644 index 00000000..ed0bc7e7 --- /dev/null +++ b/website/src/lib/components/ui/select/select-trigger.svelte @@ -0,0 +1,27 @@ + + +span]:line-clamp-1", + className + )} + {...$$restProps} + let:builder + on:click + on:keydown +> + +
+ +
+
diff --git a/website/src/lib/components/ui/switch/index.ts b/website/src/lib/components/ui/switch/index.ts new file mode 100644 index 00000000..f5533db7 --- /dev/null +++ b/website/src/lib/components/ui/switch/index.ts @@ -0,0 +1,7 @@ +import Root from "./switch.svelte"; + +export { + Root, + // + Root as Switch, +}; diff --git a/website/src/lib/components/ui/switch/switch.svelte b/website/src/lib/components/ui/switch/switch.svelte new file mode 100644 index 00000000..c6bcfd2a --- /dev/null +++ b/website/src/lib/components/ui/switch/switch.svelte @@ -0,0 +1,28 @@ + + + + + diff --git a/website/src/routes/+page.svelte b/website/src/routes/+page.svelte index a12b1f2c..406463e9 100644 --- a/website/src/routes/+page.svelte +++ b/website/src/routes/+page.svelte @@ -5,7 +5,7 @@ import GPXData from '$lib/components/GPXData.svelte'; import Map from '$lib/components/Map.svelte'; import Menu from '$lib/components/Menu.svelte'; - import Toolbar from '$lib/components/Toolbar.svelte'; + import Toolbar from '$lib/components/toolbar/Toolbar.svelte'; import LayerControl from '$lib/components/layer-control/LayerControl.svelte'; @@ -17,7 +17,7 @@ -
+