-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: online sync plans code refactor & small features #114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 18 changed files in this pull request and generated no suggestions.
Files not reviewed (12)
- frontend/package-lock.json: Language not supported
- frontend/package.json: Language not supported
- frontend/src/app/plans/edit/[id]/page.client.tsx: Evaluated as low risk
- frontend/src/app/plans/edit/[id]/page.tsx: Evaluated as low risk
- frontend/src/app/plans/page.client.tsx: Evaluated as low risk
- frontend/src/actions/plans.ts: Evaluated as low risk
- frontend/src/app/plans/page.tsx: Evaluated as low risk
- frontend/src/app/layout.tsx: Evaluated as low risk
- frontend/src/lib/usePlan.ts: Evaluated as low risk
- frontend/src/components/PlanDisplayLink.tsx: Evaluated as low risk
- frontend/src/app/plans/edit/[id]/_components/SyncedButton.tsx: Evaluated as low risk
- frontend/src/app/plans/edit/[id]/_components/OfflineAlert.tsx: Evaluated as low risk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
widać, że się postarałeś i doceniam za chęci, ale pomyśl nad lepszymi abstrakcjami, jest szansa, że będzie trzeba to bardziej od zera przebudować, bo zarządzanie tym stanem wygląda dość źle
<CloudIcon className="size-4 text-emerald-500" /> | ||
) : !(onlineId ?? "") ? ( | ||
<AlertTriangleIcon className="size-4 text-rose-500" /> | ||
) : syncing ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie można tutaj jakoś ładniej tego zrobić? Bo te ternary w renderze trochę średnio wyglądają
className="min-w-10" | ||
onClick={() => { | ||
if (!equalsDates) { | ||
bounceAlert(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Te ify trochę brzydkie na moje
frontend/src/lib/usePlan.ts
Outdated
import { useAtom } from "jotai"; | ||
|
||
import { type ExtendedCourse, planFamily } from "@/atoms/planFamily"; | ||
|
||
import type { Registration } from "./types"; | ||
|
||
export interface PlanState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie chcemy wszystkich interfejsów razem trzymać w types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chcemy, lint bartusia nie chce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jak nie pozwala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ale Marcinowi chodziło to żeby wrzucić to do folderu types 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaaaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorka ze tak pozno, wiekszosc zostala juz poprawiona i nie widze niczego co mi nie pasuje
wywailem env baseurl bo doslownie do niczego ona nie byla potrzebne, tylko robilismy z tego apps url wiec po prostu to dodalem do env, dzieki czemu moglem uzywac tego pliku tez po kliencie jak juz nie bylo eksportu serwerowego, do tego lepsze nazwy i mniej zmiennych w funkcjach w page.client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, o wiele lepsze te abstrakcje, nadal niektóre if'ologie bym wydzielił do funkcji, ale jest dobrze
też te aktualizowanie bym zrobił automatycznie w tle, żeby user nic nie musiał klikać (a Tobie by to oszczędziło kodu na alerty), ale to pewnie poza scopem tej pr'ki
} | ||
}} | ||
> | ||
{plan.synced && isEqualsDates ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nie poprawiłeś tego, nadal dublujesz logike i tutaj i tam na górze w useMemo
* @param plan **plan** object from useAtom() | ||
* @returns Objects: ```{ status: "NOT_LOGGED_IN" | "UNKNOWN", message: string }``` or ```{ status: "SUCCESS" }``` | ||
*/ | ||
export const createOnlinePlan = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o wiele lepsza abstrakcja, nice
This pull request includes various updates and improvements to the frontend codebase, particularly involving the addition of a new tooltip component and the refactoring of plan-related types and functions. The most important changes include adding the
@radix-ui/react-tooltip
package, refactoring type imports, and enhancing the user interface with tooltips and offline alerts.Package Updates:
@radix-ui/react-tooltip
version1.1.4
topackage.json
andpackage-lock.json
. [1] [2] [3]Type Refactoring:
frontend/src/actions/plans.ts
to use a centralized types file.UI Enhancements:
TooltipProvider
to the root layout infrontend/src/app/layout.tsx
to enable tooltips across the application. [1] [2] [3]SyncedButton
component to provide additional context to users. (frontend/src/app/plans/edit/[id]/_components/SyncedButton.tsxL10-R17, frontend/src/app/plans/edit/[id]/_components/SyncedButton.tsxR26-R59, frontend/src/app/plans/edit/[id]/_components/SyncedButton.tsxR77-R81)OfflineAlert
component to notify users when they are offline. (frontend/src/app/plans/edit/[id]/_components/OfflineAlert.tsxR1-R12)Code Organization:
CreateNewPlanPage
topage.client.tsx
and updated imports accordingly. (frontend/src/app/plans/edit/[id]/page.client.tsxL4-R12, frontend/src/app/plans/edit/[id]/page.client.tsxR32-R41, frontend/src/app/plans/edit/[id]/page.tsxL5-R5)