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

website: Research Page implementations #2380

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Conversation

OchiengPaul442
Copy link
Contributor

@OchiengPaul442 OchiengPaul442 commented Jan 16, 2025

Summary of Changes (What does this PR do?)

  • Adjusted the UI and updated the content on the page

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done

Screenshots (optional)

image

Summary by CodeRabbit

  • New Features

    • Introduced CardWrapper component for improved layout and styling across multiple pages
    • Added new sections to Research page:
      • Data Access Section
      • Fellowship Section
      • Platform Integration Section
  • Refactor

    • Restructured Research page layout
    • Modularized page components for better organization
    • Simplified page descriptions and content management
  • Style

    • Enhanced visual presentation with new component wrappers
    • Adjusted spacing and background colors
    • Implemented responsive design elements

Copy link

coderabbitai bot commented Jan 16, 2025

Warning

Rate limit exceeded

@OchiengPaul442 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd7563 and cb010a4.

📒 Files selected for processing (2)
  • website2/src/views/solutions/research/ResearchPage.tsx (2 hunks)
  • website2/src/views/solutions/research/data-access.tsx (1 hunks)
📝 Walkthrough

Walkthrough

The pull request introduces a new CardWrapper React component in the website2/src/components/sections/solutions directory. This component provides a flexible, reusable wrapper for content sections across different pages of the website. The implementation is then applied to multiple pages including AfricanCities, Communities, and Research pages, demonstrating a consistent approach to layout and styling. The changes involve restructuring existing sections to utilize the new CardWrapper, enhancing the modularity and visual consistency of the website's design.

Changes

File Change Summary
website2/src/components/sections/solutions/CardWrapper.tsx New React functional component created with flexible props and styling
website2/src/views/solutions/AfricanCities/AfricanCityPage.tsx Integrated CardWrapper for publications section
website2/src/views/solutions/communities/CommunityPage.tsx Wrapped quote section with CardWrapper
website2/src/views/solutions/research/ResearchPage.tsx Significant restructuring with new sections and CardWrapper integration
website2/src/views/solutions/research/data-access.tsx New DataAccessSection component added
website2/src/views/solutions/research/fellowship-section.tsx New FellowshipSection component introduced
website2/src/views/solutions/research/platform-integration.tsx New PlatformIntegration component created

Possibly related PRs

Suggested Reviewers

  • Baalmart
  • Codebmk

Poem

Wrapper of cards, sleek and bright,
Bringing structure with gentle might.
Components dance in harmony's flow,
Modularity begins to grow 🎨
A digital canvas, clean and light!


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 or @coderabbitai title 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

@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 (8)
website2/src/components/sections/solutions/CardWrapper.tsx (1)

15-21: Consider adding size variants and color scheme props.

The component could be more flexible with props for different sizes and color schemes, making it more reusable across different contexts.

 interface CardWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
   children: React.ReactNode;
+  size?: 'sm' | 'md' | 'lg';
+  colorScheme?: 'green' | 'white' | 'gray';
 }
website2/src/views/solutions/research/platform-integration.tsx (1)

95-97: Consider using responsive image dimensions.

Fixed width/height values might not scale well across different screen sizes. Consider using relative units or aspect ratio containers.

-  width={800}
-  height={600}
+  fill
+  sizes="(max-width: 768px) 100vw, 50vw"
website2/src/views/solutions/research/fellowship-section.tsx (1)

18-40: Consider creating a shared animations configuration.

Animation configurations are duplicated across multiple components. Consider extracting them into a shared utility.

Create a new file src/utils/animations.ts:

export const fadeInUpContainer = {
  hidden: { opacity: 0, y: 50 },
  visible: {
    opacity: 1,
    y: 0,
    transition: {
      duration: 0.5,
      staggerChildren: 0.1,
    },
  },
};

export const fadeInUpItem = {
  hidden: { opacity: 0, y: 20 },
  visible: {
    opacity: 1,
    y: 0,
    transition: {
      duration: 0.5,
    },
  },
};
website2/src/views/solutions/research/data-access.tsx (1)

30-39: Move content to a separate data file.

Consider moving the content object to a separate data file for better maintainability and potential internationalization.

Create a new file src/data/research-content.ts:

export const dataAccessContent = {
  images: {
    blob: '...',
    consultation: [...],
  },
  text: {
    title: 'Automating data access for reference grade monitors',
    paragraphs: [...],
  },
};
website2/src/views/solutions/AfricanCities/AfricanCityPage.tsx (1)

154-185: Consider extracting the publication URL to a constant.

The implementation looks clean, but the hardcoded URL in the onClick handler could be moved to a constants file for better maintainability.

+const PUBLICATION_URLS = {
+  SEEING_AIR_DETAIL: 'https://www.sciencedirect.com/science/article/pii/S2352340922007065?via%3Dihub'
+};

 <CustomButton
   onClick={() =>
     window.open(
-      'https://www.sciencedirect.com/science/article/pii/S2352340922007065?via%3Dihub',
+      PUBLICATION_URLS.SEEING_AIR_DETAIL,
       '_blank',
     )
   }
