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(luna): impl loading and error in lessons page #254

Closed
wants to merge 1 commit into from

Conversation

moalidv
Copy link
Collaborator

@moalidv moalidv commented Dec 26, 2024

No description provided.

@moalidv moalidv marked this pull request as draft December 26, 2024 16:30
@moalidv moalidv force-pushed the mo/luna-loading-error branch 5 times, most recently from 2532f6a to 5ce14d6 Compare December 29, 2024 13:27
@moalidv moalidv force-pushed the mo/luna-loading-error branch from 5ce14d6 to d885874 Compare December 29, 2024 20:48
@moalidv moalidv self-assigned this Dec 29, 2024
@neuodev
Copy link
Member

neuodev commented Dec 29, 2024

🚀 Nova
🚀 Luna
🚀 Nebula
🚀 Dashboard

@moalidv moalidv marked this pull request as ready for review December 29, 2024 21:38
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better when you aren't using the svg, to not include it

@@ -79,7 +79,9 @@ describe("Ratings", () => {
values: [1, 2, 4, 5],
});

const avg = await ratings.findAvgRatings([t1.id, t2.id, t3.id]);
const avg = await ratings.findAvgRatings({
Copy link
Member

Choose a reason for hiding this comment

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

unrelated changes, Try to rebase on latest master

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

@mostafakamar2308
I want to ask about that point
findAvgRatings function take an object as a parameter containing users as an array of numbers so how can we give the function this array directly without the object and label of users

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mostafakamar2308
I have tried to rebase on the latest master but the error is still present

Copy link
Member

Choose a reason for hiding this comment

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

If you rebased now, you should not face this issue.

@neuodev
Copy link
Member

neuodev commented Dec 30, 2024

@moalidv please rebase.

Comment on lines +23 to +28
${variant === "large" ? "30px" : ""}
${variant === "medium" ? "25px" : ""}
${variant === "small" ? "15px" : ""}, white
${variant === "large" ? "16px" : ""}
${variant === "medium" ? "0px" : ""}
${variant === "small" ? "0px" : ""}
Copy link
Member

@neuodev neuodev Dec 30, 2024

Choose a reason for hiding this comment

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

we can have a function that returns the size based on the variant.

const size = useMemo(() => {
 if (variant === 'large') return '30px';
// ... 
}, [])

// or even better 
const styles = useMemo(() => {
   if (variant === 'large') return ['30px', '16px'];
   // ... 
}, [])

Copy link
Member

Choose a reason for hiding this comment

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

This is not in use. Please remove it as well as its export in the package.json file.

@neuodev
Copy link
Member

neuodev commented Dec 30, 2024

There is a degree of distortion in the spinner.

Screencast.from.2024-12-30.20-06-47.webm

Copy link
Collaborator

@mmoehabb mmoehabb left a comment

Choose a reason for hiding this comment

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

Easy to read and clean code, keep the good work up 😄

@@ -25,8 +25,9 @@ export const Content: React.FC<{
fetching: boolean;
error: boolean;
hasMore: boolean;
refetch?: Void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think using the Void type, in general, is considered bad or harmful practice. If it's not feasible or not that necessary and tedious to declare/define a type for this specific function. I'd recommend leaving a comment stating what it's supposed to do.

Copy link
Collaborator

@mmoehabb mmoehabb Dec 30, 2024

Choose a reason for hiding this comment

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

You may write, for instance: // A callback function that invokes tanstack query refetch method.

export const LoadingError: React.FC<{
retry: Void;
error: string;
variant?: "small" | "medium" | "large";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome work. This solution is really good and flawless. However, I have a suggestion: what if we defined the type of variant as follows "10" | "16" | "20", and then embedded it in tailwind class name tw-w-${variant}. I think It could make the code more succinct.

Copy link
Member

Choose a reason for hiding this comment

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

This will not work due to how tailwind scan for classnames.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will not work due to how tailwind scan for classnames.

I think It will work fine, at least inside the cn utility function.

@neuodev
Copy link
Member

neuodev commented Jan 1, 2025

This pull request will be closed in favor of #271

@neuodev neuodev closed this Jan 1, 2025
@neuodev neuodev deleted the mo/luna-loading-error branch January 1, 2025 17:27
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