mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
19 lines
545 B
TypeScript
19 lines
545 B
TypeScript
import { useState } from "preact/hooks";
|
|
|
|
const counts: { [key: string]: number } = {};
|
|
|
|
export default function PaintCounter({ small }: { small?: boolean }) {
|
|
if (import.meta.env.PROD) return null;
|
|
|
|
const [uniqueId] = useState('' + Math.random());
|
|
const count = counts[uniqueId] ?? 0;
|
|
counts[uniqueId] = count + 1;
|
|
return (
|
|
<div style={{ textAlign: 'center', fontSize: '0.8em' }}>
|
|
{ small ? <>P: { count + 1 }</> : <>
|
|
Painted {count + 1} time(s).
|
|
</> }
|
|
</div>
|
|
)
|
|
}
|