Skip to content

feat: ticket message component#172

Merged
hmbanan666 merged 1 commit into
mainfrom
message-component
Sep 19, 2025
Merged

feat: ticket message component#172
hmbanan666 merged 1 commit into
mainfrom
message-component

Conversation

@hmbanan666
Copy link
Copy Markdown
Collaborator

@hmbanan666 hmbanan666 commented Sep 19, 2025

Summary by CodeRabbit

  • New Features
    • Dedicated rendering for ticket messages (text, images, files) with localized timestamps.
    • Ticket header now shows the ticket creation date with localized formatting and proper message count pluralization.
    • “Show more” triggers success haptic feedback.
  • Refactor
    • Message rendering split into specialized components; context-aware menu actions for file open and copy.
  • Style
    • Smaller typography for message/count indicators, added top spacing to ticket cards, and minor layout adjustments for improved readability.

@hmbanan666 hmbanan666 self-assigned this Sep 19, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 19, 2025

Walkthrough

Refactors ticket message rendering by replacing inline logic with three dedicated components for text, image, and file. Adds two new presentational tweaks in item/ticket cards. Updates ticket page header to show localized creation date and adjusts show-more vibration to success. No public API changes beyond new components’ props.

Changes

Cohort / File(s) Summary
Styling adjustments
apps/atrium-telegram/app/components/flow/ItemCard.vue, apps/atrium-telegram/app/components/ticket/Card.vue
Add text-sm to comment/message count; add mt-6 to ticket card container. No logic changes.
Ticket message componentization (refactor)
apps/atrium-telegram/app/components/ticket/Message.vue
Replaces inline rendering with MessageText, MessageImage, MessageFile. Adds computed flags for message type, updates dropdown conditions, introduces handleFileClick, removes old icon/date logic.
New ticket message components
apps/atrium-telegram/app/components/ticket/MessageText.vue, .../MessageImage.vue, .../MessageFile.vue
Adds three components to render text, image, and file messages. Each formats timestamps with date-fns (ru locale). MessageFile maps fileType to icon/label and exposes message prop.
Ticket page header/date & interaction
apps/atrium-telegram/app/pages/ticket/[ticketId]/index.vue
Reworks header to show message icon/count and localized creation date; adds date-fns formatting; updates show-more handler to vibrate('success'); minor structural layout adjustments.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant MV as Message.vue
  participant MT as MessageText
  participant MI as MessageImage
  participant MF as MessageFile
  participant DM as DropdownMenu

  U->>MV: Open ticket thread
  MV->>MV: Compute isText / isImage / isFile
  alt Text message
    MV->>MT: Render text content
    MT-->>U: Text + timestamp
    MV->>DM: Show "Copy message"
  else Image message
    MV->>MI: Render image
    MI-->>U: Image + timestamp
    MV->>DM: Hide "Copy message"
  else File message
    MV->>MF: Render file block
    MF-->>U: File icon/label + timestamp
    MV->>DM: Show "Open" (if fileUrl)
  end
  U->>DM: Click "Open" (file)
  DM->>MV: handleFileClick(fileUrl)
  MV-->>U: Opens new tab
Loading
sequenceDiagram
  autonumber
  actor U as User
  participant P as Ticket Page
  participant VF as Vibrate Feedback

  U->>P: Click "Show more"
  P->>VF: vibrate('success')
  P->>P: shownMessages += 10
  P-->>U: More messages rendered
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • chore: feedback rework #99: Adjusts feedback utility and vibrate signature; related to this PR’s switch to vibrate('success') in the ticket page.
  • feat: show tickets page #170: Works on ticket message rendering/attachments; overlaps with this PR’s message component refactor.
  • feat: tickets #52: Introduces Ticket/TicketMessage types used by the new MessageText/Image/File components.

Poem

I nibble through commits with gentle might,
Three messages split, now tidy and bright.
Dates whisper softly, “от d MMMM” in glow,
A happy buzz—vibrate success—let’s go!
Small fonts, neat cards, I thump with delight,
This burrow of code feels perfectly right. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: ticket message component" concisely captures the primary change — introducing/refactoring ticket message rendering into dedicated message components — and follows conventional commit style. It directly relates to the changeset; while the changes add multiple components (plural), the title remains accurate and not misleading.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch message-component

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.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
12.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@hmbanan666 hmbanan666 merged commit 2719478 into main Sep 19, 2025
6 of 8 checks passed
@hmbanan666 hmbanan666 deleted the message-component branch September 19, 2025 12:10
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: 0

