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

Update the Codú challenge banner #1145

Merged

Conversation

NiallJoeMaher
Copy link
Contributor

Pull Request details

  • Fix the col layouts so they are consistent on feed and homepage.
  • Remove image that is no longer used

Any Breaking changes

  • Nope

Associated Screenshots

New
New challenge banner with gradient
Old
Old banner that I thought looked poop

* Fix the col layouts so they are consistent on feed and homepage.
* Remove image that is no longer used
@NiallJoeMaher NiallJoeMaher requested a review from a team as a code owner October 17, 2024 22:39
Copy link

vercel bot commented Oct 17, 2024

@NiallJoeMaher is attempting to deploy a commit to the Codú Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Oct 17, 2024

Walkthrough

The changes introduce a new component called CoduChallenge, which replaces existing content in both the ArticlesPage and Home components. The layout adjustments include changes to column spans and gaps in the grid layout. The previous writing challenge image has been removed, and the new component is styled with Tailwind CSS. The CoduChallenge component serves as a promotional section for a writing challenge, featuring a header, description, and a link for more information.

Changes

File Path Change Summary
app/(app)/articles/_client.tsx, Adjusted layout: changed gap from gap-8 to gap-6, modified column spans, removed writing challenge image, added CoduChallenge component.
app/(app)/page.tsx Removed Image component and related content for "Codú writing challenge", added CoduChallenge component, adjusted grid layout gap.
components/CoduChallenge/CoduChallenge.tsx Added new functional component CoduChallenge, styled with Tailwind CSS, exported as default.
e2e/articles.spec.ts Updated tests to reflect changes in expected link visibility, modifying link text in two test cases.

Possibly related PRs

  • Add border radius in tags #1116: This PR modifies the ArticlesPage and Home components in app/(app)/articles/_client.tsx and app/(app)/page.tsx, respectively, by adding rounded corners to elements that are also affected in the main PR, which adjusts layout and styling in these same components.

Suggested labels

hacktoberfest-accepted, hacktoberfest

🐇 In the meadow, bright and bold,
A challenge for stories yet untold.
With CoduChallenge, come take a chance,
Write your tale, join the dance!
Gaps are smaller, the layout's neat,
Hop along, let creativity meet! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 51dd686 and 6cdf90a.

📒 Files selected for processing (2)
  • components/CoduChallenge/CoduChallenge.tsx (1 hunks)
  • e2e/articles.spec.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/CoduChallenge/CoduChallenge.tsx
  • e2e/articles.spec.ts

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

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
codu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2024 8:27pm

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 (2)
components/CoduChallenge/CoduChallenge.tsx (2)

5-19: Enhance accessibility with ARIA attributes.

Consider adding appropriate ARIA attributes to improve accessibility. For example:

- <div className="mb-8 mt-2 overflow-hidden rounded border border-neutral-300 bg-gradient-to-br from-blue-600 to-pink-600 text-white shadow-lg dark:border-neutral-600">
+ <div className="mb-8 mt-2 overflow-hidden rounded border border-neutral-300 bg-gradient-to-br from-blue-600 to-pink-600 text-white shadow-lg dark:border-neutral-600" role="region" aria-labelledby="challenge-title">
-   <h3 className="mb-2 text-2xl font-bold">Ready for a challenge?</h3>
+   <h3 id="challenge-title" className="mb-2 text-2xl font-bold">Ready for a challenge?</h3>

This change adds a role and aria-labelledby to the outer div, and an id to the heading, improving the structure for screen readers.


16-16: Improve link text for better accessibility and SEO.

The current link text "Find out more" is not very descriptive out of context. Consider changing it to something more specific, like "Learn about the 6-week challenge".

- Find out more
+ Learn about the 6-week challenge

This change provides more context about the destination, improving both accessibility for screen reader users and SEO.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 48708f0 and 7db16d9.

⛔ Files ignored due to path filters (1)
  • public/images/announcements/challenge.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (3)
  • app/(app)/articles/_client.tsx (3 hunks)
  • app/(app)/page.tsx (2 hunks)
  • components/CoduChallenge/CoduChallenge.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (11)
