-
Notifications
You must be signed in to change notification settings - Fork 2
client(feat): implement ticket completion feature with documentation … #12
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
Open
xowin
wants to merge
1
commit into
dev
Choose a base branch
from
complete-button
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| "use client"; | ||
|
|
||
| import { BookOpen, CheckCircle } from "lucide-react"; | ||
| import { FormEvent, useState } from "react"; | ||
|
|
||
| import Button from "../ui/button"; | ||
| import LabeledIcon from "../ui/labeled-icon"; | ||
| import Modal from "../ui/modal"; | ||
|
|
||
| export interface TicketCompleteModalProps { | ||
| isOpen: boolean; | ||
| ticketTitle: string; | ||
| existingDocumentation?: string; | ||
| onClose: () => void; | ||
| onComplete: (documentation: string) => void; | ||
| isLoading?: boolean; | ||
| } | ||
|
|
||
| export default function TicketCompleteModal({ | ||
| isOpen, | ||
| ticketTitle, | ||
| existingDocumentation = "", | ||
| onClose, | ||
| onComplete, | ||
| isLoading = false, | ||
| }: TicketCompleteModalProps) { | ||
| const [documentation, setDocumentation] = useState(existingDocumentation); | ||
|
|
||
| const handleSubmit = (e: FormEvent) => { | ||
| e.preventDefault(); | ||
| onComplete(documentation); | ||
| }; | ||
|
|
||
| const handleClose = () => { | ||
| setDocumentation(existingDocumentation); // Reset to original value | ||
| onClose(); | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal isOpen={isOpen} onClose={handleClose}> | ||
| <div className="max-w-2xl p-4"> | ||
| <div className="mb-6"> | ||
| <div className="flex items-center gap-2 mb-2"> | ||
| <CheckCircle className="w-5 h-5 text-green-600" /> | ||
| <h3 className="text-lg font-semibold text-gray-800 dark:text-gray-200"> | ||
| Complete Ticket | ||
| </h3> | ||
| </div> | ||
| <p className="text-gray-600 dark:text-gray-400 mb-2"> | ||
| <strong>Ticket:</strong> {ticketTitle} | ||
| </p> | ||
| <p className="text-sm text-gray-500 dark:text-gray-500"> | ||
| Before marking this ticket as complete, please document how you resolved it. | ||
| This helps other team members learn from your solution. | ||
| </p> | ||
| </div> | ||
|
|
||
| <form onSubmit={handleSubmit}> | ||
| <div className="mb-6"> | ||
| <label className="flex items-center text-sm font-medium text-gray-800 dark:text-gray-300 mb-2"> | ||
| <LabeledIcon className="mr-2" icon={<BookOpen className="w-4" />} label="Resolution Documentation" /> | ||
| </label> | ||
| <textarea | ||
| value={documentation} | ||
| onChange={(e) => setDocumentation(e.target.value)} | ||
| placeholder="Describe how you resolved this ticket: • What was the root cause? • What steps did you take? • What solution worked? • Any preventive measures for the future?" | ||
| className="w-full p-3 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-300 rounded-md resize-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" | ||
| rows={8} | ||
| required | ||
| /> | ||
| <p className="text-xs text-gray-500 mt-1"> | ||
| Documentation is required to complete the ticket | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="flex justify-end gap-3"> | ||
| <Button | ||
| type="button" | ||
| className="bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-600 dark:text-white rounded" | ||
| onClick={handleClose} | ||
| disabled={isLoading} | ||
| > | ||
| Cancel | ||
| </Button> | ||
| <Button | ||
| type="submit" | ||
| className="bg-green-600 hover:bg-green-700 text-white rounded" | ||
| disabled={isLoading || !documentation.trim()} | ||
| > | ||
| {isLoading ? ( | ||
| <span className="flex items-center gap-2"> | ||
| <div className="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" /> | ||
| Completing... | ||
| </span> | ||
| ) : ( | ||
| <span className="flex items-center gap-2"> | ||
| <CheckCircle className="w-4 h-4" /> | ||
| Complete Ticket | ||
| </span> | ||
| )} | ||
| </Button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </Modal> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The completion flow bypasses the dedicated completion endpoint (/api/v1/tickets/{id}/complete) and uses the general update endpoint instead. This creates inconsistency - there's a specific completion API that's not being used. Consider using the completeTicket function or removing the unused completion endpoint.