Skip to content

Commit 70c0fe9

Browse files
committed
self-hosted: improve help text
1 parent 2652ba6 commit 70c0fe9

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎src/components/selfHosted.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
import { Detail } from "@raycast/api";
1+
import { ActionPanel, Detail, OpenInBrowserAction } from "@raycast/api";
22
import { ReactElement } from "react";
33
import { sourcegraphSelfHosted, Sourcegraph, isCloud } from "../sourcegraph";
44

55
export default function SelfHostedCommand({ command }: { command: (src: Sourcegraph) => ReactElement }) {
66
const tryCloudMessage = "Alternatively, you can try the Sourcegraph Cloud version of this command first.";
77

8+
const helpActions = (
9+
<ActionPanel>
10+
<OpenInBrowserAction
11+
title="Open Setup Guide"
12+
url="https://github.com/raycast/extensions/tree/main/extensions/sourcegraph#setup"
13+
/>
14+
</ActionPanel>
15+
);
16+
817
const src = sourcegraphSelfHosted();
918
if (!src) {
1019
return (
1120
<Detail
12-
navigationTitle="Invalid self-hosted Sourcegraph URL"
21+
navigationTitle="No Sourcegraph Self-Hosted instance configured"
1322
markdown={`**⚠️ No Sourcegraph Sourcegraph Self-Hosted instance configured** - set one up in the extension preferences!\n\n${tryCloudMessage}`}
23+
actions={helpActions}
1424
/>
1525
);
1626
}
@@ -21,14 +31,16 @@ export default function SelfHostedCommand({ command }: { command: (src: Sourcegr
2131
<Detail
2232
navigationTitle="Invalid Sourcegraph Self-Hosted URL"
2333
markdown={`**⚠️ Sourcegraph Self-Hosted URL '${src.instance}' is invalid:** ${e}\n\nUpdate it in the extension preferences!\n\n${tryCloudMessage}`}
34+
actions={helpActions}
2435
/>
2536
);
2637
}
2738
if (!isCloud(src.instance) && !src.token) {
2839
return (
2940
<Detail
3041
navigationTitle="Invalid Sourcegraph Self-Hosted access token"
31-
markdown={`**⚠️ A token is required for Sourcegraph Self-Hosted instance '${src.instance}'** - add an access token for Sourcegraph Self-Hosted in your preferences!\n\n${tryCloudMessage}`}
42+
markdown={`**⚠️ A token is required for Sourcegraph Self-Hosted instance '${src.instance}'** - add an access token for Sourcegraph Self-Hosted in the extension preferences!\n\n${tryCloudMessage}`}
43+
actions={helpActions}
3244
/>
3345
);
3446
}

0 commit comments

Comments
 (0)