Skip to content

Commit cb1c2b9

Browse files
authoredJul 8, 2024··
Closed Banner (#242)
1 parent 8b78582 commit cb1c2b9

File tree

6 files changed

+64
-20
lines changed

6 files changed

+64
-20
lines changed
 

‎app/components/ClosedBanner.tsx

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from "react"
2+
import { Text } from "./Text"
3+
import { View, type TextStyle, type ViewStyle } from "react-native"
4+
import { colors, spacing } from "../theme"
5+
import { translate } from "../i18n"
6+
import { openLinkInBrowser } from "../utils/openLinkInBrowser"
7+
8+
export const ClosedBanner = () => {
9+
const chainReactWebsite = () =>
10+
openLinkInBrowser(`https://${translate("common.appClosedLinkText")}`)
11+
12+
return (
13+
<View style={$wrapper}>
14+
<Text style={$text}>
15+
{translate("common.appClosedPart1")}
16+
<Text style={$link} onPress={chainReactWebsite} tx="common.appClosedLinkText" />
17+
{translate("common.appClosedPart2")}
18+
</Text>
19+
</View>
20+
)
21+
}
22+
23+
const $wrapper: ViewStyle = {
24+
backgroundColor: colors.errorBackground,
25+
padding: spacing.extraSmall,
26+
}
27+
28+
const $text: TextStyle = {
29+
color: colors.error,
30+
textAlign: "center",
31+
}
32+
33+
const $link: TextStyle = {
34+
color: colors.error,
35+
textDecorationColor: colors.error,
36+
textDecorationLine: "underline",
37+
}

‎app/components/Header.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Text, TextProps } from "./Text"
1414
import { Icon, IconTypes } from "./Icon"
1515
import { isRTL, translate } from "../i18n"
1616
import SafeAreaViewFixed from "./SafeAreaViewFixed"
17+
import { ClosedBanner } from "./ClosedBanner"
1718

1819
export interface HeaderProps {
1920
/**
@@ -175,6 +176,7 @@ export function Header(props: HeaderProps) {
175176
{...HeaderViewProps}
176177
style={[$safeArea, HeaderViewProps?.style, { backgroundColor }]}
177178
>
179+
<ClosedBanner />
178180
<View style={[$container, $containerStyleOverride]}>
179181
<HeaderAction
180182
tx={leftTx}

‎app/components/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from "./BoxShadow"
44
export * from "./Button"
55
export * from "./ButtonLink"
66
export * from "./Card"
7+
export * from "./ClosedBanner"
78
export * from "./carousel"
89
export * from "./CustomToast"
910
export * from "./Header"

‎app/i18n/en.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const en = {
44
cancel: "Cancel",
55
back: "Back",
66
comingSoon: "Coming soon",
7+
appClosedPart1: "Hey, this app is not being used in 2024; go to ",
8+
appClosedPart2: " to get all the details!",
9+
appClosedLinkText: "ChainReactConf.com",
710
},
811
welcomeScreen: {
912
heading: "Welcome to Chain React!",

‎app/screens/TalkDetailsScreen/TalkDetailsHeader.tsx

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react"
22
import { TextStyle, View, ViewStyle } from "react-native"
33
import Animated, { interpolate, SharedValue, useAnimatedStyle } from "react-native-reanimated"
4-
import { Text } from "../../components"
4+
import { ClosedBanner, Text } from "../../components"
55
import { BackButton } from "../../navigators/BackButton"
66
import { colors, layout, spacing } from "../../theme"
77

@@ -36,16 +36,19 @@ export const TalkDetailsHeader: React.FunctionComponent<TalkDetailsHeaderProps>
3636
}, [headingHeight])
3737

3838
return (
39-
<View style={$rowContainer}>
40-
<BackButton />
41-
<AnimatedText
42-
allowFontScaling={false}
43-
preset="navHeader"
44-
style={[$centerTitle, $animatedTitle]}
45-
>
46-
{title}
47-
</AnimatedText>
48-
</View>
39+
<>
40+
<ClosedBanner />
41+
<View style={$rowContainer}>
42+
<BackButton />
43+
<AnimatedText
44+
allowFontScaling={false}
45+
preset="navHeader"
46+
style={[$centerTitle, $animatedTitle]}
47+
>
48+
{title}
49+
</AnimatedText>
50+
</View>
51+
</>
4952
)
5053
}
5154

‎app/screens/WelcomeScreen.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import {
88
ViewStyle,
99
useWindowDimensions,
1010
} from "react-native"
11-
import { SafeAreaView } from "react-native-safe-area-context"
12-
import { Button, Screen, Text } from "../components"
11+
import { Button, ClosedBanner, Screen, Text } from "../components"
1312
import { useAppNavigation } from "../hooks"
1413
import { AppStackScreenProps } from "../navigators"
1514
import { colors, spacing } from "../theme"
@@ -32,7 +31,8 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = (_props) => {
3231
}, [])
3332

3433
return (
35-
<Screen style={$container}>
34+
<Screen safeAreaEdges={["top", "bottom"]} style={$container}>
35+
<ClosedBanner />
3636
<View style={$topContainer}>
3737
<Image style={$welcomeLogo} source={welcomeLogo} />
3838
</View>
@@ -58,7 +58,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = (_props) => {
5858
/>
5959
</View>
6060

61-
<SafeAreaView style={$bottomContainer} edges={["bottom"]}>
61+
<View style={$bottomContainer}>
6262
<View
6363
style={[
6464
$bottomContentContainer,
@@ -72,7 +72,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = (_props) => {
7272
onPress={goNext}
7373
/>
7474
</View>
75-
</SafeAreaView>
75+
</View>
7676
</Screen>
7777
)
7878
}
@@ -85,7 +85,7 @@ const $container: ViewStyle = {
8585
const $topContainer: ViewStyle = {
8686
flexShrink: 1,
8787
flexGrow: 1,
88-
flexBasis: "25%",
88+
flexBasis: "20%",
8989
justifyContent: "flex-start",
9090
}
9191

@@ -100,10 +100,8 @@ const $middleContainer: ViewStyle = {
100100
const $bottomContainer: ViewStyle = {
101101
flexShrink: 1,
102102
flexGrow: 0,
103-
flexBasis: "25%",
103+
flexBasis: "20%",
104104
backgroundColor: colors.background,
105-
borderTopLeftRadius: 16,
106-
borderTopRightRadius: 16,
107105
}
108106

109107
const $bottomContentContainer: ViewStyle = {

0 commit comments

Comments
 (0)
Please sign in to comment.