fix(github): show an Open settings button in not-connected dialogs for quick access
This commit is contained in:
@@ -10,7 +10,7 @@ import { NotificationSettings } from './NotificationSettings';
|
|||||||
import { GitHubSettings } from './GitHubSettings';
|
import { GitHubSettings } from './GitHubSettings';
|
||||||
import { ScrollableOverlay } from '@/components/ui/ScrollableOverlay';
|
import { ScrollableOverlay } from '@/components/ui/ScrollableOverlay';
|
||||||
import { useDeviceInfo } from '@/lib/device';
|
import { useDeviceInfo } from '@/lib/device';
|
||||||
import { isWebRuntime } from '@/lib/desktop';
|
import { isVSCodeRuntime, isWebRuntime } from '@/lib/desktop';
|
||||||
import type { OpenChamberSection } from './OpenChamberSidebar';
|
import type { OpenChamberSection } from './OpenChamberSidebar';
|
||||||
|
|
||||||
interface OpenChamberPageProps {
|
interface OpenChamberPageProps {
|
||||||
@@ -122,6 +122,9 @@ const GitSectionContent: React.FC = () => {
|
|||||||
|
|
||||||
// GitHub section: Connect account for PR/issue workflows
|
// GitHub section: Connect account for PR/issue workflows
|
||||||
const GitHubSectionContent: React.FC = () => {
|
const GitHubSectionContent: React.FC = () => {
|
||||||
|
if (isVSCodeRuntime()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return <GitHubSettings />;
|
return <GitHubSettings />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const OPENCHAMBER_SECTION_GROUPS: SectionGroup[] = [
|
|||||||
id: 'github',
|
id: 'github',
|
||||||
label: 'GitHub',
|
label: 'GitHub',
|
||||||
items: ['Connect', 'PRs', 'Issues'],
|
items: ['Connect', 'PRs', 'Issues'],
|
||||||
|
hideInVSCode: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'notifications',
|
id: 'notifications',
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { useSessionStore } from '@/stores/useSessionStore';
|
|||||||
import { useConfigStore } from '@/stores/useConfigStore';
|
import { useConfigStore } from '@/stores/useConfigStore';
|
||||||
import { useMessageStore } from '@/stores/messageStore';
|
import { useMessageStore } from '@/stores/messageStore';
|
||||||
import { useContextStore } from '@/stores/contextStore';
|
import { useContextStore } from '@/stores/contextStore';
|
||||||
|
import { useUIStore } from '@/stores/useUIStore';
|
||||||
import { opencodeClient } from '@/lib/opencode/client';
|
import { opencodeClient } from '@/lib/opencode/client';
|
||||||
import { createWorktreeSessionForNewBranch } from '@/lib/worktreeSessionCreator';
|
import { createWorktreeSessionForNewBranch } from '@/lib/worktreeSessionCreator';
|
||||||
import { generateBranchSlug } from '@/lib/git/branchNameGenerator';
|
import { generateBranchSlug } from '@/lib/git/branchNameGenerator';
|
||||||
@@ -69,6 +70,8 @@ export function GitHubIssuePickerDialog({
|
|||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
const { github } = useRuntimeAPIs();
|
const { github } = useRuntimeAPIs();
|
||||||
|
const setSettingsDialogOpen = useUIStore((state) => state.setSettingsDialogOpen);
|
||||||
|
const setSidebarSection = useUIStore((state) => state.setSidebarSection);
|
||||||
const activeProject = useProjectsStore((state) => state.getActiveProject());
|
const activeProject = useProjectsStore((state) => state.getActiveProject());
|
||||||
|
|
||||||
const projectDirectory = activeProject?.path ?? null;
|
const projectDirectory = activeProject?.path ?? null;
|
||||||
@@ -156,6 +159,11 @@ export function GitHubIssuePickerDialog({
|
|||||||
const connected = Boolean(result?.connected);
|
const connected = Boolean(result?.connected);
|
||||||
const repoUrl = result?.repo?.url ?? null;
|
const repoUrl = result?.repo?.url ?? null;
|
||||||
|
|
||||||
|
const openGitHubSettings = React.useCallback(() => {
|
||||||
|
setSidebarSection('settings');
|
||||||
|
setSettingsDialogOpen(true);
|
||||||
|
}, [setSettingsDialogOpen, setSidebarSection]);
|
||||||
|
|
||||||
const filtered = React.useMemo(() => {
|
const filtered = React.useMemo(() => {
|
||||||
const q = query.trim().toLowerCase();
|
const q = query.trim().toLowerCase();
|
||||||
if (!q) return issues;
|
if (!q) return issues;
|
||||||
@@ -458,7 +466,14 @@ Do not implement changes until I confirm; end with: “Next actions: <1 sentence
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{connected === false ? (
|
{connected === false ? (
|
||||||
<div className="text-center text-muted-foreground py-8">GitHub not connected.</div>
|
<div className="text-center text-muted-foreground py-8 space-y-3">
|
||||||
|
<div>GitHub not connected. Connect your GitHub account in settings.</div>
|
||||||
|
<div className="flex justify-center">
|
||||||
|
<Button variant="outline" size="sm" onClick={openGitHubSettings}>
|
||||||
|
Open settings
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{error ? (
|
{error ? (
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { useSessionStore } from '@/stores/useSessionStore';
|
|||||||
import { useConfigStore } from '@/stores/useConfigStore';
|
import { useConfigStore } from '@/stores/useConfigStore';
|
||||||
import { useMessageStore } from '@/stores/messageStore';
|
import { useMessageStore } from '@/stores/messageStore';
|
||||||
import { useContextStore } from '@/stores/contextStore';
|
import { useContextStore } from '@/stores/contextStore';
|
||||||
|
import { useUIStore } from '@/stores/useUIStore';
|
||||||
import { opencodeClient } from '@/lib/opencode/client';
|
import { opencodeClient } from '@/lib/opencode/client';
|
||||||
import { createWorktreeSessionForNewBranchExact } from '@/lib/worktreeSessionCreator';
|
import { createWorktreeSessionForNewBranchExact } from '@/lib/worktreeSessionCreator';
|
||||||
import { gitFetch } from '@/lib/gitApi';
|
import { gitFetch } from '@/lib/gitApi';
|
||||||
@@ -60,6 +61,8 @@ export function GitHubPullRequestPickerDialog({
|
|||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
const { github } = useRuntimeAPIs();
|
const { github } = useRuntimeAPIs();
|
||||||
|
const setSettingsDialogOpen = useUIStore((state) => state.setSettingsDialogOpen);
|
||||||
|
const setSidebarSection = useUIStore((state) => state.setSidebarSection);
|
||||||
const activeProject = useProjectsStore((state) => state.getActiveProject());
|
const activeProject = useProjectsStore((state) => state.getActiveProject());
|
||||||
|
|
||||||
const projectDirectory = activeProject?.path ?? null;
|
const projectDirectory = activeProject?.path ?? null;
|
||||||
@@ -148,6 +151,11 @@ export function GitHubPullRequestPickerDialog({
|
|||||||
const connected = Boolean(result?.connected);
|
const connected = Boolean(result?.connected);
|
||||||
const repoUrl = result?.repo?.url ?? null;
|
const repoUrl = result?.repo?.url ?? null;
|
||||||
|
|
||||||
|
const openGitHubSettings = React.useCallback(() => {
|
||||||
|
setSidebarSection('settings');
|
||||||
|
setSettingsDialogOpen(true);
|
||||||
|
}, [setSettingsDialogOpen, setSidebarSection]);
|
||||||
|
|
||||||
const filtered = React.useMemo(() => {
|
const filtered = React.useMemo(() => {
|
||||||
const q = query.trim().toLowerCase();
|
const q = query.trim().toLowerCase();
|
||||||
if (!q) return prs;
|
if (!q) return prs;
|
||||||
@@ -468,7 +476,14 @@ Nice-to-have:
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{connected === false ? (
|
{connected === false ? (
|
||||||
<div className="text-center text-muted-foreground py-8">GitHub not connected.</div>
|
<div className="text-center text-muted-foreground py-8 space-y-3">
|
||||||
|
<div>GitHub not connected. Connect your GitHub account in settings.</div>
|
||||||
|
<div className="flex justify-center">
|
||||||
|
<Button variant="outline" size="sm" onClick={openGitHubSettings}>
|
||||||
|
Open settings
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{error ? (
|
{error ? (
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
} from '@/components/ui/collapsible';
|
} from '@/components/ui/collapsible';
|
||||||
import { generatePullRequestDescription } from '@/lib/gitApi';
|
import { generatePullRequestDescription } from '@/lib/gitApi';
|
||||||
import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs';
|
import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs';
|
||||||
|
import { useUIStore } from '@/stores/useUIStore';
|
||||||
import type {
|
import type {
|
||||||
GitHubPullRequest,
|
GitHubPullRequest,
|
||||||
GitHubPullRequestStatus,
|
GitHubPullRequestStatus,
|
||||||
@@ -73,6 +74,13 @@ export const PullRequestSection: React.FC<{
|
|||||||
baseBranch: string;
|
baseBranch: string;
|
||||||
}> = ({ directory, branch, baseBranch }) => {
|
}> = ({ directory, branch, baseBranch }) => {
|
||||||
const { github } = useRuntimeAPIs();
|
const { github } = useRuntimeAPIs();
|
||||||
|
const setSettingsDialogOpen = useUIStore((state) => state.setSettingsDialogOpen);
|
||||||
|
const setSidebarSection = useUIStore((state) => state.setSidebarSection);
|
||||||
|
|
||||||
|
const openGitHubSettings = React.useCallback(() => {
|
||||||
|
setSidebarSection('settings');
|
||||||
|
setSettingsDialogOpen(true);
|
||||||
|
}, [setSettingsDialogOpen, setSidebarSection]);
|
||||||
|
|
||||||
const [isOpen, setIsOpen] = React.useState(true);
|
const [isOpen, setIsOpen] = React.useState(true);
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
@@ -263,8 +271,13 @@ export const PullRequestSection: React.FC<{
|
|||||||
<div className="border-t border-border/40">
|
<div className="border-t border-border/40">
|
||||||
<div className="flex flex-col gap-3 p-3">
|
<div className="flex flex-col gap-3 p-3">
|
||||||
{!isConnected ? (
|
{!isConnected ? (
|
||||||
<div className="typography-meta text-muted-foreground">
|
<div className="space-y-2">
|
||||||
GitHub not connected. Connect in Settings to create and merge PRs.
|
<div className="typography-meta text-muted-foreground">
|
||||||
|
GitHub not connected. Connect your GitHub account in settings.
|
||||||
|
</div>
|
||||||
|
<Button variant="outline" size="sm" onClick={openGitHubSettings} className="w-fit">
|
||||||
|
Open settings
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user