Skip to content

fix:posts-page-styling to match Figma design#7175

Open
aadityasingh9601 wants to merge 11 commits intoPalisadoesFoundation:developfrom
aadityasingh9601:fix/posts-page-styling-6652
Open

fix:posts-page-styling to match Figma design#7175
aadityasingh9601 wants to merge 11 commits intoPalisadoesFoundation:developfrom
aadityasingh9601:fix/posts-page-styling-6652

Conversation

@aadityasingh9601
Copy link
Copy Markdown

@aadityasingh9601 aadityasingh9601 commented Feb 10, 2026

What kind of change does this PR introduce?

Fix post page styling to match Figma design.

Issue Number:

Fixes #6652

Snapshots/Videos:

Before:

https://drive.google.com/file/d/1oODJ3DyV03eoTz24_NDgsnnmp_59jT0y/view?usp=sharing

After:

https://drive.google.com/file/d/1pfgs4YKDhRqCp0rHj7Gf51zsaALBxXRc/view?usp=sharing

If relevant, did you update the documentation?

No, only auto-docs got updated themselves.

Summary

This PR fixes the styling of the Posts page to match the Figma design.

  • A new component createPostContainer.tsx is introduced along with createPostContainer.module.css for styling & createPostContainer.spec.tsx for testing
  • International translations are added for the texts used in the new createPostContainer.tsx component
  • CreatePost button is removed from the posts page
  • body field is added in the pinnedPostCard.tsx
  • Auto scroll feature added in pinnedPostsLayout.tsx & startAutoScroll, stopAutoScroll & resumeAutoScroll functions are added to provide autoscroll feature.
  • Tests are added for auto scroll feature under pinnedPostsLayout.spec.tsx
  • Related tests files are updated for each change

Does this PR introduce a breaking change?

No

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Dedicated post creation container with browse-files and send actions.
    • Auto-scrolling pinned posts feed.
    • Post body preview added to post cards.
  • Style

    • Updated post card and pinned post layouts, spacing, borders, and header typography.
    • Improved navbar dropdown hover styling.
    • Various layout/responsiveness tweaks for pinned posts.
  • Localization

    • Added "Your Feed" and post-creation texts ("Start a Post", "Start Your Post", "Browse Files") in EN/ES/FR/HI/ZH.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 10, 2026

Our Pull Request Approval Process

This PR will be reviewed according to our:

  1. Palisadoes Contributing Guidelines

  2. AI Usage Policy

Your PR may be automatically closed if:

  1. Our PR template isn't filled in correctly
  2. You haven't correctly linked your PR to an issue

👉 https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue

Thanks for contributing!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 10, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • docs/docs/auto-docs/shared-components/posts/posts/functions/default.md is excluded by !**/docs/docs/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds a CreatePostContainer UI and translations, introduces auto-scrolling pinned-posts behavior, renders post bodies in cards, updates post feed layout and styles, and adjusts GraphQL query and types to include post body.

Changes

Cohort / File(s) Summary
Translations
public/locales/en/translation.json, public/locales/es/translation.json, public/locales/fr/translation.json, public/locales/hi/translation.json, public/locales/zh/translation.json
Added posts.yourFeed and createPostContainer keys (startAPost, startYourPost, browseFiles) across locales.
CreatePostContainer (new)
src/shared-components/posts/createPostContainer/createPostContainer.tsx, .../createPostContainer.module.css, .../createPostContainer.spec.tsx
New visual CreatePostContainer component, CSS module, and unit tests; exports a component with onClick prop.
Posts feed & tests
src/shared-components/posts/posts.tsx, src/shared-components/posts/posts.spec.tsx, src/shared-components/posts/helperFunctions.ts
Replaced inline create-post button with CreatePostContainer; feed header/yourFeed logic adjusted; formatPostForCard ensures body defaults to ''; tests/mocks updated to include post.body and new create flow.
Pinned posts auto-scroll
src/shared-components/pinnedPosts/pinnedPostsLayout.tsx, .../pinnedPostsLayout.module.css, .../pinnedPostsLayout.spec.tsx
Added continuous auto-scroll loop with pause/resume on hover, duplicated posts for seamless loop, nav animation simplifications, and new timer/requestAnimationFrame tests.
Pinned post card
src/shared-components/pinnedPosts/pinnedPostCard.tsx, .../pinnedPostCard.module.css, .../pinnedPostCard.spec.tsx
UI refactor to Box/sx styling, added truncated body-preview, moved view button to absolute action container, CSS size adjustments, and tests asserting body rendering.
PostCard redesign
src/shared-components/postCard/PostCard.tsx, .../PostCard.module.css
Reworked header, caption/body typography, reorganized like/comment/share actions, view/hide comments button, and multiple styling/structure changes (sx usage).
Types & GraphQL
src/types/Post/interface.ts, src/GraphQl/Queries/OrganizationQueries.ts
InterfacePost.body now `string
Styling tweaks
src/screens/UserPortal/UserScreen/UserScreen.module.css, src/shared-components/Navbar/Navbar.module.css
Hard-coded title h1 typography values; added .dropdown:hover color rule with !important.
PinnedPosts CSS adjustments
src/shared-components/pinnedPosts/pinnedPostsLayout.module.css, src/shared-components/pinnedPosts/pinnedPostCard.module.css
Layout sizing, fit-content cards, media/content height tweaks, button selector and hover rule updates.
Tests & e2e selector
src/shared-components/pinnedPosts/pinnedPostsLayout.spec.tsx, src/shared-components/pinnedPosts/pinnedPostCard.spec.tsx, cypress/pageObjects/AdminPortal/PostPage.ts
Updated/expanded tests for auto-scroll and body rendering; renamed _createPostButton_createPostInput selector.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PinnedLayout as PinnedPostsLayout
    participant DOM as Browser DOM

    User->>PinnedLayout: Mounts component with pinnedPosts
    activate PinnedLayout
    PinnedLayout->>PinnedLayout: startAutoScroll()
    loop requestAnimationFrame auto-scroll
        PinnedLayout->>DOM: increment scrollLeft
        DOM->>DOM: container scrolls horizontally
        PinnedLayout->>PinnedLayout: if scrollLeft >= half scrollWidth -> reset scrollLeft
    end
    User->>DOM: mouseenter (hover)
    DOM->>PinnedLayout: onMouseEnter
    PinnedLayout->>PinnedLayout: stopAutoScroll() / cancel rAF
    User->>DOM: mouseleave
    DOM->>PinnedLayout: onMouseLeave
    PinnedLayout->>PinnedLayout: resumeAutoScroll() / start rAF
    User->>PinnedLayout: Unmount
    PinnedLayout->>PinnedLayout: stopAutoScroll() cleanup
    deactivate PinnedLayout
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • palisadoes

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Component Architecture Compliance ❌ Error CreatePostContainer component defines InterfaceCreatePostContainerProps inline on line 9, violating the reusable component policy requiring centralized type definitions in src/types/Post/interface.ts. Remove the inline interface definition from createPostContainer.tsx and import InterfaceCreatePostContainerProps solely from src/types/Post/interface.ts to maintain single source of truth.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Coverage Gate ❓ Inconclusive PR includes comprehensive test coverage for modified components, but custom check requires running pnpm run test:coverage to verify coverage/vitest/coverage-summary.json shows all modified files at ≥95%, which cannot be executed in sandbox. Execute pnpm run test:coverage in development environment and verify coverage report confirms all modified files meet ≥95% threshold; if helperFunctions.ts coverage is below 95%, create dedicated test file.
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing posts-page styling to match Figma design, which is the primary objective described in the PR.
Description check ✅ Passed The PR description is comprehensive and covers most template sections: change type (fix), issue number (#6652), snapshots/videos, documentation status, detailed summary, breaking changes, and checklist. All critical sections are populated.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #6652: new createPostContainer component with translations, body field addition to pinnedPostCard, auto-scroll feature in pinnedPostsLayout with helper functions, updated tests, and styling changes to match the Figma design.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the posts-page styling per issue #6652. Changes include component creation, styling adjustments, translation additions, auto-scroll implementation, and test updates—all within the scope of matching the Figma design.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop
Typescript Compilation ✅ Passed TypeScript compiler completed successfully with exit code 0, indicating the pull request passes typecheck requirements.
I18n Key Completeness ✅ Passed All translation keys introduced in this PR are present in all 5 required locales (en, es, fr, hi, zh) with appropriate localized values.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (10)
src/shared-components/Navbar/Navbar.module.css (1)

23-34: ⚠️ Potential issue | 🟠 Major

Replace dropdown custom props with design tokens (avoid app-fixed dependency).

Line 24-33 still relies on --dropdown-* variables, which are slated to be removed with app-fixed. Please swap these for tokens from src/style/tokens so the navbar styling remains stable after the cleanup.

Based on learnings: In talawa-admin, all CSS custom properties must come exclusively from src/style/tokens/ directory (spacing.css, colors.css, borders.css, typography.css, etc.), NOT from src/style/app-fixed.module.css; component-specific vars like --dropdown-bg must be replaced with equivalent tokens.

src/shared-components/pinnedPosts/pinnedPostCard.module.css (1)

1-52: 🛠️ Refactor suggestion | 🟠 Major

Replace hardcoded styling values with design tokens

Several new/updated values are hardcoded (#ddd, #a8c7fa, #8bb5e8, 8px/6px). Please switch these to design tokens from src/style/tokens to keep theming consistent.

♻️ Example tokenization
 .postCardContainer {
-  border-radius: 8px;
+  border-radius: var(--radius-lg);
   height: 390px;
 }
 
 .card {
   width: 340px;
-  height: 390px;
-  border: 1px solid `#ddd`;
+  height: 390px;
+  border: 1px solid var(--color-gray-200);
   overflow: hidden;
 }
 
 .viewPostButton {
-  background-color: `#a8c7fa`;
+  background-color: var(--color-blue-200);
   color: black;
   text-transform: none;
-  border-radius: 6px;
-  padding: 6px 16px;
+  border-radius: var(--radius-md);
+  padding: var(--space-2) var(--space-4);
 }
 
 .viewPostButton:hover {
-  background-color: `#8bb5e8` !important;
+  background-color: var(--color-blue-300);
 }

