Skip to content
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

Merged
merged 14 commits into from
Dec 16, 2024

Conversation

qamarq
Copy link
Member

@qamarq qamarq commented Dec 11, 2024

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:

  • Added @radix-ui/react-tooltip version 1.1.4 to package.json and package-lock.json. [1] [2] [3]

Type Refactoring:

  • Refactored type imports in frontend/src/actions/plans.ts to use a centralized types file.

UI Enhancements:

Code Organization:

@qamarq qamarq changed the title feat: new tooltip messages on sync button, alert while log out refactor: online sync plans code refactor & small features Dec 11, 2024
@qamarq qamarq self-assigned this Dec 11, 2024
@qamarq qamarq marked this pull request as ready for review December 11, 2024 18:50

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
Copy link
Member

@Rei-x Rei-x left a 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

frontend/src/app/layout.tsx Outdated Show resolved Hide resolved
frontend/src/app/layout.tsx Outdated Show resolved Hide resolved
frontend/src/app/plans/edit/[id]/page.client.tsx Outdated Show resolved Hide resolved
frontend/src/app/plans/edit/[id]/page.client.tsx Outdated Show resolved Hide resolved
frontend/src/components/PlanDisplayLink.tsx Show resolved Hide resolved
frontend/src/lib/usePlan.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/handleCreateOnlinePlan.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/handleSyncPlan.ts Outdated Show resolved Hide resolved
<CloudIcon className="size-4 text-emerald-500" />
) : !(onlineId ?? "") ? (
<AlertTriangleIcon className="size-4 text-rose-500" />
) : syncing ? (
Copy link
Member

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();
Copy link
Member

@D0dii D0dii Dec 14, 2024

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

import { useAtom } from "jotai";

import { type ExtendedCourse, planFamily } from "@/atoms/planFamily";

import type { Registration } from "./types";

export interface PlanState {
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jak nie pozwala

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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 😭

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaaaaa

Copy link
Member

@olekszczepanowski olekszczepanowski left a 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
Copy link
Member

@Rei-x Rei-x left a 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 ? (
Copy link
Member

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

frontend/src/lib/usePlan.ts Outdated Show resolved Hide resolved
* @param plan **plan** object from useAtom()
* @returns Objects: ```{ status: "NOT_LOGGED_IN" | "UNKNOWN", message: string }``` or ```{ status: "SUCCESS" }```
*/
export const createOnlinePlan = async (
Copy link
Member

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

@qamarq qamarq merged commit 6294086 into main Dec 16, 2024
1 check passed
@qamarq qamarq deleted the refactor/online-sync-feature branch December 16, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants