From 4bfd2275f3ed7e2c08f404e0400d8a2a6cc20f48 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 23 Feb 2024 13:23:28 -0600 Subject: [PATCH] Move `libs/table` and `libs/pagination` into `app/` (#1971) move libs/table and libs/pagination into app/ --- .prettierrc.js | 1 + {libs/pagination => app/components}/Pagination.tsx | 0 .../__tests__ => app/hooks}/use-pagination.spec.ts | 2 +- .../use-pagination.tsx => app/hooks/use-pagination.ts | 0 app/layouts/helpers.tsx | 2 +- {libs => app}/table/QueryTable.tsx | 4 +++- {libs => app}/table/Table.tsx | 0 {libs => app}/table/cells/BooleanCell.tsx | 0 {libs => app}/table/cells/Cell.tsx | 0 {libs => app}/table/cells/DateCell.tsx | 0 {libs => app}/table/cells/DefaultCell.tsx | 0 {libs => app}/table/cells/EmptyCell.tsx | 0 {libs => app}/table/cells/EnabledCell.tsx | 0 {libs => app}/table/cells/FirewallFilterCell.tsx | 0 {libs => app}/table/cells/InstanceLinkCell.tsx | 0 {libs => app}/table/cells/InstanceResourceCell.tsx | 0 {libs => app}/table/cells/InstanceStatusCell.tsx | 0 {libs => app}/table/cells/LabelCell.tsx | 0 {libs => app}/table/cells/LinkCell.tsx | 0 {libs => app}/table/cells/SizeCell.tsx | 0 {libs => app}/table/cells/TruncateCell.tsx | 0 {libs => app}/table/cells/TwoLineCell.tsx | 0 {libs => app}/table/cells/TypeValueCell.tsx | 0 {libs => app}/table/cells/TypeValueListCell.tsx | 0 {libs => app}/table/cells/index.ts | 0 {libs => app}/table/columns/action-col.tsx | 0 {libs => app}/table/columns/index.ts | 0 {libs => app}/table/columns/select-col.tsx | 0 {libs => app}/table/headers/DefaultHeader.tsx | 0 {libs => app}/table/headers/index.ts | 0 {libs => app}/table/index.ts | 0 {libs => app}/table/react-table.ts | 0 libs/pagination/index.ts | 10 ---------- tsconfig.json | 4 ++-- 34 files changed, 8 insertions(+), 15 deletions(-) rename {libs/pagination => app/components}/Pagination.tsx (100%) rename {libs/pagination/__tests__ => app/hooks}/use-pagination.spec.ts (97%) rename libs/pagination/use-pagination.tsx => app/hooks/use-pagination.ts (100%) rename {libs => app}/table/QueryTable.tsx (98%) rename {libs => app}/table/Table.tsx (100%) rename {libs => app}/table/cells/BooleanCell.tsx (100%) rename {libs => app}/table/cells/Cell.tsx (100%) rename {libs => app}/table/cells/DateCell.tsx (100%) rename {libs => app}/table/cells/DefaultCell.tsx (100%) rename {libs => app}/table/cells/EmptyCell.tsx (100%) rename {libs => app}/table/cells/EnabledCell.tsx (100%) rename {libs => app}/table/cells/FirewallFilterCell.tsx (100%) rename {libs => app}/table/cells/InstanceLinkCell.tsx (100%) rename {libs => app}/table/cells/InstanceResourceCell.tsx (100%) rename {libs => app}/table/cells/InstanceStatusCell.tsx (100%) rename {libs => app}/table/cells/LabelCell.tsx (100%) rename {libs => app}/table/cells/LinkCell.tsx (100%) rename {libs => app}/table/cells/SizeCell.tsx (100%) rename {libs => app}/table/cells/TruncateCell.tsx (100%) rename {libs => app}/table/cells/TwoLineCell.tsx (100%) rename {libs => app}/table/cells/TypeValueCell.tsx (100%) rename {libs => app}/table/cells/TypeValueListCell.tsx (100%) rename {libs => app}/table/cells/index.ts (100%) rename {libs => app}/table/columns/action-col.tsx (100%) rename {libs => app}/table/columns/index.ts (100%) rename {libs => app}/table/columns/select-col.tsx (100%) rename {libs => app}/table/headers/DefaultHeader.tsx (100%) rename {libs => app}/table/headers/index.ts (100%) rename {libs => app}/table/index.ts (100%) rename {libs => app}/table/react-table.ts (100%) delete mode 100644 libs/pagination/index.ts diff --git a/.prettierrc.js b/.prettierrc.js index 0a64eadc1..dbce9f0a1 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -18,6 +18,7 @@ export default { '', '^@oxide/(.*)$', '', + '^~/(.*)$', '^app/(.*)$', '', '^[./]', diff --git a/libs/pagination/Pagination.tsx b/app/components/Pagination.tsx similarity index 100% rename from libs/pagination/Pagination.tsx rename to app/components/Pagination.tsx diff --git a/libs/pagination/__tests__/use-pagination.spec.ts b/app/hooks/use-pagination.spec.ts similarity index 97% rename from libs/pagination/__tests__/use-pagination.spec.ts rename to app/hooks/use-pagination.spec.ts index 81c3523e8..62e12865e 100644 --- a/libs/pagination/__tests__/use-pagination.spec.ts +++ b/app/hooks/use-pagination.spec.ts @@ -8,7 +8,7 @@ import { act, renderHook } from '@testing-library/react' import { describe, expect, it } from 'vitest' -import { usePagination } from '../use-pagination' +import { usePagination } from './use-pagination' describe('usePagination', () => { it('starts with empty state', () => { diff --git a/libs/pagination/use-pagination.tsx b/app/hooks/use-pagination.ts similarity index 100% rename from libs/pagination/use-pagination.tsx rename to app/hooks/use-pagination.ts diff --git a/app/layouts/helpers.tsx b/app/layouts/helpers.tsx index c2e8aed34..e5137b610 100644 --- a/app/layouts/helpers.tsx +++ b/app/layouts/helpers.tsx @@ -8,10 +8,10 @@ import { useRef } from 'react' import { Outlet } from 'react-router-dom' -import { Pagination } from '@oxide/pagination' import { SkipLinkTarget } from '@oxide/ui' import { classed } from '@oxide/util' +import { Pagination } from '~/components/Pagination' import { PageActionsTarget } from 'app/components/PageActions' import { useScrollRestoration } from 'app/hooks/use-scroll-restoration' diff --git a/libs/table/QueryTable.tsx b/app/table/QueryTable.tsx similarity index 98% rename from libs/table/QueryTable.tsx rename to app/table/QueryTable.tsx index f0851fd50..f53effeb3 100644 --- a/libs/table/QueryTable.tsx +++ b/app/table/QueryTable.tsx @@ -31,10 +31,12 @@ import { type Result, type ResultItem, } from '@oxide/api' -import { Pagination, usePagination } from '@oxide/pagination' import { EmptyMessage, TableEmptyBox } from '@oxide/ui' import { invariant, isOneOf } from '@oxide/util' +import { Pagination } from '~/components/Pagination' +import { usePagination } from '~/hooks/use-pagination' + import { DefaultCell } from './cells' import { getActionsCol, getMultiSelectCol, getSelectCol, type MakeActions } from './columns' import { Table } from './Table' diff --git a/libs/table/Table.tsx b/app/table/Table.tsx similarity index 100% rename from libs/table/Table.tsx rename to app/table/Table.tsx diff --git a/libs/table/cells/BooleanCell.tsx b/app/table/cells/BooleanCell.tsx similarity index 100% rename from libs/table/cells/BooleanCell.tsx rename to app/table/cells/BooleanCell.tsx diff --git a/libs/table/cells/Cell.tsx b/app/table/cells/Cell.tsx similarity index 100% rename from libs/table/cells/Cell.tsx rename to app/table/cells/Cell.tsx diff --git a/libs/table/cells/DateCell.tsx b/app/table/cells/DateCell.tsx similarity index 100% rename from libs/table/cells/DateCell.tsx rename to app/table/cells/DateCell.tsx diff --git a/libs/table/cells/DefaultCell.tsx b/app/table/cells/DefaultCell.tsx similarity index 100% rename from libs/table/cells/DefaultCell.tsx rename to app/table/cells/DefaultCell.tsx diff --git a/libs/table/cells/EmptyCell.tsx b/app/table/cells/EmptyCell.tsx similarity index 100% rename from libs/table/cells/EmptyCell.tsx rename to app/table/cells/EmptyCell.tsx diff --git a/libs/table/cells/EnabledCell.tsx b/app/table/cells/EnabledCell.tsx similarity index 100% rename from libs/table/cells/EnabledCell.tsx rename to app/table/cells/EnabledCell.tsx diff --git a/libs/table/cells/FirewallFilterCell.tsx b/app/table/cells/FirewallFilterCell.tsx similarity index 100% rename from libs/table/cells/FirewallFilterCell.tsx rename to app/table/cells/FirewallFilterCell.tsx diff --git a/libs/table/cells/InstanceLinkCell.tsx b/app/table/cells/InstanceLinkCell.tsx similarity index 100% rename from libs/table/cells/InstanceLinkCell.tsx rename to app/table/cells/InstanceLinkCell.tsx diff --git a/libs/table/cells/InstanceResourceCell.tsx b/app/table/cells/InstanceResourceCell.tsx similarity index 100% rename from libs/table/cells/InstanceResourceCell.tsx rename to app/table/cells/InstanceResourceCell.tsx diff --git a/libs/table/cells/InstanceStatusCell.tsx b/app/table/cells/InstanceStatusCell.tsx similarity index 100% rename from libs/table/cells/InstanceStatusCell.tsx rename to app/table/cells/InstanceStatusCell.tsx diff --git a/libs/table/cells/LabelCell.tsx b/app/table/cells/LabelCell.tsx similarity index 100% rename from libs/table/cells/LabelCell.tsx rename to app/table/cells/LabelCell.tsx diff --git a/libs/table/cells/LinkCell.tsx b/app/table/cells/LinkCell.tsx similarity index 100% rename from libs/table/cells/LinkCell.tsx rename to app/table/cells/LinkCell.tsx diff --git a/libs/table/cells/SizeCell.tsx b/app/table/cells/SizeCell.tsx similarity index 100% rename from libs/table/cells/SizeCell.tsx rename to app/table/cells/SizeCell.tsx diff --git a/libs/table/cells/TruncateCell.tsx b/app/table/cells/TruncateCell.tsx similarity index 100% rename from libs/table/cells/TruncateCell.tsx rename to app/table/cells/TruncateCell.tsx diff --git a/libs/table/cells/TwoLineCell.tsx b/app/table/cells/TwoLineCell.tsx similarity index 100% rename from libs/table/cells/TwoLineCell.tsx rename to app/table/cells/TwoLineCell.tsx diff --git a/libs/table/cells/TypeValueCell.tsx b/app/table/cells/TypeValueCell.tsx similarity index 100% rename from libs/table/cells/TypeValueCell.tsx rename to app/table/cells/TypeValueCell.tsx diff --git a/libs/table/cells/TypeValueListCell.tsx b/app/table/cells/TypeValueListCell.tsx similarity index 100% rename from libs/table/cells/TypeValueListCell.tsx rename to app/table/cells/TypeValueListCell.tsx diff --git a/libs/table/cells/index.ts b/app/table/cells/index.ts similarity index 100% rename from libs/table/cells/index.ts rename to app/table/cells/index.ts diff --git a/libs/table/columns/action-col.tsx b/app/table/columns/action-col.tsx similarity index 100% rename from libs/table/columns/action-col.tsx rename to app/table/columns/action-col.tsx diff --git a/libs/table/columns/index.ts b/app/table/columns/index.ts similarity index 100% rename from libs/table/columns/index.ts rename to app/table/columns/index.ts diff --git a/libs/table/columns/select-col.tsx b/app/table/columns/select-col.tsx similarity index 100% rename from libs/table/columns/select-col.tsx rename to app/table/columns/select-col.tsx diff --git a/libs/table/headers/DefaultHeader.tsx b/app/table/headers/DefaultHeader.tsx similarity index 100% rename from libs/table/headers/DefaultHeader.tsx rename to app/table/headers/DefaultHeader.tsx diff --git a/libs/table/headers/index.ts b/app/table/headers/index.ts similarity index 100% rename from libs/table/headers/index.ts rename to app/table/headers/index.ts diff --git a/libs/table/index.ts b/app/table/index.ts similarity index 100% rename from libs/table/index.ts rename to app/table/index.ts diff --git a/libs/table/react-table.ts b/app/table/react-table.ts similarity index 100% rename from libs/table/react-table.ts rename to app/table/react-table.ts diff --git a/libs/pagination/index.ts b/libs/pagination/index.ts deleted file mode 100644 index 6d3969ed2..000000000 --- a/libs/pagination/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * Copyright Oxide Computer Company - */ - -export * from './Pagination' -export * from './use-pagination' diff --git a/tsconfig.json b/tsconfig.json index 757bc08eb..69b8fc99b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,14 +12,14 @@ "noEmit": true, "outDir": "dist", "paths": { + "~/*": ["app/*"], "app/*": ["app/*"], "@oxide/gen/*": ["libs/api/__generated__/*"], "@oxide/api": ["libs/api/index.ts"], "@oxide/api-mocks": ["libs/api-mocks/index.ts"], "@oxide/ui": ["libs/ui/index.ts"], "@oxide/util": ["libs/util/index.ts"], - "@oxide/table": ["libs/table/index.ts"], - "@oxide/pagination": ["libs/pagination/index.ts"] + "@oxide/table": ["app/table/index.ts"] }, "resolveJsonModule": true, "rootDir": ".",