diff --git a/apps/mobile/src/features/chats/KinLevelsScreen.tsx b/apps/mobile/src/features/chats/KinLevelsScreen.tsx index a46b4d2f7bd40..b19609b7c495a 100644 --- a/apps/mobile/src/features/chats/KinLevelsScreen.tsx +++ b/apps/mobile/src/features/chats/KinLevelsScreen.tsx @@ -25,6 +25,7 @@ import { ScreenScrollView } from "../../components/ui/ScreenScrollView"; import { appAtomRegistry } from "../../state/atom-registry"; import { useAtomCommand } from "../../state/use-atom-command"; import { kinClient } from "./state/kinClient"; +import { KinApprovalCard } from "./widgets/KinApprovalCard"; import { kinChatTitle, kinDirectory } from "@t3tools/client-runtime/kin/kinScreenState"; import { useKinHostAt } from "./state/useKinHost"; import { @@ -170,7 +171,7 @@ function KinLevelsBody(props: { text: change.kind === "lower" ? `Lowered to ${change.level}.` - : `Raise to ${change.level} requested. It applies once you sign the approval.`, + : `Raise to ${change.level} requested. Approve it below with Face ID.`, error: false, }); }; @@ -272,6 +273,16 @@ function KinLevelsBody(props: { ))} )} + {result.value.pendingRaises + .filter((raise) => raise.state === "awaiting_approval") + .map((raise) => ( + + ))} {view.chats.length === 0 ? null : ( diff --git a/apps/mobile/src/features/chats/KinWaitingScreen.tsx b/apps/mobile/src/features/chats/KinWaitingScreen.tsx index 91305afbe699a..d47aa20f3c4a1 100644 --- a/apps/mobile/src/features/chats/KinWaitingScreen.tsx +++ b/apps/mobile/src/features/chats/KinWaitingScreen.tsx @@ -1,5 +1,8 @@ import { useNavigation } from "@react-navigation/native"; +import { kinApprovalActionIdOf } from "@t3tools/contracts"; +import { View } from "react-native"; +import { Button } from "../../components/ui/Button"; import { EmptyState } from "../../components/ui/EmptyState"; import { ListRow } from "../../components/ui/ListRow"; import { ListSection } from "../../components/ui/ListSection"; @@ -11,8 +14,9 @@ import { kinWaitingRowView, } from "@t3tools/client-runtime/kin/kinScreenState"; import { useKinInbox } from "./state/useKinInbox"; +import { KinApprovalCard } from "./widgets/KinApprovalCard"; -/** Placeholder Waiting on you until the native cards land: one row per item, oldest first. */ +/** Waiting on you, oldest first: approvals as their full cards, everything else as a row. */ export function KinWaitingScreen() { const navigation = useNavigation(); const { host, state, retry } = useKinInbox(); @@ -30,28 +34,59 @@ export function KinWaitingScreen() { /> ); } + const openChat = (item: (typeof view.waiting)[number]) => + navigation.navigate("KinChat", { + environmentId: ready.environmentId, + orgId: item.orgId, + chatId: item.chatId, + }); + const approvals = view.waiting.flatMap((item) => { + const actionId = + item.reason === "approval" && item.widgetId !== null + ? kinApprovalActionIdOf(item.widgetId) + : null; + return actionId === null ? [] : [{ item, actionId }]; + }); + const rest = view.waiting.filter( + (item) => !approvals.some((approval) => approval.item.waitingId === item.waitingId), + ); return ( - - {view.waiting.map((item) => { - const row = kinWaitingRowView(item, ready.inbox.value.chats, agentNames); - return ( - - navigation.navigate("KinChat", { - environmentId: ready.environmentId, - orgId: item.orgId, - chatId: item.chatId, - }) - } + <> + {approvals.map(({ item, actionId }) => ( + + - ); - })} - + +