components/CoduChallenge/CoduChallenge.tsx (4)

1-1: LGTM: Import statement is correct and necessary.

The import of Link from next/link is appropriate for the component's usage.


23-23: LGTM: Export statement is correct.

The default export of the CoduChallenge component is appropriate and follows common React patterns.


1-23: Overall, well-implemented component with minor suggestions for improvement.

The CoduChallenge component is well-structured and effectively promotes the writing challenge. It uses modern React practices and Tailwind CSS for styling. Consider implementing the suggested accessibility improvements and link text change to enhance user experience and SEO. Great job on creating a visually appealing and functional component!


5-5: Ensure sufficient text contrast for accessibility.

The gradient background (from-blue-600 to-pink-600) with white text might not provide sufficient contrast in all areas. Consider using a contrast checker tool to ensure WCAG compliance.

Run the following command to check for other instances of potentially low-contrast text:

app/(app)/page.tsx (4)

10-10: LGTM: Import changes align with PR objectives.

The addition of the CoduChallenge import and the removal of the Image and challenge.png imports are consistent with the goal of updating the challenge banner. These changes reflect the transition from an image-based banner to a new component-based approach.


49-49: LGTM: Grid gap adjustment improves layout consistency.

The change from gap-8 to gap-6 in the grid layout is a subtle improvement that aligns with the PR objective of enhancing visual consistency. This minor adjustment should provide a more cohesive look to the page layout.


Line range hint 1-73: Summary: Changes successfully implement PR objectives

The modifications in this file effectively achieve the goals outlined in the PR objectives:

  1. The challenge banner has been updated by replacing the old image-based approach with the new CoduChallenge component.
  2. Layout consistency has been improved through the adjustment of the grid gap.
  3. Unused elements (old challenge image) have been removed.

These changes align well with the PR's aim to enhance visual consistency and update the Codú challenge banner. The implementation appears clean and straightforward, with no apparent issues.


54-54: LGTM: CoduChallenge component added as per PR objectives.

The addition of the CoduChallenge component in the sidebar successfully replaces the previous writing challenge section, aligning with the PR objectives. This change should enhance the visual appeal and consistency of the challenge banner.

To ensure the CoduChallenge component is implemented correctly, please run the following verification script:

This script will help verify the proper implementation of the new CoduChallenge component and ensure that all references to the old challenge image have been removed.

✅ Verification successful

Verification Successful: CoduChallenge Component Implemented Correctly

The CoduChallenge component has been successfully added to the sidebar, and no remaining references to the old challenge image (challenge.png) were found. The implementation aligns with the PR objectives and enhances the visual appeal and consistency of the challenge banner.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the CoduChallenge component

# Test 1: Check if the CoduChallenge component file exists
echo "Checking for CoduChallenge component file..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)"

# Test 2: Verify the content of the CoduChallenge component
echo "Checking CoduChallenge component content..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)" --exec cat {}

# Test 3: Check for any remaining references to the old challenge image
echo "Checking for remaining references to the old challenge image..."
rg --type typescript --type tsx "challenge\.png"

Length of output: 1462


Script:

#!/bin/bash
# Description: Verify the implementation of the CoduChallenge component

# Test 1: Check if the CoduChallenge component file exists
echo "Checking for CoduChallenge component file..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)"

# Test 2: Verify the content of the CoduChallenge component
echo "Checking CoduChallenge component content..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)" --exec cat {}

# Test 3: Check for any remaining references to the old challenge image
echo "Checking for remaining references to the old challenge image..."
rg --type ts --type tsx "challenge\.png"

Length of output: 1447


Script:

#!/bin/bash
# Description: Verify the implementation of the CoduChallenge component

# Test 1: Check if the CoduChallenge component file exists
echo "Checking for CoduChallenge component file..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)"

# Test 2: Verify the content of the CoduChallenge component
echo "Checking CoduChallenge component content..."
fd --type f --full-path "components/CoduChallenge/CoduChallenge.(tsx|jsx)" --exec cat {}

