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

feat: updated the ui of editor page #67

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

Anishali2
Copy link
Collaborator

@Anishali2 Anishali2 commented Mar 11, 2025

Before
Image

After
image

Summary by CodeRabbit

  • New Features
    • Introduced a new Starred page, allowing quick access to favorite items.
    • Updated the navigation menu so the “Starred” option now leads directly to this new page.
  • Style
    • Standardized the height of folder items for a consistent look.
    • Enhanced the layout of the favorites section with improved spacing.
    • Added a new layout class for better organization of favorite folders.
  • Refactor
    • Streamlined navigation by removing the legacy sidebar favorites section.

@Anishali2 Anishali2 linked an issue Mar 11, 2025 that may be closed by this pull request
@Anishali2 Anishali2 self-assigned this Mar 11, 2025
Copy link

coderabbitai bot commented Mar 11, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request introduces a new "starred" route and a corresponding StarredPage component to access starred items. Additionally, the sidebar has been modified to disable the favorite folders section, with related code commented out. The folder item styling now explicitly sets a height of 58px via both SCSS and an inline style. The menu configuration has been updated to direct the favorite folders item to the new starred route, and a new SCSS class has been added to enhance the layout on the images page.

Changes

File(s) Change Summary
apps/portal/components/_routes.ts Added new route: starred: '/starred' in the route configuration.
apps/portal/components/containers/dashboardLayout/Sidebar/Sidebar.tsx Removed useCallback import and the FavFoldersSidebarSection component from imports; commented out rendering logic for favorite folders; modified the isActive function to only exclude 'back'.
apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.module.scss
apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.tsx
Set fixed height of 58px: added height: 58px to .mainWrapper in SCSS and applied an inline style of height on the FolderItem component.
apps/portal/misc/menuItems.tsx Updated the route property for the menu item of type 'favFolders' to use the new starred route via preRoutes.media and panelRoutes.starred.
apps/portal/pages/media/starred.tsx Introduced new StarredPage component with authentication check, data fetching via Redux actions, loading state management, and conditional rendering of favorite folders.
apps/portal/pagesScss/media/Images.module.scss Added a new CSS class .foldersFavourites with flex layout, wrapping, gap of 18px, and left margin of 32px.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Router
    participant StarredPage
    participant Cookies
    participant ReduxStore

    User->>Router: Navigate to '/starred'
    Router->>StarredPage: Render StarredPage component
    StarredPage->>Cookies: Retrieve authentication token
    alt Token Missing
        StarredPage->>Router: Redirect to '/login'
    else Token Valid
        StarredPage->>ReduxStore: Dispatch action to show folders
        StarredPage->>ReduxStore: Fetch explorer data if not loaded
        ReduxStore-->>StarredPage: Return data and folder order
        StarredPage->>User: Display favorite folders (or message if empty)
    end
Loading

Poem

Oh, what fun, the routes now gleam,
A starred path shines like a dream.
The sidebar rests, its favorites hid,
While folder heights are neatly bid.
With a hop and a skip, the changes cheer,
CodeRabbit bounces with delight right here!
(_/)(^.^)(_/)


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -146,12 +145,12 @@ const Sidebar: FC<IProps> = ({ isProfilePage, isWorkspaceSettingsPage }) => {
)}

<div>
<div ref={favFoldersRef}>
{/* <div ref={favFoldersRef}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed that component that shows on click and replace with route

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.module.scss (1)

18-18: Missing semicolon in CSS property

The height property is missing a semicolon at the end, which is inconsistent with the coding style used throughout the rest of the file.

-  height:58px
+  height: 58px;
apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.tsx (1)

360-360: Redundant styling in both CSS and inline styles

The height of 58px is defined both in the CSS module (FolderItem.module.scss) and as an inline style here, creating redundancy. This can lead to confusion about which style takes precedence and makes maintenance more difficult.

Choose one approach consistently:

- style={{ height: '58px' }}
+ className={styles.mainWrapper}

And keep the height definition only in the CSS module.

apps/portal/pagesScss/media/Images.module.scss (1)

51-56: New foldersFavourites class needs formatting fixes

The new class has proper flexbox layout properties, but there are some formatting issues:

  1. Missing semicolon after the last property
  2. Inconsistent spacing around the colon in property declarations
  .foldersFavourites{
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
-    margin-left: 32px
+    margin-left: 32px;
  }
apps/portal/components/containers/dashboardLayout/Sidebar/Sidebar.tsx (1)

147-153: Transitioned from sidebar section to dedicated page.

The FavFoldersSidebarSection has been commented out as the functionality has been moved to a dedicated "Starred" page. Consider removing this commented code if the new implementation is confirmed to be working correctly.

-            {/* <div ref={favFoldersRef}>
-              <FavFoldersSidebarSection
-                visible={showFavoriteFolders}
-                setVisible={setShowFavoriteFolders}
-              />
-            </div>*/}
apps/portal/pages/media/starred.tsx (1)

