-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
82 changes: 82 additions & 0 deletions
82
front/src/components/zeroAccident/zeroAccidentBanner.component.tsx
This file contains 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,82 @@ | ||
import type { FC } from "react"; | ||
import * as React from "react"; | ||
import { Linking, StyleSheet } from "react-native"; | ||
|
||
import { Links } from "../../constants"; | ||
import { PLATFORM_IS_ANDROID } from "../../constants/platform.constants"; | ||
import { Colors, Margins, Paddings, Sizes } from "../../styles"; | ||
import type { TrackerEvent } from "../../type"; | ||
import { TrackerUtils } from "../../utils"; | ||
import { CommonText, CustomButton, View } from "../baseComponents"; | ||
import TrackerHandler from "../tracker/trackerHandler.component"; | ||
|
||
interface Props { | ||
title: string; | ||
buttonTitle: string; | ||
fromPage: string; | ||
} | ||
|
||
const ZeroAccidentBanner: FC<Props> = ({ title, buttonTitle, fromPage }) => { | ||
const [trackerEventObject, setTrackerEventObject] = | ||
React.useState<TrackerEvent>(); | ||
|
||
const goToStore = React.useCallback(() => { | ||
const storeUrl = PLATFORM_IS_ANDROID | ||
? Links.zeroAccidentAppUrlAndroid | ||
: Links.zeroAccidentHttpsiOSAppUrl; | ||
|
||
setTrackerEventObject({ | ||
action: TrackerUtils.TrackingEvent.ZERO_ACCIDENT, | ||
name: `${TrackerUtils.TrackingEvent.ZERO_ACCIDENT} - ${ | ||
PLATFORM_IS_ANDROID ? "Android" : "iOS" | ||
} (${fromPage})`, | ||
}); | ||
void Linking.openURL(storeUrl); | ||
}, [fromPage]); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
return ( | ||
<> | ||
<TrackerHandler eventObject={trackerEventObject} /> | ||
<View style={styles.container}> | ||
<CommonText style={styles.bannerTitle}>{title}</CommonText> | ||
<CustomButton title={buttonTitle} rounded action={goToStore} /> | ||
</View> | ||
</> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
bannerButtonTitle: { | ||
fontSize: Sizes.sm, | ||
textTransform: "uppercase", | ||
}, | ||
bannerDescription: { | ||
color: Colors.commonText, | ||
marginVertical: Margins.light, | ||
}, | ||
bannerTitle: { | ||
color: Colors.primaryBlueDark, | ||
fontSize: Sizes.sm, | ||
lineHeight: Sizes.lg, | ||
}, | ||
container: { | ||
backgroundColor: Colors.primaryBlueLight, | ||
borderLeftColor: Colors.primaryBlueDark, | ||
borderLeftWidth: 3, | ||
marginBottom: Paddings.light, | ||
marginVertical: Paddings.default, | ||
padding: Paddings.default, | ||
}, | ||
header: { | ||
paddingBottom: Paddings.larger, | ||
}, | ||
mainContainer: { | ||
backgroundColor: Colors.white, | ||
flex: 1, | ||
paddingHorizontal: Paddings.larger, | ||
paddingVertical: Paddings.default, | ||
}, | ||
}); | ||
|
||
export default ZeroAccidentBanner; |
This file contains 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
10 changes: 9 additions & 1 deletion
10
front/src/constants/databaseQueries/configDbQueries.constants.ts
This file contains 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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
export const CONFIG_GET_ALL = ` | ||
query GetLastAppVersion { | ||
query GetConfig { | ||
config { | ||
lastAppVersionNumber | ||
news | ||
} | ||
} | ||
`; | ||
|
||
export const CONFIG_ZERO_ACCIDENT = ` | ||
query GetConfig { | ||
config { | ||
activationZeroAccident | ||
} | ||
} | ||
`; |
This file contains 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 |
---|---|---|
|
@@ -151,6 +151,7 @@ export const ARTICLE_DETAILS_WITH_ID = ( | |
id | ||
} | ||
handicap | ||
zeroAccident: zero_accident | ||
} | ||
} | ||
`; | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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