Skip to content

Commit 31715d5

Browse files
committed
Fix all TypeScript/ESLint errors
- Update GitHub Actions workflow to include frontend linting
1 parent 710155f commit 31715d5

27 files changed

+202
-167
lines changed
Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
on:
22
push:
3-
name: pytest, ruff, mypy
3+
name: pytest, ruff, mypy, frontend
44
jobs:
5-
test:
5+
test-backend:
66
runs-on: ubuntu-latest
77
steps:
88
#----------------------------------------------
@@ -47,3 +47,28 @@ jobs:
4747
- name: Run mypy
4848
run: |
4949
uv run mypy planty
50+
51+
test-frontend:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Check out repository
55+
uses: actions/checkout@v4
56+
57+
- name: Set up Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: "20"
61+
cache: "npm"
62+
cache-dependency-path: frontend/package-lock.json
63+
64+
- name: Install dependencies
65+
working-directory: frontend
66+
run: npm ci
67+
68+
- name: Run ESLint
69+
working-directory: frontend
70+
run: npm run lint
71+
72+
- name: Check TypeScript compilation
73+
working-directory: frontend
74+
run: npm run build

compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
services:
22
minio:
33
image: minio/minio
4-
ports:
5-
- "0.0.0.0:9000:9000"
4+
# ports:
5+
# - "0.0.0.0:9000:9000"
66
volumes:
77
- minio-volume:/data
88
command: server --console-address ":9001" /data
@@ -32,8 +32,8 @@ services:
3232
db:
3333
image: postgres:16
3434
restart: always
35-
ports:
36-
- ${PLANTY_DB_PORT}:5432
35+
# ports:
36+
# - ${PLANTY_DB_PORT}:5432
3737
environment:
3838
- POSTGRES_DB=${PLANTY_DB_NAME}
3939
- POSTGRES_PASSWORD=${PLANTY_DB_PASS}

frontend/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
components/ui/*

frontend/Dockerfile.frontend

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@ COPY . .
99

1010
EXPOSE 3000
1111

12-
# TODO: fix build errors and use this to avoid using dev server in production:
13-
# RUN npm run build
14-
# CMD ["npm", "start"]
15-
16-
CMD ["npm", "run", "dev"]
12+
RUN npm run build
13+
CMD ["npm", "start"]

frontend/api/api-calls.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Api, RecurrenceInfo } from "@/api/Api";
1+
import { Api, RecurrenceInfo, TaskUpdateRequest } from "@/api/Api";
22

33
const api = new Api().api;
44

@@ -49,21 +49,9 @@ export async function moveTask(
4949
}
5050
}
5151

52-
export async function updateTask(updateTaskData: {
53-
id: string;
54-
title?: string;
55-
description?: string;
56-
due_to?: string;
57-
recurrence: RecurrenceInfo | null;
58-
}) {
52+
export async function updateTask(updateTaskData: TaskUpdateRequest) {
5953
try {
60-
const result = await api.updateTaskApiTaskPatch({
61-
id: updateTaskData.id,
62-
title: updateTaskData.title,
63-
description: updateTaskData.description,
64-
due_to: updateTaskData.due_to,
65-
recurrence: updateTaskData.recurrence,
66-
});
54+
const result = await api.updateTaskApiTaskPatch(updateTaskData);
6755
console.log("Task edited successfully:", result);
6856
return result;
6957
} catch (error: any) {
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { Section } from "@/components/tasks/section";
22

3-
export default async function Page({
4-
params,
5-
}: {
6-
params: Promise<{ id: string }>;
7-
}) {
3+
export default async function Page() {
84
// TODO: fetch initial data here to avoid flickering?
95
return <Section sectionId="archived" />;
106
}

frontend/components/calendar-view.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ function CalendarView() {
4747
tasksByDate,
4848
overdueTasks,
4949
isLoading,
50-
isError,
5150
mutate: mutateTasksByDate,
5251
} = useTasksByDate(weekStart, weekEnd, isCurrentWeekSelected);
5352

54-
const handleDateSelect = (date: Date) => {
55-
setSelectedDate(date);
56-
setIsPopoverOpen(false);
53+
const handleDateSelect = (date: Date | undefined) => {
54+
if (date) {
55+
setSelectedDate(date);
56+
setIsPopoverOpen(false);
57+
}
5758
};
5859

59-
function getWeekRange(date: Date): string {
60+
function getWeekRange(): string {
6061
const today = new Date();
6162
const currentWeekStart = startOfWeek(today, { weekStartsOn: 1 });
6263
const isCurrentWeek = weekStart.getTime() === currentWeekStart.getTime();
@@ -100,7 +101,7 @@ function CalendarView() {
100101
return `${baseFormat} · ${format(date, "EEEE", { locale: enUS })}`;
101102
}
102103

103-
const weekRange = selectedDate ? getWeekRange(selectedDate) : "";
104+
const weekRange = selectedDate ? getWeekRange() : "";
104105

105106
const allTasks = [
106107
...(isCurrentWeekSelected && overdueTasks?.length

frontend/components/left-panel/app-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { Archive, Calendar, Search, Settings2, Sparkles } from "lucide-react";
3+
import { Archive, Calendar, Search, Settings2 } from "lucide-react";
44
import * as React from "react";
55

66
import { siGithub } from "simple-icons";

frontend/components/left-panel/edit-section-dialog.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import {
88
} from "@/components/ui/dialog";
99
import { useRef } from "react";
1010
import { SectionEditDialogForm } from "./section-edit-dialog-form";
11+
import { SectionResponse } from "@/api/Api";
1112

1213
interface EditSectionDialogProps {
1314
isOpened: boolean;
1415
onOpenChange: (open: boolean) => void;
15-
section: {
16-
id: string;
17-
title: string;
18-
};
19-
onSubmit: (section: any) => void;
16+
section: SectionResponse;
17+
onSubmit: (section: { id: string; title: string }) => void;
2018
}
2119

2220
export function EditSectionDialog({

frontend/components/left-panel/logo.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Image from "next/image";
22
import Link from "next/link";
3-
import { useRouter } from "next/navigation";
43
export function Logo() {
5-
const router = useRouter();
64
return (
75
<div className="flex justify-center w-full">
86
<div className="w-40">

0 commit comments

Comments
 (0)