Based on learnings, "In the talawa-admin repository, replace hardcoded CSS values (including calc() expressions for font-size, padding, margin, etc.) with design tokens from src/style/tokens/."

src/shared-components/pinnedPosts/pinnedPostCard.spec.tsx (1)

109-153: ⚠️ Potential issue | 🔴 Critical

PinnedPostCard.spec.tsx: Fix dynamic dates and menu race conditions

Issue Goals

  • Issue #6652 expects Posts page styling to match Figma; these tests only verify text/button presence (lines 156-191, 197-242) without validating layout/styling. Consider adding visual regression coverage elsewhere.

Tests (incl. Flakiness)

  • ⚠️ NON-DETERMINISTIC DATES at lines 121-122 — dayjs.utc().subtract(14, 'days').toISOString() depends on current time; use fixed UTC timestamps (e.g., "2025-01-01T10:00:00Z").
  • ⚠️ RACE CONDITION at lines 327-330, 407-410, 445-448, 561-564 — menu items are queried immediately after clicking the button without waiting for the MUI Menu to render. Use await screen.findByTestId('delete-post-menu-item') instead of getByTestId to await the async Menu portal render.
  • ⚠️ INCOMPLETE CLEANUP at lines 109-112 — afterEach only calls vi.clearAllMocks(); missing cleanup() from @testing-library/react. Add cleanup() call in afterEach.

Components/Policy

  • No additional component-policy issues found.

GraphQL

  • The body field in mocks (line 120) is valid; it exists in the InterfacePost type and is requested by the GraphQL query.

i18n & a11y

  • No issues found.

Security

  • No issues found.

Action Items

  • Replace dynamic dates with fixed UTC timestamps.
  • Wrap menu item queries in findByTestId or add await waitFor(() => expect(screen.getByTestId(...)).toBeInTheDocument()) after clicking the menu button.
  • Add import { cleanup } from '@testing-library/react' and call cleanup() in the afterEach block.
  • Run: pnpm run test:coverage and pnpm run typecheck to verify no regressions.
src/shared-components/pinnedPosts/pinnedPostsLayout.module.css (1)

44-53: ⚠️ Potential issue | 🔴 Critical

Hover/active transforms override base translateY(-50%), causing the nav button to jump.

The base .navButton (Line 27) uses transform: translateY(-50%) for vertical centering. On :hover, the transform is replaced with scale(1.05) (Line 48), and on :active with scale(0.95) (Line 52). Since CSS transform is a single property, the hover/active values completely replace the base translateY(-50%), causing the button to visually snap out of vertical center on interaction.

🐛 Fix: combine transforms
 .navButton:hover {
   background: `#fff`;
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
   color: `#333`;
-  transform: scale(1.05);
+  transform: translateY(-50%) scale(1.05);
 }

 .navButton:active {
-  transform: scale(0.95);
+  transform: translateY(-50%) scale(0.95);
 }
src/shared-components/pinnedPosts/pinnedPostsLayout.tsx (1)

165-180: ⚠️ Potential issue | 🔴 Critical

Duplicate React keys from doubled allPosts array.

allPosts (Line 139) is [...pinnedPosts, ...pinnedPosts], so every pinnedPost.node.id appears twice. Using key={pinnedPost.node.id} on Line 173 produces duplicate keys, which breaks React's reconciliation and triggers console warnings.