# Test 3: Check for any remaining references to the old challenge image
echo "Checking for remaining references to the old challenge image..."
rg "challenge\.png" -g "*.ts" -g "*.tsx"

Length of output: 1419

app/(app)/articles/_client.tsx (3)

15-15: LGTM: New component import added.

The import statement for the new CoduChallenge component is correctly added. This aligns with the PR objective to update the Codú challenge banner.


99-100: LGTM: Grid layout adjustments.

The changes to the grid layout (reduced gap and column span) align with the PR objective to enhance visual consistency. These adjustments seem intentional to accommodate the new CoduChallenge component.

Please verify that these layout changes produce the desired visual outcome across different screen sizes.


Line range hint 1-189: Summary: Changes successfully implement the new CoduChallenge component.

The modifications in this file align well with the PR objectives. The new CoduChallenge component has been imported and integrated into the sidebar, and the layout has been adjusted to accommodate these changes. The updates should enhance the visual consistency of the layout on both the feed and homepage.

Final verifications:

  1. Ensure that the removal of the old challenge image (mentioned in the PR objectives) has been handled correctly, possibly in other files not shown in this review.
  2. Test the page on various screen sizes to confirm that the new layout remains visually appealing and functional across devices.
  3. Verify that the new CoduChallenge component displays the gradient design mentioned in the PR description.

To ensure no unintended changes were made, run the following command:

If this command returns any results, please review those lines to ensure they are intentional and necessary changes.

✅ Verification successful

Verification Successful: No unexpected changes found.

The executed shell script did not detect any modifications outside of the intended "CoduChallenge" integration and layout adjustments. This confirms that the changes align with the PR objectives and no unintended alterations are present.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any unexpected changes in the file

# Test: Look for any changes not related to CoduChallenge or layout adjustments
rg -i -v "CoduChallenge|col-span|gap" app/\(app\)/articles/_client.tsx

Length of output: 6806

Comment on lines +159 to +160
<section className="col-span-5 hidden lg:block">
<CoduChallenge />
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Issue Found: CoduChallenge component lacks responsive design implementation.

The CoduChallenge component is present and styled with gradient backgrounds as intended. However, it does not include responsive classes (e.g., sm:, md:, lg:, xl:), which may cause display issues on different screen sizes.

Please update the component to include responsive design classes to ensure it functions well across all devices.

🔗 Analysis chain

LGTM: CoduChallenge component added to sidebar.

The CoduChallenge component has been successfully added to the sidebar, and the column span has been adjusted accordingly. This change directly implements the new challenge banner as described in the PR objectives.

Please ensure that:

  1. The content of the CoduChallenge component matches the design specifications.
  2. The component is styled correctly and visually appealing.
  3. The component is responsive and displays well on different screen sizes.

You can verify this by running the following commands:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the implementation of the CoduChallenge component

# Test 1: Verify the component file exists
fd -t f "CoduChallenge.tsx" components

# Test 2: Check for proper styling (assuming Tailwind classes are used)
rg -i "className=" components/CoduChallenge/CoduChallenge.tsx

# Test 3: Look for responsive design implementation
rg -i "sm:|md:|lg:|xl:" components/CoduChallenge/CoduChallenge.tsx

# Test 4: Ensure the component includes key elements mentioned in the PR (e.g., gradient design)
rg -i "gradient" components/CoduChallenge/CoduChallenge.tsx

Length of output: 889

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: 0

🧹 Outside diff range and nitpick comments (2)
e2e/articles.spec.ts (2)

15-16: LGTM! Consider adding a test for the new banner text.

The change from "Codú Writing Challenge" to "Find out more" aligns with the PR objectives to update the Codú challenge banner. The test structure remains correct.

Consider adding a test to verify the visibility of the new challenge banner text (e.g., "Codú Writing Challenge") to ensure complete coverage of the updated UI elements.


Line range hint 1-190: Overall, the changes look good and align with the PR objectives.

The updates to the test cases accurately reflect the changes made to the Codú challenge banner. The consistency across both authenticated and unauthenticated user scenarios is commendable.

