Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Carta Giovani Nazionale): [#177058904] Introduces the Bottom Sheet that shows all the informations about an available discount for CGN #2888

Merged
merged 38 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fdd0129
[#177059013] Implements Discount item for Merchant detail screen
CrisTofani Mar 9, 2021
c400fc7
[#177059013] minor fixes on discountItem
CrisTofani Mar 10, 2021
c39be47
Merge branch 'master' into 177059013-merchants-discount-item
CrisTofani Mar 10, 2021
2d80498
[#176959185] Adds the CGN MErchant detail screen component
CrisTofani Mar 10, 2021
8ccc8a4
Merge branch 'master' into 176959185-merchant-detail-screen
CrisTofani Mar 10, 2021
6a8fe5e
Merge branch 'master' into 177059013-merchants-discount-item
CrisTofani Mar 10, 2021
1f9f5f1
Merge branch 'master' into 176959185-merchant-detail-screen
CrisTofani Mar 10, 2021
0b7a6c7
Merge branch 'master' into 177059013-merchants-discount-item
CrisTofani Mar 10, 2021
7035d0f
[#177058904] Implements Discount bottom sheet component
CrisTofani Mar 10, 2021
ee118a8
Merge branch 'master' into 177058904-discount-detail-bottom-sheet
CrisTofani Mar 10, 2021
0320927
Merge branch 'master' into 177059013-merchants-discount-item
CrisTofani Mar 10, 2021
f8b615e
Merge branch 'master' into 176959185-merchant-detail-screen
CrisTofani Mar 10, 2021
8951e62
[#177058904] UI fixes
CrisTofani Mar 11, 2021
119cef5
[#177058904] Merge
CrisTofani Mar 11, 2021
837eeec
[#177058904] UI Fixes and minor improvements on Copy handler
CrisTofani Mar 11, 2021
191fa24
[#177058904] UI Fixes
CrisTofani Mar 11, 2021
018e776
[#177059013] refactoring
Undermaken Mar 11, 2021
e6143d0
Merge branch 'master' into 177059013-merchants-discount-item
Undermaken Mar 11, 2021
cc0c660
[#177059013] improve
Undermaken Mar 11, 2021
02dc153
[#177058904] refactoring
CrisTofani Mar 11, 2021
8ce0fdb
[#177059013] fix UI styles and composition
Undermaken Mar 11, 2021
f46b855
[#177058904] refactoring
CrisTofani Mar 11, 2021
54be9ec
[#177059013] Merge branch 'master' of github.com:pagopa/io-app into 1…
Undermaken Mar 11, 2021
b553dcb
[#176959185] review
Undermaken Mar 11, 2021
47262e5
[#177058904] revert refactoring and fixes
CrisTofani Mar 11, 2021
c5a783f
[#176959185] from string to number
Undermaken Mar 11, 2021
a93a458
[#176959185] Merge from master branch
CrisTofani Mar 11, 2021
ca2330a
[#177058904] Merge and fixes
CrisTofani Mar 11, 2021
7e412eb
Merge branch 'master' into 177058904-discount-detail-bottom-sheet
CrisTofani Mar 12, 2021
21877cd
[#176959185] Merge branch 'master' of github.com:pagopa/io-app into 1…
Undermaken Mar 12, 2021
0f5ff25
[#177058904] Merge branch '176959185-merchant-detail-screen' of githu…
Undermaken Mar 12, 2021
79340bd
Apply suggestions from code review
CrisTofani Mar 12, 2021
fb2889e
[#177058904] Refactoring to value box
CrisTofani Mar 12, 2021
54064e3
[#177058904] refactoring
CrisTofani Mar 12, 2021
72cdf8c
[#177058904] refactoring
Undermaken Mar 12, 2021
f40633b
Merge branch 'master' into 177058904-discount-detail-bottom-sheet
Undermaken Mar 12, 2021
79d5d41
[#177058904] fix
Undermaken Mar 12, 2021
bee6233
[#177058904] Merge remote-tracking branch 'origin/177058904-discount-…
Undermaken Mar 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from "react";
import { View } from "native-base";
import { StyleSheet } from "react-native";
import { TouchableWithoutFeedback } from "@gorhom/bottom-sheet";
import { Millisecond } from "italia-ts-commons/lib/units";
import { TmpDiscountType } from "../../__mock__/availableMerchantDetail";
import { useIOBottomSheet } from "../../../../../utils/bottomSheet";
import I18n from "../../../../../i18n";
Expand All @@ -13,6 +14,7 @@ import IconFont from "../../../../../components/ui/IconFont";
import { IOColors } from "../../../../../components/core/variables/IOColors";
import { clipboardSetStringWithFeedback } from "../../../../../utils/clipboard";
import { BaseTypography } from "../../../../../components/core/typography/BaseTypography";
import { addEvery } from "../../../../../utils/strings";
import CgnDiscountValueBox from "./CgnDiscountValueBox";

type Props = {
Expand Down Expand Up @@ -44,7 +46,7 @@ const styles = StyleSheet.create({
discountValue: { textAlign: "center", lineHeight: 30 }
});

const FEEDBACK_MS = 3000;
const FEEDBACK_TIMEOUT = 3000 as Millisecond;

const CATEGORY_ICON_SIZE = 22;
const COPY_ICON_SIZE = 24;
Expand All @@ -67,7 +69,7 @@ const CgnDiscountDetail: React.FunctionComponent<Props> = ({
setIsTap(true);
clipboardSetStringWithFeedback(discount.discountCode);
// eslint-disable-next-line functional/immutable-data
timerRetry.current = setTimeout(() => setIsTap(false), FEEDBACK_MS);
timerRetry.current = setTimeout(() => setIsTap(false), FEEDBACK_TIMEOUT);
}
};

Expand Down Expand Up @@ -103,7 +105,7 @@ const CgnDiscountDetail: React.FunctionComponent<Props> = ({
font={"RobotoMono"}
style={styles.codeText}
>
{discount.discountCode}
{addEvery(discount.discountCode, " ", 3)}
</BaseTypography>
<IconFont
name={isTap ? "io-complete" : "io-copy"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { H3 } from "../../../../../components/core/typography/H3";

type ValueBoxProps = {
value: number;
small?: boolean;
small?: true;
};

const styles = StyleSheet.create({
Expand Down Expand Up @@ -37,23 +37,23 @@ const CgnDiscountValueBox = ({ value, small }: ValueBoxProps) => {
.decode(value)
.map(v => v.toString())
.getOrElse("-");

const percentage = (
<H5 weight={"SemiBold"} color={"white"}>
{PERCENTAGE_SYMBOL}
</H5>
);
return (
<View style={small ? styles.smallValueBox : styles.discountValueBox}>
{small ? (
<H4 weight={"Bold"} color={"white"} style={styles.percentage}>
{normalizedValue}
<H5 weight={"SemiBold"} color={"white"}>
{PERCENTAGE_SYMBOL}
{percentage}
</H5>
</H4>
) : (
<H3 weight={"Bold"} color={"white"} style={styles.percentage}>
{/* avoid overflow */}
{normalizedValue}
<H5 weight={"SemiBold"} color={"white"}>
{PERCENTAGE_SYMBOL}
</H5>
{percentage}
Undermaken marked this conversation as resolved.
Show resolved Hide resolved
</H3>
)}
</View>
Expand Down