Skip to content

[416] Added Teams Leaders Table widget#118

Merged
yuramax merged 16 commits into
mainfrom
416-upgrade-leadership-team-widget
May 27, 2025
Merged

[416] Added Teams Leaders Table widget#118
yuramax merged 16 commits into
mainfrom
416-upgrade-leadership-team-widget

Conversation

@Anton-88
Copy link
Copy Markdown
Contributor

Added new Team Leaders table widget

@Anton-88 Anton-88 requested a review from killev as a code owner May 25, 2025 07:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2025

📝 Walkthrough

Walkthrough

A new leadership team widget module, its template, styles, and related configuration are added. The widget displays team members with images, bios, and links, and integrates new SCSS styles and animations. Several existing styles are modified or removed to accommodate the new component. The team-members module updates include simplifying the bio field and making experience and LinkedIn fields required.

Changes

File(s) Change Summary
website/app.js Added 'leadership-team-widget' module to ApostropheCMS configuration.
website/lib/mainWidgets.js Included 'leadership-team' widget in the layout widgets group.
website/modules/leadership-team-widget/index.js Defined a new widget extending '@apostrophecms/widget-type' with fields for intro and team leaders relationship.
website/modules/leadership-team-widget/views/widget.html Added HTML template for rendering the leadership team widget with responsive layout and conditional image display.
website/modules/asset/ui/src/index.scss Imported _leadership-team.scss and _animation.scss stylesheets.
website/modules/asset/ui/src/scss/_carousel.scss Removed .sf-leadership-header style block and related whitespace adjustments.
website/modules/asset/ui/src/scss/_leadership-team.scss Created comprehensive styles for leadership team layout, cards, hover effects, and responsiveness.
website/modules/asset/ui/src/scss/_animation.scss Added fadeSlideIn keyframe animation for fade-in and slide-up effects.
website/modules/team-members/index.js Changed bio field from rich-text area to plain textarea string; made experience and linkedin fields required.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ApostropheCMS
    participant LeadershipTeamWidget
    participant TeamMembers

    User->>ApostropheCMS: Request page with leadership team widget
    ApostropheCMS->>LeadershipTeamWidget: Render widget
    LeadershipTeamWidget->>TeamMembers: Retrieve selected team leader data
    LeadershipTeamWidget-->>ApostropheCMS: Return rendered HTML with team data
    ApostropheCMS-->>User: Serve page with leadership team section
Loading

Suggested reviewers

  • Anton-88
  • IhorMasechko
  • VitalyyP

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e17f55e and 89d57d7.

