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.
150 lines
4.1 KiB
TypeScript
150 lines
4.1 KiB
TypeScript
/**
|
|
* Platform-admin: the cross-tenant right-to-erasure (GDPR Art. 17) queue
|
|
* (GET /admin/erasure-requests), newest first, with pull-to-refresh and
|
|
* pagination. Read-only here — operator-initiated erasure lives on the Users
|
|
* screen behind confirmation. Staff-gated server-side.
|
|
*
|
|
* NAV MANIFEST:
|
|
* - { route: "/account/admin/erasure-requests", title: "Erasure Requests" }
|
|
*/
|
|
|
|
import * as React from "react";
|
|
import {
|
|
FlatList,
|
|
RefreshControl,
|
|
StyleSheet,
|
|
Text,
|
|
View,
|
|
} from "react-native";
|
|
|
|
import { Stack } from "expo-router";
|
|
|
|
import { colors } from "@/components/me/theme";
|
|
import {
|
|
adminListErasureRequests,
|
|
DEFAULT_ADMIN_COMPLIANCE_LIMIT,
|
|
} from "@/lib/admin";
|
|
import type { ErasureRequest } from "@/lib/compliance";
|
|
import {
|
|
AdminListState,
|
|
Badge,
|
|
Card,
|
|
KeyValue,
|
|
LoadMoreFooter,
|
|
adminStyles,
|
|
formatDateTime,
|
|
} from "@/components/admin/ui";
|
|
import { useAdminList } from "@/components/admin/use-admin-list";
|
|
import { useSession } from "@/src/shared/auth";
|
|
|
|
function toneForStatus(
|
|
status: string,
|
|
): "neutral" | "success" | "warning" | "danger" {
|
|
const s = status.toLowerCase();
|
|
if (s === "completed") return "success";
|
|
if (s === "processing") return "warning";
|
|
if (s === "failed") return "danger";
|
|
return "neutral";
|
|
}
|
|
|
|
export default function AdminErasureRequestsScreen(): React.ReactElement {
|
|
const { apiKey } = useSession();
|
|
const token = apiKey ?? undefined;
|
|
|
|
const fetcher = React.useCallback(
|
|
(
|
|
window: { limit: number; offset: number },
|
|
transport: { token?: string; signal: AbortSignal },
|
|
) => adminListErasureRequests(window, transport),
|
|
[],
|
|
);
|
|
|
|
const list = useAdminList<ErasureRequest>(
|
|
fetcher,
|
|
token,
|
|
DEFAULT_ADMIN_COMPLIANCE_LIMIT,
|
|
);
|
|
|
|
const renderItem = React.useCallback(
|
|
({ item }: { item: ErasureRequest }): React.ReactElement => (
|
|
<Card>
|
|
<View style={styles.rowBetween}>
|
|
<Text style={styles.id} numberOfLines={1}>
|
|
{item.scope || "user"}
|
|
</Text>
|
|
<Badge
|
|
label={item.status || "requested"}
|
|
tone={toneForStatus(item.status || "requested")}
|
|
/>
|
|
</View>
|
|
<KeyValue label="Request id" value={item.id} />
|
|
<KeyValue label="User id" value={item.user_id} />
|
|
<KeyValue label="Requested" value={formatDateTime(item.requested_at)} />
|
|
<KeyValue label="Completed" value={formatDateTime(item.completed_at)} />
|
|
</Card>
|
|
),
|
|
[],
|
|
);
|
|
|
|
return (
|
|
<View style={adminStyles.container}>
|
|
<Stack.Screen options={{ title: "Erasure Requests" }} />
|
|
<FlatList
|
|
data={list.items as ErasureRequest[]}
|
|
keyExtractor={(item) => item.id}
|
|
renderItem={renderItem}
|
|
contentContainerStyle={adminStyles.content}
|
|
refreshControl={
|
|
<RefreshControl
|
|
refreshing={list.status === "refreshing"}
|
|
onRefresh={list.refresh}
|
|
tintColor={colors.accent}
|
|
/>
|
|
}
|
|
onEndReachedThreshold={0.4}
|
|
onEndReached={list.loadMore}
|
|
ListHeaderComponent={
|
|
<Text style={adminStyles.intro}>
|
|
Every right-to-erasure request across every tenant, newest first.
|
|
Erasure anonymizes PII in place while preserving financial records.
|
|
</Text>
|
|
}
|
|
ListEmptyComponent={
|
|
<AdminListState
|
|
loading={list.initialLoading}
|
|
error={list.error}
|
|
empty={list.status === "ready"}
|
|
emptyTitle="No erasure requests"
|
|
emptyHint="No right-to-erasure requests have been filed."
|
|
onRetry={list.refresh}
|
|
/>
|
|
}
|
|
ListFooterComponent={
|
|
<LoadMoreFooter
|
|
hasMore={list.hasMore}
|
|
loading={list.status === "loadingMore"}
|
|
count={list.items.length}
|
|
onLoadMore={list.loadMore}
|
|
/>
|
|
}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
rowBetween: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
justifyContent: "space-between",
|
|
gap: 8,
|
|
},
|
|
id: {
|
|
color: colors.textPrimary,
|
|
fontSize: 16,
|
|
fontWeight: "700",
|
|
flexShrink: 1,
|
|
textTransform: "capitalize",
|
|
},
|
|
});
|