Skip to content

Commit

Permalink
refactor: fix cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattchris committed Mar 16, 2024
1 parent 4e32def commit c0c6d77
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 47 deletions.
2 changes: 1 addition & 1 deletion client/assets/close/close1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions client/components/DropDownItem.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

const DropdownItem = ({ label }: { label: string }) => {
function DropdownItem({ label }: { label: string }) {
return (
<View style={styles.container}>
<Text style={styles.dropdownLabel}>{label}</Text>
</View>
);
};
}

const styles = StyleSheet.create({
container: {
Expand All @@ -27,4 +27,4 @@ const styles = StyleSheet.create({
}
});

export default DropdownItem;
export { DropdownItem };
8 changes: 3 additions & 5 deletions client/components/TaskInfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

const TaskInfoComponent = ({
export function TaskInfoComponent({
name,
label,
category,
Expand All @@ -13,7 +13,7 @@ const TaskInfoComponent = ({
category: string;
type: string;
date: Date;
}) => {
}) {
const formattedStartDate = date ? new Date(date).toLocaleDateString() : 'N/A';

return (
Expand All @@ -26,7 +26,7 @@ const TaskInfoComponent = ({
<Text style={styles.categoryType}>{`${formattedStartDate}`}</Text>
</View>
);
};
}

const styles = StyleSheet.create({
container: {
Expand All @@ -53,5 +53,3 @@ const styles = StyleSheet.create({
marginTop: 10
}
});

export default TaskInfoComponent;
4 changes: 0 additions & 4 deletions client/components/TaskType/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import React from 'react';

import { useNavigation } from '@react-navigation/native';
import { IconButton } from 'react-native-paper';

import Close1 from '../../assets/close/close1.svg';
import Close2 from '../../assets/close/close2.svg';
import { AppStackNavigation } from '../../navigation/AppNavigation';

export function CloseButton({ onPress }: { onPress: () => void }) {
const navigation = useNavigation<AppStackNavigation>();

return (
<IconButton
className="align-center m-2 flex h-[50px] w-[52px] justify-center rounded-xl bg-carewallet-gray"
Expand Down
14 changes: 7 additions & 7 deletions client/screens/TaskList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import DropDownPicker from 'react-native-dropdown-picker';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { Button } from 'react-native-paper';

import TaskInfoComponent from '../components/TaskInfoCard';
import { TaskInfoComponent } from '../components/TaskInfoCard';
import { CloseButton } from '../components/TaskType/CloseButton';
import { useCareWalletContext } from '../contexts/CareWalletContext';
import { getTaskLabels, useFilteredTasks } from '../services/task';
Expand Down Expand Up @@ -56,12 +56,12 @@ export default function TaskListScreen() {
),
[]
);
// TODO: Implement clearFilters function in dropdown picker
const clearFilters = () => {
setSearchQuery('');
setSelectedLabel(null);
closeBottomSheet();
};
// // TODO: Implement clearFilters function in dropdown picker
// const clearFilters = () => {
// setSearchQuery('');
// setSelectedLabel(null);
// closeBottomSheet();
// };

// Fetch task labels for each task (2d array list)
useEffect(() => {
Expand Down
18 changes: 10 additions & 8 deletions client/services/task.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import axios from 'axios';

import { Task } from '../types/task';
import { TaskLabel } from '../types/label';
import { Task } from '../types/task';
import { api_url } from './api-links';

type TaskQueryParams = {
Expand All @@ -15,9 +15,11 @@ type TaskQueryParams = {
endDate?: string;
};

const getFilteredTasks = async (queryParams: TaskQueryParams): Promise<Task[]> => {
const getFilteredTasks = async (
queryParams: TaskQueryParams
): Promise<Task[]> => {
const { data } = await axios.get(`${api_url}/tasks/filtered?`, {
params: queryParams,
params: queryParams
});
return data;
};
Expand All @@ -28,16 +30,16 @@ export const getTaskLabels = async (taskID: string): Promise<TaskLabel[]> => {
};

export const useFilteredTasks = (queryParams: TaskQueryParams) => {
const queryClient = useQueryClient();
// const queryClient = useQueryClient();

const { data: tasks, isLoading: tasksIsLoading } = useQuery<Task[]>({
queryKey: ['filteredTaskList', queryParams],
queryFn: () => getFilteredTasks(queryParams),
refetchInterval: 20000,
refetchInterval: 20000
});

return {
tasks,
tasksIsLoading,
tasksIsLoading
};
};
};
8 changes: 4 additions & 4 deletions client/types/label.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface TaskLabel {
task_id: number;
group_id: number;
label_name: string;
}
task_id: number;
group_id: number;
label_name: string;
}
30 changes: 15 additions & 15 deletions client/types/task.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export interface Task {
task_id: number;
group_id: number;
created_by: string;
created_date: string;
start_date?: string | null;
end_date?: string | null;
notes?: string | null;
repeating: boolean;
repeating_interval?: string | null;
repeating_end_date?: string | null;
task_status: string;
task_type: string;
task_info?: string | null;
[key: string]: string | number | boolean | null | undefined; // Index signature for string indexing
};
task_id: number;
group_id: number;
created_by: string;
created_date: string;
start_date?: string | null;
end_date?: string | null;
notes?: string | null;
repeating: boolean;
repeating_interval?: string | null;
repeating_end_date?: string | null;
task_status: string;
task_type: string;
task_info?: string | null;
[key: string]: string | number | boolean | null | undefined; // Index signature for string indexing
}

0 comments on commit c0c6d77

Please sign in to comment.