@geops/rvf-mobility-web-component 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@geops/rvf-mobility-web-component",
3
3
  "license": "UNLICENSED",
4
4
  "description": "Web components for rvf in the domains of mobility and logistics.",
5
- "version": "0.1.18",
5
+ "version": "0.1.20",
6
6
  "homepage": "https://rvf-mobility-web-component-geops.vercel.app/",
7
7
  "type": "module",
8
8
  "main": "index.js",
@@ -1,5 +1,6 @@
1
1
  import { Feature } from "ol";
2
2
 
3
+ import RvfLink from "../../../RvfLink";
3
4
  import { PROVIDER_BY_FEED_ID } from "../../../utils/constants";
4
5
  import getLinkByDevice from "../../../utils/getLinkByDevice";
5
6
 
@@ -47,25 +48,23 @@ function FloatingVehiclesDetails({ features }: FloatingVehiclesDetailsProps) {
47
48
  });
48
49
 
49
50
  const feedId = features?.[0].get("feed_id");
50
- const link = getLinkByDevice(features[0]);
51
- console.log("FloatingVehiclesDetails", feedId, link);
51
+ const link = getLinkByDevice(features?.[0]);
52
52
 
53
53
  return (
54
- <div className="flex flex-col overflow-scroll">
55
- {features.length} Fahrzeuge
56
- <span className="text-lg text-grey">Fahrzeug mieten</span>
57
- <ul className="h-screen list-disc overflow-scroll pl-4 underline underline-offset-2">
58
- {renderedDetails}
59
- </ul>
54
+ <div className="flex flex-1 flex-col gap-2 overflow-scroll">
55
+ <div className="flex flex-1 flex-col gap-2 overflow-scroll">
56
+ <div>{features.length} Fahrzeuge</div>
57
+ <div className="flex flex-1 flex-col overflow-scroll">
58
+ <div className="text-grey">Fahrzeug mieten</div>
59
+ <ul className="list-disc overflow-scroll pl-4 underline underline-offset-2">
60
+ {renderedDetails}
61
+ </ul>
62
+ </div>
63
+ </div>
60
64
  {feedId && link && (
61
- <a
62
- className="mx-auto text-lg text-grey hover:text-red"
63
- href={getLinkByDevice(features[0])}
64
- rel="noreferrer"
65
- target="_blank"
66
- >
67
- Über {PROVIDER_BY_FEED_ID[feedId]}
68
- </a>
65
+ <div className="flex justify-center">
66
+ <RvfLink href={link}>Über {PROVIDER_BY_FEED_ID[feedId]}</RvfLink>
67
+ </div>
69
68
  )}
70
69
  </div>
71
70
  );
@@ -102,21 +102,19 @@ function RvfSharedMobilityDetails({
102
102
  };
103
103
 
104
104
  return (
105
- <div className="flex flex-col overflow-scroll px-2 pt-2">
106
- <div className="flex items-center text-xl text-grey">
107
- <img
108
- alt="logo"
109
- className="max-w-24"
110
- src={logos[features[0]?.get("feed_id")]}
111
- />
112
- </div>
105
+ <>
106
+ <img
107
+ alt="logo"
108
+ className="max-w-24"
109
+ src={logos[features[0]?.get("feed_id")]}
110
+ />
113
111
  {features.length && isStationDetails && (
114
112
  <StationDetails feature={features[0]} />
115
113
  )}
116
114
  {!!features[0]?.get("form_factor") && isFloatingVehicle && (
117
115
  <FloatingVehiclesDetails features={features} />
118
116
  )}
119
- </div>
117
+ </>
120
118
  );
121
119
  }
122
120
 
@@ -13,11 +13,11 @@ function StationDetails({ feature }: StationDetailsProps) {
13
13
  }, [feature]);
14
14
 
