feat: quiz
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useState } from "react";
|
||||
import { Can } from "@/components/staff-context";
|
||||
import { toast } from "sonner";
|
||||
import { api, AdminError, type AdminFeedback } from "@/lib/api";
|
||||
import { usePagedList } from "@/lib/use-paged-list";
|
||||
@@ -40,7 +41,8 @@ export default function FeedbackPage() {
|
||||
if (
|
||||
await confirm({
|
||||
title: "Acknowledge this feedback?",
|
||||
message: "The author will be emailed that we've seen it and started work.",
|
||||
message:
|
||||
"The author will be emailed that we've seen it and started work.",
|
||||
confirmLabel: "Acknowledge",
|
||||
})
|
||||
) {
|
||||
@@ -52,7 +54,8 @@ export default function FeedbackPage() {
|
||||
if (
|
||||
await confirm({
|
||||
title: "Mark resolved?",
|
||||
message: "The author will be emailed a thank-you. This can't be undone.",
|
||||
message:
|
||||
"The author will be emailed a thank-you. This can't be undone.",
|
||||
confirmLabel: "Mark resolved",
|
||||
})
|
||||
) {
|
||||
@@ -132,27 +135,35 @@ export default function FeedbackPage() {
|
||||
<TD className="whitespace-nowrap">{fmtDate(f.created_at)}</TD>
|
||||
<TD className="text-right">
|
||||
<div className="flex flex-wrap justify-end gap-2">
|
||||
{!f.resolved_at && !f.acknowledged_at ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => acknowledge(f)}
|
||||
>
|
||||
Acknowledge
|
||||
</Button>
|
||||
) : null}
|
||||
{!f.resolved_at ? (
|
||||
<Can perm="feedback:resolve">
|
||||
{!f.resolved_at && !f.acknowledged_at ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => acknowledge(f)}
|
||||
>
|
||||
Acknowledge
|
||||
</Button>
|
||||
) : null}
|
||||
{!f.resolved_at ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => resolve(f)}
|
||||
>
|
||||
Resolve
|
||||
</Button>
|
||||
) : null}
|
||||
</Can>
|
||||
<Can perm="feedback:reply">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => resolve(f)}
|
||||
onClick={() => setReply(f)}
|
||||
>
|
||||
Resolve
|
||||
{f.replied_at ? "Reply again" : "Reply"}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button size="sm" variant="outline" onClick={() => setReply(f)}>
|
||||
{f.replied_at ? "Reply again" : "Reply"}
|
||||
</Button>
|
||||
</Can>
|
||||
</div>
|
||||
</TD>
|
||||
</TR>
|
||||
@@ -206,7 +217,10 @@ function ReplyModal({
|
||||
if (!feedback || message.trim() === "") return;
|
||||
setBusy(true);
|
||||
try {
|
||||
const { data } = (await api.replyFeedback(feedback.id, message.trim())) as {
|
||||
const { data } = (await api.replyFeedback(
|
||||
feedback.id,
|
||||
message.trim(),
|
||||
)) as {
|
||||
data: { replied: boolean; emailed: boolean };
|
||||
};
|
||||
toast.success(
|
||||
|
||||
Reference in New Issue
Block a user