📒 Files selected for processing (1)
  • website/modules/asset/ui/src/scss/_leadership-team.scss (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • website/modules/asset/ui/src/scss/_leadership-team.scss
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: security-scan
  • GitHub Check: e2e-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

Copy link
Copy Markdown
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: 3

🧹 Nitpick comments (4)
website/modules/asset/ui/src/scss/_carousel.scss (1)

240-275: Remove legacy commented carousel styles
The commented-out .sf-leadership carousel styles are no longer needed and can be removed to reduce clutter.

Apply this diff to clean up the file:

@@ 239,6 +239,6 @@
 // Leadership team
-// .sf-leadership {
-//   .sf-person__photo {
-//     @include transition(opacity);
-//     img {
-//       width: 87px;
-//       height: 87px;
-//       @include breakpoint-medium {
-//         width: 225px;
-//         height: 225px;
-//       }
-//     }
-//   }
-//   @include breakpoint-medium {
-//     .swiper-slide-active {
-//       .sf-leadership-header__bio {
-//         @include border(border-left);
-//       }
-//     }
-//     .sf-person {
-//       &:hover {
-//         .sf-person__vita {
-//           opacity: 1;
-//         }
-//         .sf-person__photo {
-//           opacity: 0;
-//         }
-//       }
-//     }
-//     .sf-person-wrapper {
-//       border-top: 0;
-//     }
-//     .sf-person__footer {
-//       margin-top: 0;
-//     }
-//   }
-//}
website/modules/leadership-team-widget/views/widget.html (1)

13-23: Render leader headshots with proper fallbacks
The nested checks ensure only valid attachments render. For performance, consider adding loading="lazy" to the <img> tag.

Example diff:

 <img 
   srcset="{{ apos.image.srcset(attachment) }}"
   src="{{ apos.attachment.url(attachment, { size: data.options.size or 'full' }) }}"
   alt="{{ attachment._alt or leader.title }}"
+  loading="lazy"
   {% if apos.attachment.hasFocalPoint(attachment) %}style="object-position: {{ apos.attachment.focalPointToObjectPosition(attachment) }}"{% endif %}
 >
website/modules/asset/ui/src/scss/_leadership-team.scss (1)

94-111: Animation performance could be optimized.

The vita section uses multiple transitions (max-height, opacity, transform) which could impact performance. Consider using transform and opacity only, as these properties don't trigger layout recalculations.

Consider this optimization:

.sf-leader__vita {
-  max-height: 0;
+  transform: scaleY(0);
+  transform-origin: top;
  opacity: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  padding: 0;
  background-color: #f9f9f9;
  
  p {
    margin-top: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: $gray-500;
-    transform: translateY(100%);
+    transform: translateY(20px);
    transition: transform 0.6s ease;
    padding: 20px 40px;
  }

Then in the hover state:

  .sf-leader__vita {
    opacity: 1;
-    max-height: 120px;
+    transform: scaleY(1);
    padding: 10px 40px 20px;
    margin-top: 50px;
    
    @include breakpoint-medium {
      margin-top: 80px;
-      max-height: 140px;
    }
    
    p {
      transform: translateY(0);
    }
  }
website/modules/leadership-team-widget/index.js (1)

1-84: Remove commented-out code.

The large block of commented code appears to be a previous implementation using an array-based approach. Since the current implementation uses a relationship field (which is a better approach), this commented code should be removed to keep the codebase clean.

-/*
- * Const headingToolbar = require('../../lib/headingToolbar');
- * const linkSchema = require('../../lib/linkSchema');
- */
-
-/*
- * Module.exports = {
- *   extend: '@apostrophecms/widget-type',
- *   options: {
- *     label: 'Leadership Team Carousel',
- *     icon: 'binoculars-icon',
- *   },
- *   fields: {
- *     add: {
- *       intro: {
- *         label: 'Intro',
- *         type: 'area',
- *         options: {
- *           widgets: {
- *             '@apostrophecms/rich-text': {
- *               ...headingToolbar,
- *             },
- *           },
- *         },
- *       },
- *       cards: {
- *         label: 'Team members',
- *         type: 'array',
- *         titleField: 'title',
- *         min: 1,
- *         fields: {
- *           add: {
- *             cardTitle: {
- *               label: 'Name',
- *               type: 'string',
- *               required: true,
- *             },
- *             position: {
- *               label: 'Position',
- *               type: 'string',
- *               required: true,
- *             },
- *             yearsOfExperience: {
- *               label: 'Years of Experience',
- *               type: 'integer',
- *               min: 1,
- *               required: false,
- *             },
- *             headshot: {
- *               label: 'Headshot',
- *               type: 'area',
- *               required: true,
- *               options: {
- *                 max: 1,
- *                 min: 1,
- *                 help: '1:1 is recommended',
- *                 widgets: {
- *                   '@apostrophecms/image': {
- *                     aspectRatio: [1, 1],
- *                   },
- *                 },
- *               },
- *             },
- *             bio: {
- *               label: 'Bio',
- *               type: 'area',
- *               required: true,
- *               options: {
- *                 widgets: {
- *                   '@apostrophecms/rich-text': {
- *                     ...headingToolbar,
- *                   },
- *                 },
- *               },
- *             },
- *             ...linkSchema.fields.add,
- *           },
- *         },
- *       },
- *     },
- *   },
- * };
- */
-
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9ec6a27 and 70f2f44.

📒 Files selected for processing (7)
  • website/app.js (1 hunks)
  • website/lib/mainWidgets.js (1 hunks)
  • website/modules/asset/ui/src/index.scss (1 hunks)
  • website/modules/asset/ui/src/scss/_carousel.scss (1 hunks)
  • website/modules/asset/ui/src/scss/_leadership-team.scss (1 hunks)
  • website/modules/leadership-team-widget/index.js (1 hunks)
  • website/modules/leadership-team-widget/views/widget.html (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
website/modules/leadership-team-widget/index.js (1)
website/lib/mainWidgets.js (1)
  • headingToolbar (1-1)
🔇 Additional comments (10)
website/modules/asset/ui/src/index.scss (1)

23-23: Import leadership team styles
The new partial _leadership-team.scss is correctly imported alongside other component styles, ensuring the leadership team widget’s CSS is bundled.

website/app.js (1)

122-122: Register the leadership-team-widget module
The 'leadership-team-widget': {} entry is properly added to the ApostropheCMS modules list to enable the new widget.

website/lib/mainWidgets.js (1)

35-35: Expose the leadership-team widget in the layout group
Adding 'leadership-team': {} integrates the new widget into the “Specialty” layout widgets.

website/modules/leadership-team-widget/views/widget.html (5)

1-4: Wrap widget in semantic section and render intro area
Using a <section> with data-leadership-team-widget and an area for the intro is well structured and follows ApostropheCMS conventions.


5-8: Row grouping logic for responsive grid
The loop.index0 % 3 == 0 and loop.index0 > 0 check correctly breaks rows after every three items. Readability is clear.


29-31: Titles and positions rendered clearly
Using <h4> and <h5> for title and position is semantic and aids accessibility.


33-35: Render bio via rich-text area
Embedding the bio area ensures editors can manage rich content. This follows best practices for content areas.


49-54: Skip markup closing tags
These lines simply close previously opened containers; no action needed.

website/modules/asset/ui/src/scss/_leadership-team.scss (1)

178-190: Well-structured responsive grid implementation.

The mobile-first approach with flexbox grid is well implemented. The transition from single-column to three-column layout is clean and follows best practices.

website/modules/leadership-team-widget/index.js (1)

87-128: Well-structured widget configuration.

The widget implementation follows ApostropheCMS best practices:

  1. Proper extension: Correctly extends @apostrophecms/widget-type
  2. Good field structure: The relationship field approach is better than the commented array approach
  3. Builder projection: Properly configured to retrieve only needed fields from team-members
  4. Field validation: Required fields are appropriately marked

The relationship field configuration is particularly well done, allowing reuse of team member data across the site while maintaining order control in this widget.

Comment thread website/modules/leadership-team-widget/views/widget.html Outdated
Comment thread website/modules/asset/ui/src/scss/_leadership-team.scss Outdated
Comment thread website/modules/leadership-team-widget/index.js
Copy link
Copy Markdown
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

🧹 Nitpick comments (2)
website/modules/team-members/index.js (2)

1-1: Remove unused import.

The headingToolbar import is no longer needed since the bio field has been changed from a rich-text area to a plain string textarea.

-const headingToolbar = require('../../lib/headingToolbar');

56-62: Consider adding URL validation for LinkedIn field.

While making the LinkedIn field required is good for data consistency, consider adding URL validation to ensure proper LinkedIn profile URLs are entered.

 linkedin: {
   label: 'LinkedIn',
   type: 'string',
   help: 'Site url without http protocol.',
   placeholder: 'linkedin.com/in/your-profile',
+  pattern: '^linkedin\\.com\\/in\\/[a-zA-Z0-9-]+$',
   required: true,
 },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 70f2f44 and d53d4ef.

📒 Files selected for processing (7)
  • website/app.js (1 hunks)
  • website/lib/mainWidgets.js (1 hunks)
  • website/modules/asset/ui/src/index.scss (1 hunks)
  • website/modules/asset/ui/src/scss/_carousel.scss (1 hunks)
  • website/modules/asset/ui/src/scss/_leadership-team.scss (1 hunks)
  • website/modules/leadership-team-widget/views/widget.html (1 hunks)
  • website/modules/team-members/index.js (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • website/modules/asset/ui/src/index.scss
  • website/app.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • website/modules/leadership-team-widget/views/widget.html
  • website/lib/mainWidgets.js
  • website/modules/asset/ui/src/scss/_carousel.scss
  • website/modules/asset/ui/src/scss/_leadership-team.scss
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: e2e-tests
  • GitHub Check: lint
  • GitHub Check: unit-tests
  • GitHub Check: security-scan
🔇 Additional comments (1)
website/modules/team-members/index.js (1)

54-54: Good change: Making experience required.

Making the experience field required ensures consistent data for the leadership team widget display.

Comment thread website/modules/team-members/index.js
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2025

🔍 Vulnerabilities of apostrophe-cms:test

📦 Image Reference apostrophe-cms:test
digestsha256:b35709ec63a09eaa3d49847f04f7de71928f7e3373bcf3969823d49c02fb8e66
vulnerabilitiescritical: 0 high: 3 medium: 0 low: 0
platformlinux/amd64
size284 MB
packages935
📦 Base Image node:23-alpine
also known as
  • 23-alpine3.21
  • 23.11-alpine
  • 23.11-alpine3.21
  • 23.11.1-alpine
  • 23.11.1-alpine3.21
digestsha256:169ee1b69bd3f5c7c8508a9919e8b367bba9dc7fa9a03097ec9f85d2e8179631
vulnerabilitiescritical: 0 high: 0 medium: 0 low: 0
critical: 0 high: 1 medium: 0 low: 0 async 1.5.2 (npm)

pkg:npm/async@1.5.2

high 7.8: CVE--2021--43138 OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities

Affected range<2.6.4
Fixed version2.6.4, 3.2.2
CVSS Score7.8
CVSS VectorCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS Score1.061%
EPSS Percentile77th percentile
Description

A vulnerability exists in Async through 3.2.1 (fixed in 3.2.2), which could let a malicious user obtain privileges via the mapValues() method.

critical: 0 high: 1 medium: 0 low: 0 async 0.9.2 (npm)

pkg:npm/async@0.9.2

high 7.8: CVE--2021--43138 OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities

Affected range<2.6.4
Fixed version2.6.4, 3.2.2
CVSS Score7.8
CVSS VectorCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS Score1.061%
EPSS Percentile77th percentile
Description

A vulnerability exists in Async through 3.2.1 (fixed in 3.2.2), which could let a malicious user obtain privileges via the mapValues() method.

critical: 0 high: 1 medium: 0 low: 0 connect-multiparty 2.2.0 (npm)

pkg:npm/connect-multiparty@2.2.0

high 7.8: CVE--2022--29623 Unrestricted Upload of File with Dangerous Type

Affected range<=2.2.0
Fixed versionNot Fixed
CVSS Score7.8
CVSS VectorCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS Score0.119%
EPSS Percentile32nd percentile
Description

An arbitrary file upload vulnerability in the file upload module of Express Connect-Multiparty 2.2.0 allows attackers to execute arbitrary code via a crafted PDF file. NOTE: the Supplier has not verified this vulnerability report.

@yuramax yuramax changed the title Added Teams Leaders table [416] Added Teams Leaders Table widget May 25, 2025
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 25, 2025
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 26, 2025
yuramax
yuramax previously approved these changes May 26, 2025
Copy link
Copy Markdown
Contributor

@yuramax yuramax left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

IhorMasechko
IhorMasechko previously approved these changes May 26, 2025
Copy link
Copy Markdown
Contributor

@IhorMasechko IhorMasechko left a comment

Choose a reason for hiding this comment

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

Great job!

Comment thread website/modules/leadership-team-widget/index.js Outdated
@yuramax yuramax dismissed stale reviews from coderabbitai[bot] and themself via 6e1ac93 May 26, 2025 20:57
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 26, 2025
yuramax
yuramax previously approved these changes May 26, 2025
Copy link
Copy Markdown
Contributor

@yuramax yuramax left a comment

Choose a reason for hiding this comment

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

LGTM

IhorMasechko
IhorMasechko previously approved these changes May 27, 2025
Copy link
Copy Markdown
Contributor

@IhorMasechko IhorMasechko left a comment

Choose a reason for hiding this comment

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

LGTM

@yuramax yuramax dismissed stale reviews from IhorMasechko, coderabbitai[bot], and themself via 89d57d7 May 27, 2025 11:20
@yuramax yuramax self-requested a review May 27, 2025 11:26
Copy link
Copy Markdown
Contributor

@yuramax yuramax left a comment

Choose a reason for hiding this comment

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

👌

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@VitalyyP VitalyyP left a comment

Choose a reason for hiding this comment

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

LGTM

@IhorMasechko IhorMasechko self-requested a review May 27, 2025 12:37
Copy link
Copy Markdown
Contributor

@IhorMasechko IhorMasechko left a comment

Choose a reason for hiding this comment

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

LGTM

@yuramax yuramax enabled auto-merge (squash) May 27, 2025 12:57
Copy link
Copy Markdown
Collaborator

@killev killev left a comment

Choose a reason for hiding this comment

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

LGTM

@yuramax yuramax merged commit fe8cb44 into main May 27, 2025
12 checks passed
@yuramax yuramax deleted the 416-upgrade-leadership-team-widget branch May 27, 2025 17:28
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.

5 participants