Skip to content

feat(dashboards): add social listening sidebar entry for ed persona (LFXV2-1689)#792

Merged
audigregorie merged 13 commits into
mainfrom
feat/LFXV2-1689-pcc-social-listening
May 28, 2026
Merged

feat(dashboards): add social listening sidebar entry for ed persona (LFXV2-1689)#792
audigregorie merged 13 commits into
mainfrom
feat/LFXV2-1689-pcc-social-listening

Conversation

@audigregorie
Copy link
Copy Markdown
Contributor

Summary

This pull request updates the sidebar menu for users with the executive-director persona in the MainLayoutComponent. The main change is the dynamic construction of the "Metrics" section, which now includes an additional "Social Listening" menu item when a foundation is selected, and refactors how the metrics items are defined.

Sidebar menu improvements for executive directors:

  • Dynamically builds the metricsItems array to include "Health Metrics" and "Marketing Impact" links, and conditionally adds a "Social Listening" link (which opens in a new tab) if a foundation is selected. (apps/lfx-one/src/app/layouts/main-layout/main-layout.component.ts)
  • Refactors the "Metrics" sidebar section to use the new metricsItems array, replacing the previous hardcoded items. (apps/lfx-one/src/app/layouts/main-layout/main-layout.component.ts)

…FXV2-1689)

- refactor metrics items into a local array to enable conditional append
- add social listening entry with pcc deep-link url when foundation uid is present
- hide entry when no foundation is selected to avoid broken deep links
- reading selectedFoundation() inside computed auto-wires reactive updates on foundation switch

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
Copilot AI review requested due to automatic review settings May 26, 2026 19:28
@audigregorie audigregorie requested a review from a team as a code owner May 26, 2026 19:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a backend endpoint and client method to fetch a project's Salesforce SFID, exposes that SFID via ProjectContextService as a signal, and uses the signal to conditionally append a Social Listening external link to the executive-director Metrics menu.

Changes

Metrics Menu Enhancement + SFID lookup

Layer / File(s) Summary
Projects SFID API endpoint
apps/lfx-one/src/server/routes/projects.route.ts, apps/lfx-one/src/server/controllers/project.controller.ts
Adds GET /projects/:uid/sfid route and ProjectController.getProjectSfid which validates uid, resolves an SFID with the server-side project service, logs, and returns { sfid }.
Client ProjectService sfid method
apps/lfx-one/src/app/shared/services/project.service.ts
Adds getProjectSfid(uid) that GETs /api/projects/{uid}/sfid, maps response.sfid to `string
ProjectContextService selectedFoundationSfid signal
apps/lfx-one/src/app/shared/services/project-context.service.ts
Adds selectedFoundationSfid Signal derived from selectedFoundation; when a foundation uid exists it calls projectService.getProjectSfid(uid), otherwise yields null (initialized with toSignal(..., { initialValue: null })) and uses startWith(null) while resolving.
Conditional Social Listening link in Metrics menu
apps/lfx-one/src/app/layouts/main-layout/main-layout.component.ts
Introduces metricsItems array for executive-director Metrics that always contains "Health Metrics" and "Marketing Impact" and conditionally appends a "Social Listening" external link when selectedFoundationSfid() is present (URL built from environment.urls.pcc with trailing-slash normalization); Metrics now uses items: metricsItems.

Sequence Diagram(s)

sequenceDiagram
  participant MainLayout
  participant ProjectContextService
  participant ProjectService
  participant ProjectsRoute
  participant ProjectController

  MainLayout->>ProjectContextService: read selectedFoundationSfid()
  ProjectContextService->>ProjectService: getProjectSfid(uid)
  ProjectService->>ProjectsRoute: HTTP GET /api/projects/:uid/sfid
  ProjectsRoute->>ProjectController: getProjectSfid(req)
  ProjectController->>ProjectService: projectService.getProjectSfidByUid(uid)
  ProjectController-->>ProjectService: returns sfid
  ProjectService-->>ProjectContextService: returns sfid (or null)
  ProjectContextService-->>MainLayout: signal emits sfid (or null)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a dynamic social listening sidebar entry for the executive-director persona in the dashboard layouts.
Description check ✅ Passed The description is directly related to the changeset, explaining the refactoring of the Metrics section and the addition of the conditional Social Listening menu item for executive directors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/LFXV2-1689-pcc-social-listening

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Foundation-lens sidebar navigation for the executive-director persona by refactoring the “Metrics” section to be built dynamically and adding a conditional “Social Listening” entry (opening an external PCC report in a new tab) when a foundation is selected.

Changes:

  • Builds a metricsItems array for EDs and conditionally appends a “Social Listening” external link using the selected foundation UID.
  • Refactors the “Metrics” section to render from metricsItems instead of inline hardcoded items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/lfx-one/src/app/layouts/main-layout/main-layout.component.ts Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

🚀 Deployment Status

Your branch has been deployed to: https://ui-pr-792.dev.v2.cluster.linuxfound.info

Deployment Details:

  • Environment: Development
  • Namespace: ui-pr-792
  • ArgoCD App: ui-pr-792

The deployment will be automatically removed when this PR is closed.

- Register GET /api/projects/:uid/sfid route, mounted before documents block to keep the /:uid/<verb> family clustered
- Add ProjectController.getProjectSfid wrapping the existing NATS-backed getProjectSfidByUid helper
- Return { sfid: string | null } with HTTP 200 on lookup failure so callers can hide affordances uniformly

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
- Adopt validateUidParameter (canonical helper per server-helpers.md) to bring getProjectSfid in line with every other /:uid endpoint in this controller
- Closes Important finding from post-commit code review on 04c2708 (defense-in-depth consistency gap)

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
- add getProjectSfid(uid) on client ProjectService hitting /api/projects/:uid/sfid
- unwrap { sfid } response to string | null at the rxjs layer
- catchError to of(null) so caller hides cleanly on lookup failure
- import map from rxjs alphabetically alongside catchError

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
- wrap uid in encodeURIComponent on /api/projects/:uid/sfid URL
- console.error before of(null) so silent 401s/5xx surface in console
- aligns with sibling list GETs in project.service.ts that log on failure

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
…V2-1689)

- add selectedFoundationSfid: Signal<string | null> to ProjectContextService
- initializer mirrors initCanWrite shape via toObservable + switchMap
- short-circuits to of(null) when no foundation selected (no http call)
- switchMap cancels in-flight lookups on foundation switch

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
…1689)

- swap selectedFoundation()?.uid for selectedFoundationSfid() signal
- compose PCC URL with /project/<sfid>/reports/social-listening
- hide sidebar entry until sfid resolves (no broken UUID-based URL)
- no behaviour change to ED gate or sibling Metrics items

Signed-off-by: Audi Young <audi.mycloud@gmail.com>
Copilot AI review requested due to automatic review settings May 27, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread apps/lfx-one/src/app/shared/services/project-context.service.ts Outdated
Copilot AI review requested due to automatic review settings May 27, 2026 20:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread apps/lfx-one/src/server/controllers/project.controller.ts
Signed-off-by: Audi Young <audi.mycloud@gmail.com>
Signed-off-by: Audi Young <audi.mycloud@gmail.com>
Copilot AI review requested due to automatic review settings May 28, 2026 15:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread apps/lfx-one/src/server/controllers/project.controller.ts
@audigregorie audigregorie merged commit efb80ae into main May 28, 2026
12 checks passed
@audigregorie audigregorie deleted the feat/LFXV2-1689-pcc-social-listening branch May 28, 2026 15:53
@github-actions
Copy link
Copy Markdown

🧹 Deployment Removed

The deployment for PR #792 has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants