Skip to content

Feedbacks - #87

Merged
dev-rathore merged 5 commits into
masterfrom
dev
Jan 30, 2025
Merged

dev-rathore merged 5 commits into
masterfrom
dev

Conversation

@dev-rathore

@dev-rathore dev-rathore commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added clipboard functionality to copy collaboration links
    • Introduced text truncation for descriptions and about sections
    • Enhanced address autocomplete for collaboration creation
  • Improvements

    • Refined notification system with more structured notifications
    • Updated budget display with consistent currency representation
    • Improved real-time updates for applications and proposals
  • Bug Fixes

    • Simplified location input handling in collaboration creation
    • Adjusted map interaction and centering behavior
  • Chores

    • Updated dependencies, including clipboard and autocomplete libraries
    • Downgraded expo-notifications version

Manan-Sharma-5 and others added 4 commits January 30, 2025 18:35
* feedbacks

* feedbacks

* address autocomplete for web

* map on web implementation
@dev-rathore dev-rathore self-assigned this Jan 30, 2025
@coderabbitai

coderabbitai Bot commented Jan 30, 2025 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@dev-rathore has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

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

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

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

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

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 21789ba and 29abb50.

📒 Files selected for processing (1)
  • shared-uis (1 hunks)

Walkthrough

This pull request introduces several enhancements across multiple components, focusing on notification management, text truncation, and UI improvements. Key changes include adding a createNotification method, implementing clipboard functionality, introducing a new AddressAutocomplete component, and standardizing currency display. The modifications span various files, improving code organization, user experience, and notification handling without fundamentally altering the application's core functionality.

Changes

File Change Summary
components/BottomSheetActions.tsx Added clipboard functionality, updated notification handling with createNotification
components/card/collaboration-details/application-card.tsx Implemented text truncation for application messages
components/card/collaboration-details/invitation-card.tsx Added text truncation for profile content
components/channel/channel-list.tsx Removed group addition functionality
components/collaboration-card/card-components/CollaborationStats.tsx Added currency constant for budget display
components/collaboration/create-collaboration/AddressAutocomplete.tsx New component for address autocomplete functionality
components/create-collaboration/screen-two.tsx Replaced GooglePlacesAutocomplete with AddressAutocomplete
contexts/notification-context.provider.tsx Added createNotification method, refined notification handling
package.json Added expo-clipboard and react-google-autocomplete dependencies

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant NotificationContext
    participant Firestore

    User->>Component: Trigger Notification
    Component->>NotificationContext: createNotification()
    NotificationContext->>Firestore: Add Notification Document
    NotificationContext->>Component: Notification Created
    Component->>NotificationContext: sendNotification()
    NotificationContext->>User: Notification Sent
Loading

Possibly related PRs

Suggested reviewers

  • Manan-Sharma-5

Poem

🐰 A Rabbit's Code Review Delight

Notifications dance with newfound might,
Clipboard magic, truncated text so bright,
Components refactored, clean and light,
Our code hops forward with pure delight!

Hop hop hooray! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (13)
components/card/collaboration-details/invitation-card.tsx (1)

97-99: Consider adding visual indication for truncated text.

The implementation looks good and matches the truncation length used in other cards. Since the text is truncated and clickable (wrapped in Pressable), consider adding a visual indicator (e.g., ellipsis or "Read more" link) when text is actually truncated.

 <CardDescription
-  text={truncateText(data.profile?.content?.about || "", 160)}
+  text={`${truncateText(data.profile?.content?.about || "", 160)}${
+    (data.profile?.content?.about?.length || 0) > 160 ? ' <a href="#">Read more</a>' : ''
+  }`}
 />
components/menu/index.tsx (1)

57-57: Extract magic number and improve null handling.

While the implementation is good, consider these improvements:

  1. Extract the truncation length (120) to a constant for better maintainability.
  2. Add null coalescing for better error handling.
+const BRAND_ABOUT_MAX_LENGTH = 120;
+
 // In the component:
-{truncateText(selectedBrand?.profile?.about, 120)}
+{truncateText(selectedBrand?.profile?.about ?? "", BRAND_ABOUT_MAX_LENGTH)}
types/Notification.ts (1)

8-15: Consider tightening type definitions
The optional data?: { [key: string]: any } property enables flexibility but reduces type safety. If you have known fields for notifications, consider a stricter schema for better clarity and maintainability.

components/map/index.tsx (1)

23-29: Minimize redundant map re-centering and manage callback dependencies

  1. Calling both setCenter and panTo on line 23 can be redundant; consider using only one for a smoother user experience.
  2. If you intend to recalculate the callback when location changes, ensure that updating location does not cause excessive re-renders.
  3. Specifying both center and defaultCenter can be redundant. Typically, center takes precedence if provided.

Refactor example:

