diff --git a/api/src/bikes.ts b/api/src/bikes.ts new file mode 100644 index 0000000..e7e1bc9 --- /dev/null +++ b/api/src/bikes.ts @@ -0,0 +1,19 @@ +enum BikeStatus { + Sold, + Stolen, + PartiallyStolen, + NotYetStolen, + NotYetBought, +} + +const getBikes = () => { + return [ + { id: "a", brand: "Rose", status: BikeStatus.Sold }, + { id: "b", brand: "Canyon", status: BikeStatus.Sold }, + { id: "c", brand: "Focus", status: BikeStatus.Stolen }, + { id: "d", brand: "Focus", status: BikeStatus.PartiallyStolen }, + { id: "e", brand: "Trek", status: BikeStatus.NotYetBought }, + ]; +}; + +export { getBikes }; diff --git a/api/src/index.ts b/api/src/index.ts index 7c85b91..e69d6c7 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -1,6 +1,11 @@ // This file contains the api +import { getBikes } from "./bikes"; + const api = () => { + const handlers: Function[] = []; + handlers.push(getBikes); + console.log("The api is running..."); }; diff --git a/web/src/bikes.tsx b/web/src/bikes.tsx new file mode 100644 index 0000000..1389b12 --- /dev/null +++ b/web/src/bikes.tsx @@ -0,0 +1,39 @@ +import React from "react"; + +enum BikeStatus { + Sold, + Stolen, + PartiallyStolen, + NotYetStolen, + NotYetBought, +} + +type Bike = { + id: string; + brand: string; + status: BikeStatus; +}; + +const bikeStatusToDisplayValueMap: Record = { + [BikeStatus.Sold]: "Sold", + [BikeStatus.Stolen]: "Stolen", + [BikeStatus.PartiallyStolen]: "PartiallyStolen", + [BikeStatus.NotYetStolen]: "NotYetStolen", + [BikeStatus.NotYetBought]: "NotYetBought", +}; + +const Bikes: React.FC = () => { + const bikes: Bike[] = []; // Get bikes from api + + return ( + + ); +}; + +export { Bikes }; diff --git a/web/src/index.tsx b/web/src/index.tsx index f0ebc9e..3b8fc9d 100644 --- a/web/src/index.tsx +++ b/web/src/index.tsx @@ -1,3 +1,9 @@ -import React from 'react' +import React from "react"; +import { Bikes } from "./bikes"; -const App: React.FC = () => (<>The app) \ No newline at end of file +const App: React.FC = () => ( + <> +

My bikes:

+ + +);