Skip to content

Commit 0ec9253

Browse files
committed
chore: updated documentation link
1 parent f5693df commit 0ec9253

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

site/src/components/UserDropdown/UserDropdown.test.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ const renderAndClick = async (props: Partial<UserDropdownProps> = {}) => {
1111
}
1212

1313
describe("UserDropdown", () => {
14+
const env = process.env
15+
16+
beforeEach(() => {
17+
jest.resetModules()
18+
process.env = { ...env }
19+
})
20+
21+
afterEach(() => {
22+
process.env = env
23+
})
24+
1425
describe("when the trigger is clicked", () => {
1526
it("opens the menu", async () => {
1627
await renderAndClick()
@@ -32,14 +43,15 @@ describe("UserDropdown", () => {
3243
})
3344

3445
it("has the correct link for the documentation item", async () => {
46+
process.env.CODER_VERSION = "v0.5.4"
3547
await renderAndClick()
3648

3749
const link = screen.getByText(Language.docsLabel).closest("a")
3850
if (!link) {
3951
throw new Error("Anchor tag not found for the documentation menu item")
4052
}
4153

42-
expect(link.getAttribute("href")).toBe("https://coder.com/docs")
54+
expect(link.getAttribute("href")).toBe(`https://github.com/coder/coder/tree/${process.env.CODER_VERSION}/docs`)
4355
})
4456

4557
it("has the correct link for the account item", async () => {

site/src/components/UserDropdown/UsersDropdown.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ export const UserDropdown: React.FC<UserDropdownProps> = ({ user, onSignOut }: U
7777
</MenuItem>
7878
</Link>
7979

80-
<a href="https://coder.com/docs" target="_blank" rel="noreferrer" className={styles.link}>
80+
<a
81+
href={`https://github.com/coder/coder/tree/${process.env.CODER_VERSION}/docs`}
82+
target="_blank"
83+
rel="noreferrer"
84+
className={styles.link}
85+
>
8186
<MenuItem className={styles.menuItem} onClick={onPopoverClose}>
8287
<ListItemIcon className={styles.icon}>
8388
<DocsIcon />

site/webpack.common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import { Configuration, EnvironmentPlugin } from "webpack"
1313
*/
1414
const environmentPlugin = new EnvironmentPlugin({
1515
INSPECT_XSTATE: "",
16+
CODER_VERSION: "main",
1617
})
1718
console.info(`--- Setting INSPECT_XSTATE to '${process.env.INSPECT_XSTATE || ""}'`)
19+
console.info(`--- Setting CODER_VERSION to '${process.env.CODER_VERSION || "main"}'`)
1820
console.info(`--- Setting NODE_ENV to '${process.env.NODE_ENV || ""}'`)
1921

2022
/**

0 commit comments

Comments
 (0)