🧹 Nitpick comments (2)
apps/atrium-telegram/app/components/ticket/MessageFile.vue (1)

2-2: Consider responsive width constraint.

The fixed w-2/3 width may not provide optimal display across all device sizes. Consider using a responsive approach for better mobile experience.

-  <div class="w-2/3 relative flex flex-col justify-between gap-1.5">
+  <div class="w-full max-w-sm relative flex flex-col justify-between gap-1.5">
apps/atrium-telegram/app/components/ticket/MessageImage.vue (1)

2-2: Consider responsive width constraint.

Similar to MessageFile.vue, the fixed w-2/3 width may not be optimal across all device sizes.

-  <div v-if="message.fileUrl" class="w-2/3 relative flex flex-col justify-between gap-1.5">
+  <div v-if="message.fileUrl" class="w-full max-w-sm relative flex flex-col justify-between gap-1.5">
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b928c69 and 358d65f.

📒 Files selected for processing (7)
  • apps/atrium-telegram/app/components/flow/ItemCard.vue (1 hunks)
  • apps/atrium-telegram/app/components/ticket/Card.vue (1 hunks)
  • apps/atrium-telegram/app/components/ticket/Message.vue (4 hunks)
  • apps/atrium-telegram/app/components/ticket/MessageFile.vue (1 hunks)
  • apps/atrium-telegram/app/components/ticket/MessageImage.vue (1 hunks)
  • apps/atrium-telegram/app/components/ticket/MessageText.vue (1 hunks)
  • apps/atrium-telegram/app/pages/ticket/[ticketId]/index.vue (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (14)
apps/atrium-telegram/app/components/flow/ItemCard.vue (1)

27-27: LGTM: Typography consistency improvement.

Adding text-sm to the comments count container aligns typography across ticket components for better visual consistency.

apps/atrium-telegram/app/components/ticket/Card.vue (2)

13-13: LGTM: Improved spacing.

Adding mt-6 provides better vertical separation between the ticket content and metadata section.


15-15: LGTM: Typography alignment.

Adding text-sm to maintain consistent small text sizing with other ticket components.

apps/atrium-telegram/app/components/ticket/MessageText.vue (2)

22-24: Props destructuring is correct for Vue 3.5+.

Vue's compiler automatically prepends props. when code in the same <script setup> block accesses variables destructured from defineProps, so this destructuring approach will work correctly in Vue 3.5+.


9-11: LGTM: Consistent timestamp formatting.

The timestamp formatting uses the same pattern and Russian locale as other ticket components, ensuring visual consistency across the interface.

apps/atrium-telegram/app/components/ticket/MessageFile.vue (1)

27-50: LGTM: Well-structured file type mapping.

The getFileData function provides clear mapping from file types to appropriate icons and Russian labels. The switch statement covers the expected cases with a sensible default fallback.

apps/atrium-telegram/app/pages/ticket/[ticketId]/index.vue (3)

72-73: LGTM: Date formatting imports.

Adding date-fns and Russian locale imports aligns with the broader ticket date formatting improvements across the application.


16-30: LGTM: Enhanced header with creation date.

The new header layout provides better information hierarchy by showing message count on the left and creation date on the right. The localized date formatting using format() with Russian locale is consistent with other components.


94-94: LGTM: Success vibration feedback.

Changing the vibration from default to 'success' provides more appropriate haptic feedback when loading additional messages successfully.

apps/atrium-telegram/app/components/ticket/MessageImage.vue (1)

3-7: LGTM: Proper image display with accessibility consideration.

The image implementation with object-contain and rounded corners provides good visual presentation. The empty alt="" is appropriate for decorative images in this context.

apps/atrium-telegram/app/components/ticket/Message.vue (4)

60-62: LGTM: Clear message type classification logic.

The computed properties provide clear, readable conditions for determining message types based on the presence and type of file attachments.


17-28: LGTM: Clean component composition.

The refactor to use dedicated message components (TicketMessageText, TicketMessageImage, TicketMessageFile) improves code organization and maintainability by separating concerns for different message types.


66-73: LGTM: Improved dropdown menu logic.

The dropdown menu conditions now correctly use the computed message type helpers and the new handleFileClick function, making the logic more maintainable.


117-122: LGTM: Safe file URL handling.

The handleFileClick function includes proper null/undefined guards before opening URLs, preventing potential runtime errors.

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.

1 participant