15
15
  return (
16
- <div className="flex flex-col">
16
+ <div className="flex flex-col gap-2">
17
17
  {feature.get("num_vehicles_available")} Fahrzeuge
18
18
  {link && (
19
19
  <a
20
- className={"my-12 flex items-center justify-center"}
20
+ className={"my-10 flex items-center justify-center"}
21
21
  href={link}
22
22
  rel="noreferrer"
23
23
  target="_blank"
@@ -0,0 +1,45 @@
1
+ import type { JSX, PreactDOMAttributes } from "preact";
2
+
3
+ import { memo, useMemo } from "preact/compat";
4
+ import { twMerge } from "tailwind-merge";
5
+
6
+ export type RvfLinkProps = {
7
+ theme?: "primary" | "secondary";
8
+ } & JSX.AnchorHTMLAttributes<HTMLAnchorElement> &
9
+ PreactDOMAttributes;
10
+
11
+ const baseClasses =
12
+ "my-1 flex gap-2 text-[14px] @sm/main:text-[16px] @md/main:text-[18px] items-center justify-left font-semibold text-button";
13
+
14
+ export const themes = {
15
+ primary: {
16
+ classes:
17
+ "bg-red text-white disabled:bg-lightgrey hover:bg-darkred hover:border-darkred active:bg-lightred active:border-lightred ",
18
+ selectedClasses: "bg-darkred border-darkred",
19
+ },
20
+ secondary: {
21
+ classes: "bg-white text-grey hover:text-red active:text-lightred",
22
+ selectedClasses: "text-red",
23
+ },
24
+ };
25
+
26
+ function RvfLink({
27
+ children,
28
+ className,
29
+ theme = "secondary",
30
+ ...props
31
+ }: RvfLinkProps) {
32
+ const classes = useMemo(() => {
33
+ return twMerge(
34
+ `${baseClasses} ${themes[theme].classes} ${className || ""}`,
35
+ );
36
+ }, [className, theme]);
37
+
38
+ return (
39
+ <a className={classes} rel="noreferrer" target="_blank" {...props}>
40
+ {children}
41
+ </a>
42
+ );
43
+ }
44
+
45
+ export default memo(RvfLink);
@@ -0,0 +1 @@
1
+ export { default } from "./RvfLink";
@@ -554,7 +554,7 @@ function RvfMobilityMap({
554
554
  }}
555
555
  title={getFeatureInformationTitle(selectedFeature)}
556
556
  ></RvfOverlayHeader>
557
- <RvfFeatureDetails className="relative flex flex-col gap-2 overflow-y-auto overflow-x-hidden px-2 pt-2" />
557
+ <RvfFeatureDetails className="relative flex h-full flex-col gap-4 overflow-y-auto overflow-x-hidden p-4" />
558
558
  </>
559
559
  )}
560
560
  {hasToolbar && hasPrint && isExportMenuOpen && (
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -81,7 +81,7 @@ export const PROVIDER_BY_FEED_ID = {
81
81
  naturenergie_sharing: "naturenergie\nsharing",
82
82
  nextbike_df: "Frelo",
83
83
  yoio_freiburg: "Yoio",
84
- zeus_freiburg: "Zeus",
84
+ zeus_freiburg: "ZEUS",
85
85
  // "nextbike",
86
86
  // "EinfachMobil",
87
87
  // "Donkey Republic"
@@ -1,9 +1,9 @@
1
1
  import { Feature } from "ol";
2
2
 
3
3
  function getLinkByDevice(feature: Feature): string {
4
- const iosLink = feature.get("rental_uris_ios");
5
- const androidLink = feature.get("rental_uris_android");
6
- const webLink = feature.get("rental_uris_web");
4
+ const iosLink = feature?.get("rental_uris_ios");
5
+ const androidLink = feature?.get("rental_uris_android");
6
+ const webLink = feature?.get("rental_uris_web");
7
7
  if (
8
8
  iosLink &&
9
9
  (navigator.userAgent.includes("iPhone") ||