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

Save develop polish #970

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open

Save develop polish #970

wants to merge 9 commits into from

Conversation

OverGlass
Copy link
Collaborator

@OverGlass OverGlass commented Feb 6, 2025

Summary by CodeRabbit

  • New Features
    • Introduced an enhanced video player that activates for live events, providing improved media controls.
    • Added a save icon to the event description editor and enabled conditional display of additional form fields for organizers.
    • Integrated responsive modal sizing and support for live streaming links.
  • Refactor / Style
    • Improved the consistency and theming of dropdown and select components with dynamic label handling.
    • Upgraded input controls with new sizing variants and support for multiline entries.

Copy link
Contributor

coderabbitai bot commented Feb 6, 2025

Walkthrough

The pull request introduces a new DOMComponent within the VimeoPlayer for rendering iframes and revises several UI components. Dropdown, Input, and Select components have updated styling, theming, and layout logic. Event form components now conditionally render fields based on an isAuthor flag, and media rendering in event detail pages uses the VimeoPlayer when event conditions are met. Additionally, the event schemas have been extended to include a live_url field for streaming events.

Changes

File(s) Change Summary
src/components/VimeoPlayer.tsx
src/features/events/pages/detail/EventDesktopScreen.tsx
src/features/events/pages/detail/EventMobileScreen.tsx
Introduced a new DOMComponent to render an iframe; event detail pages now conditionally render VimeoPlayer based on event.full and a valid live_url.
src/components/base/Dropdown/index.tsx Updated DropdownItem to accept a theme prop and simplified icon rendering; changed DropdownFrame default variant from 'md' to 'xl' and added variant false for unset max height.
src/components/base/Input/Input.tsx Modified InputFrame hover styles to use a theme-based color; updated size variants with new heights, border radius values, and added a multiline variant with auto height.
src/components/base/Select/SelectBottomSheet.tsx
src/components/base/Select/SelectV3.tsx
src/components/base/Select/types.ts
src/components/base/Select/useSelectSearch.tsx
Removed minHeight and added size:false property in DropdownFrame; altered text rendering logic in SelectV3 with conditional sub-label display; extended SelectProps with showSubLabel; updated useSelectSearch to include theme and icon in items.
src/features/events/components/EventForm/DescriptionInput.tsx
src/features/events/components/EventForm/EventFormDesktopScreen.tsx
src/features/events/components/EventForm/EventFormMobileScreen.tsx
src/features/events/components/EventForm/ViewportModal.tsx
src/features/events/components/EventForm/context.tsx
Revised modal editor header by adding a Save icon and removing a cancel button; introduced an isAuthor flag for conditionally rendering scope fields; updated viewport modal dimensions based on window size; enhanced event form context with refined scopeOptions, new payload properties, and isAuthor determination.
src/services/events/schema.ts Added a live_url property to event schemas as nullable/optional; updated property paths to include live_url for live streaming events.

Sequence Diagram(s)

sequenceDiagram
    participant E as EventDetailComponent
    participant V as VimeoPlayer
    participant F as Fallback Image
    E->>E: Evaluate if event.full is true\nand live_url starts with "https://vimeo.com/event/"
    alt Valid Vimeo URL
        E->>V: Render VimeoPlayer with live_url & DOM props
    else
        E->>F: Render fallback image
    end
Loading
sequenceDiagram
    participant EF as EventForm
    participant Ctx as FormContext (isAuthor)
    participant S as Scope Field
    EF->>Ctx: Retrieve isAuthor flag
    alt isAuthor is true
        Ctx->>S: Render scope selection component
    else
        Ctx-->>EF: Omit scope selection component
    end
Loading

Poem

Oh, happy hops in lines of code,
Where iframes and themes now flow.
I nibble on new props so bright,
With isAuthor guiding the form’s light.
Streaming events and schema delight,
A bunny’s joy in every byte! 🐇💻

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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.

Copy link
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: 1

🧹 Nitpick comments (7)
src/features/events/components/EventForm/ViewportModal.tsx (2)

24-27: Extract magic numbers into named constants and add min dimensions.

While the calculations are reasonable, consider these improvements:

  1. Extract magic numbers into named constants for better maintainability
  2. Add minimum dimensions to ensure usability on small screens
+const MAX_WIDTH_PERCENTAGE = 80
+const MAX_WIDTH_PIXELS = 1048
+const HEIGHT_PERCENTAGE = 60
+const MIN_WIDTH = 320
+const MIN_HEIGHT = 240

 const size = useWindowDimensions()

-const width = Math.min((size.width * 80) / 100, 1048)
-const height = (size.height * 60) / 100
+const width = Math.max(MIN_WIDTH, Math.min((size.width * MAX_WIDTH_PERCENTAGE) / 100, MAX_WIDTH_PIXELS))
+const height = Math.max(MIN_HEIGHT, (size.height * HEIGHT_PERCENTAGE) / 100)

