-
Notifications
You must be signed in to change notification settings - Fork 1
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
Website/refactor #222
Website/refactor #222
Conversation
…nto website/refactor
…nto website/refactor
Reviewer's Guide by SourceryThis pull request refactors the design system and website-related styles. The changes primarily involve the introduction of a new color system using CSS variables, updates to various CSS classes, and the addition of new styles for dark mode. Additionally, there are updates to the documentation structure and some JavaScript code changes. File-Level Changes
Tips
|
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.
Hey @tulsiojha - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
Here's what I looked at during the review
- 🟡 General issues: 21 issues found
- 🔴 Security: 2 blocking issues, 1 other issue
- 🟢 Testing: all looks good
- 🟡 Complexity: 6 issues found
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -2,50 +2,308 @@ | |||
|
|||
/* @import url('https://fonts.googleapis.com/css2?family=Familjen+Grotesk:ital,wght@0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'); */ | |||
|
|||
.range-slide-base{ | |||
:root { |
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.
suggestion: Consider organizing CSS variables by category.
To improve readability and maintainability, consider grouping related CSS variables together and adding comments to separate different categories (e.g., colors, typography, spacing).
:root { | |
:root { | |
/* Color Variables */ | |
--shiki-color-text: oklch(37.53% 0 0); | |
--shiki-color-background: transparent; | |
} |
"devops":{ | ||
"title":"DevOps", | ||
"type":"page" | ||
"--introduction--":{ |
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.
suggestion: Consider using a consistent naming convention for separators.
Using a consistent naming convention for separators (e.g., --section--
) can make the JSON structure more intuitive and easier to understand.
"--introduction--":{ | |
"--section-introduction--":{ |
@@ -1,5 +1,7 @@ | |||
import { UndoRedo, DiffSourceToggleWrapper } from '@mdxeditor/editor'; | |||
import '@mdxeditor/editor/style.css'; | |||
import axios from 'axios'; |
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.
suggestion: Consider handling axios errors more gracefully.
Instead of logging errors to the console, consider displaying a user-friendly error message or retrying the request.
desc: 'Remote local environments blend local and remote development, allowing developers to work as if locally but on cloud-based infrastructure. This setup enables seamless access, consistent environments, collaboration across locations, resource efficiency, and scalable resources. It merges the convenience of local development with the power and flexibility of remote capabilities to enhance productivity.', | ||
classNames: 'wb-pb-lg 3xl:wb-pb-md', | ||
desc: "Kloudlite Remote Local environments refer to a hybrid development setup where remote Kubernetes-based environments are seamlessly integrated with local development containers. These local containers run on the developer's machine and are connected to the remote environments via a secure WireGuard network, enabling access to remote services as if they were local. This setup ensures development-production parity by synchronizing configurations and secrets, allowing developers to use their local IDEs for coding while maintaining a consistent and secure environment.", | ||
classNames: 'wb-pb-2xl 3xl:wb-pb-xl', | ||
}, | ||
{ | ||
title: 'How does Kloudlite Development Environments work?', | ||
desc: 'Kloudlite establishes a WireGuard VPN mesh that connects all infrastructure running workloads with developer devices. With this network connection in place, developers can access environments directly from their local machines. They have the capability to clone environments, switch between them, and collaborate seamlessly without the need to worry about building and deploying applications.', | ||
desc: `Kloudlite Development Environments work by linking your local machine to remote environment | ||
where your applications run. Configs and Secrets are kept in sync between your local machine and the remote environment. | ||
Local containers will be in the same wireguard network as remote environment. | ||
These connect through a secure network, allowing you to access and work with all necessary services without installing them locally. | ||
This setup enables developers to work efficiently, ensuring that what they build on their computers will function the same way when | ||
deployed on the remote servers.`, | ||
classNames: 'wb-pb-lg 3xl:wb-pb-md', | ||
}, |
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.
suggestion: Update description for remote local environments
The description for remote local environments has been updated to provide more detailed information about the setup and benefits. This change improves clarity and helps users understand the functionality better.
desc: 'Remote local environments blend local and remote development, allowing developers to work as if locally but on cloud-based infrastructure. This setup enables seamless access, consistent environments, collaboration across locations, resource efficiency, and scalable resources. It merges the convenience of local development with the power and flexibility of remote capabilities to enhance productivity.', | |
classNames: 'wb-pb-lg 3xl:wb-pb-md', | |
desc: "Kloudlite Remote Local environments refer to a hybrid development setup where remote Kubernetes-based environments are seamlessly integrated with local development containers. These local containers run on the developer's machine and are connected to the remote environments via a secure WireGuard network, enabling access to remote services as if they were local. This setup ensures development-production parity by synchronizing configurations and secrets, allowing developers to use their local IDEs for coding while maintaining a consistent and secure environment.", | |
classNames: 'wb-pb-2xl 3xl:wb-pb-xl', | |
}, | |
{ | |
title: 'How does Kloudlite Development Environments work?', | |
desc: 'Kloudlite establishes a WireGuard VPN mesh that connects all infrastructure running workloads with developer devices. With this network connection in place, developers can access environments directly from their local machines. They have the capability to clone environments, switch between them, and collaborate seamlessly without the need to worry about building and deploying applications.', | |
desc: `Kloudlite Development Environments work by linking your local machine to remote environment | |
where your applications run. Configs and Secrets are kept in sync between your local machine and the remote environment. | |
Local containers will be in the same wireguard network as remote environment. | |
These connect through a secure network, allowing you to access and work with all necessary services without installing them locally. | |
This setup enables developers to work efficiently, ensuring that what they build on their computers will function the same way when | |
deployed on the remote servers.`, | |
classNames: 'wb-pb-lg 3xl:wb-pb-md', | |
}, | |
desc: "Kloudlite Remote Local environments are a hybrid setup where local development containers on a developer's machine are integrated with remote Kubernetes environments via a secure WireGuard network. This allows access to remote services as if they were local, ensuring development-production parity by synchronizing configurations and secrets. Developers can use their local IDEs while maintaining a consistent and secure environment.", |
}; | ||
|
||
const AvatarItem = ({ gravatarHash }: { gravatarHash?: string }) => { |
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.
suggestion: Add AvatarItem component
The AvatarItem component has been added to display user avatars based on gravatar hashes. This is a useful addition for enhancing user profiles.
const AvatarItem = ({ gravatarHash }: { gravatarHash?: string }) => { | |
const AvatarItem = ({ gravatarHash = '' }: { gravatarHash?: string }) => { |
@@ -11,14 +11,13 @@ function scrollbar() { | |||
'@apply wb-bg-transparent': {}, | |||
}, | |||
'&::-webkit-scrollbar-thumb': { | |||
'@apply wb-bg-black dark:wb-bg-black wb-rounded wb-cursor-pointer': | |||
{}, | |||
'@apply wb-bg-surface-basic-hovered wb-rounded wb-cursor-pointer': {}, |
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.
issue (complexity): Consider reverting to the original class names to maintain simplicity and consistency.
The new code introduces more specific class names (wb-bg-surface-basic-hovered
and wb-bg-surface-basic-pressed
), which increases complexity and reduces readability. The previous class names (wb-bg-black
and wb-bg-surface-primary-default
) were more consistent and easier to understand. Consider reverting to the original class names to maintain simplicity and consistency. If the new class names are necessary, please document the changes and their purpose to aid future developers.
'border-border-default dark:border-border-darktheme-default bg-surface-basic-default dark:bg-surface-darktheme-basic-default text-text-default dark:text-text-darktheme-default': | ||
type === 'neutral', | ||
'border-border-primary dark:border-border-darktheme-primary bg-surface-primary-subdued dark:bg-surface-darktheme-primary-subdued text-text-primary dark:text-text-darktheme-primary': | ||
'border-border-default bg-surface-basic-default': type === 'neutral', |
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.
issue (complexity): Consider using a typeClasses
object to map the type
to the corresponding class names while retaining dark theme support.
The new code is more complex and less functional for a few reasons:
-
Loss of Dark Theme Support: The removal of dark theme classes means the component no longer supports dark mode, which can negatively impact user experience for those who prefer or require it.
-
Readability: The new code is less readable due to the removal of the clear separation of styles for different themes. This makes it harder to understand at a glance what styles are applied under different conditions.
-
Maintainability: Removing the dark theme classes makes future changes to reintroduce or modify dark theme support more difficult. The original code was more maintainable with its clear definition of styles for both light and dark themes.
Consider using a typeClasses
object to map the type
to the corresponding class names while retaining dark theme support. This approach improves readability and maintainability:
const Badge = ({
type = 'neutral',
children,
icon,
className,
}: IBadge) => {
const iconProps = { size: 12, color: 'currentColor' };
const typeClasses = {
neutral: 'border-border-default dark:border-border-darktheme-default bg-surface-basic-default dark:bg-surface-darktheme-basic-default text-text-default dark:text-text-darktheme-default',
info: 'border-border-primary dark:border-border-darktheme-primary bg-surface-primary-subdued dark:bg-surface-darktheme-primary-subdued text-text-primary dark:text-text-darktheme-primary',
success: 'border-border-success bg-surface-success-subdued text-text-success dark:border-border-darktheme-success dark:bg-surface-darktheme-success-subdued dark:text-text-darktheme-success',
warning: 'border-border-warning bg-surface-warning-subdued text-text-warning dark:border-border-darktheme-warning dark:bg-surface-darktheme-warning-subdued dark:text-text-darktheme-warning',
critical: 'border-border-critical bg-surface-critical-subdued text-text-critical dark:border-border-darktheme-critical dark:bg-surface-darktheme-critical-subdued dark:text-text-darktheme-critical',
};
return (
<div
className={cn(
'flex gap-md items-center py-md px-2xl w-fit rounded-full bodySm border select-none pulsable',
typeClasses[type],
className
)}
>
{!!icon && cloneElement(icon, iconProps)}
{children}
</div>
);
};
)} | ||
> | ||
<AvatarBase color={color} size={size} image={props.image} /> | ||
{!noImage && ( |
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.
issue (complexity): Consider refactoring to simplify the code and improve readability.
The new code introduces additional complexity due to increased conditional logic and an expanded function signature. The added noImage
prop makes the code harder to read and understand at a glance. To simplify the code while maintaining the same functionality, consider the following refactor:
- Extract class names into variables (
buttonClassName
andcontainerClassName
) to make the JSX cleaner. - Simplify conditional rendering for
AvatarBase
and the name/subtitle sections. - Ensure consistent formatting and indentation for improved readability.
Here's a possible refactor:
import { ReactNode, forwardRef } from 'react';
import { AvatarBase, IAvatar } from '../atoms/avatar';
import { BounceIt } from '../bounce-it';
import { cn } from '../utils';
interface IProfile extends IAvatar {
name?: ReactNode;
subtitle?: ReactNode;
responsive?: boolean;
noImage?: boolean;
}
const Profile = forwardRef<HTMLButtonElement, IProfile>(
({ name, subtitle, color, responsive = true, size, noImage, ...props }, ref) => {
const buttonClassName = cn(
'flex py-sm px-md gap-lg items-center ring-offset-1 dark:ring-offset-0 outline-none transition-all rounded focus-visible:ring-2 focus-visible:ring-border-focus dark:focus-visible:ring-border-darktheme-focus'
);
const containerClassName = cn(
'flex-col items-start',
responsive ? 'hidden md:flex' : 'flex'
);
return (
<BounceIt className="w-fit">
<button {...props} ref={ref} className={buttonClassName}>
{!noImage && <AvatarBase color={color} size={size} image={props.image} />}
{(name || subtitle) && (
<div className={containerClassName}>
{name && (
<div className="bodyMd-medium gap-y-md pulsable text-text-default dark:text-text-darktheme-default">
{name}
</div>
)}
{subtitle && (
<div className="bodySm text-text-subtle dark:text-text-darktheme-subtle">
{subtitle}
</div>
)}
</div>
)}
</button>
</BounceIt>
);
}
);
export default Profile;
This refactor maintains the same functionality while making the code easier to read and understand.
content="hello" | ||
onClick={async () => { | ||
try { | ||
axios({ |
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.
🚨 issue (security): Potential hard-coded URL found.
Consider using environment variables or configuration files to manage URLs.
onClick={async () => { | ||
try { | ||
axios({ | ||
url: 'https://auth1.dev.kloudlite.io/api', |
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.
🚨 issue (security): Hard-coded URL found.
It's recommended to use environment variables or configuration files to manage URLs.
Design system and Website related change
Summary by Sourcery
This pull request refactors the design system and website by introducing a comprehensive set of CSS variables for color theming, adding new stylesheets, and updating the layout and styles of various components. It also includes new documentation sections and a new page for 'Local Development Environments'.