Skip to content

Commit 9ec05da

Browse files
committed
styling changes
1 parent 9e29c4b commit 9ec05da

File tree

3 files changed

+63
-55
lines changed

3 files changed

+63
-55
lines changed

components/spondee/SessionControls.tsx

+24-20
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Settings from "@/app/(tabs)/settings";
2+
import { Trial } from "@/app/(tabs)/tests/spondee";
23
import { router } from "expo-router";
4+
import { Dispatch, SetStateAction, useState } from "react";
35
import { StyleSheet, TouchableOpacity, View } from "react-native";
46
import { THIText } from "../THIText";
5-
import React, {Dispatch, SetStateAction, useState} from "react";
6-
import {Trial} from "@/app/(tabs)/tests/spondee";
77

88
type SessionControlProps = {
99
totalTrials: number;
@@ -14,43 +14,47 @@ type SessionControlProps = {
1414
};
1515

1616
export interface SessionData {
17-
attempts: Trial[];
18-
soundEnabled: boolean;
19-
numCards: number;
17+
attempts: Trial[];
18+
soundEnabled: boolean;
19+
numCards: number;
2020
}
2121

2222
export function SessionControls({
2323
totalTrials,
2424
numCorrect,
2525
numCards,
2626
setNumCards,
27-
attempts
27+
attempts,
2828
}: SessionControlProps) {
29+
const [soundEnabled, setSoundEnabled] = useState(true);
2930

30-
const [soundEnabled, setSoundEnabled] = useState(true);
31-
32-
const sessionData: SessionData = {
33-
attempts,
34-
soundEnabled,
35-
numCards,
36-
}
31+
const sessionData: SessionData = {
32+
attempts,
33+
soundEnabled,
34+
numCards,
35+
};
3736

3837
return (
3938
<View style={styles.controlsContainer}>
4039
<TouchableOpacity
4140
onPress={() => {
42-
console.log("End Session");
43-
console.log(numCorrect, totalTrials, "End Session");
44-
router.push({
45-
pathname: "/(tabs)/inputSessionNotes",
46-
params: { sessionData: JSON.stringify(sessionData) },
47-
});
41+
console.log("End Session");
42+
console.log(numCorrect, totalTrials, "End Session");
43+
router.push({
44+
pathname: "/(tabs)/inputSessionNotes",
45+
params: { sessionData: JSON.stringify(sessionData) },
46+
});
4847
}}
4948
style={styles.button}
5049
>
5150
<THIText style={styles.buttonText}>End Session</THIText>
5251
</TouchableOpacity>
53-
<Settings numCards={numCards} setNumCards={setNumCards} soundEnabled={soundEnabled} setSoundEnabled={setSoundEnabled} />
52+
<Settings
53+
numCards={numCards}
54+
setNumCards={setNumCards}
55+
soundEnabled={soundEnabled}
56+
setSoundEnabled={setSoundEnabled}
57+
/>
5458
</View>
5559
);
5660
}
+26-26
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
type SpondeeCard = {
2-
word: string;
2+
word: string;
33
};
44

55
const SpondeeCards: SpondeeCard[] = [
6-
{word: "outside"},
7-
{word: "playground"},
8-
{word: "hotdog"},
9-
{word: "icecream"},
10-
{word: "railroad"},
11-
{word: "snowman"},
12-
{word: "bathtub"},
13-
{word: "cowboy"},
14-
{word: "toothbrush"},
15-
{word: "pancake"},
16-
{word: "mailman"},
17-
{word: "bluebird"},
18-
{word: "popcorn"},
19-
{word: "bedroom"},
20-
{word: "football"},
21-
{word: "suitcase"},
22-
{word: "starfish"},
23-
{word: "doghouse"},
24-
{word: "airplane"},
25-
{word: "sunshine"},
26-
{word: "doorbell"},
27-
{word: "cupcake"},
28-
{word: "firetruck"},
29-
{word: "sidewalk"}
6+
{ word: "outside" },
7+
{ word: "playground" },
8+
{ word: "hotdog" },
9+
{ word: "icecream" },
10+
{ word: "railroad" },
11+
{ word: "snowman" },
12+
{ word: "bathtub" },
13+
{ word: "cowboy" },
14+
{ word: "toothbrush" },
15+
{ word: "pancake" },
16+
{ word: "mailman" },
17+
{ word: "bluebird" },
18+
{ word: "popcorn" },
19+
{ word: "bedroom" },
20+
{ word: "football" },
21+
{ word: "suitcase" },
22+
{ word: "starfish" },
23+
{ word: "doghouse" },
24+
{ word: "airplane" },
25+
{ word: "sunshine" },
26+
{ word: "doorbell" },
27+
{ word: "cupcake" },
28+
{ word: "firetruck" },
29+
{ word: "sidewalk" },
3030
];
3131

3232
export default SpondeeCards;
33-
export {SpondeeCard}
33+
export { SpondeeCard };

components/spondee/TestGrid.tsx

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { Trial } from "@/app/(tabs)/tests/spondee";
12
import Card from "@/components/spondee/Card";
2-
import { useState } from "react";
3-
import {Trial} from "@/app/(tabs)/tests/spondee";
4-
import {FlatList, ListRenderItemInfo, StyleSheet, View} from "react-native";
3+
import { useEffect, useState } from "react";
4+
import { FlatList, ListRenderItemInfo, StyleSheet, View } from "react-native";
55

66
export default function TestGrid({
77
numCards,
@@ -18,17 +18,21 @@ export default function TestGrid({
1818
setAttempts: (attempts: Trial[]) => void;
1919
callback: (item: { id: number; title: string }) => void;
2020
}) {
21+
useEffect(() => {}, [numCards]);
2122
const [selectedId, setSelectedId] = useState<number>();
2223

2324
let columns = Math.min(Math.trunc((numCards + 1) / 2), 4);
2425

25-
const renderCard = ({ item }: ListRenderItemInfo<{ id: number; title: string }>) => {
26+
const renderCard = ({
27+
item,
28+
}: ListRenderItemInfo<{ id: number; title: string }>) => {
2629
const backgroundColor = item.id === selectedId ? "#6D88B433" : "#FFFFFF";
2730
const submitButton = item.id === selectedId;
31+
console.log("card thing");
2832

2933
const addItem = (newItem: Trial) => {
3034
setAttempts([...attempts, newItem]);
31-
}
35+
};
3236

3337
const handlePress = () => {
3438
console.log(item.title, correctCard);
@@ -49,10 +53,10 @@ export default function TestGrid({
4953
size={columns}
5054
numCards={numCards}
5155
onSubmit={() => {
52-
// Call callback to spondee.tsx
53-
callback(item);
54-
// Handle press ourselves too
55-
handlePress();
56+
// Call callback to spondee.tsx
57+
callback(item);
58+
// Handle press ourselves too
59+
handlePress();
5660
}}
5761
/>
5862
);

0 commit comments

Comments
 (0)