Skip to content

Commit 9d0ff1d

Browse files
committed
refactor: Cleaned up unused imports, removed redundant code, added radix to parseInt calls, and updated regex for YouTube URLs.
1 parent 3c76011 commit 9d0ff1d

18 files changed

Lines changed: 25 additions & 62 deletions

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
extends: '@react-native',
44
rules: {
55
'react-native/no-inline-styles': 'off',
6+
'react/no-unstable-nested-components': ['warn', { allowAsProps: true }],
67
'@typescript-eslint/no-unused-vars': [
78
'warn',
89
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },

src/components/BottomSheet.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
PanResponder,
1313
StyleSheet,
1414
TouchableWithoutFeedback,
15-
Dimensions,
1615
StyleProp,
1716
ViewStyle,
1817
KeyboardAvoidingView,

src/components/YouTubePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from "react";
22
import { View, Text, Image, Pressable, Linking } from "react-native";
3-
import { Play, Youtube } from "lucide-react-native";
3+
import { Play } from "lucide-react-native";
44
import theme from "../data/color-theme";
55

66
type Props = {

src/context/TimerContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function TimerProvider({ children }: { children: ReactNode }) {
3838
const dataToSave = customState || stateRef.current;
3939
const encrypted = encryptObject(dataToSave);
4040
await AsyncStorage.setItem(TIMER_STORAGE_KEY, encrypted);
41-
} catch (error) { }
41+
} catch { }
4242
};
4343

4444
// Initial load
@@ -51,7 +51,7 @@ export function TimerProvider({ children }: { children: ReactNode }) {
5151
if (!data) {
5252
try {
5353
data = JSON.parse(stored);
54-
} catch (e) {
54+
} catch {
5555
data = null;
5656
}
5757
}
@@ -88,7 +88,7 @@ export function TimerProvider({ children }: { children: ReactNode }) {
8888
}
8989
}
9090
}
91-
} catch (error) { }
91+
} catch { }
9292
};
9393
loadTimer();
9494
}, []);

src/hooks/useStreak.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function useStreak(tasks: any[]) {
7070
if (!parsed) {
7171
try {
7272
parsed = JSON.parse(raw) as StreakLog;
73-
} catch (e) {
73+
} catch {
7474
parsed = null;
7575
}
7676
}

src/layouts/TasksScreen/TaskListContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const groupTasksByDate = (tasks: any[]): TaskGroup[] => {
5353

5454
// Build groups and sort: Today always first, then ascending by date
5555
return Array.from(groupMap.entries())
56-
.map(([label, tasks]) => ({ label, tasks }))
56+
.map(([label, groupTasks]) => ({ label, tasks: groupTasks }))
5757
.sort((a, b) => {
5858
const aKey = getLabelSortKey(a.label);
5959
const bKey = getLabelSortKey(b.label);

src/layouts/homeScreen/TodayRecentTasks.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { useState, useCallback } from "react";
2-
import { useNavigation, useFocusEffect } from "@react-navigation/native";
1+
import React, { useState } from "react";
2+
import { useNavigation } from "@react-navigation/native";
33
import {
44
Text,
55
View,
@@ -24,7 +24,7 @@ import { useTaskManager } from "../../hooks/useTaskManager";
2424

2525
function TodayRecentTasks() {
2626
const navigation = useNavigation<any>();
27-
const { tasks, saveNewTask, toggleTaskComplete, deleteTask, advanceTaskStatus } = useTaskManager();
27+
const { tasks, saveNewTask, deleteTask, advanceTaskStatus } = useTaskManager();
2828

2929
const [selectedTask, setSelectedTask] = useState<any | null>(null);
3030
const [sheetVisible, setSheetVisible] = useState(false);
@@ -56,16 +56,7 @@ function TodayRecentTasks() {
5656
}
5757
};
5858

59-
const openTaskSheet = (task: any) => {
60-
setSelectedTask(task);
61-
setSheetVisible(true);
62-
Animated.spring(slideAnim, {
63-
toValue: 1,
64-
useNativeDriver: true,
65-
bounciness: 0,
66-
speed: 14,
67-
}).start();
68-
};
59+
// openTaskSheet removed since it's unused
6960

7061
const closeTaskSheet = () => {
7162
Animated.timing(slideAnim, {

src/navigation/TabNavigator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import HomeScreen from "../screens/HomeScreen";
33
import TaskScreen from "../screens/TaskScreen";
44
import BrainDumpScreen from "../screens/BrainDumpScreen";
55
import theme from "../data/color-theme";
6-
import { LayoutDashboard, ListTodo, Lightbulb, Settings, Brain } from "lucide-react-native";
6+
import { LayoutDashboard, ListTodo, Settings, Brain } from "lucide-react-native";
77
import { useSafeAreaInsets } from "react-native-safe-area-context";
88
import SettingScreen from "../screens/SettingScreen";
99

src/screens/AnalyticsScreen.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
Target,
99
TrendingUp,
1010
ListTodo,
11-
BarChart2,
1211
} from "lucide-react-native";
1312
import theme from "../data/color-theme";
1413
import { useTaskManager } from "../hooks/useTaskManager";

src/screens/BrainDumpScreen.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { View, Text, TextInput, ScrollView, Pressable, KeyboardAvoidingView, Platform, Linking, Image, Animated, PanResponder, Dimensions, TouchableOpacity } from "react-native";
1+
import { View, Text, TextInput, ScrollView, Pressable, KeyboardAvoidingView, Platform, Linking, Animated, PanResponder, Dimensions } from "react-native";
22
import { SafeAreaView } from "react-native-safe-area-context";
3-
import { useState, useCallback, useEffect, useRef } from "react";
3+
import { useState, useCallback, useRef } from "react";
44
import AsyncStorage from "@react-native-async-storage/async-storage";
5-
import { Trash2, Plus, Brain, Sparkles, Play } from "lucide-react-native";
5+
import { Trash2, Plus, Brain, Sparkles } from "lucide-react-native";
66
import { useFocusEffect } from "@react-navigation/native";
77
import { encryptObject, decryptObject } from "../utils/security";
88
import theme from "../data/color-theme";
@@ -40,7 +40,6 @@ const formatDate = (iso: string) => {
4040
export default function BrainDumpScreen() {
4141
const [entries, setEntries] = useState<DumpEntry[]>([]);
4242
const [input, setInput] = useState("");
43-
const [pressingId, setPressingId] = useState<number | null>(null);
4443
const [activeTab, setActiveTab] = useState<"texts" | "links">("texts");
4544

4645
const isLinkEntry = (text: string) => /(https?:\/\/[^\s]+)/g.test(text);

0 commit comments

Comments
 (0)