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.
85 lines
2.0 KiB
TypeScript
85 lines
2.0 KiB
TypeScript
/**
|
|
* Bell button with an overlaid unread badge, for the header / Me tab. Fetches
|
|
* its own unread count (via {@link useUnreadCount}, refreshed on focus) and taps
|
|
* through to the notification center. Self-contained so it can be dropped into a
|
|
* navigator's `headerRight` or rendered inline.
|
|
*/
|
|
|
|
import { Pressable, StyleSheet, View } from "react-native";
|
|
|
|
import { useRouter } from "expo-router";
|
|
|
|
import { colors } from "@/components/me/theme";
|
|
import { UnreadBadge } from "./UnreadBadge";
|
|
import { useUnreadCount } from "./useUnreadCount";
|
|
|
|
interface NotificationBellProps {
|
|
/** Extra horizontal padding, useful when placed in a header. */
|
|
compact?: boolean;
|
|
}
|
|
|
|
export function NotificationBell({ compact = false }: NotificationBellProps) {
|
|
const router = useRouter();
|
|
const { count } = useUnreadCount();
|
|
|
|
return (
|
|
<Pressable
|
|
onPress={() => router.push("/notifications")}
|
|
hitSlop={10}
|
|
accessibilityRole="button"
|
|
accessibilityLabel={
|
|
count > 0
|
|
? `Notifications, ${count} unread`
|
|
: "Notifications"
|
|
}
|
|
style={[styles.button, compact ? styles.compact : null]}
|
|
>
|
|
<View style={styles.bellIcon}>
|
|
<View style={styles.bellDome} />
|
|
<View style={styles.bellBase} />
|
|
</View>
|
|
{count > 0 ? (
|
|
<View style={styles.badgeAnchor}>
|
|
<UnreadBadge count={count} />
|
|
</View>
|
|
) : null}
|
|
</Pressable>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
button: {
|
|
width: 40,
|
|
height: 40,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
compact: { marginRight: 8 },
|
|
bellIcon: {
|
|
width: 20,
|
|
height: 20,
|
|
alignItems: "center",
|
|
justifyContent: "flex-end",
|
|
},
|
|
bellDome: {
|
|
width: 14,
|
|
height: 12,
|
|
borderTopLeftRadius: 7,
|
|
borderTopRightRadius: 7,
|
|
borderWidth: 2,
|
|
borderBottomWidth: 0,
|
|
borderColor: colors.textPrimary,
|
|
},
|
|
bellBase: {
|
|
width: 8,
|
|
height: 2,
|
|
backgroundColor: colors.textPrimary,
|
|
borderRadius: 1,
|
|
},
|
|
badgeAnchor: {
|
|
position: "absolute",
|
|
top: 2,
|
|
right: 2,
|
|
},
|
|
});
|