121-137: Add explicit height to the folder item for consistent UI.

The component appears to be missing an explicit height for folder items, which could lead to inconsistent UI display. Based on the PR description about UI updates, consider adding a consistent height to the folder items.

  <div className="tw-h-[calc(100vh-206px)] tw-overflow-y-auto">
-   <div className={styles.foldersFavourites} id="scrollableDiv">
+   <div className={`${styles.foldersFavourites} tw-h-58px`} id="scrollableDiv" style={{ height: '58px' }}>
      {folderData
        .filter((v) => isFavorite(v))
        .map((folder: IDbFolderData) => (
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b0d31b and fe6fd0c.

📒 Files selected for processing (7)
  • apps/portal/components/_routes.ts (1 hunks)
  • apps/portal/components/containers/dashboardLayout/Sidebar/Sidebar.tsx (4 hunks)
  • apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.module.scss (1 hunks)
  • apps/portal/components/pagesComponents/_imagesScreen/components/folderItem/FolderItem.tsx (1 hunks)
  • apps/portal/misc/menuItems.tsx (1 hunks)
  • apps/portal/pages/media/starred.tsx (1 hunks)
  • apps/portal/pagesScss/media/Images.module.scss (1 hunks)
🔇 Additional comments (8)
apps/portal/components/_routes.ts (1)

25-25: LGTM: New route for starred items added correctly

The new starred route is properly integrated within the panelRoutes object, following the established pattern. This addition supports the new UI feature for accessing starred items.

apps/portal/misc/menuItems.tsx (1)

49-49: Route properly updated for the 'favFolders' menu item.

The route for the "Starred" menu item is now correctly pointing to the new starred route instead of an empty string. This change enables proper navigation when the user clicks on this menu item.

apps/portal/components/containers/dashboardLayout/Sidebar/Sidebar.tsx (3)

1-1: Removed unused import.

The useCallback import has been removed as it's no longer needed after the favorite folders functionality changes.


83-83: Simplified isActive condition.

The isActive function now only excludes the 'back' item type, allowing the 'favFolders' item to be active when its route matches the current path.


112-114: Enabled proper navigation for favFolders.

Commenting out this special case ensures that the 'favFolders' menu item is now wrapped in a <Link> component like other menu items, enabling proper navigation.

apps/portal/pages/media/starred.tsx (3)

58-58: Incomplete implementation noted by TODO comment.

There's a commented out line with a TODO comment. Consider implementing the explorer data listener or removing this comment if it's no longer applicable.


126-134: Empty callback functions in FolderItem.

The onClick and onDrop props are set to empty functions. Consider implementing actual functionality or document why these are intentionally no-ops.

  <FolderItem
    key={folder.id}
    folder={folder}
-   onClick={() => void 0}
+   onClick={() => {/* TODO: Implement folder click behavior */}}
-   onDrop={() => void 0}
+   onDrop={() => {/* TODO: Implement folder drop behavior */}}
    setLoading={(loadingState) => setLoading(loadingState)}
    isFavorite={true}
    canEdit={false}
  />

1-163: Well-implemented StarredPage component.

The overall structure of the StarredPage component is well-designed. It fetches necessary data, handles authentication, and provides appropriate UI for displaying favorite folders with a good empty state handling.

Anishali2 and others added 2 commits March 12, 2025 05:15
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Anishali2
Copy link
Collaborator Author

Sir @evereq Please verify this if this looks good let me know I'll fix this on extension also but first I need your approval

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
apps/portal/pages/media/starred.tsx (1)

123-124: ⚠️ Potential issue

Potential null or undefined values in isFavorite invocation.

When filtering folders with isFavorite, the function might return undefined instead of a boolean as identified in a previous comment. This could lead to unexpected filtering behavior.

  {Array.isArray(folderData) &&
-  folderData.filter((v) => isFavorite(v)).length ? (
+  folderData.filter((v) => !!isFavorite(v)).length ? (

This is a temporary fix while you also fix the isFavorite function itself as mentioned in the earlier comment.

🧹 Nitpick comments (5)
apps/portal/pages/media/starred.tsx (5)

58-58: Remove or implement commented code.

There's a commented code line with a TODO that might need to be addressed before merging this PR. Either implement the functionality, remove the comment, or add a more detailed explanation about what needs to be fixed.


127-128: Repeated filtering logic.

The same filtering logic is applied twice - once to check if there are any favorite folders and again when rendering them. This is inefficient.

- {folderData
-   .filter((v) => isFavorite(v))
-   .map((folder: IDbFolderData) => (
+ {folderData.filter((v) => !!isFavorite(v)).map((folder: IDbFolderData) => (

Consider storing the filtered results in a variable to avoid duplicate processing:

const favoriteFolderItems = folderData.filter((v) => !!isFavorite(v));

// Then in your JSX:
{Array.isArray(folderData) && favoriteFolderItems.length ? (
  // ...
  {favoriteFolderItems.map((folder: IDbFolderData) => (
    // ...
  ))}

132-133: Empty click and drop handlers.

The onClick and onDrop handlers are set to () => void 0, which effectively does nothing. If these handlers are intentionally meant to be no-ops, consider adding a comment explaining why or remove them if they're not needed.

- onClick={() => void 0}
- onDrop={() => void 0}
+ // No action needed when clicking or dropping on favorite folders
+ onClick={() => {}}
+ onDrop={() => {}}

151-151: Inconsistent spelling of "Favourite".

The word "Favourite" is used here, but "Favorite" is used elsewhere in the component (line 114). Choose one spelling consistently throughout the application.

- No Favourite Folders found{' '}
+ No Favorite Folders found{' '}

124-124: Hard-coded height calculations.

The component uses hard-coded height calculations in Tailwind classes (tw-h-[calc(100vh-206px)]). This might not be responsive on all screen sizes.

Consider using a more flexible layout approach or ensuring these values adjust for different screen sizes.

Also applies to: 142-142

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe6fd0c and def594d.

📒 Files selected for processing (1)
  • apps/portal/pages/media/starred.tsx (1 hunks)
🔇 Additional comments (1)
apps/portal/pages/media/starred.tsx (1)

88-97: Incomplete boolean return in isFavorite function.

The isFavorite function doesn't return a boolean when favoriteFolders?.images is falsy.

  const isFavorite = useCallback(
    (folder: IDbFolderData) => {
      if (favoriteFolders?.images) {
        return parseCollectionToArray(favoriteFolders.images).some(
          (x) => x.id === folder.id,
        );
      }
+     return false;
    },
    [favoriteFolders],
  );

@@ -81,7 +80,7 @@ const Sidebar: FC<IProps> = ({ isProfilePage, isWorkspaceSettingsPage }) => {
};

const isActive = (item: IMainMenuItem) => {
if (item.type === 'favFolders' || item.type === 'back') return false;
if (item.type === 'back') return false;
Copy link
Member

Choose a reason for hiding this comment

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

@Anishali2 why you removed item.type === 'favFolders' ??

@evereq
Copy link
Member

evereq commented Mar 15, 2025

@Anishali2 screenshots "before" and "after" completely does not make any sense as they show totally different states / data etc. I also can't get sense of code changes, sorry... Please explain everything you do in this PR better and show how it was worked before and how it will work after your changes. Also, that feature seems called "Favorite Folders" (or just "Favorites"), but you used term "starred", not good

@evereq evereq marked this pull request as draft March 15, 2025 16:56
@evereq evereq requested a review from paradoxe35 March 15, 2025 16:56
Anishali2 and others added 2 commits March 17, 2025 03:06
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Anishali2
Copy link
Collaborator Author

Brother @paradoxe35 can you please review this PR first and approve first.
I've fixed all those issues which is mentioned by Sir

image

@paradoxe35
Copy link
Contributor

Brother @paradoxe35 can you please review this PR first and approve first.
I've fixed all those issues which is mentioned by Sir

image

Sure @Anishali2

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.

[Fix/UI]: Change ui of started folders
3 participants