Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
/**
|
|
* Presentational unread-count pill. Renders nothing when `count <= 0`, a small
|
|
* accented badge otherwise (capped at "99+"). Pure — it takes the count as a
|
|
* prop so it can decorate any surface (the header bell, a Me-tab row, etc.)
|
|
* without owning any fetching.
|
|
*/
|
|
|
|
import { StyleSheet, Text, View } from "react-native";
|
|
|
|
import { colors } from "@/components/me/theme";
|
|
|
|
interface UnreadBadgeProps {
|
|
count: number;
|
|
/** Optional accessibility noun, e.g. "unread notifications" (default). */
|
|
label?: string;
|
|
}
|
|
|
|
export function UnreadBadge({ count, label = "unread notifications" }: UnreadBadgeProps) {
|
|
if (!Number.isFinite(count) || count <= 0) return null;
|
|
|
|
const display = count > 99 ? "99+" : String(count);
|
|
|
|
return (
|
|
<View
|
|
style={styles.badge}
|
|
accessibilityRole="text"
|
|
accessibilityLabel={`${count} ${label}`}
|
|
>
|
|
<Text style={styles.text} allowFontScaling={false}>
|
|
{display}
|
|
</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
badge: {
|
|
minWidth: 18,
|
|
height: 18,
|
|
borderRadius: 9,
|
|
paddingHorizontal: 5,
|
|
backgroundColor: colors.error,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
text: {
|
|
color: "#ffffff",
|
|
fontSize: 11,
|
|
fontWeight: "800",
|
|
lineHeight: 14,
|
|
},
|
|
});
|