Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ba 2298 web package placeholder #222

Merged
merged 5 commits into from
Mar 18, 2025

Conversation

mathieubouhelier
Copy link
Contributor

@mathieubouhelier mathieubouhelier commented Feb 20, 2025

This PR update the placeholder with activity log changes.

Description

As a Developer, on the Baseapp Activity Log,I would like to add user profile update activities (profile picture, banner, and bio changes) to the Activity Log and create comprehensive documentation or a video tutorial on how to add new activities to the log, In order to ensure the Activity Log is more comprehensive and future developers can easily extend its functionality.

Acceptance Criteria
Profile Update Activities

Add the following user activities to the Activity Log:

Changes to the profile picture

Changes to the profile banner

Updates to the user bio

Display Activities using text per Figma

Display the new activities with the correct timestamp and in chronological order.

Given a user changes their profile picture, when the activity is logged, then it should display in the Activity Log with the appropriate format and timestamp.

Given a user updates their profile banner or bio, when the activity is logged, then it should appear in the Activity Log in chronological order with other activities.

Add the new activities to the current package template (Fork Repository)

Summary by CodeRabbit

  • New Features

    • Enhanced activity logs with additional event details, including a new events field for improved insights.
    • Introduced a utility for generating update messages based on log differences, allowing for clearer communication of changes.
    • Extended the backend schema with a new diff field, enhancing data representation capabilities for activity logs.
  • Refactor

    • Streamlined the process for generating log messages, resulting in a clearer and more efficient display logic.
  • Chores

    • Updated import paths for consistency following directory restructuring.
    • Updated the version of the package to 1.0.24 and refreshed the changelog to reflect recent changes.

Copy link

changeset-bot bot commented Feb 20, 2025

⚠️ No Changeset found

Latest commit: e51e08f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Feb 20, 2025

Walkthrough

The changes introduce a new field events in the ActivityLogsFragmentQuery, which includes an edges array containing label and diff properties. This enhancement allows for retrieving event-related information in activity logs. Additionally, a utility function getUpdateMessage is added to generate detailed log messages based on the diff. Several new types related to activity logs are defined to improve type safety, and a new diff field of type GenericScalar is added to the GraphQL schema.

Changes

File(s) Change Summary
packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts
packages/components/schema.graphql
Added new field: events (with an edges array containing label and diff) in the query fragment and a new diff: GenericScalar field in the GraphQL schema to support detailed activity logs.
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts
packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts
Introduced new types (ActivityLogs, ActivityLogEdges, ActivityLogNode, LogEvent, LogEventEdges, LogEventEdgesNode, LogDiff), replaced the getDisplayText function with an inline getLogMessage that calls the new getUpdateMessage utility for generating detailed update messages using diff.
packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterChip/types.ts
packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterComponent/types.ts
Updated import path for FetchParameters from '../common/types' to '../../../common/types'.
packages/components/modules/activity-log/web/ActivityLogComponent/index.tsx Modified import statement for DateFilterChip to reference it from the current directory.

Possibly related PRs

  • BA-2029-fe-package-baseapp-activity-log-search-by-user #180: The changes in the main PR, which add a new events field to the ActivityLogsFragmentQuery, are related to the retrieved PR as both involve modifications to the ActivityLogsFragment and its structure, specifically concerning the handling of log data.
  • BA-2169 BaseApp Activity Log - Filter by Date #200: The changes in the main PR, which add a new events field to the ActivityLogsFragmentQuery, are related to the retrieved PR as both involve modifications to the ActivityLogsFragment and the handling of activity log data, specifically with the introduction of date filtering logic that utilizes the createdFrom and createdTo arguments.
  • BA-2116 System messages #186: The changes in the main PR, which add a new events field to the ActivityLogsFragmentQuery, are related to the modifications in the retrieved PR that introduce a messageType field to the node object in the MessagesListFragment, as both involve enhancements to the data structures used in their respective GraphQL queries.

Suggested labels

needs review

Suggested reviewers

  • anicioalexandre
  • deboracosilveira
  • priscilladeroode

Poem

In a burrow deep and bright,
I hopped through logs with pure delight.
New fields and types, oh what a sight!
Update messages that shine so clear,
A rabbit’s cheer, now rendered near! 🐰

Hoppity changes, snug and light.

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterComponent/types.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterChip/types.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
  • 5 others

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @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.

@mathieubouhelier mathieubouhelier force-pushed the BA-2298-web-package-placeholder branch 3 times, most recently from e35e1c1 to 3058142 Compare February 24, 2025 15:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts (1)

10-27: Add JSDoc comments to improve code documentation.

The interfaces are well-structured but would benefit from documentation explaining their purpose and usage.

Here's a suggested improvement:

+/**
+ * Represents the changes made in a log event
+ */
 export interface LogDiff {
   image?: string[]
   banner_image?: string[]
   biography?: string[]
   [key: string]: any
 }

+/**
+ * Represents a single log event with its label and associated changes
+ */
 export interface LogEvent {
   node: {
     label: string
     diff?: LogDiff
   }
 }

+/**
+ * Represents a log node containing the action type and related events
+ */
 export interface LogNode {
   verb: string
   events: { edges: LogEvent[] }
 }
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (1)