- event.map?.setCenter(event.detail.latLng as any);
  event.map?.panTo(event.detail.latLng as any);

Use either setCenter or panTo consistently, or handle them conditionally to avoid conflicting animations.

Also applies to: 33-35, 41-41, 43-44, 46-46, 48-52

components/collaboration-card/card-components/CollaborationStats.tsx (1)

65-66: Consider improving the currency format.

The current format ${CURRENCY}. ${value} includes a period after the currency which might look unconventional. Consider removing the period for a cleaner display:

-            ? `${CURRENCY}. ${props.budget.min}`
-            : `${CURRENCY}. ${props.budget.min} - ${CURRENCY}. ${props.budget.max}`
+            ? `${CURRENCY} ${props.budget.min}`
+            : `${CURRENCY} ${props.budget.min} - ${CURRENCY} ${props.budget.max}`
contexts/notification-context.provider.tsx (1)

27-31: Consider using an enum for userType.

The userType parameter would benefit from being more strictly typed using an enum to prevent potential errors from typos or invalid values.

enum UserType {
  MANAGERS = "managers",
  USERS = "users"
}

createNotification: (
  userId: string,
  notification: INotifications,
  userType: UserType = UserType.MANAGERS,
) => Promise<void>;
components/collaboration/create-collaboration/AddressAutocomplete.tsx (3)

42-42: Consider using a more specific type for the web ref.

The web ref is typed as any which loses type safety. Consider using the correct type from the react-google-autocomplete library.

-const mapInputRefWeb = useRef<any>(null);
+const mapInputRefWeb = useRef<HTMLInputElement>(null);

74-74: Add type assertion for location type.

The type assertion as string could be replaced with proper type checking to ensure type safety.

-type: collaboration.location?.type as string,
+type: typeof collaboration.location?.type === 'string' ? collaboration.location.type : 'Remote',

87-94: Consider extracting shared styles.

The style object is duplicated between web and native implementations. Consider extracting it into a shared constant.

+const sharedStyles = (theme: Theme) => ({
+  backgroundColor: Colors(theme).background,
+  borderRadius: 4,
+  borderColor: Colors(theme).primary,
+  borderWidth: 1,
+  color: Colors(theme).text,
+});

-style={{
-  backgroundColor: Colors(theme).background,
-  padding: 10,
-  borderRadius: 4,
-  borderColor: Colors(theme).primary,
-  borderWidth: 1,
-  color: Colors(theme).text,
-}}
+style={{
+  ...sharedStyles(theme),
+  padding: 10,
+}}
hooks/request/use-applications.tsx (1)

109-122: Consider consolidating notification data.

The notification data is duplicated between createNotification and sendNotification calls. Consider extracting the shared data into a constant.

+const notificationData = {
+  title: "Application Accepted",
+  description: `Your application for ${data.collaboration.name} has been accepted`,
+  data: {
+    collaborationId: data.collaboration.id,
+  },
+};

createNotification(
  influencerApplication.application.userId,
  {
-    data: {
-      collaborationId: data.collaboration.id,
-    },
-    description: `Your application for ${data.collaboration.name} has been accepted`,
+    ...notificationData,
    isRead: false,
    timeStamp: Date.now(),
-    title: "Application Accepted",
    type: "application-accepted",
  },
  "users"
);

sendNotification(
  {
    users: [influencerApplication.application.userId],
  },
  {
-    data: {
-      collaborationId: influencerApplication.application.collaborationId,
-    },
    notification: {
-      title: "Application Accepted",
-      description: `Your application for ${data.collaboration.name} has been accepted`,
+      ...notificationData
    },
  },
);
components/create-collaboration/screen-one.tsx (1)

59-70: Consider adding currency formatting utility.

While using the CURRENCY constant improves consistency, consider creating a utility function for currency formatting that handles all cases.

+const formatCurrency = (amount: number) => `${CURRENCY} ${convertToKUnits(amount)}`;

-return `${CURRENCY}. ${convertToKUnits(Math.max(collaboration.budget?.min, collaboration.budget?.max))}`;
+return formatCurrency(Math.max(collaboration.budget?.min || 0, collaboration.budget?.max || 0));

-return `${CURRENCY}. ${convertToKUnits(collaboration.budget?.min || 0)}`;
+return formatCurrency(collaboration.budget?.min || 0);

-return `${CURRENCY}.  ${convertToKUnits(collaboration.budget?.min || 0)}-${convertToKUnits(collaboration.budget?.max || 500)}`;
+return `${formatCurrency(collaboration.budget?.min || 0)}-${formatCurrency(collaboration.budget?.max || 500)}`;
components/BottomSheetActions.tsx (1)

78-102: Consider consolidating notification calls to avoid duplicate messages.

The code currently sends two notifications for the same event:

  1. createNotification for storing in Firestore
  2. sendNotification for push notification

