mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: Rename Preferences to Settings (#1487)
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import React from "react"
|
||||
import { Route, Routes } from "react-router-dom"
|
||||
import { AuthAndFrame } from "./components/AuthAndFrame/AuthAndFrame"
|
||||
import { PreferencesLayout } from "./components/PreferencesLayout/PreferencesLayout"
|
||||
import { RequireAuth } from "./components/RequireAuth/RequireAuth"
|
||||
import { SettingsLayout } from "./components/SettingsLayout/SettingsLayout"
|
||||
import { IndexPage } from "./pages"
|
||||
import { NotFoundPage } from "./pages/404Page/404Page"
|
||||
import { CliAuthenticationPage } from "./pages/CliAuthPage/CliAuthPage"
|
||||
import { HealthzPage } from "./pages/HealthzPage/HealthzPage"
|
||||
import { LoginPage } from "./pages/LoginPage/LoginPage"
|
||||
import { OrgsPage } from "./pages/OrgsPage/OrgsPage"
|
||||
import { AccountPage } from "./pages/PreferencesPages/AccountPage/AccountPage"
|
||||
import { SSHKeysPage } from "./pages/PreferencesPages/SSHKeysPage/SSHKeysPage"
|
||||
import { SettingsPage } from "./pages/SettingsPage/SettingsPage"
|
||||
import { AccountPage } from "./pages/SettingsPages/AccountPage/AccountPage"
|
||||
import { SSHKeysPage } from "./pages/SettingsPages/SSHKeysPage/SSHKeysPage"
|
||||
import { CreateWorkspacePage } from "./pages/TemplatesPages/OrganizationPage/TemplatePage/CreateWorkspacePage"
|
||||
import { TemplatePage } from "./pages/TemplatesPages/OrganizationPage/TemplatePage/TemplatePage"
|
||||
import { TemplatesPage } from "./pages/TemplatesPages/TemplatesPage"
|
||||
@@ -131,7 +131,7 @@ export const AppRouter: React.FC = () => (
|
||||
}
|
||||
/>
|
||||
|
||||
<Route path="preferences" element={<PreferencesLayout />}>
|
||||
<Route path="settings" element={<SettingsLayout />}>
|
||||
<Route path="account" element={<AccountPage />} />
|
||||
<Route path="ssh-keys" element={<SSHKeysPage />} />
|
||||
</Route>
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ export const Language = {
|
||||
emailLabel: "Email",
|
||||
emailInvalid: "Please enter a valid email address.",
|
||||
emailRequired: "Please enter an email address.",
|
||||
updatePreferences: "Update preferences",
|
||||
updateSettings: "Update settings",
|
||||
}
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
@@ -73,7 +73,7 @@ export const AccountForm: React.FC<AccountFormProps> = ({
|
||||
|
||||
<div>
|
||||
<LoadingButton color="primary" loading={isLoading} type="submit" variant="contained">
|
||||
{isLoading ? "" : Language.updatePreferences}
|
||||
{isLoading ? "" : Language.updateSettings}
|
||||
</LoadingButton>
|
||||
</div>
|
||||
</Stack>
|
||||
+5
-5
@@ -8,20 +8,20 @@ import { TabPanel } from "../TabPanel/TabPanel"
|
||||
export const Language = {
|
||||
accountLabel: "Account",
|
||||
sshKeysLabel: "SSH Keys",
|
||||
preferencesLabel: "Preferences",
|
||||
settingsLabel: "Settings",
|
||||
}
|
||||
|
||||
const menuItems = [
|
||||
{ label: Language.accountLabel, path: "/preferences/account" },
|
||||
{ label: Language.sshKeysLabel, path: "/preferences/ssh-keys" },
|
||||
{ label: Language.accountLabel, path: "/settings/account" },
|
||||
{ label: Language.sshKeysLabel, path: "/settings/ssh-keys" },
|
||||
]
|
||||
|
||||
export const PreferencesLayout: React.FC = () => {
|
||||
export const SettingsLayout: React.FC = () => {
|
||||
return (
|
||||
<AuthAndFrame>
|
||||
<Box display="flex" flexDirection="column">
|
||||
<Margins>
|
||||
<TabPanel title={Language.preferencesLabel} menuItems={menuItems}>
|
||||
<TabPanel title={Language.settingsLabel} menuItems={menuItems}>
|
||||
<Outlet />
|
||||
</TabPanel>
|
||||
</Margins>
|
||||
@@ -63,6 +63,6 @@ describe("UserDropdown", () => {
|
||||
throw new Error("Anchor tag not found for the account menu item")
|
||||
}
|
||||
|
||||
expect(link.getAttribute("href")).toBe("/preferences/account")
|
||||
expect(link.getAttribute("href")).toBe("/settings/account")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -68,7 +68,7 @@ export const UserDropdown: React.FC<UserDropdownProps> = ({ user, onSignOut }: U
|
||||
|
||||
<Divider />
|
||||
|
||||
<Link to="/preferences/account" className={styles.link}>
|
||||
<Link to="/settings/account" className={styles.link}>
|
||||
<MenuItem className={styles.menuItem} onClick={onPopoverClose}>
|
||||
<ListItemIcon className={styles.icon}>
|
||||
<AccountIcon />
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from "@testing-library/react"
|
||||
import React from "react"
|
||||
import * as API from "../../../api/api"
|
||||
import { GlobalSnackbar } from "../../../components/GlobalSnackbar/GlobalSnackbar"
|
||||
import * as AccountForm from "../../../components/PreferencesAccountForm/PreferencesAccountForm"
|
||||
import * as AccountForm from "../../../components/SettingsAccountForm/SettingsAccountForm"
|
||||
import { renderWithAuth } from "../../../testHelpers/renderHelpers"
|
||||
import * as AuthXService from "../../../xServices/auth/authXService"
|
||||
import { AccountPage, Language } from "./AccountPage"
|
||||
@@ -25,7 +25,7 @@ const fillAndSubmitForm = async () => {
|
||||
await waitFor(() => screen.findByLabelText("Email"))
|
||||
fireEvent.change(screen.getByLabelText("Email"), { target: { value: newData.email } })
|
||||
fireEvent.change(screen.getByLabelText("Username"), { target: { value: newData.username } })
|
||||
fireEvent.click(screen.getByText(AccountForm.Language.updatePreferences))
|
||||
fireEvent.click(screen.getByText(AccountForm.Language.updateSettings))
|
||||
}
|
||||
|
||||
describe("AccountPage", () => {
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
import { useActor } from "@xstate/react"
|
||||
import React, { useContext } from "react"
|
||||
import { isApiError, mapApiErrorToFieldErrors } from "../../../api/errors"
|
||||
import { AccountForm } from "../../../components/PreferencesAccountForm/PreferencesAccountForm"
|
||||
import { Section } from "../../../components/Section/Section"
|
||||
import { AccountForm } from "../../../components/SettingsAccountForm/SettingsAccountForm"
|
||||
import { XServiceContext } from "../../../xServices/StateContext"
|
||||
|
||||
export const Language = {
|
||||
@@ -4,7 +4,7 @@ import * as TypesGen from "../../api/typesGenerated"
|
||||
import { displayError, displaySuccess } from "../../components/GlobalSnackbar/utils"
|
||||
|
||||
export const Language = {
|
||||
successProfileUpdate: "Updated preferences.",
|
||||
successProfileUpdate: "Updated settings.",
|
||||
successRegenerateSSHKey: "SSH Key regenerated successfully",
|
||||
errorRegenerateSSHKey: "Error on regenerate the SSH Key",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user