Skip to content

refactor: remove index files from components #1086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/docker-local/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "docker_volume" "coder_volume" {
}

resource "docker_container" "workspace" {
count = data.coder_workspace.me.start_count
count = data.coder_workspace.me.start_count
image = var.docker_image
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
dns = ["1.1.1.1"]
Expand Down
2 changes: 1 addition & 1 deletion site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import { Route, Routes } from "react-router-dom"
import { RequireAuth } from "./components"
import { AuthAndFrame } from "./components/AuthAndFrame/AuthAndFrame"
import { RequireAuth } from "./components/Page/RequireAuth"
import { PreferencesLayout } from "./components/Preferences/Layout"
import { IndexPage } from "./pages"
import { NotFoundPage } from "./pages/404"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/AuthAndFrame/AuthAndFrame.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { Navbar } from "../Navbar"
import { Navbar } from "../Navbar/Navbar"
import { Footer } from "../Page/Footer"
import { RequireAuth } from "../Page/RequireAuth"

Expand Down
3 changes: 0 additions & 3 deletions site/src/components/Button/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story } from "@storybook/react"
import React from "react"
import { CodeBlock, CodeBlockProps } from "./index"
import { CodeBlock, CodeBlockProps } from "./CodeBlock"

const sampleLines = `Successfully assigned coder/image-jcws7 to cluster-1
Container image "gcr.io/coder-dogfood/master/coder-dev-ubuntu@sha256" already present on machine
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { screen } from "@testing-library/react"
import React from "react"
import { render } from "../../testHelpers"
import { CodeBlock } from "./index"
import { CodeBlock } from "./CodeBlock"

describe("CodeBlock", () => {
it("renders lines)", async () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/CodeExample/CodeExample.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { makeStyles } from "@material-ui/core/styles"
import React from "react"
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { CopyButton } from "../Button"
import { CopyButton } from "../Button/CopyButton"

export interface CodeExampleProps {
code: string
Expand Down
1 change: 0 additions & 1 deletion site/src/components/CodeExample/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { screen } from "@testing-library/react"
import React from "react"
import { render } from "../../testHelpers"
import { EmptyState } from "./index"
import { EmptyState } from "./EmptyState"

describe("EmptyState", () => {
it("renders (smoke test)", async () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/ErrorSummary/ErrorSummary.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentMeta, Story } from "@storybook/react"
import React from "react"
import { ErrorSummary, ErrorSummaryProps } from "."
import { ErrorSummary, ErrorSummaryProps } from "./ErrorSummary"

export default {
title: "components/ErrorSummary",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react"
import React from "react"
import { ErrorSummary } from "./index"
import { ErrorSummary } from "./ErrorSummary"

describe("ErrorSummary", () => {
it("renders", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FormikContextType } from "formik/dist/types"
import { getFormHelpers, onChangeTrimmed } from "./index"
import { getFormHelpers, onChangeTrimmed } from "./utils"

interface TestType {
untouchedGoodField: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { FormikContextType, getIn } from "formik"
import { ChangeEvent, ChangeEventHandler, FocusEventHandler } from "react"

export * from "./FormCloseButton"
export * from "./FormDropdownField"
export * from "./FormSection"
export * from "./FormTextField"
export * from "./FormTitle"

interface FormHelpers {
name: string
onBlur: FocusEventHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { screen } from "@testing-library/react"
import React from "react"
import { render } from "../../testHelpers"
import { Header } from "./index"
import { Header } from "./Header"

describe("Header", () => {
it("renders title and subtitle", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useActor } from "@xstate/react"
import React, { useContext } from "react"
import { XServiceContext } from "../../xServices/StateContext"
import { NavbarView } from "./NavbarView"
import { NavbarView } from "./NavbarView/NavbarView"

export const Navbar: React.FC = () => {
const xServices = useContext(XServiceContext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story } from "@storybook/react"
import React from "react"
import { NavbarView, NavbarViewProps } from "."
import { NavbarView, NavbarViewProps } from "./NavbarView"

export default {
title: "components/NavbarView",
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Navbar/NavbarView/NavbarView.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { screen } from "@testing-library/react"
import React from "react"
import { NavbarView } from "."
import { render } from "../../../testHelpers"
import { MockUser } from "../../../testHelpers/entities"
import { NavbarView } from "./NavbarView"

describe("NavbarView", () => {
const noop = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { UserResponse } from "../../../api/types"
import { navHeight } from "../../../theme/constants"
import { AdminDropdown } from "../../AdminDropdown/AdminDropdown"
import { Logo } from "../../Icons/Logo"
import { UserDropdown } from "../UserDropdown"
import { UserDropdown } from "../UserDropdown/UsersDropdown"

export interface NavbarViewProps {
user?: UserResponse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Box from "@material-ui/core/Box"
import { Story } from "@storybook/react"
import React from "react"
import { UserDropdown, UserDropdownProps } from "."
import { UserDropdown, UserDropdownProps } from "./UsersDropdown"

export default {
title: "components/UserDropdown",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { screen } from "@testing-library/react"
import React from "react"
import { Language, UserDropdown, UserDropdownProps } from "."
import { render } from "../../../testHelpers"
import { MockUser } from "../../../testHelpers/entities"
import { Language, UserDropdown, UserDropdownProps } from "./UsersDropdown"

const renderAndClick = async (props: Partial<UserDropdownProps> = {}) => {
render(<UserDropdown user={props.user ?? MockUser} onSignOut={props.onSignOut ?? jest.fn()} />)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { BorderedMenu } from "../../BorderedMenu/BorderedMenu"
import { CloseDropdown, OpenDropdown } from "../../DropdownArrows/DropdownArrows"
import { DocsIcon } from "../../Icons/DocsIcon"
import { LogoutIcon } from "../../Icons/LogoutIcon"
import { UserAvatar } from "../../User"
import { UserAvatar } from "../../User/UserAvatar"
import { UserProfileCard } from "../../User/UserProfileCard"

export const Language = {
Expand Down
2 changes: 0 additions & 2 deletions site/src/components/Page/index.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions site/src/components/Preferences/AccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import TextField from "@material-ui/core/TextField"
import { FormikContextType, FormikErrors, useFormik } from "formik"
import React from "react"
import * as Yup from "yup"
import { getFormHelpers, onChangeTrimmed } from "../Form"
import { getFormHelpers, onChangeTrimmed } from "../Form/utils"
import { Stack } from "../Stack/Stack"
import { LoadingButton } from "./../Button"
import { LoadingButton } from "./../Button/LoadingButton"

interface AccountFormValues {
name: string
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Preferences/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Box from "@material-ui/core/Box"
import React from "react"
import { Outlet } from "react-router-dom"
import { AuthAndFrame } from "../AuthAndFrame/AuthAndFrame"
import { TabPanel } from "../TabPanel"
import { TabPanel } from "../TabPanel/TabPanel"

export const Language = {
accountLabel: "Account",
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Section/SectionView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Button from "@material-ui/core/Button"
import TextField from "@material-ui/core/TextField"
import { Story } from "@storybook/react"
import React from "react"
import { Section, SectionProps } from "./"
import { Section, SectionProps } from "./Section"

export default {
title: "components/Section",
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/SignIn/CliAuthToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Paper from "@material-ui/core/Paper"
import { makeStyles } from "@material-ui/core/styles"
import Typography from "@material-ui/core/Typography"
import React from "react"
import { CodeExample } from "../CodeExample"
import { CodeExample } from "../CodeExample/CodeExample"

export interface CliAuthTokenProps {
sessionToken: string
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/SignIn/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import TextField from "@material-ui/core/TextField"
import { FormikContextType, useFormik } from "formik"
import React from "react"
import * as Yup from "yup"
import { getFormHelpers, onChangeTrimmed } from "../Form"
import { LoadingButton } from "./../Button"
import { getFormHelpers, onChangeTrimmed } from "../Form/utils"
import { LoadingButton } from "./../Button/LoadingButton"
import { Welcome } from "./Welcome"

/**
Expand Down
2 changes: 0 additions & 2 deletions site/src/components/SignIn/index.tsx

This file was deleted.

12 changes: 6 additions & 6 deletions site/src/components/Snackbar/GlobalSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { makeStyles } from "@material-ui/core/styles"
import React, { useCallback, useState } from "react"
import { useCustomEvent } from "../../hooks/events"
import { CustomEventListener } from "../../util/events"
import { ErrorIcon } from "../Icons/ErrorIcon"
import { Typography } from "../Typography/Typography"
import { EnterpriseSnackbar } from "./EnterpriseSnackbar"
import {
AdditionalMessage,
isNotificationList,
Expand All @@ -8,12 +13,7 @@ import {
MsgType,
NotificationMsg,
SnackbarEventType,
} from "."
import { useCustomEvent } from "../../hooks/events"
import { CustomEventListener } from "../../util/events"
import { ErrorIcon } from "../Icons/ErrorIcon"
import { Typography } from "../Typography/Typography"
import { EnterpriseSnackbar } from "./EnterpriseSnackbar"
} from "./utils"

export const GlobalSnackbar: React.FC = () => {
const styles = useStyles()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { displaySuccess, isNotificationTextPrefixed, MsgType, NotificationMsg } from "./index"
import { displaySuccess, isNotificationTextPrefixed, MsgType, NotificationMsg } from "./utils"

describe("Snackbar", () => {
describe("isNotificationTextPrefixed", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { dispatchCustomEvent } from "../../util/events"

///////////////////////////////////////////////////////////////////////////////
// Notification Component
///////////////////////////////////////////////////////////////////////////////

export { GlobalSnackbar } from "./GlobalSnackbar"

///////////////////////////////////////////////////////////////////////////////
// Notification Types
///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/TabPanel/TabPanel.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story } from "@storybook/react"
import React from "react"
import { TabPanel, TabPanelProps } from "."
import { TabPanel, TabPanelProps } from "./TabPanel"

export default {
title: "components/TabPanel",
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Table/Cells/UserCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Link from "@material-ui/core/Link"
import { makeStyles } from "@material-ui/core/styles"
import Typography from "@material-ui/core/Typography"
import React from "react"
import { UserAvatar, UserAvatarProps } from "../../User"
import { UserAvatar, UserAvatarProps } from "../../User/UserAvatar"

export interface UserCellProps {
Avatar: UserAvatarProps
Expand Down
1 change: 0 additions & 1 deletion site/src/components/Table/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions site/src/components/User/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions site/src/components/UsersTable/UsersTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import { UserResponse } from "../../api/types"
import { Column, Table } from "../../components/Table"
import { EmptyState } from "../EmptyState"
import { Column, Table } from "../../components/Table/Table"
import { EmptyState } from "../EmptyState/EmptyState"
import { UserCell } from "../Table/Cells/UserCell"

const Language = {
Expand Down
1 change: 0 additions & 1 deletion site/src/components/Workspace/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions site/src/components/index.tsx

This file was deleted.

15 changes: 6 additions & 9 deletions site/src/forms/CreateTemplateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import { FormikContextType, useFormik } from "formik"
import React from "react"
import * as Yup from "yup"
import { CreateTemplateRequest, Organization, Provisioner, Template } from "../api/types"
import { LoadingButton } from "../components/Button"
import {
DropdownItem,
FormCloseButton,
FormDropdownField,
FormSection,
FormTextField,
FormTitle,
} from "../components/Form"
import { LoadingButton } from "../components/Button/LoadingButton"
import { FormCloseButton } from "../components/Form/FormCloseButton"
import { DropdownItem, FormDropdownField } from "../components/Form/FormDropdownField"
import { FormSection } from "../components/Form/FormSection"
import { FormTextField } from "../components/Form/FormTextField"
import { FormTitle } from "../components/Form/FormTitle"

export interface CreateTemplateFormProps {
provisioners: Provisioner[]
Expand Down
7 changes: 5 additions & 2 deletions site/src/forms/CreateWorkspaceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import { FormikContextType, useFormik } from "formik"
import React from "react"
import * as Yup from "yup"
import { CreateWorkspaceRequest, Template, Workspace } from "../api/types"
import { LoadingButton } from "../components/Button"
import { FormCloseButton, FormSection, FormTextField, FormTitle } from "../components/Form"
import { LoadingButton } from "../components/Button/LoadingButton"
import { FormCloseButton } from "../components/Form/FormCloseButton"
import { FormSection } from "../components/Form/FormSection"
import { FormTextField } from "../components/Form/FormTextField"
import { FormTitle } from "../components/Form/FormTitle"

export interface CreateWorkspaceForm {
template: Template
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/UsersPage/UsersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useActor } from "@xstate/react"
import React, { useContext } from "react"
import { ErrorSummary } from "../../components/ErrorSummary"
import { ErrorSummary } from "../../components/ErrorSummary/ErrorSummary"
import { XServiceContext } from "../../xServices/StateContext"
import { UsersPageView } from "./UsersPageView"

Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/UsersPage/UsersPageView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { makeStyles } from "@material-ui/core/styles"
import React from "react"
import { Pager, UserResponse } from "../../api/types"
import { Header } from "../../components/Header"
import { Header } from "../../components/Header/Header"
import { UsersTable } from "../../components/UsersTable/UsersTable"

export const Language = {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/cli-auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useActor } from "@xstate/react"
import React, { useContext, useEffect, useState } from "react"
import { getApiKey } from "../api"
import { FullScreenLoader } from "../components/Loader/FullScreenLoader"
import { CliAuthToken } from "../components/SignIn"
import { CliAuthToken } from "../components/SignIn/CliAuthToken"
import { XServiceContext } from "../xServices/StateContext"

export const CliAuthenticationPage: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Navigate, useLocation } from "react-router-dom"
import { Footer } from "../components/Page/Footer"
import { retrieveRedirect } from "../util/redirect"
import { XServiceContext } from "../xServices/StateContext"
import { SignInForm } from "./../components/SignIn"
import { SignInForm } from "./../components/SignIn/SignInForm"

export const useStyles = makeStyles((theme) => ({
root: {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/preferences/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useActor } from "@xstate/react"
import React, { useContext } from "react"
import { isApiError, mapApiErrorToFieldErrors } from "../../api/errors"
import { AccountForm } from "../../components/Preferences/AccountForm"
import { Section } from "../../components/Section"
import { Section } from "../../components/Section/Section"
import { XServiceContext } from "../../xServices/StateContext"

export const Language = {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/preferences/linkedAccounts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { Section } from "../../components/Section"
import { Section } from "../../components/Section/Section"

const Language = {
title: "Linked Accounts",
Expand Down
Loading