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

Function toast

apps/client/@/shadcn/hooks/use-toast.ts:145–172  ·  view source on GitHub ↗
({ ...props }: Toast)

Source from the content-addressed store, hash-verified

143type Toast = Omit<ToasterToast, "id">
144
145function toast({ ...props }: Toast) {
146 const id = genId()
147
148 const update = (props: ToasterToast) =>
149 dispatch({
150 type: "UPDATE_TOAST",
151 toast: { ...props, id },
152 })
153 const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
154
155 dispatch({
156 type: "ADD_TOAST",
157 toast: {
158 ...props,
159 id,
160 open: true,
161 onOpenChange: (open) => {
162 if (!open) dismiss()
163 },
164 },
165 })
166
167 return {
168 id: id,
169 dismiss,
170 update,
171 }
172}
173
174function useToast() {
175 const [state, setState] = React.useState<State>(memoryState)

Callers 15

updateUserFunction · 0.90
updateFunction · 0.90
updateStatusFunction · 0.90
hideFunction · 0.90
lockFunction · 0.90
deleteIssueFunction · 0.90
addCommentFunction · 0.90
deleteCommentFunction · 0.90
addTimeFunction · 0.90
fetchUsersFunction · 0.90
transferTicketFunction · 0.90
updateTicketStatusFunction · 0.90

Calls 3

genIdFunction · 0.85
dispatchFunction · 0.85
dismissFunction · 0.85

Tested by

no test coverage detected