Skip to content

feat: enhance CommunityTicketCard with upvote and comment functionality#91

Merged
wenjan19 merged 1 commit intomainfrom
feat/student-feedback
Feb 28, 2026
Merged

feat: enhance CommunityTicketCard with upvote and comment functionality#91
wenjan19 merged 1 commit intomainfrom
feat/student-feedback

Conversation

@wenjan19
Copy link
Collaborator

@wenjan19 wenjan19 commented Feb 28, 2026

hueuhe

Summary by Sourcery

Enhance the community ticket card to support richer ticket display and interactive engagement controls.

New Features:

  • Add upvote toggle and comment action handlers to community ticket cards with per-ticket upvote state on the community board page.
  • Display ticket author avatar or initials, formatted creation time, and optional image attachment with a full-size modal preview on the community ticket card.

Enhancements:

  • Restyle the community ticket card with improved layout, accessibility, and keyboard interaction for better usability.

Summary by CodeRabbit

  • New Features
    • Added upvote feature with persistent count tracking on community tickets
    • Introduced comment action button for direct access to discussions
    • Added image modal preview for ticket attachments
    • Improved card layout with author avatars, initials, and better information hierarchy
    • Enhanced keyboard navigation support (Enter/Space keys) for ticket card interactions

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 28, 2026

Reviewer's Guide

Refactors the CommunityTicketCard UI to a richer, accessible card with avatar, attachment preview, and new upvote/comment interaction handlers, and wires those handlers into the community board page with local per-ticket upvote state tracking.

Sequence diagram for ticket upvote toggle on CommunityBoard

sequenceDiagram
  actor User
  participant CommunityBoardPage
  participant CommunityTicketCard
  participant UpvoteState as upvoteByTicketId

  User->>CommunityTicketCard: Click upvote button
  CommunityTicketCard->>CommunityTicketCard: stopPropagation()
  CommunityTicketCard->>CommunityBoardPage: onUpvoteToggle(ticket)

  CommunityBoardPage->>UpvoteState: Read current = upvoteByTicketId[ticket.id] || {count:0, upvoted:false}
  CommunityBoardPage->>UpvoteState: Write updated entry
  Note over UpvoteState: Toggle upvoted, increment or decrement count

  UpvoteState-->>CommunityBoardPage: Updated state object
  CommunityBoardPage-->>CommunityTicketCard: Re-render with
  Note over CommunityBoardPage,CommunityTicketCard: upvoteCount and isUpvoted props updated

  CommunityTicketCard->>User: Updated icon and count displayed
Loading

Sequence diagram for opening ticket comments from CommunityTicketCard

sequenceDiagram
  actor User
  participant CommunityBoardPage
  participant CommunityTicketCard

  User->>CommunityTicketCard: Click comment button
  CommunityTicketCard->>CommunityTicketCard: stopPropagation()
  CommunityTicketCard->>CommunityBoardPage: onCommentClick(ticket)
  CommunityBoardPage->>CommunityBoardPage: selectedTicket = ticket
  CommunityBoardPage-->>User: Comments panel or details for selectedTicket shown
Loading

Flow diagram for CommunityBoard and CommunityTicketCard wiring

graph TD
  A[CommunityBoardPage +page.svelte] -->|passes ticket,isActive,onClick,onCommentClick,onUpvoteToggle,upvoteCount,isUpvoted| B[CommunityTicketCard.svelte]

  subgraph PageState
    S1[selectedTicket]
    S2[upvoteByTicketId Record]
  end

  A --> S1
  A --> S2

  B -->|onClick callback| A
  B -->|onCommentClick callback| A
  B -->|onUpvoteToggle callback| A

  A -->|updates| S1
  A -->|updates| S2
  S2 -->|derived props per ticket id| A
  A -->|re-renders with updated props| B
Loading

File-Level Changes

Change Details Files
Enhance CommunityTicketCard with richer layout, accessibility, avatar/attachment display, and upvote/comment interaction handlers.
  • Replace button-based card container with a div/article using role="button" and keyboard handlers for accessibility while keeping double-click navigation behavior
  • Remove priority/status rendering and instead display author, timestamp via formatTime, ticket number, category chip, description, and location in a redesigned layout
  • Add avatar/initials rendering for the ticket author and an optional attachment thumbnail that opens a modal image preview with a close button
  • Introduce onCommentClick and onUpvoteToggle callbacks with upvoteCount and isUpvoted props, and render upvote/comment buttons that stop propagation so they don’t trigger the card click handler
  • Add internal state isImageModalOpen and a helper getInitials plus derived values for commentCount, hasAttachment, and authorName
frontend/src/components/ui/tickets/CommunityTicketCard.svelte
Wire up upvote and comment interactions from the CommunityTicketCard into the community board page with local upvote state per ticket.
  • Introduce upvoteByTicketId state as a record keyed by ticket id holding count and upvoted flag
  • Add handleCommentClick to select a ticket when the comment interaction occurs, mirroring handleTicketClick behavior
  • Add handleUpvoteToggle to flip the upvoted flag and increment/decrement the count safely for a given ticket id
  • Pass onCommentClick, onUpvoteToggle, upvoteCount, and isUpvoted into CommunityTicketCard when rendering tickets
frontend/src/routes/community-board/+page.svelte

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between c58087a and 8fc7218.

📒 Files selected for processing (2)
  • frontend/src/components/ui/tickets/CommunityTicketCard.svelte
  • frontend/src/routes/community-board/+page.svelte
 ___________________________________________
< I am a verified code reviewer on Twitter. >
 -------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/student-feedback

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The clickTimer is typed as NodeJS.Timeout, which can cause type mismatches in the browser; consider using let clickTimer: ReturnType<typeof setTimeout> | null = null instead for better compatibility in the Svelte client runtime.
  • The image modal currently only closes on mouse clicks; you may want to add keyboard handling (e.g. Escape key listener) to close it for better accessibility and keyboard navigation support.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `clickTimer` is typed as `NodeJS.Timeout`, which can cause type mismatches in the browser; consider using `let clickTimer: ReturnType<typeof setTimeout> | null = null` instead for better compatibility in the Svelte client runtime.
- The image modal currently only closes on mouse clicks; you may want to add keyboard handling (e.g. Escape key listener) to close it for better accessibility and keyboard navigation support.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@wenjan19 wenjan19 merged commit 231b298 into main Feb 28, 2026
3 of 4 checks passed
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