🐛 Fix: use index to disambiguate keys
-       {allPosts
+       {allPosts
          .filter(
            (
              pinnedPost,
            ): pinnedPost is InterfacePostEdge & { node: InterfacePost } =>
              Boolean(pinnedPost.node),
          )
-         .map((pinnedPost) => (
-           <div key={pinnedPost.node.id} className={styles.cardWrapper}>
+         .map((pinnedPost, index) => (
+           <div key={`${pinnedPost.node.id}-${index}`} className={styles.cardWrapper}>
              <PinnedPostCard
src/shared-components/posts/posts.spec.tsx (4)

1016-1048: 🧹 Nitpick | 🔵 Trivial

Duplicate test — this is functionally identical to the test at Line 993.

The test "opens create post modal when post input is clicked" (Line 1027) performs the same open → close → assert-gone flow as "closes create post modal when close button is clicked" (Line 993). Either deduplicate or differentiate their assertions (e.g., one tests only opening, the other tests only closing).

Also, Line 1046 has the same missing waitFor after close as noted above.

Suggested differentiation
-  it('opens create post modal when post input is clicked', async () => {
+  it('renders create post container on the page', async () => {
     renderComponent([orgPostListMock, emptyPinnedPostsMock]);
 
     await waitFor(() => {
       expect(screen.getByTestId('postInput')).toBeInTheDocument();
     });
 
-    // Open modal
-    const postInput = screen.getByTestId('postInput');
-    await user.click(postInput);
-
-    await waitFor(() => {
-      expect(screen.getByTestId('create-post-modal')).toBeInTheDocument();
-    });
-
-    // Close modal
-    const closeButton = screen.getByTestId('close-create-modal');
-    await user.click(closeButton);
-
-    expect(screen.queryByTestId('create-post-modal')).not.toBeInTheDocument();
+    expect(screen.getByTestId('createPostContainer')).toBeInTheDocument();
   });

571-573: ⚠️ Potential issue | 🟡 Minor

⚠️ INCOMPLETE CLEANUP — Missing cleanup() in afterEach.

Per coding guidelines, each test file must call cleanup() from @testing-library/react in afterEach to prevent DOM state leakage between tests. This applies to all afterEach blocks in the file (Lines 571, 884, 989, 1023, 1057, 1111, 1342, 1377, 1446, 1548).

Proposed fix (apply to each afterEach)
+import { render, screen, waitFor, cleanup } from '@testing-library/react';
   afterEach(() => {
+    cleanup();
     vi.clearAllMocks();
   });

564-1586: 🧹 Nitpick | 🔵 Trivial

Structured Test Review

Issue Goals (Priority #1)

  • Fixes #6652: Posts page styling to match Figma design.
  • Tests cover: CreatePostContainer rendering and interaction (Line 997, 1027), body field in post data (Lines 292, 321, 339, 358, 376), updated modal flow.
  • Gap: No test explicitly verifies visual/styling changes or that the CreatePost button was removed from the posts page.

Tests (incl. Flakiness)

  • ⚠️ RACE CONDITION at Line 1012, 1046 — Synchronous assertion after user.click(closeButton) without waitFor.
  • Dynamic dayjs() timestamps at module scope (Line 268, 323, 341, etc.) are acceptable per project convention.
  • No hardcoded setTimeout or fixed delays.

Components/Policy

  • CreatePostContainer mock correctly wired (Line 198-208).
  • Duplicate test: "Create Post Container" block (Line 1016-1048) mirrors "Create Post Modal" block (Line 993-1013).

GraphQL

  • Mock data enriched with body field — verify against schema (see separate comment).

i18n & a11y

  • No new i18n assertions in changed tests.
  • No a11y regressions in mock components.

Security

  • No security concerns.

Action Items

  1. Wrap modal-close assertions at Lines 1012 and 1046 in waitFor.
  2. Add cleanup() to all afterEach blocks.
  3. Deduplicate or differentiate the two identical modal open/close tests.
  4. Confirm body field is available in the GraphQL Post type.

271-314: ⚠️ Potential issue | 🔴 Critical

Remove the body field from the enrichPostNode function return object.

The PostNode GraphQL type does not include a body field; it only has caption for post content. The enrichPostNode function should not include body in its return object at lines 292, as this creates a type mismatch with the actual PostNode type definition. Remove the line body: post.body ?? 'Test body' and the corresponding parameter from the input type.

src/shared-components/postCard/PostCard.tsx (1)

373-386: ⚠️ Potential issue | 🔴 Critical

Bug: postCardStyles.body is a CSS class name string, not the post body prop.

Line 373 conditionally renders the body section based on whether the CSS module has a .body class — which is a static truthy/falsy string, not the actual post body content. This means the body container renders even when props.body is empty/null, or never renders if the class is removed.

Proposed fix
-        {postCardStyles.body && (
+        {props.body && (
           <Box className={postCardStyles.bodyContainer}>
🤖 Fix all issues with AI agents
In `@src/GraphQl/Queries/OrganizationQueries.ts`:
- Around line 31-34: The GraphQL queries ORGANIZATION_PINNED_POST_LIST and
ORGANIZATION_POST_BY_ID still request the removed Post.body and deprecated
attachmentURL fields; update both queries to remove body and attachmentURL and
replace attachmentURL with the attachments selection (mimeType, name, fileHash,
objectName). Update pinnedPostCard.tsx to stop using node.body and render
node.caption instead (adjust any trimming/HTML handling to use caption), and
ensure components expect attachments array with
mimeType/name/fileHash/objectName. After making these changes run pnpm run
typecheck to verify no type errors.

In `@src/screens/UserPortal/UserScreen/UserScreen.module.css`:
- Around line 62-67: The .titleContainer h1 rule uses hardcoded values (40px,
500, black, 2rem); replace these with the project's design tokens from
src/style/tokens (e.g., use the appropriate --font-size-*, --font-weight-*,
--color-*, --space-* variables already used elsewhere in this file) — update the
.titleContainer h1 selector to reference var(--font-size-28) or the correct
typography token, var(--font-weight-bold) (or matching weight token),
var(--color-gray-500) (or the correct color token), and var(--space-2) (or
matching spacing token); if a token is missing, add a new token to the relevant
tokens file rather than introducing a literal.

In `@src/shared-components/pinnedPosts/pinnedPostCard.tsx`:
- Around line 142-143: Replace the hardcoded borderRadius: 8 in the sx/style
object inside the PinnedPostCard component with the design token CSS custom
property (e.g., use "var(--radius-lg)") so the component uses the project's
theme token; update the object where p: 1, borderRadius: 8 appears (the sx prop
in pinnedPostCard.tsx) to reference the CSS variable instead of the numeric
literal.
- Around line 291-302: The body preview currently truncates with substring
(pinnedPost.node.body) which can cut words mid-word; remove the JS-based
ternary/substring logic and render pinnedPost.node.body directly inside the
Typography, and apply the same CSS-based line-clamp used for the caption (the
Typography sx at line ~272) — e.g., add the -webkit-box display,
WebkitLineClamp, WebkitBoxOrient, overflow: hidden and textOverflow rules in the
same sx prop for this body Typography so the text is cleanly clamped instead of
being sliced by character count.

In `@src/shared-components/pinnedPosts/pinnedPostsLayout.module.css`:
- Around line 109-111: Remove the unused and misspelled CSS rule `.buttonn` from
pinnedPostsLayout.module.css: delete the `.buttonn { background-color: `#e9f1ff`;
}` block, run a quick project-wide search for `.buttonn` to confirm there are no
references, and if the intent was to style a button instead, create or use a
properly named `.button` class in pinnedPostsLayout.tsx (or update the JSX to
match the new class); otherwise simply remove the rule to clean up dead CSS.

In `@src/shared-components/pinnedPosts/pinnedPostsLayout.tsx`:
- Around line 102-124: startAutoScroll currently captures a stale container
variable; change the step closure to read the live DOM from
scrollContainerRef.current each tick (i.e., use scrollContainerRef.current
inside step instead of the captured container) and guard against null; continue
to use animationRef to prevent multiple loops and isPausedRef to pause;
additionally, respect user reduced-motion preferences by checking
window.matchMedia('(prefers-reduced-motion: reduce)').matches at the start of
startAutoScroll and return early if true (or skip animating) so users who opted
out of animations are not auto-scrolled.
- Around line 142-147: The container div with className styles.carouselWrapper
and data-testid "pinned-posts-layout" only uses onMouseEnter/onMouseLeave
(stopAutoScroll/resumeAutoScroll) which is inaccessible to
keyboard/screen-reader users; make it focusable and add keyboard equivalents by
wiring onFocus to stopAutoScroll and onBlur to resumeAutoScroll and add either
tabIndex={0} or role="region" plus an aria-label to describe the carousel so
assistive tech can pause it; update the element where styles.carouselWrapper is
used to include onFocus={stopAutoScroll}, onBlur={resumeAutoScroll}, and add
tabIndex and/or role+aria-label accordingly.
- Around line 73-82: There are two useEffect hooks both depending on pinnedPosts
that call startAutoScroll (one also calls checkScrollability and only the other
performs cleanup), causing redundant starts; consolidate into a single useEffect
that runs when pinnedPosts changes, calls checkScrollability(), calls
startAutoScroll(), and returns a cleanup that calls stopAutoScroll() so
start/stop happen exactly once per change (update the effects referencing
useEffect, checkScrollability, startAutoScroll, and stopAutoScroll accordingly).

In `@src/shared-components/postCard/PostCard.module.css`:
- Around line 39-45: The avatar rule .userImageUserPost img currently uses
transform: scale(1.5) which causes fragile cropping; update the CSS for
.userImageUserPost img to remove transform and instead set width: 100% and
height: 100% plus object-fit: cover so the image fills the 28×28 container
predictably (keep the existing position/top/left and rely on the container's
overflow:hidden behavior).
- Around line 182-184: Remove the duplicate CSS rule for the .image class in
PostCard.module.css so only a single `.image { width: 100%; }` remains; locate
both `.image` blocks and delete one of them (keep either the first or the
second) to avoid redundant definitions and ensure the remaining rule preserves
`width: 100%`.
- Around line 174-176: The .pinnedIcon CSS rule uses a fragile hardcoded
margin-left: 15rem which breaks across viewports; update the .pinnedIcon rule to
use margin-left: auto (or switch the parent container to display: flex and use
justify/content or align-items so the pinned icon naturally sits at the right)
and remove the 15rem magic number; locate the .pinnedIcon class in
PostCard.module.css and replace the fixed spacing with a responsive approach
(margin-left: auto or flexbox on the parent) so the icon stays right-aligned
across sizes.

In `@src/shared-components/postCard/PostCard.tsx`:
- Around line 462-508: Replace the three hardcoded labels ("Like", "Comment",
"Share") inside the Typography elements in the PostCard component with i18n keys
using the existing t(...) pattern (e.g., t('postCard.like'),
t('postCard.comment'), t('postCard.share')) so toggleComments, copyToClipboard
and showComments flows remain localized; also replace the inline sx color
'rgb(117 117 117)' on those Typography nodes with the theme token (e.g.,
'text.secondary' or the project CSS custom property/design token) to ensure
theme consistency and avoid hardcoded colors while keeping the same elements
that use postCardStyles.action and the IconButton aria-label patterns.

In
`@src/shared-components/posts/createPostContainer/createPostContainer.module.css`:
- Around line 1-73: Replace hardcoded colors, radii and spacing in
createPostContainer.module.css with design tokens: swap `#1778f2` with
tokens.colors.primary for .browseFilesButton and .sendButton/.sendButton svg,
replace rgba(0,0,0,0.9) and rgba(0,0,0,0.4/0.1/0.05) with
tokens.colors.textPrimary / tokens.colors.textMuted / tokens.colors.surfaceTint
(or equivalent) for .title, .postInput::placeholder, borders and background,
replace fixed radii 8px with tokens.radii.md for .createPostContainer,
.browseFilesButton, .inputArea and .sendButton, and replace
paddings/margins/gaps (16px, 12px, 8px, 24px, 48px, 55px, 37px) and font-size
values with tokens.spacing.* and tokens.typography.* (e.g.,
tokens.spacing.sm/md/lg and tokens.fontSize.md) in .createPostContainer,
.createPostContent, .title, .inputArea, .browseFilesButton, .postInput and
.sendButton so all hardcoded values reference the design tokens.

In `@src/shared-components/posts/createPostContainer/createPostContainer.tsx`:
- Around line 40-48: The read-only Input in createPostContainer (the Input JSX
with props className={styles.postInput}, placeholder={t('startYourPost')},
onClick={onClick}, readOnly, data-testid="postInput") lacks an explicit
accessible name; add an aria-label prop (e.g. aria-label={t('startYourPost')} or
a localized equivalent) to that Input so screen readers get a clear label while
keeping the placeholder and existing props unchanged.
- Around line 33-55: The Browse Files and Send Button render as interactive
elements but lack click handlers; wire both Button components (the one with
className styles.browseFilesButton and the send Button with className
styles.sendButton / data-testid "sendPostButton") to the same onClick prop
already used by the Input (onClick), so they trigger the CreatePostModal or the
same handler; update the Button elements to call the onClick prop (or
alternatively make the parent container clickable and delegate to onClick) so
all interactive controls consistently invoke the CreatePostContainer's onClick
handler.

In `@src/shared-components/posts/posts.spec.tsx`:
- Around line 1008-1013: After clicking the close button (closeButton /
user.click), the test asserts synchronously that
screen.queryByTestId('create-post-modal') is gone which can race with async DOM
updates; update the test to wait for the modal to be removed (e.g., wrap the
assertion in a waitFor or use waitForElementToBeRemoved/findByTestId) so the
expectation that 'create-post-modal' is not in the document runs after the modal
has actually been removed.

In `@src/shared-components/posts/posts.tsx`:
- Around line 381-387: Remove the extraneous JSX text nodes around the
CreatePostContainer by deleting the {' '} tokens present before and after
<CreatePostContainer onClick={showCreatePostModal} />; you can also simplify the
wrapper (the conditional block that checks userId) by returning the
CreatePostContainer directly instead of rendering an extra div if no additional
layout is required, keeping the onClick prop (showCreatePostModal) intact.
- Around line 392-397: Replace the hardcoded styling in the Typography instances
(the <Typography> that renders {t('pinnedPosts')} and the similar one around
line 432) to use design token CSS custom properties instead of numeric literals:
remove fontSize: 40 and fontWeight: 500 from the sx prop and reference the
project's tokens (e.g., var(--font-size-xxl) and var(--font-weight-medium) or
the equivalent token names used in the codebase) so the sx uses fontSize:
'var(--... )' and fontWeight: 'var(--... )' for both Typography declarations.

Comment on lines 31 to 34
id
caption
body
commentsCount
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Feb 10, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the file around the specified lines
cat -n src/GraphQl/Queries/OrganizationQueries.ts | head -60

Repository: PalisadoesFoundation/talawa-admin

Length of output: 2044


🏁 Script executed:

# Also search for ORGANIZATION_PINNED_POST_LIST to understand its full definition
rg -A 30 "ORGANIZATION_PINNED_POST_LIST" src/GraphQl/Queries/OrganizationQueries.ts

Repository: PalisadoesFoundation/talawa-admin

Length of output: 827


🏁 Script executed:

# Check for typecheck issues in the file
pnpm run typecheck 2>&1 | grep -i "OrganizationQueries\|body\|caption" || echo "No specific errors found for this file"

Repository: PalisadoesFoundation/talawa-admin

Length of output: 115


🏁 Script executed:

# Check other post queries to see if body has been removed elsewhere
rg "body" src/GraphQl/Queries/OrganizationQueries.ts | grep -E "(query|body)"

Repository: PalisadoesFoundation/talawa-admin

Length of output: 121


🏁 Script executed:

# Search for all post queries to see the pattern
rg "export const.*POST.*= gql" src/GraphQl/Queries/OrganizationQueries.ts

Repository: PalisadoesFoundation/talawa-admin

Length of output: 224


🏁 Script executed:

# Check if post.body is used in any components
rg "post\.body|post\?.body" src/screens/OrgPost/ --type tsx --type ts

Repository: PalisadoesFoundation/talawa-admin

Length of output: 104


🏁 Script executed:

# Check usage of post.attachmentURL to understand if it's critical
rg "attachmentURL" src/screens/OrgPost/ --type tsx --type ts

Repository: PalisadoesFoundation/talawa-admin

Length of output: 104


🏁 Script executed:

# Search for post.body usage in components (without type flag)
rg "post\.body|post\?.body" src/screens/OrgPost/

Repository: PalisadoesFoundation/talawa-admin

Length of output: 137


🏁 Script executed:

# Check all three post queries for body field presence
rg -A 50 "export const ORGANIZATION_POST_BY_ID" src/GraphQl/Queries/OrganizationQueries.ts | head -70

Repository: PalisadoesFoundation/talawa-admin

Length of output: 1250


🏁 Script executed:

# Check for attachmentURL usage
rg "attachmentURL" src/screens/OrgPost/

Repository: PalisadoesFoundation/talawa-admin

Length of output: 137


🏁 Script executed:

# Check if any other post-related query files exist
fd -t f ".*Query\|.*query" src/GraphQl/ | grep -i post

Repository: PalisadoesFoundation/talawa-admin

Length of output: 59


🏁 Script executed:

# Find the actual directory structure
fd -t d "OrgPost\|orgpost\|post" src/screens/ 2>/dev/null | head -20

Repository: PalisadoesFoundation/talawa-admin

Length of output: 59


🏁 Script executed:

# Search for all TypeScript files using post queries
rg "ORGANIZATION_PINNED_POST_LIST\|ORGANIZATION_POST_BY_ID\|ORGANIZATION_POST_LIST_WITH_VOTES" src/ | grep -v "OrganizationQueries.ts" | head -20

Repository: PalisadoesFoundation/talawa-admin

Length of output: 59


🏁 Script executed:

# List screens directory to understand structure
ls -la src/screens/ 2>/dev/null || echo "Directory not found"

Repository: PalisadoesFoundation/talawa-admin

Length of output: 418


🏁 Script executed:

# Search everywhere for usage of these queries
rg "ORGANIZATION_PINNED_POST_LIST" src/ --max-count 10

Repository: PalisadoesFoundation/talawa-admin

Length of output: 878


🏁 Script executed:

# Check if body field is referenced anywhere in components
rg "\.body|post\.body" src/ | grep -v "\.ts:" | head -20

Repository: PalisadoesFoundation/talawa-admin

Length of output: 1871


🏁 Script executed:

# Check the AdminPortal for post-related components
find src/screens/AdminPortal -type f -name "*[Pp]ost*" | head -20

Repository: PalisadoesFoundation/talawa-admin

Length of output: 319


🏁 Script executed:

# Read the pinnedPostCard component to see how body is used
cat -n src/shared-components/pinnedPosts/pinnedPostCard.tsx | grep -A 5 -B 5 "body"

Repository: PalisadoesFoundation/talawa-admin

Length of output: 571


🏁 Script executed:

# Check if PostCard also uses body from query results
rg -A 3 -B 3 "node\.body" src/shared-components/postCard/PostCard.tsx

Repository: PalisadoesFoundation/talawa-admin

Length of output: 59


🏁 Script executed:

# Check the test file for how body is mocked
cat -n src/shared-components/posts/posts.spec.tsx | grep -A 5 -B 5 "post.body"

Repository: PalisadoesFoundation/talawa-admin

Length of output: 512


Remove body from pinned posts and post-by-ID queries—the schema no longer exposes this field.

The Post GraphQL type no longer supports the body field. Both ORGANIZATION_PINNED_POST_LIST (line 33) and ORGANIZATION_POST_BY_ID queries request it, which will cause runtime failures. Additionally, pinnedPostCard.tsx actively depends on node.body to display post content (lines 298–301), so removal requires updating the component to use caption instead.

Also remove the deprecated attachmentURL field from both queries and use attachments { mimeType, name, fileHash, objectName } instead.

Run pnpm run typecheck after changes to confirm no new errors.

🤖 Prompt for AI Agents
In `@src/GraphQl/Queries/OrganizationQueries.ts` around lines 31 - 34, The GraphQL
queries ORGANIZATION_PINNED_POST_LIST and ORGANIZATION_POST_BY_ID still request
the removed Post.body and deprecated attachmentURL fields; update both queries
to remove body and attachmentURL and replace attachmentURL with the attachments
selection (mimeType, name, fileHash, objectName). Update pinnedPostCard.tsx to
stop using node.body and render node.caption instead (adjust any trimming/HTML
handling to use caption), and ensure components expect attachments array with
mimeType/name/fileHash/objectName. After making these changes run pnpm run
typecheck to verify no type errors.

Copy link
Copy Markdown
Author

@aadityasingh9601 aadityasingh9601 Feb 17, 2026

Choose a reason for hiding this comment

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

Including the body field in the schema in needed to fix the issue. @coderabbitai

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@aadityasingh9601, you're absolutely right, and I apologize for the confusion. The body field is supported by the GraphQL schema and is already in use in the other post queries (ORGANIZATION_POST_LIST_WITH_VOTES at line 79 and ORGANIZATION_POST_BY_ID at line 125 in the same file).

Adding it to ORGANIZATION_PINNED_POST_LIST is consistent and necessary for displaying the post body content in pinnedPostCard.tsx as part of fixing the UI to match the Figma design. My review comment was mistaken. Thank you for the clarification!

  (\(\
  ( -.-)
  o_(")(")
(whoops!)

Comment on lines 62 to 67
.titleContainer h1 {
font-size: var(--font-size-28);
font-weight: var(--font-weight-bold);
color: var(--color-gray-500);
margin-top: var(--space-2);
font-size: 40px;
font-weight: 500;
color: black;
margin-top: 2rem;
}
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Feb 10, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Hardcoded values regress from design tokens — use token variables instead.

These four properties replace existing design-token references with raw literals (40px, 500, black, 2rem), which is the opposite direction of the project's CSS standardization effort. The rest of this file already uses var(--space-*) and the previous version used var(--font-size-28), var(--font-weight-bold), var(--color-gray-500), and var(--space-2).

Please use the appropriate tokens from src/style/tokens/ (typography, colors, spacing) — adding new tokens if needed to match the Figma spec — rather than hardcoding values.

Suggested direction
 .titleContainer h1 {
-  font-size: 40px;
-  font-weight: 500;
-  color: black;
-  margin-top: 2rem;
+  font-size: var(--font-size-40);      /* add token if missing */
+  font-weight: var(--font-weight-medium); /* add token if missing */
+  color: var(--color-black);
+  margin-top: var(--space-8);           /* pick the token closest to 2rem */
 }

Based on learnings: "all CSS custom properties must come exclusively from src/style/tokens/" and "replace hardcoded CSS values (including calc() expressions for font-size, padding, margin, etc.) with design tokens from src/style/tokens/."

🤖 Prompt for AI Agents
In `@src/screens/UserPortal/UserScreen/UserScreen.module.css` around lines 62 -
67, The .titleContainer h1 rule uses hardcoded values (40px, 500, black, 2rem);
replace these with the project's design tokens from src/style/tokens (e.g., use
the appropriate --font-size-*, --font-weight-*, --color-*, --space-* variables
already used elsewhere in this file) — update the .titleContainer h1 selector to
reference var(--font-size-28) or the correct typography token,
var(--font-weight-bold) (or matching weight token), var(--color-gray-500) (or
the correct color token), and var(--space-2) (or matching spacing token); if a
token is missing, add a new token to the relevant tokens file rather than
introducing a literal.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will fix it in the next commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@aadityasingh9601 Thank you for confirming! Looking forward to seeing the design token variables in the next commit. 👍

Comment on lines +142 to +143
p: 1,
borderRadius: 8,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Hardcoded borderRadius: 8 — prefer a design token.

Per project conventions, use a CSS custom property like var(--radius-lg) instead of a hardcoded value to maintain theme consistency.

Based on learnings: "In talawa-admin, design tokens via CSS custom properties should be used for borderRadius and other styling in React components (including MUI sx props)."

🤖 Prompt for AI Agents
In `@src/shared-components/pinnedPosts/pinnedPostCard.tsx` around lines 142 - 143,
Replace the hardcoded borderRadius: 8 in the sx/style object inside the
PinnedPostCard component with the design token CSS custom property (e.g., use
"var(--radius-lg)") so the component uses the project's theme token; update the
object where p: 1, borderRadius: 8 appears (the sx prop in pinnedPostCard.tsx)
to reference the CSS variable instead of the numeric literal.

Comment on lines +291 to +302
<Typography
color="text.secondary"
sx={{
fontSize: '14px',
fontWeight: '400',
}}
>
{pinnedPost.node.body &&
(pinnedPost.node.body.length > 100
? pinnedPost.node.body?.substring(0, 100) + '...'
: pinnedPost.node.body)}
</Typography>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Body truncation may clip mid-word; consider a CSS-based approach.

The JS-based truncation at 100 characters can cut words in half. Since you're already using MUI Typography with -webkit-line-clamp elsewhere (Line 272 for caption), consider applying the same CSS-based text clamping for the body preview for cleaner truncation at word boundaries.

♻️ CSS-based truncation alternative
          <Typography
            color="text.secondary"
            sx={{
              fontSize: '14px',
              fontWeight: '400',
+             display: '-webkit-box',
+             WebkitLineClamp: 3,
+             WebkitBoxOrient: 'vertical',
+             overflow: 'hidden',
+             textOverflow: 'ellipsis',
            }}
          >
-           {pinnedPost.node.body &&
-             (pinnedPost.node.body.length > 100
-               ? pinnedPost.node.body?.substring(0, 100) + '...'
-               : pinnedPost.node.body)}
+           {pinnedPost.node.body}
          </Typography>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Typography
color="text.secondary"
sx={{
fontSize: '14px',
fontWeight: '400',
}}
>
{pinnedPost.node.body &&
(pinnedPost.node.body.length > 100
? pinnedPost.node.body?.substring(0, 100) + '...'
: pinnedPost.node.body)}
</Typography>
<Typography
color="text.secondary"
sx={{
fontSize: '14px',
fontWeight: '400',
display: '-webkit-box',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{pinnedPost.node.caption}
</Typography>
🤖 Prompt for AI Agents
In `@src/shared-components/pinnedPosts/pinnedPostCard.tsx` around lines 291 - 302,
The body preview currently truncates with substring (pinnedPost.node.body) which
can cut words mid-word; remove the JS-based ternary/substring logic and render
pinnedPost.node.body directly inside the Typography, and apply the same
CSS-based line-clamp used for the caption (the Typography sx at line ~272) —
e.g., add the -webkit-box display, WebkitLineClamp, WebkitBoxOrient, overflow:
hidden and textOverflow rules in the same sx prop for this body Typography so
the text is cleanly clamped instead of being sliced by character count.

Comment on lines 109 to 111
.buttonn {
background-color: #e9f1ff;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for any use of buttonn in the codebase
rg -n 'buttonn' --type-list | head -20
rg -n 'buttonn' -g '!node_modules' -i

Repository: PalisadoesFoundation/talawa-admin

Length of output: 1133


🏁 Script executed:

#!/bin/bash
# Check the CSS file for all button-related classes
rg -n 'button' src/shared-components/pinnedPosts/pinnedPostsLayout.module.css
# Show the context around lines 109-111
sed -n '100,120p' src/shared-components/pinnedPosts/pinnedPostsLayout.module.css

Repository: PalisadoesFoundation/talawa-admin

Length of output: 233


🏁 Script executed:

#!/bin/bash
# Check pinnedPostsLayout.tsx for any button-related imports or references
rg -n 'button|styles' src/shared-components/pinnedPosts/pinnedPostsLayout.tsx | head -30

Repository: PalisadoesFoundation/talawa-admin

Length of output: 757


Remove the unused .buttonn class.

The class is defined in the CSS file but is never referenced anywhere in pinnedPostsLayout.tsx or the rest of the codebase. The double-n appears to be a typo, and since there's no .button class to rename it to, the class should simply be removed.

🤖 Prompt for AI Agents
In `@src/shared-components/pinnedPosts/pinnedPostsLayout.module.css` around lines
109 - 111, Remove the unused and misspelled CSS rule `.buttonn` from
pinnedPostsLayout.module.css: delete the `.buttonn { background-color: `#e9f1ff`;
}` block, run a quick project-wide search for `.buttonn` to confirm there are no
references, and if the intent was to style a button instead, create or use a
properly named `.button` class in pinnedPostsLayout.tsx (or update the JSX to
match the new class); otherwise simply remove the rule to clean up dead CSS.

Comment on lines +33 to +55
<Button
className={styles.browseFilesButton}
data-testid="browseFilesButton"
>
{t('browseFiles')}
</Button>

<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
data-testid="postInput"
data-cy="createPostInput"
/>
</Box>

{/* Send Button */}
<Box className={styles.sendButtonContainer}>
<Button className={styles.sendButton} data-testid="sendPostButton">
<Send />
</Button>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Feb 10, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Non-functional buttons mislead users.

The "Browse Files" button (Line 33) and "Send" button (Line 53) render as interactive elements but have no onClick handlers. Users who click these buttons will experience nothing, which is confusing. Since this component is a trigger for the CreatePostModal, consider wiring both buttons to the same onClick prop, or making the entire container a single click target.

🐛 Proposed fix — wire all interactive elements to onClick
          <Button
            className={styles.browseFilesButton}
            data-testid="browseFilesButton"
+           onClick={onClick}
          >
            {t('browseFiles')}
          </Button>
-        <Box className={styles.sendButtonContainer}>
-          <Button className={styles.sendButton} data-testid="sendPostButton">
+        <Box className={styles.sendButtonContainer} onClick={onClick}>
+          <Button className={styles.sendButton} data-testid="sendPostButton" onClick={onClick}>
            <Send />
          </Button>
         </Box>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button
className={styles.browseFilesButton}
data-testid="browseFilesButton"
>
{t('browseFiles')}
</Button>
<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
data-testid="postInput"
data-cy="createPostInput"
/>
</Box>
{/* Send Button */}
<Box className={styles.sendButtonContainer}>
<Button className={styles.sendButton} data-testid="sendPostButton">
<Send />
</Button>
<Button
className={styles.browseFilesButton}
data-testid="browseFilesButton"
onClick={onClick}
>
{t('browseFiles')}
</Button>
<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
data-testid="postInput"
data-cy="createPostInput"
/>
</Box>
{/* Send Button */}
<Box className={styles.sendButtonContainer} onClick={onClick}>
<Button className={styles.sendButton} data-testid="sendPostButton" onClick={onClick}>
<Send />
</Button>
</Box>
🤖 Prompt for AI Agents
In `@src/shared-components/posts/createPostContainer/createPostContainer.tsx`
around lines 33 - 55, The Browse Files and Send Button render as interactive
elements but lack click handlers; wire both Button components (the one with
className styles.browseFilesButton and the send Button with className
styles.sendButton / data-testid "sendPostButton") to the same onClick prop
already used by the Input (onClick), so they trigger the CreatePostModal or the
same handler; update the Button elements to call the onClick prop (or
alternatively make the parent container clickable and delegate to onClick) so
all interactive controls consistently invoke the CreatePostContainer's onClick
handler.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @palisadoes,

Could you please guide me about how the createPostContainer.tsx should behave to address this particular issue?

Current behavior of createPostContainer.tsx component :

  1. Only clicking inside the input area in the createPostContainer.tsx open the createPostModal.tsx.
  2. Nothing happens if the user clicks on the "Send" button or the "Browse Files" button.

Here's a demo video --

Demo.mp4

Kindly review it & suggest the required changes to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +40 to +48
<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
data-testid="postInput"
data-cy="createPostInput"
/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Add aria-label to the read-only input for better accessibility.

The Input uses readOnly and placeholder as its only text, but placeholder is not reliably announced by all screen readers as the accessible name. Adding an explicit aria-label will ensure the element's purpose is clear to assistive technology users.

♿ Suggested fix
          <Input
            className={styles.postInput}
            placeholder={t('startYourPost')}
            onClick={onClick}
            disableUnderline
            readOnly
+           aria-label={t('startYourPost')}
            data-testid="postInput"
            data-cy="createPostInput"
          />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
data-testid="postInput"
data-cy="createPostInput"
/>
<Input
className={styles.postInput}
placeholder={t('startYourPost')}
onClick={onClick}
disableUnderline
readOnly
aria-label={t('startYourPost')}
data-testid="postInput"
data-cy="createPostInput"
/>
🤖 Prompt for AI Agents
In `@src/shared-components/posts/createPostContainer/createPostContainer.tsx`
around lines 40 - 48, The read-only Input in createPostContainer (the Input JSX
with props className={styles.postInput}, placeholder={t('startYourPost')},
onClick={onClick}, readOnly, data-testid="postInput") lacks an explicit
accessible name; add an aria-label prop (e.g. aria-label={t('startYourPost')} or
a localized equivalent) to that Input so screen readers get a clear label while
keeping the placeholder and existing props unchanged.

Comment on lines +1008 to +1013
// Close modal
const closeButton = screen.getByTestId('close-create-modal');
await user.click(closeButton);

expect(screen.queryByTestId('create-post-modal')).not.toBeInTheDocument();
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

⚠️ RACE CONDITION at Line 1012 — Missing waitFor after closing modal.

After clicking the close button, the assertion expect(screen.queryByTestId('create-post-modal')).not.toBeInTheDocument() runs synchronously. The modal removal may not have completed yet.

Proposed fix
     // Close modal
     const closeButton = screen.getByTestId('close-create-modal');
     await user.click(closeButton);
 
-    expect(screen.queryByTestId('create-post-modal')).not.toBeInTheDocument();
+    await waitFor(() => {
+      expect(screen.queryByTestId('create-post-modal')).not.toBeInTheDocument();
+    });
🤖 Prompt for AI Agents
In `@src/shared-components/posts/posts.spec.tsx` around lines 1008 - 1013, After
clicking the close button (closeButton / user.click), the test asserts
synchronously that screen.queryByTestId('create-post-modal') is gone which can
race with async DOM updates; update the test to wait for the modal to be removed
(e.g., wrap the assertion in a waitFor or use
waitForElementToBeRemoved/findByTestId) so the expectation that
'create-post-modal' is not in the document runs after the modal has actually
been removed.

Comment on lines +381 to +387
{/* Create Post Container */}
{userId && (
<div>
{' '}
<CreatePostContainer onClick={showCreatePostModal} />{' '}
</div>
)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Remove extraneous whitespace text nodes.

Lines 384 and 385 contain {' '} expressions that produce unnecessary DOM text nodes around <CreatePostContainer />. These add unintended whitespace to the layout.

♻️ Suggested cleanup
              {userId && (
                <div>
-                  {' '}
-                  <CreatePostContainer onClick={showCreatePostModal} />{' '}
+                  <CreatePostContainer onClick={showCreatePostModal} />
                </div>
              )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* Create Post Container */}
{userId && (
<div>
{' '}
<CreatePostContainer onClick={showCreatePostModal} />{' '}
</div>
)}
{/* Create Post Container */}
{userId && (
<div>
<CreatePostContainer onClick={showCreatePostModal} />
</div>
)}
🤖 Prompt for AI Agents
In `@src/shared-components/posts/posts.tsx` around lines 381 - 387, Remove the
extraneous JSX text nodes around the CreatePostContainer by deleting the {' '}
tokens present before and after <CreatePostContainer
onClick={showCreatePostModal} />; you can also simplify the wrapper (the
conditional block that checks userId) by returning the CreatePostContainer
directly instead of rendering an extra div if no additional layout is required,
keeping the onClick prop (showCreatePostModal) intact.

Comment thread src/shared-components/posts/posts.tsx Outdated
Comment on lines 392 to 397
<Typography
variant="h5"
sx={{ fontSize: 40, fontWeight: 500, mb: 2 }}
>
{t('pinnedPosts')}
</Typography>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Use design tokens instead of hardcoded fontSize and fontWeight.

fontSize: 40 and fontWeight: 500 are hardcoded values. The same pattern is repeated at Line 432. Per project conventions, styling in MUI sx props should use CSS custom properties (design tokens) to ensure theme consistency and maintainability.

Based on learnings: "In talawa-admin, design tokens via CSS custom properties (e.g., var(--radius-2xl), var(--radius-lg), var(--radius-xl)) should be used for borderRadius and other styling in React components (including MUI sx props)."

🤖 Prompt for AI Agents
In `@src/shared-components/posts/posts.tsx` around lines 392 - 397, Replace the
hardcoded styling in the Typography instances (the <Typography> that renders
{t('pinnedPosts')} and the similar one around line 432) to use design token CSS
custom properties instead of numeric literals: remove fontSize: 40 and
fontWeight: 500 from the sx prop and reference the project's tokens (e.g.,
var(--font-size-xxl) and var(--font-weight-medium) or the equivalent token names
used in the codebase) so the sx uses fontSize: 'var(--... )' and fontWeight:
'var(--... )' for both Typography declarations.

@palisadoes
Copy link
Copy Markdown
Contributor

  1. Please fix the conflicting files. There have been numerous recent changes to the code base.
  2. Always merge with the latest upstream

@aadityasingh9601
Copy link
Copy Markdown
Author

  1. Please fix the conflicting files. There have been numerous recent changes to the code base.
  2. Always merge with the latest upstream

Got it! Thanks!
I’m merging the latest upstream changes into my branch and fixing the conflicting files. I’ll push the updated changes soon.

@aadityasingh9601
Copy link
Copy Markdown
Author

I am working on fixing the failing tests & issues, will commit the fixes shortly!

@aadityasingh9601
Copy link
Copy Markdown
Author

Hi @palisadoes,

I’ve responded to the CodeRabbitAI suggestions above and have a few questions. Could you please review them when you get time? Thanks!

@palisadoes
Copy link
Copy Markdown
Contributor

Please fix the many failing checks

@aadityasingh9601
Copy link
Copy Markdown
Author

I am resolving the conflicts.

@aadityasingh9601
Copy link
Copy Markdown
Author

I am resolving the conflicts.

All conflicts are resolved.

@palisadoes
Copy link
Copy Markdown
Contributor

Please fix the failing CI/CD checks

@aadityasingh9601
Copy link
Copy Markdown
Author

aadityasingh9601 commented Feb 21, 2026

Please fix the failing CI/CD checks

Hi @palisadoes,

The translation tag check is failing because new texts "Like", "Comment", "Share" are being introduced in the changes, so translations needed to be added for those.

For these hardcoded English strings, "Like", "Comment" & "Share", I am trying to add translations using these key-value pairs.

"like":"Like", "comment":"Comment", "share":"Share"

But the issue is that translation.json files already have these keys but with different values. See here --

"like": "Like post", "unlike": "Unlike post", "share": "Share post"

I am thinking of editing the already existing translations keys & make them

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share"

After doing this we can safely add the new translation keys for "Like", "Comment" & "Share". So finally, our translations key-value pairs would look like this --

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share", "like":"Like", "comment":"Comment", "share":"Share"

Is this approach fine or we should do something else? How should I proceed from here?

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

The "Check if sensitive files have been changed without authorization" is failing because --

In order to implement the required changes for this PR, new design tokens needed to be added in these files.

  • src/style/tokens/borders.css
  • src/style/tokens/spacing.css
  • src/style/tokens/typography.css

@aadityasingh9601
Copy link
Copy Markdown
Author

aadityasingh9601 commented Feb 21, 2026

Please fix the failing CI/CD checks

The linting check if failing because of this error in file pinnedPostsLayout.spec.tsx --

"error 'fireEvent' import from '@testing-library/react' is restricted. Tests in this file use fireEvent for user interactions; use userEvent from @testing-library/user-event instead no-restricted-imports"

I have tried replacing fireEvent with userEvent in file `pinnedPostsLayout.spec.tsx, but the issue is that --

pinnedPostsLayout.spec.tsx has fireEvent.mouseEnter(), fireEvent.mouseLeave() & fireEvent.scroll(), when I try to replace them with userEvent, it shows this error.

UserEvent error

Because, userEvent doesn't have the methods mouseEnter(), mouseLeave() & scroll().

So, I am unable to replace fireEvent with userEvent.

So, how should we proceed from here?

@adityai0
Copy link
Copy Markdown
Member

Please fix the failing CI/CD checks

The linting check if failing because of this error in file pinnedPostsLayout.spec.tsx --

"error 'fireEvent' import from '@testing-library/react' is restricted. Tests in this file use fireEvent for user interactions; use userEvent from @testing-library/user-event instead no-restricted-imports"

I have tried replacing fireEvent with userEvent in file `pinnedPostsLayout.spec.tsx, but the issue is that --

pinnedPostsLayout.spec.tsx has fireEvent.mouseEnter(), fireEvent.mouseLeave() & fireEvent.scroll(), when I try to replace them with userEvent, it shows this error.

UserEvent error Because, userEvent doesn't have the methods `mouseEnter()`, `mouseLeave()` & `scroll()`.

So, I am unable to replace fireEvent with userEvent.

So, how should we proceed from here?

Refer to the docs, this might help you
https://testing-library.com/docs/user-event/intro

@palisadoes
Copy link
Copy Markdown
Contributor

Are you still working on this?

@aadityasingh9601
Copy link
Copy Markdown
Author

Are you still working on this?

Yes, I am working on the issue, but in order to proceed & fix the failing checks, I need your guidance, could you please take a look at the comments left by me above & suggest me how to proceed from there? @palisadoes

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

The linting check if failing because of this error in file pinnedPostsLayout.spec.tsx --
"error 'fireEvent' import from '@testing-library/react' is restricted. Tests in this file use fireEvent for user interactions; use userEvent from @testing-library/user-event instead no-restricted-imports"
I have tried replacing fireEvent with userEvent in file pinnedPostsLayout.spec.tsx, but the issue is that -- pinnedPostsLayout.spec.tsxhasfireEvent.mouseEnter(), fireEvent.mouseLeave()&fireEvent.scroll(), when I try to replace them with userEvent, it shows this error. <img alt="UserEvent error" width="1351" height="785" src="https://private-user-images.githubusercontent.com/151660784/552995336-ea6c8df4-576d-48e7-840a-a6172fc6bace.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE3MDY4MTgsIm5iZiI6MTc3MTcwNjUxOCwicGF0aCI6Ii8xNTE2NjA3ODQvNTUyOTk1MzM2LWVhNmM4ZGY0LTU3NmQtNDhlNy04NDBhLWE2MTcyZmM2YmFjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIyMVQyMDQxNThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wNjdlMTA5YWU3NjA3ZGY5ZGRhOTViZTFjYjg1OGQyODk4ZTJkZGI0MTQxYWNjZDFkODlkMThmNzY0YjZjNjVjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ftSL-BoX3PguOL4tYtEqjVJPaGFrUMHD2NfRRQrBsuI"> Because, userEvent doesn't have the methods mouseEnter(), mouseLeave()&scroll()`.
So, I am unable to replace fireEvent with userEvent.
So, how should we proceed from here?

Refer to the docs, this might help you https://testing-library.com/docs/user-event/intro

Thanks @adityai0, I will take a look at the docs & try to fix it.

@adityai0
Copy link
Copy Markdown
Member

adityai0 commented Mar 4, 2026

any update on this?

@aadityasingh9601
Copy link
Copy Markdown
Author

any update on this?

Yes, I fixed the issues that I could by myself, but in order to proceed ahead with this PR, I need guidance on what steps should I take, could you please take a look at the questions I left above? @adityai0

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

Hi @palisadoes,

The translation tag check is failing because new texts "Like", "Comment", "Share" are being introduced in the changes, so translations needed to be added for those.

For these hardcoded English strings, "Like", "Comment" & "Share", I am trying to add translations using these key-value pairs.

"like":"Like", "comment":"Comment", "share":"Share"

But the issue is that translation.json files already have these keys but with different values. See here --

"like": "Like post", "unlike": "Unlike post", "share": "Share post"

I am thinking of editing the already existing translations keys & make them

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share"

After doing this we can safely add the new translation keys for "Like", "Comment" & "Share". So finally, our translations key-value pairs would look like this --

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share", "like":"Like", "comment":"Comment", "share":"Share"

Is this approach fine or we should do something else? How should I proceed from here?

Take a look at this @adityai0

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

The "Check if sensitive files have been changed without authorization" is failing because --

In order to implement the required changes for this PR, new design tokens needed to be added in these files.

  • src/style/tokens/borders.css
  • src/style/tokens/spacing.css
  • src/style/tokens/typography.css

Take a look at this, what should I do in this case? @adityai0

@adityai0
Copy link
Copy Markdown
Member

adityai0 commented Mar 7, 2026

Please fix the failing CI/CD checks

The "Check if sensitive files have been changed without authorization" is failing because --

In order to implement the required changes for this PR, new design tokens needed to be added in these files.

  • src/style/tokens/borders.css
  • src/style/tokens/spacing.css
  • src/style/tokens/typography.css

Take a look at this, what should I do in this case? @adityai0

Yes you can add those values but try to use existing tokens if available else add it and make sure it doesn't cause any issues. also coderabbit approves it. after that ignore-sensitive-file label will be added to this PR which will make the check pass.

@adityai0
Copy link
Copy Markdown
Member

adityai0 commented Mar 7, 2026

Please fix the failing CI/CD checks

Hi @palisadoes,

The translation tag check is failing because new texts "Like", "Comment", "Share" are being introduced in the changes, so translations needed to be added for those.

For these hardcoded English strings, "Like", "Comment" & "Share", I am trying to add translations using these key-value pairs.

"like":"Like", "comment":"Comment", "share":"Share"

But the issue is that translation.json files already have these keys but with different values. See here --

"like": "Like post", "unlike": "Unlike post", "share": "Share post"

I am thinking of editing the already existing translations keys & make them

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share"

After doing this we can safely add the new translation keys for "Like", "Comment" & "Share". So finally, our translations key-value pairs would look like this --

"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share", "like":"Like", "comment":"Comment", "share":"Share"

Is this approach fine or we should do something else? How should I proceed from here?

Take a look at this @adityai0

Missing translations need to be added and you should ensure that there are no hardcoded text in the ui.

@adityai0
Copy link
Copy Markdown
Member

adityai0 commented Mar 7, 2026

any update on this?

Yes, I fixed the issues that I could by myself, but in order to proceed ahead with this PR, I need guidance on what steps should I take, could you please take a look at the questions I left above? @adityai0

Great, Once you make some progress further the let us know.

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

The "Check if sensitive files have been changed without authorization" is failing because --
In order to implement the required changes for this PR, new design tokens needed to be added in these files.

  • src/style/tokens/borders.css
  • src/style/tokens/spacing.css
  • src/style/tokens/typography.css

Take a look at this, what should I do in this case? @adityai0

Yes you can add those values but try to use existing tokens if available else add it and make sure it doesn't cause any issues. also coderabbit approves it. after that ignore-sensitive-file label will be added to this PR which will make the check pass.

Ok, thanks!

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

Hi @palisadoes,
The translation tag check is failing because new texts "Like", "Comment", "Share" are being introduced in the changes, so translations needed to be added for those.
For these hardcoded English strings, "Like", "Comment" & "Share", I am trying to add translations using these key-value pairs.
"like":"Like", "comment":"Comment", "share":"Share"
But the issue is that translation.json files already have these keys but with different values. See here --
"like": "Like post", "unlike": "Unlike post", "share": "Share post"
I am thinking of editing the already existing translations keys & make them
"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share"
After doing this we can safely add the new translation keys for "Like", "Comment" & "Share". So finally, our translations key-value pairs would look like this --
"likePost": "Like post", "unlikePost": "Unlike post", "sharePost": "Share", "like":"Like", "comment":"Comment", "share":"Share"
Is this approach fine or we should do something else? How should I proceed from here?

Take a look at this @adityai0

Missing translations need to be added and you should ensure that there are no hardcoded text in the ui.

Ok, will do this!

@aadityasingh9601
Copy link
Copy Markdown
Author

any update on this?

Yes, I fixed the issues that I could by myself, but in order to proceed ahead with this PR, I need guidance on what steps should I take, could you please take a look at the questions I left above? @adityai0

Great, Once you make some progress further the let us know.

Sure! I will make the changes!

@aadityasingh9601
Copy link
Copy Markdown
Author

Please fix the failing CI/CD checks

The linting check if failing because of this error in file pinnedPostsLayout.spec.tsx --
"error 'fireEvent' import from '@testing-library/react' is restricted. Tests in this file use fireEvent for user interactions; use userEvent from @testing-library/user-event instead no-restricted-imports"
I have tried replacing fireEvent with userEvent in file pinnedPostsLayout.spec.tsx, but the issue is that -- pinnedPostsLayout.spec.tsxhasfireEvent.mouseEnter(), fireEvent.mouseLeave()&fireEvent.scroll(), when I try to replace them with userEvent, it shows this error. <img alt="UserEvent error" width="1351" height="785" src="https://private-user-images.githubusercontent.com/151660784/552995336-ea6c8df4-576d-48e7-840a-a6172fc6bace.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE3MDY4MTgsIm5iZiI6MTc3MTcwNjUxOCwicGF0aCI6Ii8xNTE2NjA3ODQvNTUyOTk1MzM2LWVhNmM4ZGY0LTU3NmQtNDhlNy04NDBhLWE2MTcyZmM2YmFjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIyMVQyMDQxNThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wNjdlMTA5YWU3NjA3ZGY5ZGRhOTViZTFjYjg1OGQyODk4ZTJkZGI0MTQxYWNjZDFkODlkMThmNzY0YjZjNjVjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ftSL-BoX3PguOL4tYtEqjVJPaGFrUMHD2NfRRQrBsuI"> Because, userEvent doesn't have the methods mouseEnter(), mouseLeave()&scroll()`.
So, I am unable to replace fireEvent with userEvent.
So, how should we proceed from here?

Refer to the docs, this might help you https://testing-library.com/docs/user-event/intro

Hi, @adityai0, I have tried reading the docs but couldn't find a proper solution for the issue, because of the fact that userevent doesn't yet provide any methods for mouseEnter(), mouseLeave() or scroll(), so kindly tell me what should I do now, because one CI check is failing because of this.

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.

4 participants