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

Function Stat

packages/shared/src/components/shell/YouPage.tsx:166–219  ·  view source on GitHub ↗
({
  icon,
  amount,
  label,
  href,
  external = false,
  onClick,
}: {
  icon?: ReactNode;
  amount: number;
  label: string;
  href?: string;
  external?: boolean;
  onClick?: () => void;
})

Source from the content-addressed store, hash-verified

164
165// One strip at the profile page's sizes, so You and a profile read the same.
166const Stat = ({
167 icon,
168 amount,
169 label,
170 href,
171 external = false,
172 onClick,
173}: {
174 icon?: ReactNode;
175 amount: number;
176 label: string;
177 href?: string;
178 external?: boolean;
179 onClick?: () => void;
180}): ReactElement => {
181 const className =
182 'flex h-6 items-center gap-1 rounded-8 transition-colors hover:bg-surface-hover';
183 const content = (
184 <>
185 {icon}
186 <b className="tabular-nums text-text-primary typo-callout">
187 {largeNumberFormat(amount)}
188 </b>
189 <span className="text-text-tertiary">{label}</span>
190 </>
191 );
192
193 if (href && external) {
194 return (
195 <a
196 href={href}
197 target="_blank"
198 rel="noopener noreferrer"
199 className={className}
200 >
201 {content}
202 </a>
203 );
204 }
205
206 if (href) {
207 return (
208 <Link href={href} passHref>
209 <a className={className}>{content}</a>
210 </Link>
211 );
212 }
213
214 return (
215 <button type="button" onClick={onClick} className={className}>
216 {content}
217 </button>
218 );
219};
220
221const usePlusRow = (): { label: string; meta: string } => {
222 const { isPlus, status } = usePlusSubscription();

Callers

nothing calls this directly

Calls 1

largeNumberFormatFunction · 0.90

Tested by

no test coverage detected