|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { useState } from "react"; |
| 4 | +import { |
| 5 | + ArrowRight, |
| 6 | + CheckCircle2, |
| 7 | + CircleDot, |
| 8 | + Flag, |
| 9 | + HelpCircle, |
| 10 | + MessageSquare, |
| 11 | + Pencil, |
| 12 | + RotateCcw, |
| 13 | +} from "lucide-react"; |
| 14 | + |
| 15 | +import { Button } from "@/components/ui/button"; |
| 16 | +import { |
| 17 | + Dialog, |
| 18 | + DialogContent, |
| 19 | + DialogDescription, |
| 20 | + DialogHeader, |
| 21 | + DialogTitle, |
| 22 | + DialogTrigger, |
| 23 | +} from "@/components/ui/dialog"; |
| 24 | + |
| 25 | +export function FlaggingHelpDialog() { |
| 26 | + const [open, setOpen] = useState(false); |
| 27 | + |
| 28 | + return ( |
| 29 | + <Dialog open={open} onOpenChange={setOpen}> |
| 30 | + <DialogTrigger asChild> |
| 31 | + <Button variant="outline" size="sm"> |
| 32 | + <HelpCircle className="mr-2 h-4 w-4" /> |
| 33 | + How flagging works |
| 34 | + </Button> |
| 35 | + </DialogTrigger> |
| 36 | + <DialogContent className="max-h-[85vh] overflow-y-auto sm:max-w-2xl"> |
| 37 | + <DialogHeader> |
| 38 | + <DialogTitle>Activity Flagging System</DialogTitle> |
| 39 | + <DialogDescription> |
| 40 | + How participants report activities and how admins resolve them. |
| 41 | + </DialogDescription> |
| 42 | + </DialogHeader> |
| 43 | + |
| 44 | + <div className="space-y-6 text-sm"> |
| 45 | + {/* How flags are created */} |
| 46 | + <section className="space-y-2"> |
| 47 | + <h3 className="flex items-center gap-2 font-semibold"> |
| 48 | + <Flag className="h-4 w-4 text-destructive" /> |
| 49 | + How activities get flagged |
| 50 | + </h3> |
| 51 | + <p className="text-muted-foreground"> |
| 52 | + Any challenge participant can report another participant's activity |
| 53 | + by clicking the <strong>…</strong> menu on an activity card in the |
| 54 | + feed and selecting <strong>Report activity</strong>. They must provide |
| 55 | + a reason (e.g., incorrect points, suspicious entry). Users cannot flag |
| 56 | + their own activities, and each user can only flag a given activity once. |
| 57 | + </p> |
| 58 | + </section> |
| 59 | + |
| 60 | + {/* State machine */} |
| 61 | + <section className="space-y-3"> |
| 62 | + <h3 className="flex items-center gap-2 font-semibold"> |
| 63 | + <CircleDot className="h-4 w-4 text-amber-500" /> |
| 64 | + Flag status lifecycle |
| 65 | + </h3> |
| 66 | + <div className="rounded-lg border p-4"> |
| 67 | + <div className="flex flex-col gap-3"> |
| 68 | + <div className="flex items-center gap-3"> |
| 69 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-xs font-medium text-amber-500"> |
| 70 | + <CircleDot className="h-3 w-3" /> |
| 71 | + Pending |
| 72 | + </span> |
| 73 | + <ArrowRight className="h-4 w-4 text-muted-foreground" /> |
| 74 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1 text-xs font-medium text-emerald-500"> |
| 75 | + <CheckCircle2 className="h-3 w-3" /> |
| 76 | + Resolved |
| 77 | + </span> |
| 78 | + </div> |
| 79 | + <div className="flex items-center gap-3"> |
| 80 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1 text-xs font-medium text-emerald-500"> |
| 81 | + <CheckCircle2 className="h-3 w-3" /> |
| 82 | + Resolved |
| 83 | + </span> |
| 84 | + <ArrowRight className="h-4 w-4 text-muted-foreground" /> |
| 85 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-orange-500/30 bg-orange-500/10 px-3 py-1 text-xs font-medium text-orange-500"> |
| 86 | + <RotateCcw className="h-3 w-3" /> |
| 87 | + Reopened |
| 88 | + </span> |
| 89 | + </div> |
| 90 | + <div className="flex items-center gap-3"> |
| 91 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-orange-500/30 bg-orange-500/10 px-3 py-1 text-xs font-medium text-orange-500"> |
| 92 | + <RotateCcw className="h-3 w-3" /> |
| 93 | + Reopened |
| 94 | + </span> |
| 95 | + <ArrowRight className="h-4 w-4 text-muted-foreground" /> |
| 96 | + <span className="inline-flex items-center gap-1.5 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3 py-1 text-xs font-medium text-emerald-500"> |
| 97 | + <CheckCircle2 className="h-3 w-3" /> |
| 98 | + Resolved |
| 99 | + </span> |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + <ul className="ml-1 space-y-1.5 text-muted-foreground"> |
| 104 | + <li> |
| 105 | + <strong className="text-foreground">Pending</strong> — A new |
| 106 | + flag starts here. The activity is marked as flagged and appears in |
| 107 | + this list for review. |
| 108 | + </li> |
| 109 | + <li> |
| 110 | + <strong className="text-foreground">Resolved</strong> — An |
| 111 | + admin has reviewed and handled the flag. The activity is unflagged |
| 112 | + and returns to normal in the feed. |
| 113 | + </li> |
| 114 | + <li> |
| 115 | + <strong className="text-foreground">Reopened</strong> — A |
| 116 | + previously resolved flag has been reopened for further review. The |
| 117 | + activity becomes flagged again. |
| 118 | + </li> |
| 119 | + </ul> |
| 120 | + </section> |
| 121 | + |
| 122 | + {/* What happens on resolution */} |
| 123 | + <section className="space-y-2"> |
| 124 | + <h3 className="flex items-center gap-2 font-semibold"> |
| 125 | + <CheckCircle2 className="h-4 w-4 text-emerald-500" /> |
| 126 | + What happens when resolved |
| 127 | + </h3> |
| 128 | + <ul className="ml-1 space-y-1.5 text-muted-foreground"> |
| 129 | + <li> |
| 130 | + The activity's <strong className="text-foreground">flagged</strong> status |
| 131 | + is cleared, removing it from this queue. |
| 132 | + </li> |
| 133 | + <li> |
| 134 | + The resolution timestamp and the resolving admin are recorded for |
| 135 | + audit purposes. |
| 136 | + </li> |
| 137 | + <li> |
| 138 | + If you added a participant-visible comment, the participant receives |
| 139 | + a notification with your message. |
| 140 | + </li> |
| 141 | + </ul> |
| 142 | + </section> |
| 143 | + |
| 144 | + {/* Admin actions */} |
| 145 | + <section className="space-y-2"> |
| 146 | + <h3 className="flex items-center gap-2 font-semibold"> |
| 147 | + <Pencil className="h-4 w-4 text-indigo-400" /> |
| 148 | + Admin actions available |
| 149 | + </h3> |
| 150 | + <p className="text-muted-foreground"> |
| 151 | + Click <strong>View Details</strong> on any flagged activity to access |
| 152 | + the full admin toolkit: |
| 153 | + </p> |
| 154 | + <ul className="ml-1 space-y-1.5 text-muted-foreground"> |
| 155 | + <li> |
| 156 | + <strong className="text-foreground">Change status</strong> — |
| 157 | + Mark as pending, resolved, or reopened. |
| 158 | + </li> |
| 159 | + <li> |
| 160 | + <strong className="text-foreground">Add admin comment</strong>{" "} |
| 161 | + <MessageSquare className="inline h-3 w-3" /> — Leave an |
| 162 | + internal note (visible to admins only) or a participant-visible |
| 163 | + comment that sends a notification to the user. |
| 164 | + </li> |
| 165 | + <li> |
| 166 | + <strong className="text-foreground">Edit activity</strong> — |
| 167 | + Adjust points earned or notes. Point changes automatically update |
| 168 | + the participant's total score and notify them. |
| 169 | + </li> |
| 170 | + </ul> |
| 171 | + </section> |
| 172 | + |
| 173 | + {/* Audit trail */} |
| 174 | + <section className="space-y-2"> |
| 175 | + <h3 className="text-sm font-semibold">Audit trail</h3> |
| 176 | + <p className="text-muted-foreground"> |
| 177 | + Every admin action (status change, comment, edit) is recorded in the |
| 178 | + activity's history timeline, including who performed the action and |
| 179 | + when. This provides full accountability for all moderation decisions. |
| 180 | + </p> |
| 181 | + </section> |
| 182 | + </div> |
| 183 | + </DialogContent> |
| 184 | + </Dialog> |
| 185 | + ); |
| 186 | +} |
0 commit comments