website2/src/views/solutions/research/ResearchPage.tsx (1)

120-123: Consider adding tooltips for technical terms.

The description includes technical terms like "IoT" and "temporal and spatial modeling" that might benefit from brief explanations via tooltips for non-technical users.

website2/src/views/solutions/communities/CommunityPage.tsx (2)

285-303: Clean implementation of the quote section!

Good use of semantic HTML with blockquote. Consider extracting the quote content to a constants file for easier content management.

+const QUOTES = {
+  MICHAEL_WANYAMA: {
+    text: "We advocate for road safety and environmental protection...",
+    author: "Michael Wanyama",
+    role: "Team Lead on AutoSafety"
+  }
+};

Line range hint 32-324: Consider breaking down the component into smaller, reusable sections.

The component is well-structured but quite large. Consider extracting sections like AirQommunity Champions and Access to Information into separate components for better maintainability and reusability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7485e58 and 290362e.

📒 Files selected for processing (7)
  • website2/src/components/sections/solutions/CardWrapper.tsx (1 hunks)
  • website2/src/views/solutions/AfricanCities/AfricanCityPage.tsx (2 hunks)
  • website2/src/views/solutions/communities/CommunityPage.tsx (2 hunks)
  • website2/src/views/solutions/research/ResearchPage.tsx (3 hunks)
  • website2/src/views/solutions/research/data-access.tsx (1 hunks)
  • website2/src/views/solutions/research/fellowship-section.tsx (1 hunks)
  • website2/src/views/solutions/research/platform-integration.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-push-website2-deploy-preview
🔇 Additional comments (5)
website2/src/components/sections/solutions/CardWrapper.tsx (1)

5-7: Props interface looks good!

Clean and well-typed interface extending HTMLDivElement props.

website2/src/views/solutions/research/data-access.tsx (1)

129-140: Review blob overlay positioning.

The absolute positioning of the blob overlay might cause layout issues on certain screen sizes. Consider using a more robust positioning strategy.

✅ Verification successful

The blob overlay positioning follows established patterns.

The current implementation aligns with the codebase's conventions for decorative elements, using proper z-indexing and responsive constraints. The absolute positioning with breakpoint-specific adjustments is a deliberate and controlled approach.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potential layout issues in other components using absolute positioning
rg -l "absolute.*top-\[.*\].*left-\[.*\]" --type tsx

Length of output: 82


Script:

#!/bin/bash
# Search for absolute positioning patterns in tsx and jsx files
rg -l "className=\"[^\"]*absolute.*?top-" --type-add 'tsx:*.{tsx,jsx}' --type tsx

# Look for similar responsive layout patterns with lg breakpoints
rg "className=\"[^\"]*lg:(top|left)-\[" --type-add 'tsx:*.{tsx,jsx}' --type tsx

# Check for blob-related components and images
fd -e tsx -e jsx -e ts -e js | xargs rg -l "blob"

Length of output: 6517

website2/src/views/solutions/AfricanCities/AfricanCityPage.tsx (1)

6-6: Clean import addition!

The CardWrapper import follows React conventions and maintains proper code organization.

website2/src/views/solutions/research/ResearchPage.tsx (2)

8-15: Well-organized component imports!

Clean separation of concerns with modular section components improves maintainability.


190-221: Extract the publication URL to a constant.

Similar to AfricanCityPage, consider moving the hardcoded URL to a constants file.

<motion.div className="lg:w-1/2 relative" variants={animations.image}>
<div className="relative aspect-[4/3] rounded-2xl overflow-hidden">
<Image
src="https://res.cloudinary.com/dbibjvyhm/image/upload/v1737012325/website/photos/Solutions/unnamed_v5i87v.png"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Move image URL to a constants file.

Hardcoded URLs should be maintained in a centralized constants file for better maintainability.

