videogen/apps/mobile/components/calendar/CalendarEntryCard.tsx
caelum0x d56639a594
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
Menivor — open source release (MIT), free to use and fork
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.
2026-12-04 02:10:26 +03:00

140 lines
3.9 KiB
TypeScript

import {
ActivityIndicator,
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import { colors } from "@/components/me/theme";
import type { CalendarEntry } from "@/lib/calendar";
import {
formatEntryTime,
isPending,
platformSummary,
statusBadge,
} from "./format";
/**
* One calendar-agenda row: the entry's local publish time + target platforms +
* a status badge. Still-`pending` entries expose Reschedule + Cancel actions
* (both disabled while a mutation for this row is in flight); tapping the row
* deep-links to the source job. Purely presentational — all state/handlers are
* owned by the parent screen.
*/
export interface CalendarEntryCardProps {
entry: CalendarEntry;
/** True while a reschedule OR cancel request for this row is in flight. */
busy: boolean;
onReschedule: (entry: CalendarEntry) => void;
onCancel: (entry: CalendarEntry) => void;
onPressJob: (jobId: string) => void;
}
export function CalendarEntryCard({
entry,
busy,
onReschedule,
onCancel,
onPressJob,
}: Readonly<CalendarEntryCardProps>) {
const badge = statusBadge(String(entry.status));
const pending = isPending(entry);
return (
<View style={styles.card}>
<View style={styles.headerRow}>
<Text style={styles.time}>{formatEntryTime(entry.scheduled_at)}</Text>
<Text style={[styles.badge, { color: badge.color }]}>
{badge.label}
</Text>
</View>
<Text style={styles.platforms} numberOfLines={1}>
{platformSummary(entry)}
</Text>
{entry.job_id ? (
<Pressable
onPress={() => onPressJob(entry.job_id as string)}
accessibilityRole="button"
accessibilityLabel="View source job"
hitSlop={6}
>
<Text style={styles.jobLink} numberOfLines={1}>
Job {entry.job_id}
</Text>
</Pressable>
) : null}
{pending ? (
<View style={styles.actions}>
<Pressable
style={[styles.action, styles.reschedule, busy && styles.disabled]}
onPress={() => onReschedule(entry)}
disabled={busy}
accessibilityRole="button"
accessibilityLabel="Reschedule this publish"
accessibilityState={{ disabled: busy }}
>
{busy ? (
<ActivityIndicator color={colors.accent} />
) : (
<Text style={styles.rescheduleText}>Reschedule</Text>
)}
</Pressable>
<Pressable
style={[styles.action, styles.cancel, busy && styles.disabled]}
onPress={() => onCancel(entry)}
disabled={busy}
accessibilityRole="button"
accessibilityLabel="Cancel this scheduled publish"
accessibilityState={{ disabled: busy }}
>
<Text style={styles.cancelText}>Cancel</Text>
</Pressable>
</View>
) : null}
</View>
);
}
const styles = StyleSheet.create({
card: {
backgroundColor: colors.card,
borderColor: colors.border,
borderWidth: 1,
borderRadius: 12,
padding: 16,
gap: 6,
},
headerRow: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
gap: 12,
},
time: {
color: colors.textPrimary,
fontSize: 16,
fontWeight: "700",
},
badge: { fontSize: 13, fontWeight: "700" },
platforms: { color: colors.textSecondary, fontSize: 14 },
jobLink: { color: colors.muted, fontSize: 12 },
actions: { flexDirection: "row", gap: 10, marginTop: 8 },
action: {
flex: 1,
borderWidth: 1,
borderRadius: 10,
paddingVertical: 10,
alignItems: "center",
},
reschedule: { borderColor: colors.accent },
rescheduleText: { color: colors.accent, fontSize: 14, fontWeight: "700" },
cancel: { borderColor: colors.error },
cancelText: { color: colors.error, fontSize: 14, fontWeight: "700" },
disabled: { opacity: 0.5 },
});