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

Apply workspace page design from Figma #418

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

devleejb
Copy link
Member

@devleejb devleejb commented Nov 30, 2024

What this PR does / why we need it:

image
  • Apply workspace page design from Figma
  • Apply font (Pretandard)

Which issue(s) this PR fixes:

Fixes #375

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced the Pretendard font for a refreshed typography experience across the application.
    • Added a sticky header with a new note creation button and a tabbed interface in the workspace layout.
  • Bug Fixes

    • Improved layout responsiveness and alignment in various components.
  • Style

    • Updated document card display and date formatting for consistency.
    • Adjusted global CSS for better font handling and scrolling behavior.
  • Chores

    • Removed unused font imports to streamline the application.

@devleejb devleejb self-assigned this Nov 30, 2024
@devleejb devleejb linked an issue Nov 30, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Nov 30, 2024

Walkthrough

The pull request introduces several changes to the frontend of the application, primarily focusing on typography and layout enhancements. A new external stylesheet for the Pretendard font is added, and the font family settings are updated across various components. The DocumentCard component is restructured for improved navigation and presentation, while the WorkspaceLayout and WorkspaceIndex components undergo layout adjustments for better responsiveness. Overall, these modifications aim to enhance the visual consistency and usability of the application.

Changes

File Change Summary
frontend/index.html Added a link element for the Pretendard font stylesheet in the <head> section.
frontend/src/App.tsx Updated fontFamily in typography to include "Pretendard Variable" and removed Roboto font imports.
frontend/src/components/cards/DocumentCard.tsx Replaced Card with Link wrapping a Paper component, updated date formatting, and reorganized imports.
frontend/src/components/layouts/WorkspaceLayout.tsx Changed layout from Box to Stack, adjusted padding and width properties, and added a new wrapping Box.
frontend/src/index.css Added a global font-family rule prioritizing "Pretendard Variable" and commented out overflow: hidden; in body.
frontend/src/pages/workspace/Index.tsx Updated layout to include a sticky header with Tabs, replaced Grid with Grid2, and added a Paper component.
frontend/src/pages/workspace/member/Index.tsx Added py={6} to Stack for improved vertical padding.

Assessment against linked issues

