From b58e1da628f507231efde4e3d1d72f5eab3058f3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:04:41 +0000 Subject: [PATCH 1/2] chore: apply Claude suggestions --- src/components/Clock.tsx | 166 +++++++++++++++------------------------ 1 file changed, 62 insertions(+), 104 deletions(-) diff --git a/src/components/Clock.tsx b/src/components/Clock.tsx index ccef490..9e83f82 100644 --- a/src/components/Clock.tsx +++ b/src/components/Clock.tsx @@ -1,120 +1,78 @@ +import { useState, useEffect } from "react"; import { Clock as ClockIcon } from "lucide-react"; -function Clock() { - let now: any = new Date(); - let time: any = - now.getHours().toString().padStart(2, "0") + +interface ClockProps { + className?: string; +} + +const POLISH_MONTHS: readonly string[] = [ + "stycznia", + "lutego", + "marca", + "kwietnia", + "maja", + "czerwca", + "lipca", + "sierpnia", + "września", + "października", + "listopada", + "grudnia", +] as const; + +const POLISH_DAYS: readonly string[] = [ + "niedziela", + "poniedziałek", + "wtorek", + "środa", + "czwartek", + "piątek", + "sobota", +] as const; + +function formatTime(date: Date): string { + return date.getHours().toString().padStart(2, "0") + ":" + - now.getMinutes().toString().padStart(2, "0") + + date.getMinutes().toString().padStart(2, "0") + ":" + - now.getSeconds().toString().padStart(2, "0"); + date.getSeconds().toString().padStart(2, "0"); +} - let polishMonths: any = [ - "stycznia", - "lutego", - "marca", - "kwietnia", - "maja", - "czerwca", - "lipca", - "sierpnia", - "września", - "października", - "listopada", - "grudnia", - ]; - let polishDays: any = ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]; +function formatDate(date: Date): string { + return POLISH_DAYS[date.getDay()] + + ", " + + date.getDate() + + " " + + POLISH_MONTHS[date.getMonth()] + + " " + + date.getFullYear(); +} - let dateStr: any = - polishDays[now.getDay()] + ", " + now.getDate() + " " + polishMonths[now.getMonth()] + " " + now.getFullYear(); +function Clock({ className }: ClockProps) { + const [time, setTime] = useState(""); + const [date, setDate] = useState(""); - let timeElement: any; - let dateElement: any; + useEffect(() => { + const updateClock = (): void => { + const now = new Date(); + setTime(formatTime(now)); + setDate(formatDate(now)); + }; - setTimeout(() => { - if (timeElement) { - let newNow: any = new Date(); - timeElement.innerHTML = - newNow.getHours().toString().padStart(2, "0") + - ":" + - newNow.getMinutes().toString().padStart(2, "0") + - ":" + - newNow.getSeconds().toString().padStart(2, "0"); - } - if (dateElement) { - let newNow: any = new Date(); - dateElement.innerHTML = - polishDays[newNow.getDay()] + - ", " + - newNow.getDate() + - " " + - polishMonths[newNow.getMonth()] + - " " + - newNow.getFullYear(); - } - }, 1000); + updateClock(); + const interval = setInterval(updateClock, 1000); - setInterval(() => { - if (timeElement) { - let newNow: any = new Date(); - timeElement.innerHTML = - newNow.getHours().toString().padStart(2, "0") + - ":" + - newNow.getMinutes().toString().padStart(2, "0") + - ":" + - newNow.getSeconds().toString().padStart(2, "0"); - } - if (dateElement) { - let newNow: any = new Date(); - dateElement.innerHTML = - polishDays[newNow.getDay()] + - ", " + - newNow.getDate() + - " " + - polishMonths[newNow.getMonth()] + - " " + - newNow.getFullYear(); - } - }, 1000); + return () => clearInterval(interval); + }, []); return ( -
-
+
+
- { - timeElement = el; - }}> - {time} - + {time}
-
{ - dateElement = el; - }} - style={{ - fontSize: "12px", - color: "#666", - fontWeight: "normal", - }}> - {dateStr} +
+ {date}
); From 8e0017e5ac749dba01775025f7f59932e22c2d01 Mon Sep 17 00:00:00 2001 From: psmyrdek Date: Thu, 21 Aug 2025 12:09:34 +0200 Subject: [PATCH 2/2] feat: upgrade --- .github/workflows/code-review.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index 56939ab..c8393ad 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -3,9 +3,11 @@ name: Code Review for PRs on: pull_request: branches: [master] + types: [labeled] jobs: code-review: + if: contains(github.event.label.name, 'claude-code-review') runs-on: ubuntu-latest permissions: contents: read