mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
refactor(frontend): extract navigation helpers and improve settings back navigation (#210)
* feat: add persistent model state storage with database backend - Create opencode_model_state table for storing user model preferences - Implement database-backed model state management (recent, favorite, variant) - Add atomic JSON file utilities with file locking for concurrent safety - Migrate providers routes from file-based to database storage - Add backfill migration to preserve existing model.json data - Include comprehensive tests for model-state and atomic-json modules - Refactor useSessionAgent hook to simplify agent/model resolution logic - Update getFileApiUrl to use consistent query parameter approach * fix: include workspace dependencies in Docker image * fix: overlay workspace node_modules after source to prevent layer overwrite * fix: ensure model state table exists for existing databases * feat: add model state persistence and improve model selection sync - Add setActiveModel to modelStore and useModelSelection for direct model updates - Sync session agent model/variant to store when messages load - Include model, agent, and variant in optimistic user messages - Fix useSessionAgent to check isFetching during message loading - Update env.ts to use getter for BASE_PATH for dynamic resolution - Fix test environment variable from OPENCODE_WORKSPACE_PATH to WORKSPACE_PATH * refactor(frontend): extract navigation helpers and improve settings back navigation - Move swipe-back route logic into shared navigation.ts module - Add getSessionListPath helper for consistent session list navigation - Add section history tracking to settings dialog for proper back navigation - Fix voice status overlay loading text visibility during starting state - Update env and vite config for production domain
This commit is contained in:
1 parent
549e0ac7b2
commit
e959cc409f
10 files changed
+361
-66
No files matched your search
@@ -17,6 +17,7 @@ import { SourceControlPanel } from "@/components/source-control"
|
||||
import { ResetPermissionsDialog } from "@/components/repo/ResetPermissionsDialog"
|
||||
import { PendingActionsGroup } from "@/components/notifications/PendingActionsGroup"
|
||||
import { invalidateConfigCaches } from "@/lib/queryInvalidation"
|
||||
import { getSessionListPath } from "@/lib/navigation"
|
||||
import { SwitchConfigDialog } from "@/components/repo/SwitchConfigDialog"
|
||||
import { Loader2, Plus } from "lucide-react"
|
||||
|
||||
@@ -45,8 +46,11 @@ export function AssistantRedirect() {
|
||||
|
||||
const handleNavigate = useCallback((sessionId: string) => {
|
||||
setStatus("opening")
|
||||
if (!showSessionList) {
|
||||
window.history.replaceState(window.history.state, "", getSessionListPath(repoId, true))
|
||||
}
|
||||
navigate(`/repos/${repoId}/sessions/${sessionId}?assistant=1`)
|
||||
}, [navigate, repoId])
|
||||
}, [navigate, repoId, showSessionList])
|
||||
|
||||
const { openAssistant } = useAssistantSessionLauncher({
|
||||
repoId,
|
||||
|
||||
@@ -9,6 +9,7 @@ import { X, CornerUpLeft } from "lucide-react";
|
||||
import { ModelSelectDialog } from "@/components/model/ModelSelectDialog";
|
||||
import { Header } from "@/components/ui/header";
|
||||
import { SessionList } from "@/components/session/SessionList";
|
||||
import { getSessionListPath } from '@/lib/navigation'
|
||||
|
||||
import { FileBrowserSheet } from "@/components/file-browser/FileBrowserSheet";
|
||||
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
|
||||
@@ -297,8 +298,8 @@ export function SessionDetail() {
|
||||
}, [opcodeUrl, sessionId, repoDirectory, navigate, repoId, sessionRouteSuffix]);
|
||||
|
||||
const handleCloseSession = useCallback(() => {
|
||||
navigate(isAssistantSession ? `/repos/${repoId}/assistant?view=sessions` : `/repos/${repoId}`);
|
||||
}, [navigate, repoId, isAssistantSession]);
|
||||
navigate(getSessionListPath(repoId, isAssistantSession))
|
||||
}, [navigate, repoId, isAssistantSession])
|
||||
|
||||
const { leaderActive } = useKeyboardShortcuts({
|
||||
openModelDialog: () => setModelDialogOpen(true),
|
||||
@@ -414,7 +415,7 @@ export function SessionDetail() {
|
||||
}
|
||||
|
||||
const workspaceDisplayName = isAssistantSession ? 'Assistant' : getRepoDisplayName(repo.repoUrl, repo.localPath, repo.sourcePath);
|
||||
const sessionBackPath = isAssistantSession ? `/repos/${repoId}/assistant?view=sessions` : `/repos/${repoId}`;
|
||||
const sessionBackPath = getSessionListPath(repoId, isAssistantSession);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user