Consider adding tests for any new UI elements introduced with the updated challenge banner, such as the gradient design mentioned in the PR description, to ensure comprehensive test coverage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7db16d9 and 51dd686.

📒 Files selected for processing (1)
  • e2e/articles.spec.ts (3 hunks)
🧰 Additional context used
🔇 Additional comments (2)
e2e/articles.spec.ts (2)

70-71: LGTM! Consistent change for authenticated users.

The change from "Codú Writing Challenge" to "Find out more" is consistent with the previous change in the unauthenticated test suite. This ensures that the updated banner is correctly displayed for both authenticated and unauthenticated users.


85-86: LGTM! Consistent changes across all test cases.

The change from "Codú Writing Challenge" to "Find out more" is consistent across all test cases, ensuring comprehensive coverage of the updated UI for both authenticated and unauthenticated users.

To ensure complete test coverage, let's verify that all instances of the old text have been updated:

✅ Verification successful

Verified! All instances of "Codú Writing Challenge" have been successfully updated to "Find out more," and the test coverage reflects these changes consistently across all relevant test cases.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining instances of the old text and confirm all new text is present

# Test 1: Search for any remaining instances of the old text
echo "Checking for any remaining 'Codú Writing Challenge' text:"
rg --type typescript '"Codú Writing Challenge"' e2e/

# Test 2: Confirm the presence of the new text in all expected locations
echo "Confirming the presence of 'Find out more' text:"
rg --type typescript '"Find out more"' e2e/

# Test 3: Check for the presence of tests for the new banner text
echo "Checking for tests of the new banner text:"
rg --type typescript 'Codú Writing Challenge' e2e/

Length of output: 597


Script:

#!/bin/bash
# Description: Check for any remaining instances of the old text and confirm all new text is present

# Test 1: Search for any remaining instances of the old text
echo "Checking for any remaining 'Codú Writing Challenge' text:"
rg --type ts '"Codú Writing Challenge"' e2e/

# Test 2: Confirm the presence of 'Find out more' text
echo "Confirming the presence of 'Find out more' text:"
rg --type ts '"Find out more"' e2e/

# Test 3: Check for the presence of tests for the new banner text
echo "Checking for tests of the new banner text:"
rg --type ts '"Find out more"' e2e/

Length of output: 971

Copy link
Contributor

@JohnAllenTech JohnAllenTech left a comment

Choose a reason for hiding this comment

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

The changes I suggested will fix your tests.

image

Tested on your branch locally to confirm

@@ -12,7 +12,7 @@ test.describe("Unauthenticated Articles Page", () => {
).toBeVisible({ visible: !isMobile });

await expect(
page.getByRole("link", { name: '"Codú Writing Challenge" text' }),
page.getByRole("link", { name: '"Find out more" text' }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
page.getByRole("link", { name: '"Find out more" text' }),
page.getByRole("link", { name: "Find out more" }),

@@ -67,7 +67,7 @@ test.describe("Authenticated Articles Page", () => {
).toBeVisible({ visible: !isMobile });

await expect(
page.getByRole("link", { name: '"Codú Writing Challenge" text' }),
page.getByRole("link", { name: '"Find out more" text' }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
page.getByRole("link", { name: '"Find out more" text' }),
page.getByRole("link", { name: "Find out more" }),

@@ -82,7 +82,7 @@ test.describe("Authenticated Articles Page", () => {
).toBeVisible({ visible: !isMobile });

await expect(
page.getByRole("link", { name: '"Codú Writing Challenge" text' }),
page.getByRole("link", { name: '"Find out more" text' }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
page.getByRole("link", { name: '"Find out more" text' }),
page.getByRole("link", { name: "Find out more" }),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Been a while since I touched Playwright and it shows 😂 Going to play with it to make sure I get gud!

@NiallJoeMaher NiallJoeMaher merged commit d32599b into codu-code:develop Oct 18, 2024
6 checks passed
@NiallJoeMaher NiallJoeMaher deleted the feat/new-challenge-design branch October 18, 2024 20:29
@coderabbitai coderabbitai bot mentioned this pull request Nov 13, 2024
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.

2 participants