diff --git a/.eslintrc.json b/.eslintrc.json index e3a1a4bd5..1b4ba2854 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,7 +37,7 @@ "ecmaVersion": "latest", "sourceType": "module" }, - "plugins": ["@typescript-eslint", "tailwindcss", "react", "react-hooks", "import", "prettier"], + "plugins": ["@typescript-eslint", "tailwindcss", "react", "react-hooks", "import", "prettier", "unused-imports"], "rules": { "tailwindcss/no-contradicting-classname": "error", "import/no-unresolved": "off", @@ -47,11 +47,15 @@ "jsx-a11y/click-events-have-key-events": "warn", "jsx-a11y/no-autofocus": "off", - "@typescript-eslint/no-unused-vars": [ - "error", + "@typescript-eslint/no-unused-vars": "off", + "unused-imports/no-unused-imports": "error", + "unused-imports/no-unused-vars": [ + "warn", { - "argsIgnorePattern": "^_", + "vars": "all", + "args": "after-used", "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" } ], diff --git a/.vscode/settings.json b/.vscode/settings.json index 043bb10e9..f55c9a2ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,10 @@ "[ignore]": { "editor.defaultFormatter": "foxundermoon.shell-format" }, - "prettier.trailingComma": "none" + "prettier.trailingComma": "none", + "editor.codeActionsOnSave": { + "source.fixAll": "always", + "source.fixAll.eslint": "always" + }, + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"] } diff --git a/apps/design-system/src/pages/view-preview/commit-details-diff-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/commit-details-diff-view-wrapper.tsx index c6b3c6cf1..1d28c3e95 100644 --- a/apps/design-system/src/pages/view-preview/commit-details-diff-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/commit-details-diff-view-wrapper.tsx @@ -3,7 +3,7 @@ import { FC, useCallback } from 'react' import { commitDetailsStore } from '@subjects/views/commit-details/commit-details-store' import { repoFilesStore } from '@subjects/views/repo-files/components/repo-files-store' import { renderEntries } from '@utils/fileViewUtils' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { FileExplorer } from '@harnessio/ui/components' import { CommitDiff, CommitSidebar, ICommitDetailsStore } from '@harnessio/ui/views' @@ -14,7 +14,7 @@ export const CommitDetailsDiffViewWrapper: FC = () => { return ( <> {}} filesList={repoFilesStore.filesList} > @@ -22,7 +22,7 @@ export const CommitDetailsDiffViewWrapper: FC = () => { {renderEntries(repoFilesStore.filesTreeData, '')} - + ) } diff --git a/apps/design-system/src/pages/view-preview/project-settings-wrapper.tsx b/apps/design-system/src/pages/view-preview/project-settings-wrapper.tsx index 3a2f063da..945b473ec 100644 --- a/apps/design-system/src/pages/view-preview/project-settings-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/project-settings-wrapper.tsx @@ -1,14 +1,16 @@ import { FC, PropsWithChildren } from 'react' import { Route } from 'react-router-dom' -import { ProjectSettingsPage } from '@harnessio/ui/views' +import { useTranslationStore } from '@utils/viewUtils' + +import { ProjectSettingsTabNav } from '@harnessio/ui/views' import RootViewWrapper from './root-view-wrapper' const Layout = () => { return (
- +
) } diff --git a/apps/design-system/src/pages/view-preview/pull-request-layout-wrapper.tsx b/apps/design-system/src/pages/view-preview/pull-request-layout-wrapper.tsx index 07a1176f9..86a4c05ef 100644 --- a/apps/design-system/src/pages/view-preview/pull-request-layout-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/pull-request-layout-wrapper.tsx @@ -2,7 +2,7 @@ import { FC, PropsWithChildren, useCallback } from 'react' import { Route } from 'react-router-dom' import { pullRequestStore } from '@subjects/views/pull-request-conversation/pull-request-store' -import { useTranslationsStore } from '@utils/viewUtils' +import { useTranslationStore } from '@utils/viewUtils' import { PullRequestLayout } from '@harnessio/ui/views' @@ -21,7 +21,7 @@ const PullRequestLayoutWrapper: FC>> = ({ children }) => { return ( - }> + }> diff --git a/apps/design-system/src/pages/view-preview/repo-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/repo-view-wrapper.tsx index 7dc7963ce..aafdebd1b 100644 --- a/apps/design-system/src/pages/view-preview/repo-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/repo-view-wrapper.tsx @@ -1,7 +1,7 @@ import { FC, PropsWithChildren } from 'react' import { Route } from 'react-router-dom' -import { useTranslationsStore } from '@utils/viewUtils' +import { useTranslationStore } from '@utils/viewUtils' import { RepoSubheader } from '@harnessio/ui/components' @@ -14,7 +14,7 @@ const RepoViewWrapper: FC>> element={ <>
- +
{children} diff --git a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx index 7ccdbc728..69909c7c8 100644 --- a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx @@ -1,7 +1,7 @@ import { FC, PropsWithChildren, useCallback, useState } from 'react' import { Outlet, Route, Routes } from 'react-router-dom' -import { noop, useThemeStore, useTranslationsStore } from '@utils/viewUtils' +import { noop, useThemeStore, useTranslationStore } from '@utils/viewUtils' import { Breadcrumb, MoreSubmenu, Navbar, NavbarItemType, SettingsMenu, Topbar } from '@harnessio/ui/components' import { SandboxLayout } from '@harnessio/ui/views' @@ -50,7 +50,7 @@ const RootViewWrapper: FC> = ({ childre handleChangePinnedMenuItem={setPinned} handleRemoveRecentMenuItem={noop} useThemeStore={useThemeStore} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> = { 'rule-not-found': ( - + ), diff --git a/apps/design-system/src/subjects/views/commit-details/commit-details-store.ts b/apps/design-system/src/subjects/views/commit-details/commit-details-store.ts index d9ff74144..faae71f33 100644 --- a/apps/design-system/src/subjects/views/commit-details/commit-details-store.ts +++ b/apps/design-system/src/subjects/views/commit-details/commit-details-store.ts @@ -812,7 +812,7 @@ export const commitDetailsStore: ICommitDetailsStore = { newNumber: 3 }, { - content: " import { noop, useThemeStore, useTranslationsStore } from '@utils/viewUtils'", + content: " import { noop, useThemeStore, useTranslationStore } from '@utils/viewUtils'", type: 'context', oldNumber: 4, newNumber: 4 @@ -1095,7 +1095,7 @@ export const commitDetailsStore: ICommitDetailsStore = { fileId: 'apps/design-system/src/pages/view-preview/root-view-wrapper.tsx::::apps/design-system/src/pages/view-preview/root-view-wrapper.tsx', filePath: 'apps/design-system/src/pages/view-preview/root-view-wrapper.tsx', - raw: 'diff --git a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\nindex 31551abd93ce31e564e2304d83638dca29b302f2..57549ac177fdd0b5197f562edb3983a2f0197a1f 100644\n--- a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\n+++ b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\n@@ -3,16 +3,7 @@ import { Outlet, Route, Routes } from \'react-router-dom\'\n \n import { noop, useThemeStore, useTranslationsStore } from \'@utils/viewUtils\'\n \n-import {\n- Breadcrumb,\n- BreadcrumbItem,\n- BreadcrumbLink,\n- BreadcrumbList,\n- BreadcrumbSeparator,\n- Navbar,\n- NavbarItemType,\n- Topbar\n-} from \'@harnessio/ui/components\'\n+import { Breadcrumb, Navbar, NavbarItemType, Topbar } from \'@harnessio/ui/components\'\n import { SandboxLayout } from \'@harnessio/ui/views\'\n \n const RootViewWrapper: FC> = ({ children, asChild = false }) => {\n@@ -62,19 +53,19 @@ const RootViewWrapper: FC> = ({ childre\n
\n \n \n- \n- \n- \n- Lorem\n- \n- \n- \n- Ipsum\n- \n- \n- Dolor\n- \n- \n+ \n+ \n+ \n+ Lorem\n+ \n+ \n+ \n+ Ipsum\n+ \n+ \n+ Dolor\n+ \n+ \n \n \n
\n' + raw: 'diff --git a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\nindex 31551abd93ce31e564e2304d83638dca29b302f2..57549ac177fdd0b5197f562edb3983a2f0197a1f 100644\n--- a/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\n+++ b/apps/design-system/src/pages/view-preview/root-view-wrapper.tsx\n@@ -3,16 +3,7 @@ import { Outlet, Route, Routes } from \'react-router-dom\'\n \n import { noop, useThemeStore, useTranslationStore } from \'@utils/viewUtils\'\n \n-import {\n- Breadcrumb,\n- BreadcrumbItem,\n- BreadcrumbLink,\n- BreadcrumbList,\n- BreadcrumbSeparator,\n- Navbar,\n- NavbarItemType,\n- Topbar\n-} from \'@harnessio/ui/components\'\n+import { Breadcrumb, Navbar, NavbarItemType, Topbar } from \'@harnessio/ui/components\'\n import { SandboxLayout } from \'@harnessio/ui/views\'\n \n const RootViewWrapper: FC> = ({ children, asChild = false }) => {\n@@ -62,19 +53,19 @@ const RootViewWrapper: FC> = ({ childre\n
\n \n \n- \n- \n- \n- Lorem\n- \n- \n- \n- Ipsum\n- \n- \n- Dolor\n- \n- \n+ \n+ \n+ \n+ Lorem\n+ \n+ \n+ \n+ Ipsum\n+ \n+ \n+ Dolor\n+ \n+ \n \n \n
\n' }, { blocks: [ diff --git a/apps/design-system/src/subjects/views/commit-details/index.tsx b/apps/design-system/src/subjects/views/commit-details/index.tsx index 9c9a89a76..53621b956 100644 --- a/apps/design-system/src/subjects/views/commit-details/index.tsx +++ b/apps/design-system/src/subjects/views/commit-details/index.tsx @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import { useTranslationsStore } from '@utils/viewUtils' +import { useTranslationStore } from '@utils/viewUtils' import { ICommitDetailsStore, RepoCommitDetailsView } from '@harnessio/ui/views' @@ -10,6 +10,6 @@ export const CommitDetailsView = () => { const useCommitDetailsStore = useCallback((): ICommitDetailsStore => commitDetailsStore, []) return ( - + ) } diff --git a/apps/design-system/src/subjects/views/execution-list/execution-list.tsx b/apps/design-system/src/subjects/views/execution-list/execution-list.tsx index 2f12063b3..afa5df6dd 100644 --- a/apps/design-system/src/subjects/views/execution-list/execution-list.tsx +++ b/apps/design-system/src/subjects/views/execution-list/execution-list.tsx @@ -1,7 +1,7 @@ import { FC } from 'react' import { Link } from 'react-router-dom' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { ExecutionListPage, RepoSummaryViewProps, TLinkComponent } from '@harnessio/ui/views' @@ -13,7 +13,7 @@ const ExecutionListWrapper: FC> = () => { return ( { <> setOpenAlertDeleteDialog(true)} handleEditLabel={() => setOpenCreateLabelDialog(true)} openCreateLabelDialog={() => setOpenCreateLabelDialog(true)} @@ -27,7 +27,7 @@ export const ProjectLabelsList = () => { open={openCreateLabelDialog} onClose={() => setOpenCreateLabelDialog(false)} onSubmit={noop} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} isCreatingLabel={false} error={''} useLabelsStore={RepoLabelsListStore.useLabelsStore} @@ -39,7 +39,7 @@ export const ProjectLabelsList = () => { type="label" deleteFn={noop} isLoading={false} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> ) diff --git a/apps/design-system/src/subjects/views/labels/repo-labels-list.tsx b/apps/design-system/src/subjects/views/labels/repo-labels-list.tsx index 03c91d8ae..9ea7d1517 100644 --- a/apps/design-system/src/subjects/views/labels/repo-labels-list.tsx +++ b/apps/design-system/src/subjects/views/labels/repo-labels-list.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { DeleteAlertDialog } from '@harnessio/ui/components' import { CreateLabelDialog, RepoLabelsListView } from '@harnessio/ui/views' @@ -15,7 +15,7 @@ export const RepoLabelsList = () => { <> setOpenAlertDeleteDialog(true)} handleEditLabel={() => setOpenCreateLabelDialog(true)} openCreateLabelDialog={() => setOpenCreateLabelDialog(true)} @@ -27,7 +27,7 @@ export const RepoLabelsList = () => { open={openCreateLabelDialog} onClose={() => setOpenCreateLabelDialog(false)} onSubmit={noop} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} isCreatingLabel={false} error={''} useLabelsStore={RepoLabelsListStore.useLabelsStore} @@ -39,7 +39,7 @@ export const RepoLabelsList = () => { type="label" deleteFn={noop} isLoading={false} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> ) diff --git a/apps/design-system/src/subjects/views/pipeline-list/pipeline-list.tsx b/apps/design-system/src/subjects/views/pipeline-list/pipeline-list.tsx index dcd8382cd..b5033eb6d 100644 --- a/apps/design-system/src/subjects/views/pipeline-list/pipeline-list.tsx +++ b/apps/design-system/src/subjects/views/pipeline-list/pipeline-list.tsx @@ -1,7 +1,7 @@ import { FC, useState } from 'react' import { Link } from 'react-router-dom' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { CreatePipelineDialog, PipelineListPage, RepoSummaryViewProps, TLinkComponent } from '@harnessio/ui/views' @@ -15,7 +15,7 @@ const PipelineListWrapper: FC> = () => { <> > = prop useRepoCommitsStore={useRepoCommitsListStore} searchCommitQuery={null} setSearchCommitQuery={noop} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} isLoading={false} searchSourceQuery="" setSearchSourceQuery={noop} diff --git a/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-changes.tsx b/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-changes.tsx index 4eb72f9cd..71676ed0c 100644 --- a/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-changes.tsx +++ b/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-changes.tsx @@ -1,6 +1,6 @@ import { FC, PropsWithChildren, useCallback } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { CommitSuggestionsDialog } from '@harnessio/ui/components' import { PullRequestChangesPage, TypesCommit, TypesPullReqActivity } from '@harnessio/ui/views' @@ -55,7 +55,7 @@ const PullRequestChanges: FC = ({ state }) => { return ( ) } diff --git a/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-conversation.tsx b/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-conversation.tsx index 638fdb989..febbd09c0 100644 --- a/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-conversation.tsx +++ b/apps/design-system/src/subjects/views/pull-request-conversation/pull-request-conversation.tsx @@ -1,6 +1,6 @@ import { FC, PropsWithChildren } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { CommitSuggestionsDialog, FilterOption, Spacer } from '@harnessio/ui/components' import { @@ -168,7 +168,7 @@ const PullRequestConversation: FC = ({ state }) => handleUpdateDescription={noop} handleDeleteComment={noop} handleUpdateComment={noop} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} repoId={repoRef} refetchActivities={noop} commentStatusPullReq={commentStatusPullReq} @@ -257,7 +257,7 @@ const PullRequestConversation: FC = ({ state }) => removeLabel={noop} addLabelError={undefined} removeLabelError={undefined} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> diff --git a/apps/design-system/src/subjects/views/pull-request-list/pull-request-list.tsx b/apps/design-system/src/subjects/views/pull-request-list/pull-request-list.tsx index 974c8f126..48e6df16c 100644 --- a/apps/design-system/src/subjects/views/pull-request-list/pull-request-list.tsx +++ b/apps/design-system/src/subjects/views/pull-request-list/pull-request-list.tsx @@ -1,6 +1,6 @@ import { FC, useCallback } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { PullRequestList, PullRequestPageProps } from '@harnessio/ui/views' @@ -19,7 +19,7 @@ const PullRequestListWrapper: FC> = props => { diff --git a/apps/design-system/src/subjects/views/repo-branches/index.tsx b/apps/design-system/src/subjects/views/repo-branches/index.tsx index 1381a9da2..4763884eb 100644 --- a/apps/design-system/src/subjects/views/repo-branches/index.tsx +++ b/apps/design-system/src/subjects/views/repo-branches/index.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { IBranchSelectorStore, RepoBranchListView } from '@harnessio/ui/views' @@ -16,7 +16,7 @@ export function RepoBranchesView() { isCreatingBranch={false} onSubmit={noop} useRepoBranchesStore={useRepoBranchesStore} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} isCreateBranchDialogOpen={isCreateBranchDialogOpen} setCreateBranchDialogOpen={setCreateBranchDialogOpen} searchQuery={''} diff --git a/apps/design-system/src/subjects/views/repo-commits/index.tsx b/apps/design-system/src/subjects/views/repo-commits/index.tsx index 6616eb7fe..4f68013cc 100644 --- a/apps/design-system/src/subjects/views/repo-commits/index.tsx +++ b/apps/design-system/src/subjects/views/repo-commits/index.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { BranchSelectorTab, IBranchSelectorStore, RepoCommitsView as RepoCommitsUiView } from '@harnessio/ui/views' @@ -41,7 +41,7 @@ export const RepoCommitsView = () => { xPrevPage={NaN} selectBranchOrTag={noop} useRepoBranchesStore={useRepoBranchesStore} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} searchQuery={branchTagQuery} setSearchQuery={setBranchTagQuery} /> diff --git a/apps/design-system/src/subjects/views/repo-create-rule.tsx b/apps/design-system/src/subjects/views/repo-create-rule.tsx index 72a9c9d84..82042d4e1 100644 --- a/apps/design-system/src/subjects/views/repo-create-rule.tsx +++ b/apps/design-system/src/subjects/views/repo-create-rule.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { useRepoRulesStore } from '@subjects/views/repo-general-settings/use-repo-rules-store' -import { useTranslationsStore } from '@utils/viewUtils' +import { useTranslationStore } from '@utils/viewUtils' import { SkeletonForm } from '@harnessio/ui/components' import { RepoBranchSettingsRulesPage } from '@harnessio/ui/views' @@ -51,7 +51,7 @@ export const RepoCreateRule = () => { handleSelectChangeForRule={() => {}} handleInputChange={() => {}} handleInitialRules={() => {}} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} setPrincipalsSearchQuery={setPrincipalsSearchQuery} principalsSearchQuery={principalsSearchQuery} /> diff --git a/apps/design-system/src/subjects/views/repo-files/components/repo-file-edit.tsx b/apps/design-system/src/subjects/views/repo-files/components/repo-file-edit.tsx index edb4afc88..0e74873cd 100644 --- a/apps/design-system/src/subjects/views/repo-files/components/repo-file-edit.tsx +++ b/apps/design-system/src/subjects/views/repo-files/components/repo-file-edit.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { EditViewTypeValue, FileEditorControlBar, GitCommitDialog, GitCommitFormType } from '@harnessio/ui/components' import { CodeModes, PathActionBar } from '@harnessio/ui/views' @@ -55,7 +55,7 @@ export const RepoFileEdit = () => { setFileName(vel)} onBlurFileName={noop} gitRefName={repoFilesStore.branchSelectorStore.selectedBranchTag.name} diff --git a/apps/design-system/src/subjects/views/repo-files/components/repo-files-wrapper.tsx b/apps/design-system/src/subjects/views/repo-files/components/repo-files-wrapper.tsx index 908d0f943..38c006dab 100644 --- a/apps/design-system/src/subjects/views/repo-files/components/repo-files-wrapper.tsx +++ b/apps/design-system/src/subjects/views/repo-files/components/repo-files-wrapper.tsx @@ -1,6 +1,6 @@ import { FC, useCallback, useMemo } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { BranchSelectorTab, CodeModes, IBranchSelectorStore, RepoFiles } from '@harnessio/ui/views' @@ -60,7 +60,7 @@ export const RepoFilesWrapper: FC = ({ codeMode, isDir, i isDir={isDir} isShowSummary={true} latestFile={repoFilesStore.latestCommitInfo} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} pathNewFile="" pathUploadFiles="" codeMode={codeMode} diff --git a/apps/design-system/src/subjects/views/repo-general-settings/repo-general-settings.tsx b/apps/design-system/src/subjects/views/repo-general-settings/repo-general-settings.tsx index 1af13ee9b..5fd61c1f9 100644 --- a/apps/design-system/src/subjects/views/repo-general-settings/repo-general-settings.tsx +++ b/apps/design-system/src/subjects/views/repo-general-settings/repo-general-settings.tsx @@ -2,7 +2,7 @@ import { useCallback, useState } from 'react' import { repoBranchListStore } from '@subjects/stores/repo-branch-store' import { useRepoRulesStore } from '@subjects/views/repo-general-settings/use-repo-rules-store' -import { useTranslationsStore } from '@utils/viewUtils' +import { useTranslationStore } from '@utils/viewUtils' import { DeleteAlertDialog } from '@harnessio/ui/components' import { ErrorTypes, RepoSettingsGeneralPage } from '@harnessio/ui/views' @@ -50,7 +50,7 @@ export const RepoGeneralSettings = () => { isRepoUpdateSuccess={false} useRepoRulesStore={useRepoRulesStore} useRepoBranchesStore={useRepoBranchesStore} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} handleRuleClick={() => {}} openRulesAlertDeleteDialog={openRulesAlertDeleteDialog} openRepoAlertDeleteDialog={openRepoAlertDeleteDialog} @@ -68,7 +68,7 @@ export const RepoGeneralSettings = () => { type="rule" identifier={alertDeleteParams} isLoading={false} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> { error={apiError?.type === ErrorTypes.DELETE_REPO ? apiError : null} type="repository" isLoading={false} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} withForm /> diff --git a/apps/design-system/src/subjects/views/repo-list/repo-list.tsx b/apps/design-system/src/subjects/views/repo-list/repo-list.tsx index c8ffebcfe..9b67827b9 100644 --- a/apps/design-system/src/subjects/views/repo-list/repo-list.tsx +++ b/apps/design-system/src/subjects/views/repo-list/repo-list.tsx @@ -1,6 +1,6 @@ import { FC, useCallback } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { RepoListProps, SandboxRepoListPage } from '@harnessio/ui/views' @@ -19,7 +19,7 @@ const RepoListWrapper: FC> = props => { return ( > = props => { saveDescription={noop} handleCreateToken={noop} navigateToFile={noop} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} useRepoBranchesStore={useRepoBranchesStore} gitRef="" updateRepoError="" diff --git a/apps/design-system/src/subjects/views/repo-webhooks-create/repo-webhooks-list.tsx b/apps/design-system/src/subjects/views/repo-webhooks-create/repo-webhooks-list.tsx index c21dbca44..c9bda09fd 100644 --- a/apps/design-system/src/subjects/views/repo-webhooks-create/repo-webhooks-list.tsx +++ b/apps/design-system/src/subjects/views/repo-webhooks-create/repo-webhooks-list.tsx @@ -1,4 +1,4 @@ -import { useTranslationsStore } from '@utils/viewUtils.ts' +import { useTranslationStore } from '@utils/viewUtils.ts' import { RepoWebhooksCreatePage } from '@harnessio/ui/views' @@ -12,7 +12,7 @@ export const RepoWebhooksCreate = () => { apiError={null} isLoading={false} useWebhookStore={repoWebhooksListStore.useWebhookStore} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> ) } diff --git a/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx b/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx index 11961aa73..38c6faf60 100644 --- a/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx +++ b/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils.ts' +import { noop, useTranslationStore } from '@utils/viewUtils.ts' import { DeleteAlertDialog } from '@harnessio/ui/components' import { RepoWebhookListPage } from '@harnessio/ui/views' @@ -25,7 +25,7 @@ export const RepoWebhooksList = () => { <> { onClose={closeDeleteWebhookDialog} deleteFn={() => closeDeleteWebhookDialog()} type="webhook" - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} /> ) diff --git a/apps/design-system/src/subjects/views/space-settings-members/space-settings-members.tsx b/apps/design-system/src/subjects/views/space-settings-members/space-settings-members.tsx index 8601a9a39..856b66422 100644 --- a/apps/design-system/src/subjects/views/space-settings-members/space-settings-members.tsx +++ b/apps/design-system/src/subjects/views/space-settings-members/space-settings-members.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' -import { noop, useTranslationsStore } from '@utils/viewUtils' +import { noop, useTranslationStore } from '@utils/viewUtils' import { DeleteAlertDialog } from '@harnessio/ui/components' import { PrincipalData, ProjectMemberListView } from '@harnessio/ui/views' @@ -69,7 +69,7 @@ export const SpaceSettingsMembers = () => { <> { type="member" identifier={deleteMemberId ?? undefined} isLoading={false} - useTranslationStore={useTranslationsStore} + useTranslationStore={useTranslationStore} withForm /> diff --git a/apps/design-system/src/utils/viewUtils.ts b/apps/design-system/src/utils/viewUtils.ts index 6692a2edd..166bb73a4 100644 --- a/apps/design-system/src/utils/viewUtils.ts +++ b/apps/design-system/src/utils/viewUtils.ts @@ -14,6 +14,6 @@ export const mockT = (key: string, options?: { [key: string]: any }) => { } // eslint-disable-next-line @typescript-eslint/no-explicit-any -export const useTranslationsStore = () => ({ t: mockT as any, changeLanguage: noop, i18n: {} as any }) +export const useTranslationStore = () => ({ t: mockT as any, changeLanguage: noop, i18n: {} as any }) // eslint-disable-next-line @typescript-eslint/no-explicit-any export const useThemeStore = () => ({ theme: 'dark-std-std' as any, setTheme: noop }) diff --git a/apps/gitness/src/pages-v2/profile-settings/settings-layout.tsx b/apps/gitness/src/pages-v2/profile-settings/profile-settings-layout.tsx similarity index 80% rename from apps/gitness/src/pages-v2/profile-settings/settings-layout.tsx rename to apps/gitness/src/pages-v2/profile-settings/profile-settings-layout.tsx index f3d919330..c4fd99e08 100644 --- a/apps/gitness/src/pages-v2/profile-settings/settings-layout.tsx +++ b/apps/gitness/src/pages-v2/profile-settings/profile-settings-layout.tsx @@ -4,13 +4,13 @@ import { ProfileSettingsTabNav } from '@harnessio/ui/views' import { useTranslationStore } from '../../i18n/stores/i18n-store' -export const SettingsLayout = () => { +export const ProfileSettingsLayout = () => { const location = useLocation() const activeTab = location.pathname.split('/').pop() || 'general' return ( <> -
+
diff --git a/apps/gitness/src/pages-v2/project/project-general-settings-container.tsx b/apps/gitness/src/pages-v2/project/project-general-settings-container.tsx index 798904ea0..2d893510c 100644 --- a/apps/gitness/src/pages-v2/project/project-general-settings-container.tsx +++ b/apps/gitness/src/pages-v2/project/project-general-settings-container.tsx @@ -9,7 +9,7 @@ import { useUpdateSpaceMutation } from '@harnessio/code-service-client' import { DeleteAlertDialog } from '@harnessio/ui/components' -import { ProjectSettingsGeneralPage } from '@harnessio/ui/views' +import { ProjectSettingsGeneralFields, ProjectSettingsGeneralPage } from '@harnessio/ui/views' import { useAppContext } from '../../framework/context/AppContext' import { useGetSpaceURLParam } from '../../framework/hooks/useGetSpaceParam' @@ -48,20 +48,13 @@ export const ProjectGeneralSettingsPageContainer = () => { } ) - const handleFormSubmit = (formData: { description: string }) => { - updateDescription.mutate({ - space_ref: space?.path, - body: { - description: formData?.description - } - }) + const handleFormSubmit = (body: ProjectSettingsGeneralFields) => { + updateDescription.mutate({ space_ref: space?.path, body }) } // delete API call here const deleteSpaceMutation = useDeleteSpaceMutation( - { - space_ref: space?.path - }, + { space_ref: space?.path }, { onSuccess: ({ body: data }) => { if (data) { @@ -71,10 +64,7 @@ export const ProjectGeneralSettingsPageContainer = () => { }, onError: (error: DeleteSpaceErrorResponse) => { const deleteErrorMsg = error?.message || 'An unknown error occurred.' - setDeleteError({ - type: '', - message: deleteErrorMsg - }) + setDeleteError({ type: '', message: deleteErrorMsg }) } } ) @@ -100,6 +90,7 @@ export const ProjectGeneralSettingsPageContainer = () => { isUpdateSuccess={updateDescription.isSuccess} updateError={updateError} setOpenDeleteDialog={() => setOpenDeleteDialog(true)} + useTranslationStore={useTranslationStore} /> { + return ( + <> +
+ +
+ + + ) +} diff --git a/apps/gitness/src/pages-v2/project/settings-layout.tsx b/apps/gitness/src/pages-v2/project/settings-layout.tsx deleted file mode 100644 index 55327b8f3..000000000 --- a/apps/gitness/src/pages-v2/project/settings-layout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Outlet } from 'react-router-dom' - -import { ProjectSettingsPage } from '@harnessio/ui/views' - -export const SettingsLayout = () => { - return ( - <> -
- -
- - - ) -} diff --git a/apps/gitness/src/routes.tsx b/apps/gitness/src/routes.tsx index 37eb2d7bc..4b64a85e0 100644 --- a/apps/gitness/src/routes.tsx +++ b/apps/gitness/src/routes.tsx @@ -16,12 +16,12 @@ import PipelineEditPage from './pages-v2/pipeline/pipeline-edit/pipeline-edit' import ProjectPipelineListPage from './pages-v2/pipeline/project-pipeline-list-page' import { SettingsProfileGeneralPage } from './pages-v2/profile-settings/profile-settings-general-container' import { SettingsProfileKeysPage } from './pages-v2/profile-settings/profile-settings-keys-container' +import { ProfileSettingsLayout } from './pages-v2/profile-settings/profile-settings-layout' import { ProfileSettingsThemePage } from './pages-v2/profile-settings/profile-settings-theme-page' -import { SettingsLayout as ProfileSettingsLayout } from './pages-v2/profile-settings/settings-layout' import { ProjectGeneralSettingsPageContainer } from './pages-v2/project/project-general-settings-container' import { ProjectLabelsList } from './pages-v2/project/project-labels-list-container' import { ProjectMemberListPage } from './pages-v2/project/project-member-list' -import { SettingsLayout as ProjectSettingsLayout } from './pages-v2/project/settings-layout' +import { ProjectSettingsLayout } from './pages-v2/project/project-settings-layout' import PullRequestChanges from './pages-v2/pull-request/pull-request-changes' import { PullRequestCommitPage } from './pages-v2/pull-request/pull-request-commits' import { CreatePullRequest } from './pages-v2/pull-request/pull-request-compare' diff --git a/package.json b/package.json index 065efc893..67c0eb304 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "eslint-plugin-react": "^7.37.2", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-tailwindcss": "^3.17.5", + "eslint-plugin-unused-imports": "3.2.0", "husky": "^9.1.4", "lint-staged": "^15.2.9", "prettier": "^3.3.3", diff --git a/packages/canary/src/components/button.tsx b/packages/canary/src/components/button.tsx index 37ff0bfa5..b3e4f8660 100644 --- a/packages/canary/src/components/button.tsx +++ b/packages/canary/src/components/button.tsx @@ -6,15 +6,15 @@ import { Slot } from '@radix-ui/react-slot' import { cva, type VariantProps } from 'class-variance-authority' const buttonVariants = cva( - 'inline-flex items-center justify-center whitespace-nowrap rounded-[4px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', + 'focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-[4px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50', { variants: { variant: { - default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90', - destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90', - outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground', - secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80', - tertiary: 'bg-tertiary text-secondary-foreground shadow-sm hover:bg-tertiary/80', + default: 'bg-primary text-primary-foreground hover:bg-primary/90 shadow', + destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm', + outline: 'border-input bg-background hover:bg-accent hover:text-accent-foreground border shadow-sm', + secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-sm', + tertiary: 'bg-tertiary text-secondary-foreground hover:bg-tertiary/80 shadow-sm', ghost: 'hover:bg-accent hover:text-accent-foreground', link: 'text-primary underline-offset-4 hover:underline', split: 'flex items-center gap-1.5 border p-0', @@ -35,9 +35,9 @@ const buttonVariants = cva( }, theme: { default: '', - error: 'border-[hsla(var(--error),0.3)] bg-[hsla(var(--error),0.1)] text-error', - warning: 'border-[hsla(var(--warning),0.3)] bg-[hsla(var(--warning),0.1)] text-warning', - success: 'border-[hsla(var(--success),0.3)] bg-[hsla(var(--success),0.1)] text-success', + error: 'text-error border-[hsla(var(--error),0.3)] bg-[hsla(var(--error),0.1)]', + warning: 'text-warning border-[hsla(var(--warning),0.3)] bg-[hsla(var(--warning),0.1)]', + success: 'text-success border-[hsla(var(--success),0.3)] bg-[hsla(var(--success),0.1)]', muted: 'border-tertiary-background/20 bg-tertiary-background/10 text-tertiary-background', primary: 'border-primary-foreground/20 bg-primary text-primary-foreground' }, diff --git a/packages/ui/locales/en/views.json b/packages/ui/locales/en/views.json index 1d7d3babb..3c7986b37 100644 --- a/packages/ui/locales/en/views.json +++ b/packages/ui/locales/en/views.json @@ -352,7 +352,27 @@ }, "removeMember": "Remove member", "inviteNewMember": "Invite new member", - "members": "Members" + "members": "Members", + "tabs": { + "general": "General", + "members": "Members", + "labels": "Labels" + }, + "general": { + "deleteProjectTitle": "Delete project", + "deleteProjectDescription": "This will permanently delete this project, and everything contained in it. All repositories in it will also be deleted.", + "deleteProjectButton": "Delete project", + "mainTitle": "General settings", + "projectNameLabel": "Project name", + "projectNamePlaceholder": "Enter project name", + "projectDescriptionLabel": "Description", + "projectDescriptionPlaceholder": "Enter description", + "formSubmitButton": { + "savingState": "Saving...", + "defaultState": "Save changes", + "savedState": "Saved" + } + } }, "roles": { "owner": "Owner", @@ -403,4 +423,4 @@ "labelData": { "create": "Create labels" } -} +} \ No newline at end of file diff --git a/packages/ui/locales/es/views.json b/packages/ui/locales/es/views.json index 480f65110..2c9cb0ac0 100644 --- a/packages/ui/locales/es/views.json +++ b/packages/ui/locales/es/views.json @@ -342,7 +342,12 @@ }, "removeMember": "Remove member", "inviteNewMember": "Invite new member", - "members": "" + "members": "", + "tabs": { + "general": "General", + "members": "Members", + "labels": "Labels" + } }, "roles": { "owner": "Owner", diff --git a/packages/ui/locales/fr/views.json b/packages/ui/locales/fr/views.json index 393535ecc..5299207ab 100644 --- a/packages/ui/locales/fr/views.json +++ b/packages/ui/locales/fr/views.json @@ -348,7 +348,12 @@ }, "removeMember": "Remove member", "inviteNewMember": "Invite new member", - "members": "" + "members": "", + "tabs": { + "general": "General", + "members": "Members", + "labels": "Labels" + } }, "roles": { "owner": "Owner", diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx index 43cb9f19d..7b69e6069 100644 --- a/packages/ui/src/components/button.tsx +++ b/packages/ui/src/components/button.tsx @@ -15,9 +15,9 @@ const buttonVariants = cva( destructive: 'bg-button-background-danger-1 text-button-foreground-danger-1 hover:bg-button-background-danger-3', outline: - 'border border-borders-2 bg-transparent text-foreground-2 hover:border-borders-6 hover:text-foreground-8', - secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80', - tertiary: 'bg-tertiary text-secondary-foreground shadow-sm hover:bg-tertiary/80', + 'border-borders-2 text-foreground-2 hover:border-borders-6 hover:text-foreground-8 border bg-transparent', + secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-sm', + tertiary: 'bg-tertiary text-secondary-foreground hover:bg-tertiary/80 shadow-sm', ghost: 'hover:bg-background-12 hover:text-accent-foreground', link: 'text-primary underline-offset-4 hover:underline', link_accent: 'text-foreground-accent underline-offset-4 hover:underline', @@ -34,7 +34,7 @@ const buttonVariants = cva( icon: 'size-8', sm_icon: 'size-7', xs_split: 'h-auto p-0 text-xs font-medium', - md_split: 'h-8 text-14 font-medium', + md_split: 'text-14 h-8 font-medium', lg_split: 'h-10 p-0 font-medium' }, borderRadius: { diff --git a/packages/ui/src/components/form-primitives/fieldset.tsx b/packages/ui/src/components/form-primitives/fieldset.tsx index dd396a3c3..b7d9984a8 100644 --- a/packages/ui/src/components/form-primitives/fieldset.tsx +++ b/packages/ui/src/components/form-primitives/fieldset.tsx @@ -18,7 +18,7 @@ export function Fieldset({ children, box, shaded, className, ...props }: Fieldse return (
{ return ( - {children} {optional && (optional)} + {children} {optional && (optional)} ) } diff --git a/packages/ui/src/components/form-primitives/legend.tsx b/packages/ui/src/components/form-primitives/legend.tsx index 0c183d117..17a47eae7 100644 --- a/packages/ui/src/components/form-primitives/legend.tsx +++ b/packages/ui/src/components/form-primitives/legend.tsx @@ -1,6 +1,6 @@ -import { ReactNode } from 'react' +import { PropsWithChildren, ReactNode } from 'react' -import { Text } from '@components/text' +import { cn } from '@utils/cn' interface LegendProps { title: ReactNode @@ -16,18 +16,19 @@ interface LegendProps { * title="Personal Information" * description="Please fill in your details below" * /> + * + * + * + * */ -export function Legend({ title, description, className }: LegendProps) { +export function Legend({ title, description, className, children }: PropsWithChildren) { return ( -
- - {title} - - {description && ( - - {description} - - )} -
+
+
{title}
+ + {description &&

{description}

} + + {children} +
) } diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx index cea8cf862..9a7ea37ec 100644 --- a/packages/ui/src/components/input.tsx +++ b/packages/ui/src/components/input.tsx @@ -9,12 +9,12 @@ export interface BaseInputProps VariantProps {} const inputVariants = cva( - 'bg-transparent px-2.5 py-1 text-foreground-1 disabled:cursor-not-allowed disabled:text-foreground-4', + 'text-foreground-1 disabled:text-foreground-4 bg-transparent px-2.5 py-1 disabled:cursor-not-allowed', { variants: { variant: { default: - 'flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-4 focus-visible:rounded focus-visible:outline-none', + 'placeholder:text-foreground-4 flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:rounded focus-visible:outline-none', extended: 'grow border-none focus-visible:outline-none' }, size: { @@ -125,7 +125,7 @@ const Input = forwardRef( return inputIconName ? ( - + {baseInputComp} ) : ( @@ -137,7 +137,7 @@ const Input = forwardRef( return ( {label && ( -