Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(clients): surface child approvals in parent threads #28516

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/28516/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 12 changed files with 88 additions and 0 deletions (loading 11).

x
0 of 12 viewed, 12 left
88 additions and 0 deletionsapps/mobile/src/features/threads/ChildThreadApprovals.tsxAdded
View file
@@ -0,0 +1,88 @@
+import { useAtomValue } from "@effect/atom-react";
+import { AuthOrchestrationOperateScope, type ScopedThreadRef } from "@t3tools/contracts";
+import type { ChildThreadApproval } from "@t3tools/client-runtime/state/thread-requests";
+import {
+ isAtomCommandInterrupted,
+ squashAtomCommandFailure,
+} from "@t3tools/client-runtime/state/runtime";
+import { useState } from "react";
+import { useEnvironmentScope } from "../../state/session";
+import { ScrollView, View } from "react-native";
+import Animated, { useAnimatedStyle, type DerivedValue } from "react-native-reanimated";
+import { AppText } from "../../components/ui/AppText";
+import { childThreadApprovalsAtom, threadEnvironment } from "../../state/threads";
+import { useAtomCommand } from "../../state/use-atom-command";
+import { PendingApprovalCard } from "./PendingApprovalCard";
+​
+function ChildApproval({ entry }: { entry: ChildThreadApproval }) {
+ const canRespond = useEnvironmentScope(entry.thread.environmentId, AuthOrchestrationOperateScope);
+ const respond = useAtomCommand(threadEnvironment.respondToApproval, { reportFailure: false });
+ const [responding, setResponding] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ return (
+ <View className="mx-3.5 my-2 gap-2">
+ <AppText className="font-t3-bold text-sm text-foreground">
+ Approval from {entry.title}
+ </AppText>
+ <PendingApprovalCard
+ canOperateThread={canRespond}
+ approval={entry.approval}
+ respondingApprovalId={responding ? entry.approval.requestId : null}