34-34: Extract Sheet snapPoints magic number into a constant.

For consistency with the other dimension calculations, consider extracting the Sheet's snapPoints value into a named constant.

+const SHEET_SNAP_POINT_PERCENTAGE = 80

 <Sheet
   modal
   open={!!open}
-  snapPoints={[80]}
+  snapPoints={[SHEET_SNAP_POINT_PERCENTAGE]}
   snapPointsMode="percent"
   // ... other props
 >

Also applies to: 48-48

src/components/VimeoPlayer.tsx (1)

3-5: Enhance accessibility and configurability.

Consider the following improvements:

  1. Add accessibility attributes to the iframe.
  2. Make the height configurable via props.

Apply this diff to implement the suggestions:

-export default function DOMComponent(props: { url: string; dom: import('expo/dom').DOMProps }) {
-  return <iframe width="100%" height="315" src={props.url} frameBorder="0" allow="autoplay; fullscreen; picture-in-picture" allowFullScreen></iframe>
+type DOMComponentProps = {
+  url: string;
+  dom: import('expo/dom').DOMProps;
+  height?: number;
+  title?: string;
+};
+
+export default function DOMComponent({ url, dom, height = 315, title }: DOMComponentProps) {
+  return (
+    <iframe
+      width="100%"
+      height={height}
+      src={url}
+      frameBorder="0"
+      allow="autoplay; fullscreen; picture-in-picture"
+      allowFullScreen
+      title={title ?? 'Vimeo video player'}
+      aria-label={title ?? 'Vimeo video player'}
+    />
+  );
+}
src/components/base/Select/SelectV3.tsx (1)

69-69: Use optional chaining for safer property access.

Consider using optional chaining to safely access the subLabel property.

Apply this diff to implement optional chaining:

-                {fullValue && fullValue.subLabel && props.showSubLabel ? <SF.Text fontSize={12}>{fullValue.subLabel}</SF.Text> : null}
+                {fullValue?.subLabel && props.showSubLabel ? <SF.Text fontSize={12}>{fullValue.subLabel}</SF.Text> : null}
🧰 Tools
🪛 Biome (1.9.4)

[error] 69-69: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/features/events/pages/detail/EventMobileScreen.tsx (1)

95-104: Enhance URL validation for Vimeo links.

While the current implementation works, the URL validation could be more robust.

Consider using a more specific regex pattern:

-          {isFull && event.live_url && event.live_url.startsWith('https://vimeo.com/event/') ? (
+          {isFull && event.live_url && /^https:\/\/vimeo\.com\/event\/\d+(?:\/[a-f0-9]+)?$/.test(event.live_url) ? (
src/features/events/components/EventForm/EventFormDesktopScreen.tsx (1)

62-62: Fix typo in label text.

The label text "Accèes" should be "Accès" in French.

-                label="Accèes"
+                label="Accès"
src/features/events/components/EventForm/EventFormMobileScreen.tsx (1)

187-187: Fix typo in label text.

The label text "Accèes" should be "Accès" in French.

-                      label="Accèes"
+                      label="Accès"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ff5ab77 and cee8aa6.

📒 Files selected for processing (15)
  • src/components/VimeoPlayer.tsx (1 hunks)
  • src/components/base/Dropdown/index.tsx (4 hunks)
  • src/components/base/Input/Input.tsx (3 hunks)
  • src/components/base/Select/SelectBottomSheet.tsx (1 hunks)
  • src/components/base/Select/SelectV3.tsx (1 hunks)
  • src/components/base/Select/types.ts (1 hunks)
  • src/components/base/Select/useSelectSearch.tsx (1 hunks)
  • src/features/events/components/EventForm/DescriptionInput.tsx (2 hunks)
  • src/features/events/components/EventForm/EventFormDesktopScreen.tsx (2 hunks)
  • src/features/events/components/EventForm/EventFormMobileScreen.tsx (4 hunks)
  • src/features/events/components/EventForm/ViewportModal.tsx (2 hunks)
  • src/features/events/components/EventForm/context.tsx (5 hunks)
  • src/features/events/pages/detail/EventDesktopScreen.tsx (2 hunks)
  • src/features/events/pages/detail/EventMobileScreen.tsx (2 hunks)
  • src/services/events/schema.ts (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/base/Select/SelectV3.tsx

[error] 69-69: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (25)
src/features/events/components/EventForm/ViewportModal.tsx (1)

5-5: LGTM! Good use of the useWindowDimensions hook.

The import is correctly grouped with other tamagui imports and will help with responsive design.

src/components/VimeoPlayer.tsx (1)

3-3: Verify the type import.

The type import for DOMProps is using a dynamic import statement. Consider importing it directly if the type is available.

src/components/base/Select/useSelectSearch.tsx (1)

15-15: LGTM!

The addition of theme and icon properties to the mapped items is consistent with the SelectOption type and enhances the component's theming capabilities.

src/components/base/Select/types.ts (1)

33-33: LGTM!

The addition of the optional showSubLabel prop enhances the component's flexibility by allowing control over sub-label visibility.

src/components/base/Select/SelectV3.tsx (1)

66-68: LGTM!

The text component changes enhance visual feedback by using the secondary prop when no value is selected.

src/components/base/Select/SelectBottomSheet.tsx (2)

70-70: LGTM! Consistent with Dropdown changes.

The size={false} prop aligns with the new variant in DropdownFrame that allows for an unset maxHeight.


74-74: LGTM! More explicit keyboard behavior.

Using "always" instead of a boolean value makes the keyboard persistence behavior more explicit.

src/components/base/Dropdown/index.tsx (2)

8-8: LGTM! Enhanced theming support.

The integration with SF components and theme-based rendering improves the component's flexibility and customization options.

Also applies to: 65-82


111-113: LGTM! Added flexibility for height control.

The new false size variant allowing maxHeight: 'unset' provides better control over dropdown dimensions.

src/services/events/schema.ts (1)

79-79: LGTM! Consistent schema updates.

The live_url field is appropriately added as nullable/optional across all relevant schemas and property paths.

Also applies to: 221-221, 243-243

src/features/events/components/EventForm/DescriptionInput.tsx (2)

7-7: LGTM!

The addition of the Save icon from @tamagui/lucide-icons aligns with the UI enhancement for the save action.


242-258: LGTM!

The header layout has been improved by:

  • Simplifying the UI to focus on the save action
  • Adding the Save icon to provide visual feedback
  • Using proper flex properties for alignment
src/components/base/Input/Input.tsx (4)

60-60: LGTM!

The hover style now uses the theme-based color $gray2, improving theme consistency.


110-141: LGTM!

The size variants and multiline support have been well-implemented with:

  • Consistent border radius progression
  • Proper height scaling
  • Flexible multiline handling with auto height and minimum height constraints

244-245: LGTM!

The size prop is now correctly handled based on the multiline state.


254-254: LGTM!

The YStack layout has been improved with proper height and padding for multiline inputs.

src/features/events/components/EventForm/context.tsx (4)

8-8: LGTM!

Added useGetSuspenseProfil hook for profile data retrieval.


99-99: LGTM!

The scope options are now correctly filtered to include only scopes with the 'events' feature.


50-76: LGTM!

The visibility options have been enhanced with clear and detailed descriptions that help users understand the implications of each option.


103-108: LGTM!

The isAuthor check is well-implemented with proper null checks and comparison logic.

src/features/events/pages/detail/EventDesktopScreen.tsx (2)

5-5: LGTM!

Added VimeoPlayer component import for video content support.


111-120: LGTM!

The media rendering logic has been enhanced to:

  • Support Vimeo event videos with proper URL validation
  • Maintain the existing fallback image functionality
src/features/events/components/EventForm/EventFormDesktopScreen.tsx (1)

26-26: LGTM! Conditional rendering of scope selector based on author status.

The implementation correctly restricts scope selection to authors only, improving security and user experience.

Also applies to: 31-53

src/features/events/components/EventForm/EventFormMobileScreen.tsx (2)

93-93: LGTM! Consistent implementation of author-based scope selection.

The mobile implementation correctly mirrors the desktop version, maintaining a consistent user experience across devices.

Also applies to: 137-159


206-206: LGTM! Improved UX with placeholder text.

The addition of noValuePlaceholder for the category selector enhances user experience by providing clear guidance.

},
},
defaultVariants: {
size: 'md',
size: 'xl',
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the impact of changing default size.

The default size variant has been changed from 'md' to 'xl', which could affect existing dropdown instances.


🏁 Script executed:

#!/bin/bash
# Search for Dropdown usage without explicit size prop
rg -A 5 '<Dropdown(?![^>]*size=)'

Length of output: 271


🏁 Script executed:

#!/bin/bash
# Re-run the search using PCRE2 for lookahead support to find <Dropdown usages without an explicit size prop
rg --pcre2 -A 5 '<Dropdown(?![^>]*\bsize=)'

Length of output: 2480


Default Size Change May Impact Dropdown Instances
Our investigation confirms that several instances of the Dropdown component (or its variants) are used without an explicit size property. For example:

  • In src/components/base/Dropdown/index.tsx, the Dropdown is invoked without specifying a size, meaning it now uses the new default ('xl') instead of the former 'md'.
  • Similar patterns were observed in related components (e.g., the DropdownFrame in the SelectDropdown and DropdownWrapper in ProfilBlock).

This change will indeed affect existing dropdown instances by applying a larger default size, which may lead to unintended layout or design issues. It would be advisable to review the impacted components and update them with an explicit size prop if the previous 'md' behavior is required.

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

Successfully merging this pull request may close these issues.

2 participants