<Button
onClick={() => {
window.open(
'https://docs.google.com/forms/d/e/1FAIpQLSfCP91gYXNAdpQ4kStJH7ZnFdXpiRElJuOttZkS7SQhmsESaQ/viewform',
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Move Google Forms URL to environment variables.

External URLs should be configured through environment variables for better maintainability and environment-specific configurations.

+ // In your environment file (.env)
+ NEXT_PUBLIC_FELLOWSHIP_FORM_URL=https://docs.google.com/forms/d/...

+ // In the component
+ const formUrl = process.env.NEXT_PUBLIC_FELLOWSHIP_FORM_URL;

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +66 to +73
<a
href="https://documents-dds-ny.un.org/doc/UNDOC/GEN/K18/002/22/PDF/K1800222.pdf?OpenElement"
target="_blank"
rel="noopener noreferrer"
className="underline text-blue-600"
>
UN resolution UNEA Res 3/8
</a>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add security attributes to external link.

The UN document link should have additional security attributes to prevent potential security vulnerabilities.

 <a
   href="https://documents-dds-ny.un.org/doc/UNDOC/GEN/K18/002/22/PDF/K1800222.pdf?OpenElement"
   target="_blank"
   rel="noopener noreferrer"
+  referrerPolicy="no-referrer"
+  rel="noopener noreferrer nofollow"
   className="underline text-blue-600"
 >

Committable suggestion skipped: line range outside the PR's diff.

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

🧹 Nitpick comments (1)
website2/src/views/solutions/research/ResearchPage.tsx (1)

133-175: Add TypeScript types for better code maintainability.

While the benefits section implementation is solid, it could benefit from proper TypeScript types.

Consider adding these type definitions:

type Benefit = {
  title: string;
  description: string;
  icon: LucideIcon;
  color: string;
};

type MotionSectionProps = {
  className?: string;
  children: React.ReactNode;
} & HTMLMotionProps<"section">;

Also, consider extracting the benefits section into a separate component for better maintainability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 290362e and 2cd7563.

📒 Files selected for processing (2)
  • website2/src/views/solutions/research/ResearchPage.tsx (3 hunks)
  • website2/src/views/solutions/research/fellowship-section.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • website2/src/views/solutions/research/fellowship-section.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-push-website2-deploy-preview
🔇 Additional comments (3)
website2/src/views/solutions/research/ResearchPage.tsx (3)

105-105: Content updates enhance technical clarity.

The simplified hero description and the addition of specific technical approaches (IoT, AI, ML, spatial modeling) provide better context for the research focus.

Also applies to: 120-123


8-8: Nice modular approach with component separation! 👍

Breaking down the sections into separate components improves maintainability and reusability.

Let's verify the component structure:

Also applies to: 13-15

✅ Verification successful

Component structure verified and follows best practices ✨

All imported components exist and follow a clean organizational pattern:

  • Shared components in components/sections/solutions/
  • Page-specific components co-located with the page
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the imported components exist and follow similar patterns
fd -e tsx -e ts "data-access|fellowship-section|platform-integration|CardWrapper" website2/src/

Length of output: 334


Line range hint 1-246: Verify animation performance impact.

The extensive use of Framer Motion animations throughout the page might affect performance on lower-end devices.

Let's check for similar animation patterns in other pages:

Consider adding a prefers-reduced-motion media query check for better accessibility.

Comment on lines +184 to +222
<motion.section
initial="hidden"
whileInView="visible"
viewport={{ once: true, amount: 0.2 }}
variants={animations.container}
>
<CardWrapper>
<motion.div className="space-y-4" variants={animations.item}>
<h4 className="text-[#0CE87E] uppercase text-[20px]">
Publications
</h4>
<h2 className="text-3xl lg:text-[40px] leading-[48px]">
Managing the Environment for Climate Resilient Livelihoods and
Sustainable Economic Development.
</h2>
<div className="space-y-2">
<p className="text-lg text-gray-700">
<span className="font-semibold">Created by </span>
<span>National Environment Management Authority(NEMA)</span>
</p>
<p className="text-lg text-gray-700">
<span className="font-semibold">Supported by </span>
<span>AirQo and Makerere University</span>
</p>
</div>
<CustomButton
onClick={() => {
window.open(
'https://www.nema.go.ug/sites/default/files/NSOER%202018-2019.pdf',
'_blank',
);
}}
className="flex items-center bg-transparent text-black justify-center w-full max-w-[200px] border border-black px-4 py-3 bg-none mt-4"
>
Read Report &rarr;
</CustomButton>
</motion.div>
</CardWrapper>
</motion.section>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider externalizing configuration and adding error handling.

The publications section could be improved in several ways:

  1. Move the publication details to a configuration file
  2. Add error handling for the external link
  3. Consider accessibility improvements for the external link

Here's a suggested improvement:

const PUBLICATIONS = {
  title: "Managing the Environment for Climate Resilient Livelihoods...",
  creator: "National Environment Management Authority(NEMA)",
  supporters: ["AirQo", "Makerere University"],
  reportUrl: "https://www.nema.go.ug/sites/default/files/NSOER%202018-2019.pdf"
};

const handleReportClick = () => {
  try {
    window.open(PUBLICATIONS.reportUrl, '_blank', 'noopener,noreferrer');
  } catch (error) {
    console.error('Failed to open report:', error);
    // Consider adding user feedback for failure
  }
};

Copy link
Contributor

New Website2 changes available for preview here

1 similar comment
Copy link
Contributor

New Website2 changes available for preview here

@Baalmart Baalmart merged commit b6895d9 into staging Jan 16, 2025
31 checks passed
@Baalmart Baalmart deleted the website-research-implemnt branch January 16, 2025 09:15
@Baalmart Baalmart mentioned this pull request Jan 16, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants