(initialStatus)
+ const order = useOrderStore((state) => state.orders.find((item) => item.id === orderId))
+ const updateOrderStatus = useOrderStore((state) => state.updateOrderStatus)
+ const ensureOrderSession = useChatStore((state) => state.ensureOrderSession)
+ const [resolvedChatSessionId, setResolvedChatSessionId] = useState(chatSessionId)
+
+ const status = order?.status ?? initialStatus
+
+ useEffect(() => {
+ if (chatSessionId) {
+ setResolvedChatSessionId(chatSessionId)
+ return
+ }
+
+ if (!order) return
+ const session = ensureOrderSession(order)
+ setResolvedChatSessionId(session.id)
+ }, [chatSessionId, order, ensureOrderSession])
return (
- {status === "pending_accept" && (
+ {status === "pending_payment" && (
<>
+ >
+ )}
+
+ {status === "pending_accept" && (
+ <>
+
+