This could lead to duplicate notifications for users.

Consider consolidating these into a single method that handles both storage and push notification:

-          createNotification(
-            cardId.influencerID,
-            {
-              data: {
-                collaborationId: data.collaboration.id,
-              },
-              description: `Your application for ${data.collaboration.name} has been accepted`,
-              isRead: false,
-              timeStamp: Date.now(),
-              title: "Application Accepted",
-              type: "application-accepted",
-
-            },
-            "users"
-          );
-
-          sendNotification(
-            {
-              users: [cardId.influencerID],
-            },
-            {
-              notification: {
-                title: "Application Accepted",
-                description: `Your application for ${data.collaboration.name} has been accepted`,
-              },
-            },
-          );
+          // Single method to handle both storage and push notification
+          const notificationData = {
+            title: "Application Accepted",
+            description: `Your application for ${data.collaboration.name} has been accepted`,
+            data: {
+              collaborationId: data.collaboration.id,
+            },
+            type: "application-accepted",
+          };
+          
+          await handleNotification(cardId.influencerID, notificationData);
components/collaboration/collaboration-details/OverviewTabContent.tsx (1)

418-419: Empty callback functions should include TODO comments.

The empty callback functions onMapRegionChange and onFormattedAddressChange might need implementation in the future.

Consider adding TODO comments to explain why these are empty:

-                onMapRegionChange={(region) => { }}
-                onFormattedAddressChange={(address) => { }}
+                onMapRegionChange={(region) => { /* TODO: Implement map region change handler */ }}
+                onFormattedAddressChange={(address) => { /* TODO: Implement address change handler */ }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 62b379b and 21789ba.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • components/BottomSheetActions.tsx (4 hunks)
  • components/card/collaboration-details/application-card.tsx (2 hunks)
  • components/card/collaboration-details/invitation-card.tsx (2 hunks)
  • components/channel/channel-list.tsx (1 hunks)
  • components/collaboration-card/card-components/CollaborationStats.tsx (2 hunks)
  • components/collaboration/collaboration-details/OverviewTabContent.tsx (5 hunks)
  • components/collaboration/create-collaboration/AddressAutocomplete.tsx (1 hunks)
  • components/collaboration/create-collaboration/CreateCollaborationMap.tsx (1 hunks)
  • components/create-collaboration/index.tsx (0 hunks)
  • components/create-collaboration/screen-one.tsx (2 hunks)
  • components/create-collaboration/screen-two.tsx (3 hunks)
  • components/map/index.tsx (1 hunks)
  • components/menu/index.tsx (2 hunks)
  • components/proposals/Applications.tsx (2 hunks)
  • components/ui/card/secondary/card-description.tsx (1 hunks)
  • contexts/notification-context.provider.tsx (5 hunks)
  • hooks/request/use-applications.tsx (3 hunks)
  • package.json (3 hunks)
  • styles/CollaborationDetails.styles.tsx (1 hunks)
  • types/Notification.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • components/create-collaboration/index.tsx
🔇 Additional comments (13)
styles/CollaborationDetails.styles.tsx (1)

42-42: Great improvement to text readability!

The addition of lineHeight: 22 creates optimal spacing for the 14px font size (approximately 1.57x ratio), which enhances text readability and visual comfort.

components/ui/card/secondary/card-description.tsx (1)

40-40: Style change looks good, but verify HTML rendering with truncated content.

The marginTop addition provides consistent spacing. However, since this component uses RenderHTML and the text prop is being truncated in parent components, ensure that the truncation doesn't break HTML tags, which could lead to rendering issues.

Run this script to check for potential HTML tag truncation issues:

✅ Verification successful

HTML truncation implementation is safe for this use case

The marginTop style change is good, and after analyzing the codebase:

  • Content being rendered comes from controlled sources (profile data)
  • Truncation happens at generous lengths (120-160 characters)
  • RenderHTML component is resilient to malformed HTML and provides fallback rendering
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for HTML tags in the truncated text to verify proper handling
rg -l '<[^>]+>' | xargs rg 'truncateText.*?["`].*?<.*?>'

Length of output: 58


Script:

#!/bin/bash
# Find truncation implementation and HTML content handling
echo "=== Searching for truncation implementations ==="
rg -A 3 "truncate.*Text|truncate.*Html" 

echo -e "\n=== Searching for RenderHTML usage ==="
rg -A 3 "RenderHTML|renderHtml"

echo -e "\n=== Searching for HTML content preparation ==="
rg -A 3 "html.*content|HTML.*content"

Length of output: 7616

components/card/collaboration-details/application-card.tsx (1)

94-94: Implementation is consistent with invitation card.

The truncation implementation matches the invitation card, which is good for consistency. Consider applying the same visual indication for truncated text as suggested for the invitation card.

components/proposals/Applications.tsx (2)

6-6: Importing router
No issues found. Good job integrating router for navigation.


8-8: Inclusion of onSnapshot
Adopting the Firestore real-time listener (onSnapshot) is an excellent move for live updates.

components/channel/channel-list.tsx (1)

12-12: LGTM! Clean removal of unused group functionality.

The cleanup of unused imports and state management improves code maintainability while preserving the core channel listing and search functionality.

components/collaboration/create-collaboration/CreateCollaborationMap.tsx (1)

75-78: LGTM! Improved type safety in map region handling.

The explicit construction of the location object with latitude and longitude properties ensures type safety and prevents potential undefined values.

contexts/notification-context.provider.tsx (1)

Line range hint 18-41: Standardize notification types.

The codebase is mixing INotifications and Notification types. Consider consolidating these into a single type to improve consistency.

Let's verify the usage of these types across the codebase:

components/create-collaboration/screen-two.tsx (1)

232-236: LGTM! Clean integration of the new AddressAutocomplete component.

The implementation correctly passes all required props and maintains the existing functionality.

components/BottomSheetActions.tsx (2)

41-44: LGTM! Notification context usage is properly structured.

The destructuring of notification context methods is clean and follows best practices.


276-285: Verify the collaboration link format.

The hardcoded URL format https://creators.trendly.pro/collaboration/${cardId} might need verification to ensure it matches your production environment.

✅ Verification successful

The collaboration link format is correctly implemented ✅

The URL format https://creators.trendly.pro/collaboration/${cardId} is consistent with the application's domain structure, where different subdomains serve specific purposes (creators for collaboration features, be for backend, brands for brand-specific features).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other instances of collaboration URLs to verify format consistency
rg -g '!*.{json,md}' "creators\.trendly\.pro/collaboration" .

Length of output: 172


Script:

#!/bin/bash
# Search for environment files and URL configurations
fd -e env -e config.ts -e config.js

# Search for any trendly.pro URLs
rg -g '!*.{json,md}' "trendly\.pro"

# Search for URL utility functions or constants
rg -g '!*.{json,md}' -i "(baseUrl|apiUrl|BASE_URL|API_URL|const.*url)"

Length of output: 2860

components/collaboration/collaboration-details/OverviewTabContent.tsx (1)

320-331: LGTM! Currency display is properly standardized.

The implementation correctly handles both single value and range displays using the CURRENCY constant.

package.json (1)

47-47: Verify dependency version compatibility with Expo 51.

The project uses Expo 51.0.21, but some dependency versions might need verification:

  1. expo-notifications downgrade to 0.28.19 might be incompatible
  2. expo-clipboard 7.0.1 and react-google-autocomplete 2.7.4 need version compatibility check

Also applies to: 57-57, 67-67

✅ Verification successful

All dependency versions are compatible with Expo SDK 51

  • expo-clipboard@7.0.1 is compatible (patch version update from 7.0.0)
  • expo-notifications@0.28.19 is compatible (stable version within 0.28.x range)
  • react-google-autocomplete version is independent of Expo SDK as it's not an Expo package
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check Expo compatibility matrix for these packages
curl -s https://raw.githubusercontent.com/expo/expo/sdk-51/packages/expo/bundledNativeModules.json | jq '.[] | select(.name | contains("clipboard") or contains("notifications"))'

Length of output: 247


Script:

#!/bin/bash
# Check Expo SDK 51 dependencies
curl -s https://raw.githubusercontent.com/expo/expo/sdk-51/packages/expo/package.json | jq '.dependencies["expo-clipboard"], .dependencies["expo-notifications"]'

# Check expo-clipboard package
curl -s https://raw.githubusercontent.com/expo/expo/main/packages/expo-clipboard/package.json | jq '.version'

# Check expo-notifications package
curl -s https://raw.githubusercontent.com/expo/expo/main/packages/expo-notifications/package.json | jq '.version'

Length of output: 414


Script:

#!/bin/bash
# Check expo-clipboard README for compatibility info
curl -s https://raw.githubusercontent.com/expo/expo/sdk-51/packages/expo-clipboard/README.md

# Check expo-notifications README for compatibility info
curl -s https://raw.githubusercontent.com/expo/expo/sdk-51/packages/expo-notifications/README.md

# Check SDK 51 release notes
curl -s https://raw.githubusercontent.com/expo/expo/sdk-51/CHANGELOG.md

Length of output: 79052


Script:

#!/bin/bash
# Check Expo SDK 51 documentation for these packages
curl -s "https://docs.expo.dev/versions/v51.0.0/sdk/clipboard/"
curl -s "https://docs.expo.dev/versions/v51.0.0/sdk/notifications/"

Length of output: 65667

Comment thread components/proposals/Applications.tsx Resolved
@dev-rathore
dev-rathore merged commit 50e3ce7 into master Jan 30, 2025
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.

2 participants