MCPcopy
hub / github.com/Peppermint-Lab/peppermint / Ticket

Function Ticket

apps/client/components/TicketDetails/index.tsx:92–1338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90];
91
92export default function Ticket() {
93 const router = useRouter();
94 const { t } = useTranslation("peppermint");
95
96 const token = getCookie("session");
97
98 const { user } = useUser();
99
100 const fetchTicketById = async () => {
101 const id = router.query.id;
102 const res = await fetch(`/api/v1/ticket/${id}`, {
103 headers: {
104 Authorization: `Bearer ${token}`,
105 },
106 });
107
108 hasAccess(res);
109
110 return res.json();
111 };
112
113 const { data, status, refetch } = useQuery("fetchTickets", fetchTicketById, {
114 enabled: false,
115 });
116
117 useEffect(() => {
118 refetch();
119 }, [router]);
120
121 const [initialContent, setInitialContent] = useState<
122 PartialBlock[] | undefined | "loading"
123 >("loading");
124
125 const editor = useMemo(() => {
126 if (initialContent === "loading") {
127 return undefined;
128 }
129 return BlockNoteEditor.create({ initialContent });
130 }, [initialContent]);
131
132 const [edit, setEdit] = useState(false);
133 const [editTime, setTimeEdit] = useState(false);
134 const [assignedEdit, setAssignedEdit] = useState(false);
135 const [labelEdit, setLabelEdit] = useState(false);
136
137 const [users, setUsers] = useState<any>();
138 const [n, setN] = useState<any>();
139
140 const [note, setNote] = useState<any>();
141 const [issue, setIssue] = useState<any>();
142 const [title, setTitle] = useState<any>();
143 // const [uploaded, setUploaded] = useState<any>();
144 const [priority, setPriority] = useState<any>();
145 const [ticketStatus, setTicketStatus] = useState<any>();
146 const [comment, setComment] = useState<any>();
147 const [timeSpent, setTimeSpent] = useState<any>();
148 const [publicComment, setPublicComment] = useState<any>(false);
149 const [timeReason, setTimeReason] = useState("");

Callers

nothing calls this directly

Calls 15

useUserFunction · 0.90
cnFunction · 0.90
toastFunction · 0.90
handleUploadFunction · 0.85
transferTicketFunction · 0.85
hideFunction · 0.85
lockFunction · 0.85
deleteIssueFunction · 0.85
deleteCommentFunction · 0.85
fetchUsersFunction · 0.70
updateFunction · 0.70
loadFromStorageFunction · 0.70

Tested by

no test coverage detected