Skip to content

Commit 94edc38

Browse files
committed
add new rating/feedback to support tab
1 parent 557d42d commit 94edc38

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/SupportCaseDetails.tsx

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
3737
const [isSubmittingReply, setIsSubmittingReply] = useState(false);
3838
const [localMessages, setLocalMessages] = useState(ticket.messages || []);
3939

40+
// rating/feedback
41+
const [rating, setRating] = useState(0)
42+
const [feedback, setFeedback] = useState("")
43+
44+
const handleStarClick = (starIndex: number) => {
45+
setRating(starIndex + 1)
46+
}
47+
48+
const handleSendFeedback = () => {
49+
console.log("Feedback sent:", { rating, feedback })
50+
// Handle feedback submission
51+
}
52+
4053
const handleSendReply = async () => {
4154
if (!team.unthreadCustomerId) {
4255
toast.error("No unthread customer id found for this team");
@@ -152,11 +165,47 @@ export function SupportCaseDetails({ ticket, team }: SupportCaseDetailsProps) {
152165
{ticket.status === "closed" && (
153166
<div className="border-t p-6">
154167
<p className="text-muted-foreground text-sm">
155-
This ticket is closed. If you need further assistance, please
156-
create a new ticket.
168+
This ticket is closed. Give us a quick rating to let us know how we did!
157169
</p>
158170
</div>
159171
)}
172+
173+
<div className="flex gap-2 mb-6 px-6">
174+
{[...Array(5)].map((_, index) => (
175+
<button key={index} onClick={() => handleStarClick(index)} className="transition-colors">
176+
<svg
177+
width="32"
178+
height="32"
179+
viewBox="0 0 24 24"
180+
fill={index < rating ? "#ff00aa" : "none"}
181+
stroke={index < rating ? "#ff00aa" : "#666"}
182+
strokeWidth={index < rating ? "2" : "1"}
183+
className="hover:fill-pink-500 hover:stroke-pink-500 rounded-sm"
184+
rx="2"
185+
>
186+
<polygon points="12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" />
187+
</svg>
188+
</button>
189+
))}
190+
</div>
191+
192+
{/* Feedback Input */}
193+
<div className="relative p-6">
194+
<div className="relative">
195+
<textarea
196+
value={feedback}
197+
onChange={(e) => setFeedback(e.target.value)}
198+
placeholder="Optional: Tell us how we can improve."
199+
className="text-muted-foreground text-sm w-full bg-black text-white rounded-lg p-4 pr-28 min-h-[100px] resize-none border border-[#262626] focus:border-[#262626] focus:outline-none placeholder-[#A1A1A1]"
200+
/>
201+
<button
202+
onClick={handleSendFeedback}
203+
className="absolute mb-2 bottom-3 right-3 bg-white text-black px-4 py-2 rounded-full text-sm font-medium hover:bg-gray-100 transition-colors"
204+
>
205+
Send Feedback
206+
</button>
207+
</div>
208+
</div>
160209
</div>
161210

162211
<div className="h-8" />

0 commit comments

Comments
 (0)