Skip to content

Commit 98e46cd

Browse files
authored
chore: use PascalCase for pages files (coder#1089)
* chore: use PascalCase for pages files * fixup * fixup * fixup * fixup * fixup * fixup
1 parent db1127d commit 98e46cd

File tree

19 files changed

+80
-56
lines changed

19 files changed

+80
-56
lines changed

site/src/AppRouter.tsx

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import { AuthAndFrame } from "./components/AuthAndFrame/AuthAndFrame"
44
import { RequireAuth } from "./components/Page/RequireAuth"
55
import { PreferencesLayout } from "./components/Preferences/Layout"
66
import { IndexPage } from "./pages"
7-
import { NotFoundPage } from "./pages/404"
8-
import { CliAuthenticationPage } from "./pages/cli-auth"
9-
import { HealthzPage } from "./pages/healthz"
10-
import { SignInPage } from "./pages/login"
11-
import { OrganizationsPage } from "./pages/orgs"
12-
import { PreferencesAccountPage } from "./pages/preferences/account"
13-
import { PreferencesLinkedAccountsPage } from "./pages/preferences/linkedAccounts"
14-
import { PreferencesSecurityPage } from "./pages/preferences/security"
15-
import { PreferencesSSHKeysPage } from "./pages/preferences/sshKeys"
16-
import { SettingsPage } from "./pages/settings"
17-
import { TemplatesPage } from "./pages/templates"
18-
import { TemplatePage } from "./pages/templates/[organization]/[template]"
19-
import { CreateWorkspacePage } from "./pages/templates/[organization]/[template]/create"
7+
import { NotFoundPage } from "./pages/404Page/404Page"
8+
import { CliAuthenticationPage } from "./pages/CliAuthPage/CliAuthPage"
9+
import { HealthzPage } from "./pages/HealthzPage/HealthzPage"
10+
import { LoginPage } from "./pages/LoginPage/LoginPage"
11+
import { OrgsPage } from "./pages/OrgsPage/OrgsPage"
12+
import { AccountPage } from "./pages/PreferencesPages/AccountPage/AccountPage"
13+
import { LinkedAccountsPage } from "./pages/PreferencesPages/LinkedAccountsPage/LinkedAccountsPage"
14+
import { SecurityPage } from "./pages/PreferencesPages/SecurityPage/SecurityPage"
15+
import { SSHKeysPage } from "./pages/PreferencesPages/SSHKeysPage/SSHKeysPage"
16+
import { SettingsPage } from "./pages/SettingsPage/SettingsPage"
17+
import { CreateWorkspacePage } from "./pages/TemplatesPages/OrganizationPage/TemplatePage/CreateWorkspacePage"
18+
import { TemplatePage } from "./pages/TemplatesPages/OrganizationPage/TemplatePage/TemplatePage"
19+
import { TemplatesPage } from "./pages/TemplatesPages/TemplatesPage"
2020
import { UsersPage } from "./pages/UsersPage/UsersPage"
21-
import { WorkspacePage } from "./pages/workspaces/[workspace]"
21+
import { WorkspacePage } from "./pages/WorkspacesPage/WorkspacesPage"
2222

2323
export const AppRouter: React.FC = () => (
2424
<Routes>
@@ -32,7 +32,7 @@ export const AppRouter: React.FC = () => (
3232
}
3333
/>
3434

35-
<Route path="login" element={<SignInPage />} />
35+
<Route path="login" element={<LoginPage />} />
3636
<Route path="healthz" element={<HealthzPage />} />
3737
<Route path="cli-auth" element={<CliAuthenticationPage />} />
3838

@@ -88,7 +88,7 @@ export const AppRouter: React.FC = () => (
8888
path="orgs"
8989
element={
9090
<AuthAndFrame>
91-
<OrganizationsPage />
91+
<OrgsPage />
9292
</AuthAndFrame>
9393
}
9494
/>
@@ -102,10 +102,10 @@ export const AppRouter: React.FC = () => (
102102
/>
103103

104104
<Route path="preferences" element={<PreferencesLayout />}>
105-
<Route path="account" element={<PreferencesAccountPage />} />
106-
<Route path="security" element={<PreferencesSecurityPage />} />
107-
<Route path="ssh-keys" element={<PreferencesSSHKeysPage />} />
108-
<Route path="linked-accounts" element={<PreferencesLinkedAccountsPage />} />
105+
<Route path="account" element={<AccountPage />} />
106+
<Route path="security" element={<SecurityPage />} />
107+
<Route path="ssh-keys" element={<SSHKeysPage />} />
108+
<Route path="linked-accounts" element={<LinkedAccountsPage />} />
109109
</Route>
110110

111111
{/* Using path="*"" means "match anything", so this route
File renamed without changes.

site/src/pages/cli-auth.tsx renamed to site/src/pages/CliAuthPage/CliAuthPage.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { useActor } from "@xstate/react"
33
import React, { useContext, useEffect, useState } from "react"
4-
import { getApiKey } from "../api"
5-
import { FullScreenLoader } from "../components/Loader/FullScreenLoader"
6-
import { CliAuthToken } from "../components/SignIn/CliAuthToken"
7-
import { XServiceContext } from "../xServices/StateContext"
4+
import { getApiKey } from "../../api"
5+
import { FullScreenLoader } from "../../components/Loader/FullScreenLoader"
6+
import { CliAuthToken } from "../../components/SignIn/CliAuthToken"
7+
import { XServiceContext } from "../../xServices/StateContext"
88

99
export const CliAuthenticationPage: React.FC = () => {
1010
const xServices = useContext(XServiceContext)

site/src/pages/login.test.tsx renamed to site/src/pages/LoginPage/LoginPage.test.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { act, screen } from "@testing-library/react"
22
import userEvent from "@testing-library/user-event"
33
import { rest } from "msw"
44
import React from "react"
5-
import { Language } from "../components/SignIn/SignInForm"
6-
import { history, render } from "../testHelpers"
7-
import { server } from "../testHelpers/server"
8-
import { SignInPage } from "./login"
5+
import { Language } from "../../components/SignIn/SignInForm"
6+
import { history, render } from "../../testHelpers"
7+
import { server } from "../../testHelpers/server"
8+
import { LoginPage } from "./LoginPage"
99

10-
describe("SignInPage", () => {
10+
describe("LoginPage", () => {
1111
beforeEach(() => {
1212
history.replace("/login")
1313
// appear logged out
@@ -20,7 +20,7 @@ describe("SignInPage", () => {
2020

2121
it("renders the sign-in form", async () => {
2222
// When
23-
render(<SignInPage />)
23+
render(<LoginPage />)
2424

2525
// Then
2626
await screen.findByText(Language.signIn)
@@ -36,7 +36,7 @@ describe("SignInPage", () => {
3636
)
3737

3838
// When
39-
render(<SignInPage />)
39+
render(<LoginPage />)
4040
const email = screen.getByLabelText(Language.emailLabel)
4141
const password = screen.getByLabelText(Language.passwordLabel)
4242
await userEvent.type(email, "test@coder.com")

site/src/pages/login.tsx renamed to site/src/pages/LoginPage/LoginPage.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { makeStyles } from "@material-ui/core/styles"
22
import { useActor } from "@xstate/react"
33
import React, { useContext } from "react"
44
import { Navigate, useLocation } from "react-router-dom"
5-
import { Footer } from "../components/Page/Footer"
6-
import { retrieveRedirect } from "../util/redirect"
7-
import { XServiceContext } from "../xServices/StateContext"
8-
import { SignInForm } from "./../components/SignIn/SignInForm"
5+
import { Footer } from "../../components/Page/Footer"
6+
import { SignInForm } from "../../components/SignIn/SignInForm"
7+
import { retrieveRedirect } from "../../util/redirect"
8+
import { XServiceContext } from "../../xServices/StateContext"
99

1010
export const useStyles = makeStyles((theme) => ({
1111
root: {
@@ -27,7 +27,7 @@ export const useStyles = makeStyles((theme) => ({
2727
},
2828
}))
2929

30-
export const SignInPage: React.FC = () => {
30+
export const LoginPage: React.FC = () => {
3131
const styles = useStyles()
3232
const location = useLocation()
3333
const xServices = useContext(XServiceContext)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react"
22

3-
export const OrganizationsPage: React.FC = () => {
3+
export const OrgsPage: React.FC = () => {
44
return <div>Coming soon!</div>
55
}

site/src/pages/preferences/account.test.tsx renamed to site/src/pages/PreferencesPages/AccountPage/AccountPage.test.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { fireEvent, screen, waitFor } from "@testing-library/react"
22
import React from "react"
3-
import * as API from "../../api"
4-
import * as AccountForm from "../../components/Preferences/AccountForm"
5-
import { GlobalSnackbar } from "../../components/Snackbar/GlobalSnackbar"
6-
import { renderWithAuth } from "../../testHelpers"
7-
import * as AuthXService from "../../xServices/auth/authXService"
8-
import { Language, PreferencesAccountPage } from "./account"
3+
import * as API from "../../../api"
4+
import * as AccountForm from "../../../components/Preferences/AccountForm"
5+
import { GlobalSnackbar } from "../../../components/Snackbar/GlobalSnackbar"
6+
import { renderWithAuth } from "../../../testHelpers"
7+
import * as AuthXService from "../../../xServices/auth/authXService"
8+
import { AccountPage, Language } from "./AccountPage"
99

1010
const renderPage = () => {
1111
return renderWithAuth(
1212
<>
13-
<PreferencesAccountPage />
13+
<AccountPage />
1414
<GlobalSnackbar />
1515
</>,
1616
)
@@ -30,7 +30,7 @@ const fillAndSubmitForm = async () => {
3030
fireEvent.click(screen.getByText(AccountForm.Language.updatePreferences))
3131
}
3232

33-
describe("PreferencesAccountPage", () => {
33+
describe("AccountPage", () => {
3434
describe("when it is a success", () => {
3535
it("shows the success message", async () => {
3636
jest.spyOn(API, "updateProfile").mockImplementationOnce((userId, data) =>

site/src/pages/preferences/account.tsx renamed to site/src/pages/PreferencesPages/AccountPage/AccountPage.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { useActor } from "@xstate/react"
22
import React, { useContext } from "react"
3-
import { isApiError, mapApiErrorToFieldErrors } from "../../api/errors"
4-
import { AccountForm } from "../../components/Preferences/AccountForm"
5-
import { Section } from "../../components/Section/Section"
6-
import { XServiceContext } from "../../xServices/StateContext"
3+
import { isApiError, mapApiErrorToFieldErrors } from "../../../api/errors"
4+
import { AccountForm } from "../../../components/Preferences/AccountForm"
5+
import { Section } from "../../../components/Section/Section"
6+
import { XServiceContext } from "../../../xServices/StateContext"
77

88
export const Language = {
99
title: "Account",
1010
description: "Update your display name, email, and username.",
1111
unknownError: "Oops, an unknown error occurred.",
1212
}
1313

14-
export const PreferencesAccountPage: React.FC = () => {
14+
export const AccountPage: React.FC = () => {
1515
const xServices = useContext(XServiceContext)
1616
const [authState, authSend] = useActor(xServices.authXService)
1717
const { me, updateProfileError } = authState.context
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from "react"
2-
import { Section } from "../../components/Section/Section"
2+
import { Section } from "../../../components/Section/Section"
33

44
const Language = {
55
title: "Linked Accounts",
66
description:
77
"Linking your Coder account will add your workspace SSH key, allowing you to perform Git actions on all your workspaces.",
88
}
99

10-
export const PreferencesLinkedAccountsPage: React.FC = () => {
10+
export const LinkedAccountsPage: React.FC = () => {
1111
return <Section title={Language.title} description={Language.description} />
1212
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from "react"
2-
import { Section } from "../../components/Section/Section"
2+
import { Section } from "../../../components/Section/Section"
33

44
const Language = {
55
title: "SSH Keys",
66
description:
77
"Coder automatically inserts a private key into every workspace; you can add the corresponding public key to any services (such as Git) that you need access to from your workspace.",
88
}
99

10-
export const PreferencesSSHKeysPage: React.FC = () => {
10+
export const SSHKeysPage: React.FC = () => {
1111
return <Section title={Language.title} description={Language.description} />
1212
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react"
2+
import { Section } from "../../../components/Section/Section"
3+
4+
const Language = {
5+
title: "Linked Accounts",
6+
description:
7+
"Linking your Coder account will add your workspace SSH key, allowing you to perform Git actions on all your workspaces.",
8+
}
9+
10+
export const LinkedAccountsPage: React.FC = () => {
11+
return <Section title={Language.title} description={Language.description} />
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react"
2+
import { Section } from "../../../components/Section/Section"
3+
4+
const Language = {
5+
title: "SSH Keys",
6+
description:
7+
"Coder automatically inserts a private key into every workspace; you can add the corresponding public key to any services (such as Git) that you need access to from your workspace.",
8+
}
9+
10+
export const SSHKeysPage: React.FC = () => {
11+
return <Section title={Language.title} description={Language.description} />
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from "react"
2-
import { Section } from "../../components/Section/Section"
2+
import { Section } from "../../../components/Section/Section"
33

44
const Language = {
55
title: "Security",
66
description: "Changing your password will sign you out of your current session.",
77
}
88

9-
export const PreferencesSecurityPage: React.FC = () => {
9+
export const SecurityPage: React.FC = () => {
1010
return <Section title={Language.title} description={Language.description} />
1111
}

0 commit comments

Comments
 (0)