MCPcopy Create free account
hub / github.com/dailydotdev/apps / FeedbackCard

Function FeedbackCard

packages/shared/src/components/feedback/FeedbackCard.tsx:27–165  ·  view source on GitHub ↗
({
  item,
  isExpanded,
  onToggleExpand,
  threadHref,
  isTeamView = false,
}: FeedbackCardProps)

Source from the content-addressed store, hash-verified

25};
26
27export const FeedbackCard = ({
28 item,
29 isExpanded,
30 onToggleExpand,
31 threadHref,
32 isTeamView = false,
33}: FeedbackCardProps): ReactElement => {
34 const showReplyState = isTeamView && !isFeedbackClosed(item.status);
35 const isLongDescription = item.description.length > 260;
36 const description = isExpanded
37 ? item.description
38 : item.description.slice(0, 260);
39 const badgeClassName = 'rounded-14 bg-surface-hover px-2 py-1 text-xs';
40
41 return (
42 <article className="rounded-16 border border-border-subtlest-tertiary bg-background-default p-4">
43 <div className="flex flex-wrap items-center gap-2">
44 <span className={`${badgeClassName} text-text-secondary`}>
45 {getFeedbackCategoryLabel(item.category)}
46 </span>
47 <span
48 className={`${badgeClassName} ${getFeedbackStatusClassName(
49 item.status,
50 )}`}
51 >
52 {getFeedbackStatusLabel(item.status, isTeamView)}
53 </span>
54 {showReplyState && (
55 <span
56 className={`${badgeClassName} ${
57 item.lastReplyIsTeam
58 ? 'text-text-tertiary'
59 : 'text-accent-cheese-default'
60 }`}
61 >
62 {item.lastReplyIsTeam ? 'Team replied' : 'Awaiting team'}
63 </span>
64 )}
65 <Typography
66 type={TypographyType.Footnote}
67 color={TypographyColor.Tertiary}
68 className="ml-auto"
69 >
70 {format(new Date(item.createdAt), 'dd MMM yyyy')}
71 </Typography>
72 </div>
73
74 {/* Feedback bodies routinely contain long URLs. Without `break-words` an
75 unbreakable run widens the card's min-content, growing whichever column
76 renders it and scrolling the page sideways on narrow screens. */}
77 <Typography
78 type={TypographyType.Body}
79 className="mt-3 whitespace-pre-wrap break-words"
80 >
81 {description}
82 {isLongDescription && !isExpanded ? '...' : ''}
83 </Typography>
84

Callers

nothing calls this directly

Calls 5

isFeedbackClosedFunction · 0.90
getFeedbackCategoryLabelFunction · 0.90
getFeedbackStatusLabelFunction · 0.90
formatFunction · 0.85

Tested by

no test coverage detected