Objective Addressed Explanation
Apply Document Card design from Figma (#375)

Possibly related issues

Possibly related PRs

Poem

🐇 In the meadow where fonts take flight,
A new style dances, oh what a sight!
Pretendard whispers in the breeze,
Enhancing our cards with elegant ease.
With each click and scroll, joy will abound,
In this vibrant world, beauty is found! 🌼

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/src/App.tsx

Oops! Something went wrong! :(

ESLint: 9.12.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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.

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (11)
frontend/src/components/layouts/WorkspaceLayout.tsx (2)

23-34: LGTM! Consider enhancing responsive padding

The new layout structure using Stack components and maxWidth constraints is well-organized. The centered content with a maximum width of 1440px follows good desktop design practices.

Consider using theme breakpoints for responsive padding:

-				<Box flexGrow={1} maxWidth="100%" px={2}>
+				<Box
+					flexGrow={1}
+					maxWidth="100%"
+					px={{
+						xs: 2,
+						sm: 3,
+						md: 4
+					}}
+				>

29-31: Document the maxWidth constant

Consider adding a comment explaining why 1440px was chosen as the maximum width constraint. This helps maintain design consistency when other developers need to create similar layouts.

+					{/* Maximum content width as per Figma design specifications */}
					<Box mx="auto" maxWidth={1440} width="100%">
frontend/index.html (2)

9-14: LGTM! Consider adding preconnect for better performance.

The font stylesheet integration looks good with proper security attributes. However, to optimize performance, consider adding a preconnect hint for the CDN domain.

Add this before the font stylesheet:

+		<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
 		<link
 			rel="stylesheet"
 			as="style"
 			crossorigin
 			href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"
 		/>

9-14: Consider adding a font loading strategy to prevent FOUT.

To prevent Flash of Unstyled Text (FOUT) and ensure a smooth font loading experience, consider implementing a font loading strategy.

Add this to manage font loading:

+		<script>
+			// Font loading strategy
+			if ("fonts" in document) {
+				// Optimization: Add a class when the font is loaded
+				document.fonts.ready.then(function () {
+					document.documentElement.classList.add('fonts-loaded');
+				});
+			}
+		</script>
 		<link
 			rel="stylesheet"
 			as="style"
 			crossorigin
 			href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css"
 		/>

Then in your CSS, you can handle the font loading state:

/* Add to your CSS */
body {
  font-family: system-ui, -apple-system, sans-serif; /* System font fallback */
}

.fonts-loaded body {
  font-family: "Pretendard Variable", "Pretendard", system-ui, -apple-system, sans-serif;
}
frontend/src/components/cards/DocumentCard.tsx (2)

1-5: Consider organizing imports for future implementation

While the current imports are clean, there are several commented-out components (IconButton, MoreVertIcon, Chip, AvatarGroup, Avatar) that will need to be imported when the TODOs are implemented. Consider adding these imports but commenting them out to make future implementation easier.

 import { Paper, Stack, Typography } from "@mui/material";
 import { Link, useParams } from "react-router-dom";
 import { Document } from "../../hooks/api/types/document.d";
 import moment from "moment";
 import AccessTimeIcon from "@mui/icons-material/AccessTime";
+// TODO: Uncomment when implementing related features
+// import { IconButton, Chip, Avatar, AvatarGroup } from "@mui/material";
+// import MoreVertIcon from "@mui/icons-material/MoreVert";

34-37: Enhance TODO comments with issue references

The TODO comments are clear but would benefit from being linked to specific issues for better tracking. Consider creating issues for:

  1. Document deletion feature
  2. Tag system implementation
  3. Yorkie presence integration
-{/* TODO(devleejb): When the document deletion is implemented, uncomment the following code */}
+{/* TODO(devleejb): When the document deletion is implemented (issue #XXX), uncomment the following code */}

Also applies to: 64-84

frontend/src/App.tsx (1)

66-66: Consider adding font loading status check.

To prevent layout shifts and ensure optimal user experience, consider adding a font loading check using the FontFace API.

Here's a suggested implementation to add in your component:

useEffect(() => {
  document.fonts.ready.then(() => {
    // Font is loaded and ready
    // You can set a state here to trigger a re-render or update loading status
  }).catch((error) => {
    console.error('Font loading failed:', error);
    // Handle the error appropriately
  });
}, []);
frontend/src/pages/workspace/Index.tsx (4)

74-76: Consider making the sticky positioning more maintainable

The hardcoded top: 64 value assumes a fixed header height. Consider using a CSS variable or theme value for better maintainability.

-					top: 64,
+					top: 'var(--header-height)',

89-96: Add accessibility attributes to the New Note button

Consider adding an aria-label to improve accessibility for screen readers.

 					<Button
 						variant="contained"
 						startIcon={<AddIcon />}
 						onClick={handleCreateDocumentModalOpen}
+						aria-label="Create new note"
 					>
 						New Note
 					</Button>

110-112: Consider improving loader visibility

The current loader positioning might not be obvious to users. Consider adding margin and a loading message for better user experience.

-					<Stack className="loader" key={0} alignItems="center">
+					<Stack className="loader" key={0} alignItems="center" my={4}>
 						<CircularProgress size={20} />
+						<Typography variant="body2" color="text.secondary" mt={1}>
+							Loading more documents...
+						</Typography>
 					</Stack>

70-128: Consider implementing an error boundary

While the component handles loading states, it might benefit from proper error handling using React Error Boundaries to gracefully handle runtime errors.

Would you like me to provide an example implementation of an Error Boundary component?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between dadb024 and 9760f0d.

📒 Files selected for processing (7)
  • frontend/index.html (1 hunks)
  • frontend/src/App.tsx (1 hunks)
  • frontend/src/components/cards/DocumentCard.tsx (2 hunks)
  • frontend/src/components/layouts/WorkspaceLayout.tsx (1 hunks)
  • frontend/src/index.css (1 hunks)
  • frontend/src/pages/workspace/Index.tsx (2 hunks)
  • frontend/src/pages/workspace/member/Index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • frontend/src/pages/workspace/member/Index.tsx
  • frontend/src/index.css
🔇 Additional comments (6)
frontend/src/components/cards/DocumentCard.tsx (4)

16-21: LGTM! Clean navigation implementation

The switch to using Link component instead of click handlers is a good improvement for accessibility and semantic HTML.


22-28: Verify padding values against Figma design

The Paper component styling looks good, but let's ensure the padding values (px: 3, py: 2) match exactly with the Figma specifications from issue #375.


42-51: Review fixed height constraint on tags container

The Stack component has a fixed height of 56px which might cause issues if there are multiple rows of tags. Consider using min-height or max-height instead to handle varying content better.

-<Stack direction="row" mt={1} gap={1} flexWrap="wrap" height={56}>
+<Stack direction="row" mt={1} gap={1} flexWrap="wrap" minHeight={56}>

29-33: LGTM! Consistent date formatting

The switch to "D MMM YYYY" format for both creation and update times improves consistency across the UI.

Also applies to: 52-63

frontend/src/App.tsx (1)

66-66: LGTM! Verify font loading configuration.

The font family configuration is well-structured with appropriate fallbacks for different operating systems and proper internationalization support.

Let's verify the font configuration:

✅ Verification successful

Font configuration is properly set up

The Pretendard font is correctly configured:

  • CDN import via pretendard.min.css in index.html
  • Font family fallback chain properly defined in both index.css and theme configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check font loading configuration
# Expected: Find font import in index.html or CSS files

# Search for Pretendard font configuration
echo "Checking for font configuration..."
rg -l "Pretendard" --type html --type css

# Search for @font-face or import statements
echo "Checking for font loading methods..."
rg "@(font-face|import.*Pretendard)" --type html --type css

Length of output: 288


Script:

#!/bin/bash
# Let's check the content of index.css to see how Pretendard is configured
echo "Content of frontend/src/index.css:"
cat frontend/src/index.css

# Also search for any CDN or font imports in HTML files
echo -e "\nChecking for CDN imports in HTML files:"
rg "link.*rel=.*stylesheet.*Pretendard|script.*src.*Pretendard" --type html

Length of output: 757


Script:

#!/bin/bash
# Let's check the HTML file for any font preloading or stylesheet imports
echo "Checking index.html content:"
cat frontend/public/index.html || cat frontend/index.html

# Also check for any font imports in other CSS files
echo -e "\nChecking for font imports in all CSS files:"
fd -e css -x grep -l "Pretendard"

Length of output: 2171

frontend/src/pages/workspace/Index.tsx (1)

26-29: Consider removing or implementing the commented "TABLE" tab

The commented "TABLE" tab suggests an incomplete feature. Either implement the table view functionality or remove the commented code to maintain clean production code.

frontend/src/pages/workspace/Index.tsx Show resolved Hide resolved
@devleejb devleejb merged commit 78b204b into main Nov 30, 2024
2 checks passed
@devleejb devleejb deleted the 375-apply-document-card-design-from-figma branch November 30, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Apply Document Card design from Figma
1 participant