Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Remove the modal feature #16

Merged
merged 6 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"cli": {
"version": ">= 7.1.2"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"tsc": "tsc",
"test": "jest"
},
"dependencies": {
Expand Down Expand Up @@ -39,4 +38,4 @@
}
},
"private": true
}
}
48 changes: 22 additions & 26 deletions src/components/TaskLine.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
View,
Text,
TextInput,
StyleSheet,
Pressable,
useColorScheme,
Expand All @@ -9,7 +9,6 @@ import Ionicons from "@expo/vector-icons/Ionicons";
import { atom, useAtomValue, useSetAtom } from "jotai";
import { TodoListsAtom } from "@/state";
import { useMemo } from "react";
import { taskModalIsVisibleAtom, taskModalTaskKeyAtom } from "@/state/ui";

interface TaskLineProps {
todoListKey: string;
Expand All @@ -26,10 +25,6 @@ export default function TaskLine({ todoListKey, taskKey }: TaskLineProps) {

const setTodoLists = useSetAtom(TodoListsAtom);

const setTaskModalIsVisible = useSetAtom(taskModalIsVisibleAtom);

const setTaskModalTaskKey = useSetAtom(taskModalTaskKeyAtom);

const darkModeIsOn = useColorScheme() == "dark";

const handleToggleTask = () => {
Expand All @@ -40,9 +35,13 @@ export default function TaskLine({ todoListKey, taskKey }: TaskLineProps) {
});
};

const handlePressOnTaskName = () => {
setTaskModalTaskKey(taskKey);
setTaskModalIsVisible(true);
const handleTaskNameUpdate = (newName: string) => {
setTodoLists({
type: "UpdateTaskName",
todoListKey: todoListKey,
taskKey: taskKey,
name: newName,
});
};

const handlePressOnDelete = () => {
Expand Down Expand Up @@ -70,18 +69,17 @@ export default function TaskLine({ todoListKey, taskKey }: TaskLineProps) {
/>
)}
</Pressable>
<Pressable onPress={handlePressOnTaskName} style={styles.taskPressable}>
<Text
style={[
styles.taskText,
darkModeIsOn && styles.taskTextDark,
isCompleted && styles.taskTextIsCompleted,
isCompleted && darkModeIsOn && styles.taskTextIsCompletedDark,
]}
>
{name}
</Text>
</Pressable>
<TextInput
style={[
styles.taskText,
darkModeIsOn && styles.taskTextDark,
isCompleted && styles.taskTextIsCompleted,
isCompleted && darkModeIsOn && styles.taskTextIsCompletedDark,
]}
onChangeText={handleTaskNameUpdate}
>
{name}
</TextInput>
<Pressable onPress={handlePressOnDelete} style={styles.deleteButton}>
<Ionicons
name="close-outline"
Expand Down Expand Up @@ -114,14 +112,12 @@ const styles = StyleSheet.create({
alignItems: "center",
paddingHorizontal: 8,
},
taskPressable: {
flex: 1,
padding: 16,
paddingLeft: 8,
},
taskText: {
fontSize: 16,
color: "black",
flex: 1,
padding: 16,
paddingLeft: 8,
},
taskTextDark: {
color: "white",
Expand Down
131 changes: 0 additions & 131 deletions src/components/TaskModal.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/screens/HomeScreen/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Ionicons from "@expo/vector-icons/Ionicons";
import { TodoListsAtom } from "@/state";
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
import { currentTodoListKeyAtom } from "@/state/ui";
import TaskModal from "@/components/TaskModal";

const currentTodoListNameAtom = atom((get) => {
const todoLists = get(TodoListsAtom);
Expand Down Expand Up @@ -89,7 +88,6 @@ export default function HomeScreen() {
/>
</View>
<TodoList todoListKey={currentTodoListKey} />
<TaskModal />
</DrawerLayoutAndroid>
</SafeAreaView>
);
Expand Down
4 changes: 0 additions & 4 deletions src/state/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ export const currentTodoListKeyAtom = atom(
},
(get, set, update: string) => set(currentTodoListKeyPrimitiveAtom, update)
);

export const taskModalIsVisibleAtom = atom(false);

export const taskModalTaskKeyAtom = atom("");
Loading