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

98 lines
2.4 KiB
TypeScript

/**
* StudioScreen — a full-screen container for the Studio (avatars & voices)
* cluster. Standardises the page background plus the loading / error states so
* each screen only renders its ready-state body (which owns its own list +
* pull-to-refresh). Mirrors the Me tab's `SectionState`, scaled to a page.
*/
import type { ReactNode } from "react";
import {
ActivityIndicator,
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import { colors } from "@/components/me/theme";
import type { ResourceStatus } from "@/components/me/use-resource";
interface StudioScreenProps {
status: ResourceStatus;
error: string;
onRetry: () => void;
/** Rendered only when `status === "ready"`. */
children: ReactNode;
loadingLabel?: string;
}
export function StudioScreen({
status,
error,
onRetry,
children,
loadingLabel,
}: StudioScreenProps) {
if (status === "loading") {
return (
<View style={styles.center}>
<ActivityIndicator color={colors.accent} />
{loadingLabel ? <Text style={styles.muted}>{loadingLabel}</Text> : null}
</View>
);
}
if (status === "error") {
return (
<View style={styles.center}>
<View style={styles.errorBox}>
<Text style={styles.errorText}>
{error || "Something went wrong."}
</Text>
<Pressable
style={styles.retry}
onPress={onRetry}
accessibilityRole="button"
>
<Text style={styles.retryText}>Try again</Text>
</Pressable>
</View>
</View>
);
}
return <View style={styles.container}>{children}</View>;
}
const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: colors.bg },
center: {
flex: 1,
backgroundColor: colors.bg,
alignItems: "center",
justifyContent: "center",
padding: 24,
gap: 12,
},
muted: { color: colors.muted, fontSize: 13 },
errorBox: {
backgroundColor: colors.card,
borderColor: colors.border,
borderWidth: 1,
borderRadius: 12,
padding: 16,
gap: 12,
alignItems: "flex-start",
alignSelf: "stretch",
},
errorText: { color: colors.error, fontSize: 14 },
retry: {
borderColor: colors.border,
borderWidth: 1,
borderRadius: 8,
paddingHorizontal: 14,
paddingVertical: 8,
},
retryText: { color: colors.textSecondary, fontWeight: "600" },
});