-
Notifications
You must be signed in to change notification settings - Fork 1
/
DrillPage.tsx
118 lines (111 loc) · 4.06 KB
/
DrillPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import React, { useState } from "react";
import { View, Pressable } from "react-native";
import { Text, useTheme } from "react-native-paper";
import { useNavigation } from "@react-navigation/native";
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
import Alert from "react-native-awesome-alerts";
import LessonButton from "../Components/Home/LessonButton";
import { rgba } from "polished";
import DrillPanel from "../Components/Home/DrillPanel";
import { useNewWindowDimensions } from "../Functions/global/WindowDimensions";
const DrillPage = () => {
const navigation: any = useNavigation();
const theme = useTheme();
const windowSize = useNewWindowDimensions();
const reSize = Math.min(windowSize.width, windowSize.height) / 25;
const [drillsVisible, setDrillsVisible] = useState(true);
const showDrillsButton = () => setDrillsVisible(true);
const hideDrillsButton = () => setDrillsVisible(false);
const [drillHelpVisible, setDrillHelpVisible] = useState(false);
const showDrillHelp = () => setDrillHelpVisible(true);
const hideDrillHelp = () => setDrillHelpVisible(false);
return (
<SafeAreaProvider>
<SafeAreaView
style={{ width: windowSize.width, height: windowSize.height }}
>
<View style={{ flexDirection: "row" }}>
<View
style={{
flexDirection: "column",
flexGrow: 1,
}}
>
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "center",
}}
>
<Text
style={{
color: theme.colors.primary,
fontSize: 50,
lineHeight: 50,
fontWeight: "bold",
}}
>
Train{" "}
<Text style={{ color: theme.colors.onBackground }}>
with a strategy
</Text>
</Text>
<Pressable
onPress={() => showDrillHelp()}
style={{ alignSelf: "flex-start" }}
>
<Text
style={{
color: theme.colors.onBackground,
lineHeight: 16,
fontSize: 18,
fontWeight: "bold",
}}
>
?
</Text>
</Pressable>
</View>
<View style={{ alignItems: "center", alignSelf: "center" }}>
{drillsVisible ? (
<View style={{ padding: reSize / 4 }}>
<DrillPanel />
</View>
) : (
<LessonButton
backgroundColor={"grey"}
disabled={true}
></LessonButton>
)}
</View>
</View>
</View>
<Alert
show={drillHelpVisible}
title="Drill Help"
message={
`Drills are a place where you can practice a strategy.\n\n` +
`When you click the "Start Drill" button, a menu will appear on the left side of your screen with a list of all strategies you can practice.\n\n` +
`Selecting a strategy from the list will navigate you to the Drill page. This page has a puzzle where you must use the strategy to solve the next step in the puzzle.\n\n` +
`Each drill is unlocked after completing the corresponding lesson!`
}
messageStyle={{ maxWidth: 500 }}
alertContainerStyle={{
backgroundColor: rgba(theme.colors.background, 0.3),
}}
showConfirmButton={true}
closeOnTouchOutside={false}
closeOnHardwareBackPress={false}
confirmText={"OK"}
confirmButtonColor={theme.colors.primary}
onConfirmPressed={() => {
hideDrillHelp();
}}
overlayStyle={{ backgroundColor: "transparent" }}
/>
</SafeAreaView>
</SafeAreaProvider>
);
};
export default DrillPage;