37-39: Consider enhancing visual presentation for profile updates.

While the text display meets the basic requirement, consider adding visual indicators (icons, different colors) to distinguish profile updates from other activities, making them more noticeable in the activity log.

Example enhancement:

 <Typography 
   ml="30px" 
   lineHeight="22px" 
   color={theme.palette.text.secondary} 
+  sx={{
+    display: 'flex',
+    alignItems: 'center',
+    '& svg': { marginRight: 1 }
+  }}
   variant="body2"
 >
+  {diff?.image || diff?.banner_image || diff?.biography ? (
+    <PersonIcon fontSize="small" color="primary" />
+  ) : null}
   {displayText}
 </Typography>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ebcd7a6 and 3058142.

📒 Files selected for processing (5)
  • packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (2 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts (1 hunks)
  • packages/components/schema.graphql (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and Lint Packages
  • GitHub Check: Component Test Packages
🔇 Additional comments (3)
packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts (1)

23-30: LGTM! The events field is well-structured.

The addition of the events field with edges array containing label and diff properties aligns well with the PR objectives to enhance activity logging for user profile updates. The structure follows GraphQL best practices and properly integrates with the connection pattern.

packages/components/schema.graphql (1)

15-15: LGTM! The diff field is appropriately typed.

The addition of the diff field using GenericScalar type is a good choice as it provides flexibility to store various data types needed for different profile update activities.

packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (1)

19-27: LGTM! Well-structured changes for handling profile updates.

The changes effectively support the new activity logging requirements:

  • Early return for robustness
  • Clean abstraction for message generation
  • Safe access to nested diff data

@anicioalexandre anicioalexandre added the needs changes PR was reviewed, and changes are required. label Mar 12, 2025
@mathieubouhelier mathieubouhelier force-pushed the BA-2298-web-package-placeholder branch from 3058142 to fc62d1b Compare March 18, 2025 08:34
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (1)

26-27: Extracting first diff edge.

Fetching the first edge’s diff is suitable for single-event logs. Consider handling multiple edges if needed.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3058142 and fc62d1b.

📒 Files selected for processing (5)
  • packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (2 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts (1 hunks)
  • packages/components/schema.graphql (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts
  • packages/components/schema.graphql
  • packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts
🧰 Additional context used
🧬 Code Definitions (1)
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (1)
packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts (1) (1)
  • getUpdateMessage (1:22)
🔇 Additional comments (7)
packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (4)

5-6: Imports look good.

Bringing in getUpdateMessage and LogDiff is consistent with the new activity log flow.


19-19: Early return for missing verb.

This guard prevents rendering null logs. Good approach.


21-23: Dynamic log message generation.

The getLogMessage function is a concise way to handle diffs with fallback to verbMapping.


38-38: Display text final usage.

Correctly renders the computed message in the UI.

packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts (3)

3-4: GraphQL import usage.

Switching to GraphQL-generated types is best practice for consistency.


5-9: New type definitions (ActivityLogs, ActivityLogEdges, ActivityLogNode, LogEvent).

Good alignment with the updated query fragment, ensuring strong type safety.


10-12: Further type definitions (LogEventEdges, LogEventEdgesNode, LogDiff).

Clear typed approach for handling diff properties.

@mathieubouhelier mathieubouhelier force-pushed the BA-2298-web-package-placeholder branch from 203a7b4 to e51e08f Compare March 18, 2025 18:43
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/CHANGELOG.md (1)

3-7: Clarify Activity Log Entry Description

The new version entry for 1.0.24 currently states “Add user activities to the Activity Log.” To improve clarity and traceability, please consider explicitly mentioning that the update logs profile picture changes, profile banner updates, and user bio modifications in the activity log. This additional detail will help future developers understand the scope of the changes at a glance.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 203a7b4 and e51e08f.

📒 Files selected for processing (10)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterChip/types.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterComponent/types.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx (2 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/index.tsx (1 hunks)
  • packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/components/package.json
🚧 Files skipped from review as they are similar to previous changes (8)
  • packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterChip/types.ts
  • packages/components/modules/activity-log/web/ActivityLogComponent/DateFilterComponent/types.ts
  • packages/components/modules/activity-log/web/ActivityLogComponent/index.tsx
  • packages/components/schema.graphql
  • packages/components/modules/activity-log/web/ActivityLogComponent/utils.ts
  • packages/components/modules/activity-log/common/graphql/queries/ActivityLogsFragment.ts
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/index.tsx
  • packages/components/modules/activity-log/web/ActivityLogComponent/LogItem/types.ts
🔇 Additional comments (1)
packages/components/CHANGELOG.md (1)

8-9: Verify Dependency Update Information

The changelog notes an updated dependency for @baseapp-frontend/components. Please verify that the version bump aligns with the patch's impact and that all corresponding updates or tests have been completed. This will ensure consistency and prevent potential integration issues across the project.

@anicioalexandre anicioalexandre merged commit d49b504 into master Mar 18, 2025
7 of 8 checks passed
@anicioalexandre anicioalexandre deleted the BA-2298-web-package-placeholder branch March 18, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changes PR was reviewed, and changes are required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants