Skip to content

fix(companion): event type links for org user#5

Open
tomerqodo wants to merge 7 commits intocoderabbit_full_base_fixcompanion_event_type_links_for_org_user_pr5from
coderabbit_full_head_fixcompanion_event_type_links_for_org_user_pr5
Open

fix(companion): event type links for org user#5
tomerqodo wants to merge 7 commits intocoderabbit_full_base_fixcompanion_event_type_links_for_org_user_pr5from
coderabbit_full_head_fixcompanion_event_type_links_for_org_user_pr5

Conversation

@tomerqodo
Copy link
Copy Markdown

@tomerqodo tomerqodo commented Jan 29, 2026

Benchmark PR from agentic-review-benchmarks#5

Summary by CodeRabbit

Release Notes

  • Style
    • Updated accent colors from blue to black for headers, icons, and labels throughout the app
    • Removed bottom border from profile header
    • Improved component alignment and layout consistency across UI elements

dhairyashiil and others added 7 commits January 25, 2026 12:01
Addresses Cubic AI review feedback (confidence 9/10): The username was
hardcoded to 'username' but still used by BasicsTab as a fallback for
URL display when bookingUrl is unavailable. This restores the useEffect
that fetches the actual username from CalComAPIService.getUsername().

Co-Authored-By: unknown <>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

The pull request introduces a bookingUrl field to EventType interfaces throughout the codebase and updates components to use this pre-computed URL directly instead of generating links via CalComAPIService. Concurrently, UI color styling is updated from blue to black for active states, and layout properties are refined with explicit flexbox alignment across multiple components.

Changes

Cohort / File(s) Summary
Color Theme Updates
companion/app/(tabs)/(availability)/availability-detail.tsx, companion/app/(tabs)/(bookings)/index.ios.tsx, companion/app/(tabs)/(bookings)/index.tsx, companion/components/Header.tsx
Icon and label colors changed from blue (#007AFF) to black (#000000) for active/selected states across menus, filters, and headers.
Profile Header Styling
companion/app/profile-sheet.ios.tsx, companion/app/profile-sheet.tsx
Removed bottom border from profile header container by removing border-b border-gray-200 className.
Layout Alignment Refinements
companion/components/event-type-detail/tabs/AdvancedTab.tsx, companion/components/event-type-detail/tabs/LimitsTab.tsx, companion/components/event-type-detail/tabs/RecurringTab.tsx, companion/app/(tabs)/(event-types)/event-type-detail.tsx
Added explicit flexDirection: "row" and alignItems: "center" (and justifyContent: "center" for switches) to ensure consistent horizontal layout and vertical alignment across row containers and switch elements.
bookingUrl Type Definitions
companion/services/types/event-types.types.ts, companion/extension/lib/linkedin.ts
Added optional bookingUrl?: string field to EventType interfaces, exposing the full booking URL as part of the public API contract.
bookingUrl Content Script Integration
companion/extension/entrypoints/content.ts
Propagated bookingUrl?: string field through event type data shapes; updated insertion and copy flows to prefer bookingUrl when present, otherwise fall back to default URL construction using username and slug.
bookingUrl Component Props
companion/components/event-type-list-item/EventTypeListItem.tsx, companion/components/event-type-list-item/EventTypeListItem.ios.tsx, companion/components/event-type-list-item/EventTypeListItemParts.tsx
Added bookingUrl prop to EventTypeTitle and EventTypeLink components; introduced getDisplayUrl helper to derive display text from bookingUrl (extracting hostname + pathname) with fallback to username/slug format.
bookingUrl Tab Components
companion/components/event-type-detail/tabs/BasicsTab.tsx
Added optional bookingUrl prop to BasicsTabProps; updated URL display to dynamically render booking URL prefix from bookingUrl when available, otherwise default to cal.com/{username}/.
bookingUrl Event Type Detail
companion/app/(tabs)/(event-types)/event-type-detail.tsx
Introduced bookingUrl state and propagated it to BasicsTab and AvailabilityTab; refactored handlePreview and handleCopyLink to validate and use bookingUrl directly instead of building links via CalComAPIService; added error handling for missing booking URLs.
bookingUrl iOS Event Types Index
companion/app/(tabs)/(event-types)/index.ios.tsx
Replaced CalComAPIService.buildEventTypeLink with direct eventType.bookingUrl usage in copy, share, and preview flows; added validation guards returning error alerts when booking URL is absent; simplified imports by removing unused UI components and using type-only EventType import.
bookingUrl Android/Web Event Types Index
companion/app/(tabs)/(event-types)/index.tsx
Replaced CalComAPIService.buildEventTypeLink with direct eventType.bookingUrl usage in copy, share, and preview flows; added early validation and error handling for missing booking URLs; updated preview to open bookingUrl in native browser (web) or in-app browser (mobile).
Service API Refactoring
companion/services/calcom.ts
Removed buildEventTypeLink export; introduced new getUsername() function with error handling that fetches username via getUserProfile, replacing previous implementation.
Minor Updates
companion/extension/entrypoints/background/index.ts
Added lint suppression comment for Safari browserAction type compatibility; no functional changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A bookingUrl hops into place,
No more links built with haste,
Colors shift from blue to black so sleek,
Flexbox dances, alignments peak,
Our app now bounces with grace!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.63% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing event type links functionality for organizational users by adding bookingUrl support.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coderabbit_full_head_fixcompanion_event_type_links_for_org_user_pr5

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.

@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hussam789
Copy link
Copy Markdown

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 2, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hussam789
Copy link
Copy Markdown

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 2, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@companion/app/`(tabs)/(event-types)/event-type-detail.tsx:
- Line 180: The bookingUrl state is declared but never populated, so update
applyEventTypeData to call setBookingUrl with the fetched eventType.bookingUrl
after you obtain the API response; specifically, inside applyEventTypeData
(after you parse/set other basic fields like name/description), call
setBookingUrl(eventType.bookingUrl) so handlePreview and handleCopyLink see the
real URL instead of the empty string.

In `@companion/extension/entrypoints/content.ts`:
- Around line 1125-1131: The copy action currently reconstructs the booking URL
from eventType.users?.[0]?.username and eventType.slug instead of using the
already-computed bookingUrl (so org/custom-domain URLs are lost); update the
clipboard operation in the block where bookingUrl is defined to call
navigator.clipboard.writeText(bookingUrl) (replace the inline template usage) so
the copy honors the exact bookingUrl value used by preview/insert.

In `@companion/services/calcom.ts`:
- Around line 1654-1662: The catch block in getUsername() declares an unused
variable `error` and discards the original failure details; change the catch to
catch (_error) or catch (err) to satisfy the linter and include the original
error context in the thrown error (e.g., throw a new Error like `Failed to get
username: ${err?.message ?? String(err)}` or use the Error `cause` option) so
debugging information from getUserProfile() is preserved while still providing
the descriptive message.

const [conferencingOptions, setConferencingOptions] = useState<ConferencingOption[]>([]);
const [conferencingLoading, setConferencingLoading] = useState(false);
const [eventTypeData, setEventTypeData] = useState<EventType | null>(null);
const [bookingUrl, setBookingUrl] = useState<string>("");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: bookingUrl state is declared but never populated.

The setBookingUrl setter is never called anywhere in the component. The state remains an empty string (""), causing:

  • handlePreview() (lines 948-954) to always show "Booking URL not available"
  • handleCopyLink() (lines 956-963) to always show "Booking URL not available"

The applyEventTypeData function fetches eventType from the API (which includes bookingUrl per the type definition), but never calls setBookingUrl(eventType.bookingUrl).

🐛 Proposed fix: Populate bookingUrl from API response

Add the following in applyEventTypeData (around line 459, after setting other basic fields):

     if (eventType.hidden !== undefined) setIsHidden(eventType.hidden);
+    if (eventType.bookingUrl) setBookingUrl(eventType.bookingUrl);
🧰 Tools
🪛 Biome (2.3.13)

[error] 180-180: This variable setBookingUrl is unused.

Unused variables are often the result of typos, incomplete refactors, or other sources of bugs.
Unsafe fix: If this is intentional, prepend setBookingUrl with an underscore.

(lint/correctness/noUnusedVariables)

🤖 Prompt for AI Agents
In `@companion/app/`(tabs)/(event-types)/event-type-detail.tsx at line 180, The
bookingUrl state is declared but never populated, so update applyEventTypeData
to call setBookingUrl with the fetched eventType.bookingUrl after you obtain the
API response; specifically, inside applyEventTypeData (after you parse/set other
basic fields like name/description), call setBookingUrl(eventType.bookingUrl) so
handlePreview and handleCopyLink see the real URL instead of the empty string.

Comment on lines +1125 to 1131
const bookingUrl =
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
navigator.clipboard
.writeText(bookingUrl)
.then(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix copy link to honor bookingUrl.

The copy action still builds a URL from username/slug, which breaks org/custom-domain event types. Mirror the bookingUrl fallback used by preview/insert.

🔧 Proposed fix
-const bookingUrl =
-  `https://cal.com/${eventType.users?.[0]?.username || "user"}/${eventType.slug}`;
+const bookingUrl =
+  eventType.bookingUrl ||
+  `https://cal.com/${eventType.users?.[0]?.username || "user"}/${eventType.slug}`;
📝 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
const bookingUrl =
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
navigator.clipboard
.writeText(bookingUrl)
.then(() => {
const bookingUrl =
eventType.bookingUrl ||
`https://cal.com/${
eventType.users?.[0]?.username || "user"
}/${eventType.slug}`;
navigator.clipboard
.writeText(bookingUrl)
.then(() => {
🤖 Prompt for AI Agents
In `@companion/extension/entrypoints/content.ts` around lines 1125 - 1131, The
copy action currently reconstructs the booking URL from
eventType.users?.[0]?.username and eventType.slug instead of using the
already-computed bookingUrl (so org/custom-domain URLs are lost); update the
clipboard operation in the block where bookingUrl is defined to call
navigator.clipboard.writeText(bookingUrl) (replace the inline template usage) so
the copy honors the exact bookingUrl value used by preview/insert.

Comment on lines +1654 to +1662
// Helper to get username
async function getUsername(): Promise<string> {
try {
const profile = await getUserProfile();
return profile.username;
} catch (error) {
throw new Error("Failed to get username");
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Prefix unused error variable and consider preserving error context.

The static analysis tool correctly flags error as unused. Additionally, the generic error message loses debugging context from the original failure.

Proposed fix
 async function getUsername(): Promise<string> {
   try {
     const profile = await getUserProfile();
     return profile.username;
-  } catch (error) {
-    throw new Error("Failed to get username");
+  } catch (_error) {
+    const message = _error instanceof Error ? _error.message : String(_error);
+    throw new Error(`Failed to get username: ${message}`);
   }
 }
📝 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
// Helper to get username
async function getUsername(): Promise<string> {
try {
const profile = await getUserProfile();
return profile.username;
} catch (error) {
throw new Error("Failed to get username");
}
}
// Helper to get username
async function getUsername(): Promise<string> {
try {
const profile = await getUserProfile();
return profile.username;
} catch (_error) {
const message = _error instanceof Error ? _error.message : String(_error);
throw new Error(`Failed to get username: ${message}`);
}
}
🧰 Tools
🪛 Biome (2.3.13)

[error] 1659-1659: This variable error is unused.

Unused variables are often the result of typos, incomplete refactors, or other sources of bugs.
Unsafe fix: If this is intentional, prepend error with an underscore.

(lint/correctness/noUnusedVariables)

🤖 Prompt for AI Agents
In `@companion/services/calcom.ts` around lines 1654 - 1662, The catch block in
getUsername() declares an unused variable `error` and discards the original
failure details; change the catch to catch (_error) or catch (err) to satisfy
the linter and include the original error context in the thrown error (e.g.,
throw a new Error like `Failed to get username: ${err?.message ?? String(err)}`
or use the Error `cause` option) so debugging information from getUserProfile()
is preserved while still providing the descriptive message.

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.

3 participants