Skip to content
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
34 changes: 0 additions & 34 deletions .github/workflows/comment-jest-coverage.yml

This file was deleted.

1 change: 0 additions & 1 deletion backend/controllers/complete_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func BulkCompleteTaskHandler(w http.ResponseWriter, r *http.Request) {

logStore := models.GetLogStore()

// Create a *single* job for all UUIDs
job := Job{
Name: "Bulk Complete Tasks",
Execute: func() error {
Expand Down
8 changes: 1 addition & 7 deletions backend/controllers/controllers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,19 @@ func Test_OAuthHandler(t *testing.T) {

func Test_OAuthCallbackHandler(t *testing.T) {
app := setup()
// This part of the test requires mocking the OAuth provider which can be complex. Simplified for demonstration.
req, err := http.NewRequest("GET", "/auth/callback?code=testcode", nil)
assert.NoError(t, err)

rr := httptest.NewRecorder()
handler := http.HandlerFunc(app.OAuthCallbackHandler)
handler.ServeHTTP(rr, req)

// Since actual OAuth flow can't be tested in unit test, we are focusing on ensuring no panic
assert.NotEqual(t, http.StatusInternalServerError, rr.Code)
}

func Test_UserInfoHandler(t *testing.T) {
app := setup()

// Create a request object to pass to the session store
req, err := http.NewRequest("GET", "/api/user", nil)
assert.NoError(t, err)

Expand All @@ -80,7 +77,7 @@ func Test_UserInfoHandler(t *testing.T) {
"uuid": "uuid-test",
"encryption_secret": "secret-test",
}
session.Save(req, httptest.NewRecorder()) // Save the session
session.Save(req, httptest.NewRecorder())

rr := httptest.NewRecorder()
handler := http.HandlerFunc(app.UserInfoHandler)
Expand Down Expand Up @@ -125,7 +122,6 @@ func Test_LogoutHandler(t *testing.T) {
}

func Test_AddTaskHandler_WithDueDate(t *testing.T) {
// Initialize job queue
GlobalJobQueue = NewJobQueue()

requestBody := map[string]interface{}{
Expand All @@ -151,7 +147,6 @@ func Test_AddTaskHandler_WithDueDate(t *testing.T) {
}

func Test_AddTaskHandler_WithoutDueDate(t *testing.T) {
// Initialize job queue
GlobalJobQueue = NewJobQueue()

requestBody := map[string]interface{}{
Expand Down Expand Up @@ -197,7 +192,6 @@ func Test_AddTaskHandler_MissingDescription(t *testing.T) {
assert.Contains(t, rr.Body.String(), "Description is required")
}

// Task Dependencies Tests
func Test_AddTaskHandler_WithDependencies(t *testing.T) {
GlobalJobQueue = NewJobQueue()

Expand Down
4 changes: 0 additions & 4 deletions backend/controllers/delete_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ func DeleteTaskHandler(w http.ResponseWriter, r *http.Request) {
return
}

// if err := tw.DeleteTaskInTaskwarrior(email, encryptionSecret, uuid, taskuuid); err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// return
// }
logStore := models.GetLogStore()
job := Job{
Name: "Delete Task",
Expand Down
1 change: 0 additions & 1 deletion backend/controllers/get_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func SyncLogsHandler(w http.ResponseWriter, r *http.Request) {
logStore := models.GetLogStore()
logs := logStore.GetLogs(last)

// Return logs as JSON
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(logs); err != nil {
http.Error(w, "Failed to encode logs", http.StatusInternalServerError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const BottomBar: React.FC<BottomBarProps> = ({
}) => {
return (
<header className="lg:hidden fixed bottom-0 w-full bg-white border-t-[1px] dark:border-b-slate-700 dark:bg-background shadow-lg flex justify-between items-center p-4 z-40">
{/* Nav Links */}
<NavigationMenu className="mx-auto">
<div className="flex space-x-4 mr-2">
<nav className="md:flex gap-2 justify-center flex-2">
Expand All @@ -51,7 +50,6 @@ const BottomBar: React.FC<BottomBarProps> = ({
</nav>
</div>

{/* Filters */}
<Popover>
<PopoverTrigger asChild>
<Button variant="ghost" className="w-auto px-3" aria-label="Filter">
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/HomeComponents/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const Hero = (props: Props) => {
</div>
</div>

{/* Shadow effect */}
<div className="shadow"></div>

<ToastNotification />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ export const NavbarMobile = (
<Dialog open={isDevLogsOpen} onOpenChange={setIsDevLogsOpen}>
<DialogTrigger>
<div
// onClick={() => {
// setIsDevLogsOpen(true);
// props.setIsOpen(false);
// }}
className={`w-[130px] cursor-pointer border ${buttonVariants({
variant: 'secondary',
})}`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { tasksCollection } from '@/lib/controller';
import { Task } from '@/components/utils/types';
import { handleLogout, deleteAllTasks } from '../navbar-utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const deleteAllTasks = async (props: Props) => {
});

try {
// Count tasks first
const taskCount = await db.tasks.where('email').equals(props.email).count();

// If no tasks, show Red toast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ export const SetupGuide = (props: Props) => {
Configure Taskwarrior with these commands, run these
commands one block at a time
</div>
{/* Link to container */}
<CopyableCode
text={`task config sync.server.origin ${url.containerOrigin}`}
copyText={`task config sync.server.origin ${url.containerOrigin}`}
/>
{/* Client ID */}
<CopyableCode
text={`task config sync.server.client_id ${props.uuid}`}
copyText={`task config sync.server.client_id ${props.uuid}`}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/HomeComponents/Tasks/TaskDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const TaskDialog = ({
}: EditTaskDialogProps) => {
const handleDialogOpenChange = (open: boolean) => {
if (open) {
onSelectTask(task, index); // Notify parent that this task is selected
onSelectTask(task, index);
}
onOpenChange(open);
};
Expand Down Expand Up @@ -763,7 +763,7 @@ export const TaskDialog = ({
onUpdateState({
isEditingDepends: false,
dependsDropdownOpen: false,
editedDepends: task.depends || [], // reset back to original
editedDepends: task.depends || [],
});
}}
>
Expand Down Expand Up @@ -1468,7 +1468,6 @@ export const TaskDialog = ({
</DialogDescription>
</div>

{/* Non-scrollable footer */}
<DialogFooter className="flex flex-row justify-end pt-4">
{task.status == 'pending' ? (
<Dialog>
Expand Down
15 changes: 1 addition & 14 deletions frontend/src/components/HomeComponents/Tasks/Tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ export const Tasks = (
resetState: resetEditState,
} = useEditTask(_selectedTask);

// Handler for dialog open/close

const debouncedSearch = debounce((value: string) => {
setDebouncedTerm(value);
setCurrentPage(1);
Expand Down Expand Up @@ -203,7 +201,6 @@ export const Tasks = (
}
}, [props.email]);

// Update the displayed time every 10 seconds
useEffect(() => {
const interval = setInterval(() => {
setLastSyncTime((prevTime) => prevTime);
Expand All @@ -219,7 +216,6 @@ export const Tasks = (
.equals(props.email)
.toArray();

// Set all tasks
setTasks(sortTasksById(tasksFromDB, 'desc'));
setTempTasks(sortTasksById(tasksFromDB, 'desc'));

Expand All @@ -229,7 +225,6 @@ export const Tasks = (
.sort((a, b) => (a > b ? 1 : -1));
setUniqueProjects(filteredProjects);

// Extract unique tags
const tagsSet = new Set(tasksFromDB.flatMap((task) => task.tags || []));
const filteredTags = Array.from(tagsSet)
.filter((tag) => tag !== '')
Expand Down Expand Up @@ -275,15 +270,13 @@ export const Tasks = (
setTasks(sortedTasks);
setTempTasks(sortedTasks);

// Update unique projects after a successful sync so the Project dropdown is populated
const projectsSet = new Set(sortedTasks.map((task) => task.project));
const filteredProjects = Array.from(projectsSet)
.filter((project) => project !== '')
.sort((a, b) => (a > b ? 1 : -1));
setUniqueProjects(filteredProjects);
});

// Store last sync timestamp using hashed key
const currentTime = Date.now();
const hashedKey = hashKey('lastSyncTime', user_email);
localStorage.setItem(hashedKey, currentTime.toString());
Expand Down Expand Up @@ -439,7 +432,6 @@ export const Tasks = (
};

const handleMarkComplete = async (taskuuid: string) => {
// Find the task being completed
const taskToComplete = tasks.find((t) => t.uuid === taskuuid);
if (!taskToComplete) {
toast.error('Task not found');
Expand Down Expand Up @@ -468,7 +460,6 @@ export const Tasks = (
}
}

// If all dependencies are completed, allow completion
setUnsyncedTaskUuids((prev) => new Set([...prev, taskuuid]));

await markTaskAsCompleted(
Expand Down Expand Up @@ -737,26 +728,22 @@ export const Tasks = (
const aOverdue = a.status === 'pending' && isOverdue(a.due);
const bOverdue = b.status === 'pending' && isOverdue(b.due);

// Overdue always on top
if (aOverdue && !bOverdue) return -1;
if (!aOverdue && bOverdue) return 1;

// Otherwise fall back to ID sort and status sort
return 0;
});
};

useEffect(() => {
let filteredTasks = [...tasks];

// Project filter
if (selectedProjects.length > 0) {
filteredTasks = filteredTasks.filter(
(task) => task.project && selectedProjects.includes(task.project)
);
}

// Status filter
if (selectedStatuses.length > 0) {
filteredTasks = filteredTasks.filter((task) => {
const isTaskOverdue = task.status === 'pending' && isOverdue(task.due);
Expand Down Expand Up @@ -985,7 +972,7 @@ export const Tasks = (
<Button variant="outline" onClick={() => setShowReports(!showReports)}>
{showReports ? 'Show Tasks' : 'Show Reports'}
</Button>
{/* Mobile-only Sync button (desktop already shows a Sync button with filters) */}
{/* Mobile-only Sync button */}
<Button
className="sm:hidden ml-2 relative"
variant="outline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const useEditTask = (selectedTask: Task | null) => {
annotationInput: '',
});

// Update edited tags when selected task changes
useEffect(() => {
if (selectedTask) {
setState((prev) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ jest.mock('../hooks', () => ({
jest.mock('../Pagination', () => {
return jest.fn((props) => (
<div data-testid="mock-pagination">
{/* Render props to make them testable */}
<span data-testid="total-pages">{props.totalPages}</span>
<span data-testid="current-page">{props.currentPage}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { toast } from 'react-toastify';
import {
// formattedDate,
getDisplayedPages,
handleCopy,
handleDate,
Expand Down Expand Up @@ -72,18 +71,6 @@ describe('sortTasks', () => {
});
});

// describe('formattedDate', () => {
// it('formats valid ISO date string correctly', () => {
// const dateString = '2023-06-17T12:00:00Z';
// expect(formattedDate(dateString)).toBe('Jun 17, 2023, 5:30:00 PM');
// });

// it('returns input string if date parsing fails', () => {
// const invalidDateString = 'invalid-date-string';
// expect(formattedDate(invalidDateString)).toBe(invalidDateString);
// });
// });

describe('sortTasksById', () => {
const tasks: Task[] = [
createTask(2, 'completed', '2', '2', ['2']),
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/HomeComponents/Tasks/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,14 @@ export const addTaskToBackend = async ({
tags,
};

// Only include due if it's provided
if (due !== undefined && due !== '') {
requestBody.due = due;
}

// Only include start if it's provided
if (start !== undefined && start !== '') {
requestBody.start = start;
}
// Add dependencies if provided

if (depends && depends.length > 0) {
requestBody.depends = depends;
}
Expand All @@ -96,12 +94,10 @@ export const addTaskToBackend = async ({
requestBody.end = end;
}

// Only include recur if it's provided
if (recur !== undefined && recur !== '') {
requestBody.recur = recur;
}

// Add annotations to request body, filtering out empty descriptions
requestBody.annotations = annotations.filter(
(annotation) =>
annotation.description && annotation.description.trim() !== ''
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/HomeComponents/Tasks/tasks-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ export const formattedDate = (dateString: string) => {
};

export const parseTaskwarriorDate = (dateString: string) => {
// Taskwarrior date format: YYYYMMDDTHHMMSSZ

if (!dateString) return null;

const year = dateString.substring(0, 4);
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/ui/key-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ export const Key = ({ lable }: { lable: string }) => {
src={`https://key.pics/key/${lable.toUpperCase()}.svg?size=15&color=dark&fontStyle=Bold&fontSize=12`}
alt={lable}
className="hidden md:inline-block ml-2"
>
{/* {key} */}
</img>
></img>
);
};
Loading