refactor(app): remove unused CreateAgentModal

Agent creation now uses the /agent/new route exclusively.
Remove the legacy modal and related deep link handling.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2026-01-03 19:48:05 +07:00
parent a12af74c7b
commit 1f9a35dafd
3 changed files with 3 additions and 61 deletions

View File

@@ -35,8 +35,7 @@ import { AgentStreamView } from "@/components/agent-stream-view";
import { AgentInputArea } from "@/components/agent-input-area";
import { AgentList } from "@/components/agent-list";
import { useAggregatedAgents } from "@/hooks/use-aggregated-agents";
import { CreateAgentModal, ImportAgentModal } from "@/components/create-agent-modal";
import type { CreateAgentInitialValues } from "@/hooks/use-agent-form-state";
import { ImportAgentModal } from "@/components/create-agent-modal";
import { useDaemonConnections } from "@/contexts/daemon-connections-context";
import type { ConnectionStatus } from "@/contexts/daemon-connections-context";
import { formatConnectionStatus } from "@/utils/daemons";
@@ -183,11 +182,7 @@ function AgentScreenContent({
const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
const [menuContentHeight, setMenuContentHeight] = useState(0);
const menuButtonRef = useRef<View>(null);
const [showCreateAgentModal, setShowCreateAgentModal] = useState(false);
const [showImportAgentModal, setShowImportAgentModal] = useState(false);
const [createAgentInitialValues, setCreateAgentInitialValues] = useState<
CreateAgentInitialValues | undefined
>();
const resolvedAgentId = agentId;
@@ -568,10 +563,6 @@ function AgentScreenContent({
router.push({ pathname: "/agent/new", params });
}, [agent, agentModel, handleCloseMenu, router, serverId]);
const handleCloseCreateAgentModal = useCallback(() => {
setShowCreateAgentModal(false);
}, []);
const handleImportAgent = useCallback(() => {
handleCloseMenu();
setShowImportAgentModal(true);
@@ -595,15 +586,6 @@ function AgentScreenContent({
[handleCloseMenu, router, serverId]
);
const createAgentModal = (
<CreateAgentModal
isVisible={showCreateAgentModal}
onClose={handleCloseCreateAgentModal}
initialValues={createAgentInitialValues}
serverId={serverId}
/>
);
const importAgentModal = (
<ImportAgentModal
isVisible={showImportAgentModal}
@@ -621,7 +603,6 @@ function AgentScreenContent({
<Text style={styles.errorText}>Agent not found</Text>
</View>
</View>
{createAgentModal}
{importAgentModal}
</>
);
@@ -872,7 +853,6 @@ function AgentScreenContent({
</View>
</Modal>
</View>
{createAgentModal}
{importAgentModal}
</>
);

View File

@@ -9,7 +9,7 @@ import { HomeHeader } from "@/components/headers/home-header";
import { HomeFooter } from "@/components/home-footer";
import { EmptyState } from "@/components/empty-state";
import { AgentList } from "@/components/agent-list";
import { CreateAgentModal, ImportAgentModal } from "@/components/create-agent-modal";
import { ImportAgentModal } from "@/components/create-agent-modal";
import { useAggregatedAgents } from "@/hooks/use-aggregated-agents";
import { useLocalSearchParams, useRouter } from "expo-router";
import { endNavigationTiming, HOME_NAVIGATION_KEY } from "@/utils/navigation-timing";
@@ -24,7 +24,6 @@ export default function HomeScreen() {
refreshAll,
} = useAggregatedAgents();
const router = useRouter();
const [showCreateModal, setShowCreateModal] = useState(false);
const [showImportModal, setShowImportModal] = useState(false);
const [pendingImportServerId, setPendingImportServerId] = useState<string | null>(null);
const { modal, flow, action, serverId: serverIdParam } = useLocalSearchParams<{
@@ -34,7 +33,6 @@ export default function HomeScreen() {
serverId?: string;
}>();
const deepLinkHandledRef = useRef<string | null>(null);
const createDeepLinkHandledRef = useRef<string | null>(null);
// Keyboard animation
const { height: keyboardHeight } = useReanimatedKeyboardAnimation();
@@ -62,10 +60,6 @@ export default function HomeScreen() {
openImportModal();
}, [openImportModal]);
const handleCloseCreateModal = useCallback(() => {
setShowCreateModal(false);
}, []);
const handleCloseImportModal = useCallback(() => {
setShowImportModal(false);
setPendingImportServerId(null);
@@ -77,12 +71,6 @@ export default function HomeScreen() {
(value) => typeof value === "string" && value.trim().toLowerCase() === "import"
);
}, [action, flow, modal]);
const wantsCreateDeepLink = useMemo(() => {
const values = [modal, flow, action];
return values.some(
(value) => typeof value === "string" && value.trim().toLowerCase() === "create"
);
}, [action, flow, modal]);
const deepLinkServerId = typeof serverIdParam === "string" ? serverIdParam : null;
const deepLinkKey = useMemo(() => {
if (!wantsImportDeepLink) {
@@ -95,16 +83,6 @@ export default function HomeScreen() {
serverId: deepLinkServerId,
});
}, [action, flow, modal, deepLinkServerId, wantsImportDeepLink]);
const createDeepLinkKey = useMemo(() => {
if (!wantsCreateDeepLink) {
return null;
}
return JSON.stringify({
action: action ?? null,
flow: flow ?? null,
modal: modal ?? null,
});
}, [action, flow, modal, wantsCreateDeepLink]);
useEffect(() => {
if (!wantsImportDeepLink || !deepLinkKey) {
@@ -117,17 +95,6 @@ export default function HomeScreen() {
deepLinkHandledRef.current = deepLinkKey;
openImportModal(deepLinkServerId);
}, [deepLinkKey, deepLinkServerId, openImportModal, wantsImportDeepLink]);
useEffect(() => {
if (!wantsCreateDeepLink || !createDeepLinkKey) {
createDeepLinkHandledRef.current = null;
return;
}
if (createDeepLinkHandledRef.current === createDeepLinkKey) {
return;
}
createDeepLinkHandledRef.current = createDeepLinkKey;
setShowCreateModal(true);
}, [createDeepLinkKey, wantsCreateDeepLink]);
useFocusEffect(
useCallback(() => {
@@ -166,8 +133,7 @@ export default function HomeScreen() {
{/* Home Footer */}
<HomeFooter />
{/* Create Agent Modal */}
<CreateAgentModal isVisible={showCreateModal} onClose={handleCloseCreateModal} />
{/* Import Agent Modal */}
<ImportAgentModal
isVisible={showImportModal}
onClose={handleCloseImportModal}

View File

@@ -1705,10 +1705,6 @@ function LazyAgentFlowModal(props: Omit<AgentFlowModalProps, "onAfterClose">) {
return <AgentFlowModal {...props} onAfterClose={handleAfterClose} />;
}
export function CreateAgentModal(props: ModalWrapperProps) {
return <LazyAgentFlowModal {...props} flow="create" />;
}
export function ImportAgentModal(props: ModalWrapperProps) {
return <LazyAgentFlowModal {...props} flow="import" />;
}