diff --git a/front-empathy/package.json b/front-empathy/package.json index 05f8d3f..28bb0c5 100644 --- a/front-empathy/package.json +++ b/front-empathy/package.json @@ -56,7 +56,8 @@ "framer": "^1" }, "devDependencies": { - "framer": "^1.1.7" + "framer": "^1.1.7", + "typescript": "^3.9.6" }, "framer": { "displayName": "" diff --git a/front-empathy/src/api/artist/index.ts b/front-empathy/src/api/artist/index.ts index beab465..fe816a3 100644 --- a/front-empathy/src/api/artist/index.ts +++ b/front-empathy/src/api/artist/index.ts @@ -1,9 +1,9 @@ import { requestGET } from "../index"; export const loadArtist = (artistId = 1) => { - return requestGET(`/artist/${ artistId }`); + return requestGET(`/artist/${artistId}`); }; export const loadArtists = (page = 1, pageUnit = 5) => { - return requestGET(`/artist?page=${ page }&page_unit=${ pageUnit }`); + return requestGET(`/artist?page=${page}&page_unit=${pageUnit}`); }; diff --git a/front-empathy/src/api/index.ts b/front-empathy/src/api/index.ts index a8d5aa7..52a921d 100644 --- a/front-empathy/src/api/index.ts +++ b/front-empathy/src/api/index.ts @@ -1,6 +1,6 @@ const SERVER_URL = process.env.REACT_APP_SERVER_API; -export const requestGET = (url: any) => { +export const requestGET = (url: string) => { return fetch(SERVER_URL + url) .then(res => res.json()) .catch(err => console.error(err)); diff --git a/front-empathy/src/components/CircleItemSlider.jsx b/front-empathy/src/components/CircleItemSlider.jsx index b5bcc25..02d9013 100644 --- a/front-empathy/src/components/CircleItemSlider.jsx +++ b/front-empathy/src/components/CircleItemSlider.jsx @@ -33,7 +33,7 @@ const SliderWrapper = styled(Slider)` `; const ArrowWrapper = styled.div` - visibility: ${props => props.show ? 'visible' : 'hidden'}; + visibility: ${ props => props.show ? 'visible' : 'hidden' }; width: 40px; height: 100%; display: flex; @@ -58,7 +58,7 @@ const CircleItemSliderWrapper = styled.div` .slide { position: relative; - ${ArrowWrapper} { + ${ ArrowWrapper } { &.left { position: absolute; top: 0; @@ -150,19 +150,19 @@ const CircleItemSlider = ({ slickItems }) => {

Upcoming event's location

- - {slickItems.map(({ id, title, img, date }) => ( -
-
-

{title}

+ + { slickItems.map(({ id, title, img, date }) => ( +
+
+

{ title }

- ))} + )) } - - + + - - + +
diff --git a/front-empathy/src/pages/LocationDetail/LocationDetail.jsx b/front-empathy/src/pages/LocationDetail/LocationDetail.jsx index 6b10eb1..73f155b 100644 --- a/front-empathy/src/pages/LocationDetail/LocationDetail.jsx +++ b/front-empathy/src/pages/LocationDetail/LocationDetail.jsx @@ -17,7 +17,7 @@ const fetchData = (url) => { }; export const getLocationId = (locationId) => { - return fetchData(`http://localhost:5000/locationDetail/${locationId}`); + return fetchData(`http://localhost:5000/locationDetail/${ locationId }`); }; const HeroSection = styled.div` @@ -181,8 +181,8 @@ const LocationDetail = ({

{location.name}

-

{location.name}

-

{location.name}

+

{ location.name }

+

{ location.name }

@@ -193,27 +193,28 @@ const LocationDetail = ({
Address - {location.address} + { location.address }
ProgrammeType - {location.programmeType} + { location.programmeType }
Location Fee - {location.fee} + { location.fee }
Opening Hour - {location.openHour} + { location.openHour }
Istagram - {location.instaId} + { location.instaId }
+ shareLink(`locationDetail`, `locationDetail`) }/> shareLink(`locationDetail`, `locationDetail`)} /> @@ -240,7 +241,7 @@ const LocationDetail = ({
- )} + ) } ); }; diff --git a/front-empathy/tsconfig.json b/front-empathy/tsconfig.json index f2850b7..7f9d1d0 100644 --- a/front-empathy/tsconfig.json +++ b/front-empathy/tsconfig.json @@ -1,6 +1,13 @@ { "compilerOptions": { "target": "es5", + "typeRoots": [ + "../../node_modules/@types", + "../../typings" + ], + "types": [ + "node" + ], "lib": [ "dom", "dom.iterable", @@ -20,6 +27,7 @@ "jsx": "react" }, "include": [ - "src" + "src", + "**/*.d.ts" ] } diff --git a/front-empathy/tslint.json b/front-empathy/tslint.json new file mode 100644 index 0000000..9109690 --- /dev/null +++ b/front-empathy/tslint.json @@ -0,0 +1,5 @@ +{ + "rules": { + "no-reference": false + } +} diff --git a/front-empathy/typings/index.d.ts b/front-empathy/typings/index.d.ts new file mode 100644 index 0000000..ca56963 --- /dev/null +++ b/front-empathy/typings/index.d.ts @@ -0,0 +1,15 @@ +/// + +export declare global { + interface Window { + } + + interface StringKeyDict { + [key: string]: T; + } + + interface NumberKeyDict { + [key: number]: T; + } + +} diff --git a/front-empathy/typings/location.d.ts b/front-empathy/typings/location.d.ts new file mode 100644 index 0000000..793c001 --- /dev/null +++ b/front-empathy/typings/location.d.ts @@ -0,0 +1,18 @@ +export declare global { + interface LocationDetail { + id: string, + name: string; + image: string; + description: string; + address: string; + programmeType: string; + fee: string + openHour: string; + instaId: string; + eventGroup: EventGroup[] + } + + interface EventGroup { + date: string; + } +}