diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..dfe276a9a5 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,108 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +const { classNameRules } = require('./eslint/rules.js') + +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + node: true + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true + }, + ecmaVersion: 'latest', + sourceType: 'module' + }, + extends: [ + 'eslint:recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:@typescript-eslint/recommended', + 'plugin:i18next/recommended', + + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + 'plugin:jsx-a11y/recommended', + 'plugin:tailwindcss/recommended', + + 'prettier' + ], + plugins: ['@typescript-eslint', 'tailwindcss', 'react', 'react-hooks', 'import', 'prettier', 'i18next'], + settings: { + react: { + version: 'detect' + }, + 'import/resolver': { + typescript: true, + node: true + } + }, + rules: { + 'tailwindcss/no-contradicting-classname': 'error', + 'import/no-unresolved': 'off', + 'react/prop-types': 'off', + 'react/react-in-jsx-scope': 'off', + + /** + * Soon it will be converted to "error" + * once all the old variants are removed + */ + 'no-restricted-syntax': ['warn', ...classNameRules], + + 'jsx-a11y/click-events-have-key-events': 'warn', + 'jsx-a11y/no-autofocus': 'off', + 'i18next/no-literal-string': [ + 'warn', + { + mode: 'jsx-only', + 'jsx-attributes': { + exclude: ['className', 'data-testid', 'id', 'type', 'size', 'name', 'variant', 'style', 'href', 'target'] + } + } + ], + + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_' + } + ], + + '@typescript-eslint/no-explicit-any': 'warn', + + 'tailwindcss/no-custom-classname': 'off' + }, + ignorePatterns: ['**/dist/**'], + overrides: [ + { + files: [ + 'packages/ui/**/*.{ts,tsx}', + 'packages/filters/**/*.{ts,tsx}', + 'packages/forms/**/*.{ts,tsx}', + 'packages/pipeline-graph/**/*.{ts,tsx}', + 'packages/core-design-system/**/*.{ts,tsx}', + 'packages/yaml-editor/**/*.{ts,tsx}' + ], + rules: { + 'no-restricted-imports': 'off', + '@typescript-eslint/no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'react-router-dom', + message: 'Please use only type imports from react-router-dom.', + allowTypeImports: true + } + ] + } + ] + } + } + ] +} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 3d8505358a..0000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "root": true, - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": "latest", - "sourceType": "module" - }, - "extends": [ - "eslint:recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:@typescript-eslint/recommended", - "plugin:i18next/recommended", - - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:jsx-a11y/recommended", - "plugin:tailwindcss/recommended", - - "prettier" - ], - "plugins": ["@typescript-eslint", "tailwindcss", "react", "react-hooks", "import", "prettier", "i18next"], - "settings": { - "react": { - "version": "detect" - }, - "import/resolver": { - "typescript": true, - "node": true - } - }, - "rules": { - "tailwindcss/no-contradicting-classname": "error", - "import/no-unresolved": "off", - "react/prop-types": "off", - "react/react-in-jsx-scope": "off", - - "jsx-a11y/click-events-have-key-events": "warn", - "jsx-a11y/no-autofocus": "off", - "i18next/no-literal-string": [ - "warn", - { - "mode": "jsx-only", - "jsx-attributes": { - "exclude": ["className", "data-testid", "id", "type", "size", "name", "variant", "style", "href", "target"] - } - } - ], - - "@typescript-eslint/no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" - } - ], - - "@typescript-eslint/no-explicit-any": "warn", - - "tailwindcss/no-custom-classname": "off" - }, - "ignorePatterns": ["**/dist/**"] -} diff --git a/.github/workflows/build-and-deploy-storybook.yml b/.github/workflows/build-and-deploy-storybook.yml index 32021094f3..f4a4778e2d 100644 --- a/.github/workflows/build-and-deploy-storybook.yml +++ b/.github/workflows/build-and-deploy-storybook.yml @@ -1,6 +1,5 @@ name: PR Checks on: - push: pull_request_target: types: - opened @@ -10,6 +9,21 @@ on: - main jobs: + CheckCleanGitTree: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: pnpm/action-setup@v4 + - run: pnpm deps + - run: pnpm build + - name: Check for uncommitted changes + run: | + # Show only the names of changed files + echo "Changed files:" + git diff --name-only HEAD --exit-code || (echo "Error: There are uncommitted changes in the working tree. Please commit or revert these changes." && exit 1) + Lint: runs-on: ubuntu-22.04 steps: @@ -52,3 +66,14 @@ jobs: - run: pnpm deps - run: pnpm build - run: pnpm test + + Build_Microfrontend: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: pnpm/action-setup@v4 + - run: pnpm install + - run: pnpm build + - run: pnpm -r -F ./apps/gitness build:webpack diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..cb3fb81c34 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish Packages to npm + +on: workflow_dispatch + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Install and build dependencies + run: | + pnpm install + pnpm build + + - name: Authenticate to npm + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ~/.npmrc + + - name: Publish packages to npm + run: pnpm publish:all diff --git a/.vscode/settings.json b/.vscode/settings.json index 043bb10e90..5c4bf9eaec 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,8 @@ "[ignore]": { "editor.defaultFormatter": "foxundermoon.shell-format" }, - "prettier.trailingComma": "none" + "prettier.trailingComma": "none", + "workbench.editorAssociations": { + "*.svg": "default" + } } diff --git a/CODEOWNERS b/CODEOWNERS index 78ea4cb7cc..0b5b8dad5c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,4 +1,23 @@ -packages/canary @knagurski -packages/views @knagurski -packages/ui @knagurski -apps/design-system @knagurski +# Global configs +.github/ abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io +.eslintrc.js abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io +.prettierrc.yml abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io + +# Common ownership for shared config files +/packages/*/package.json abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io +/apps/*/package.json abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io +/packages/*/vite.config.ts abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io +/apps/*/vite.config.ts abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io + +# Apps +/apps/gitness/* abhinav.rastogi@harness.io vardan.bansal@harness.io +/apps/portal/* kevin.nagurski@harness.io pranesh.g@harness.io abhinav.rastogi@harness.io vardan.bansal@harness.io + +# Packages with shared ownership +/packages/ui/* abhinav.rastogi@harness.io kevin.nagurski@harness.io vardan.bansal@harness.io pranesh.g@harness.io + +# Packages with individual owners +/packages/forms/* srdjan.arsic@harness.io +/packages/unified-pipeline/* srdjan.arsic@harness.io +/packages/yaml-editor/* srdjan.arsic@harness.io +/packages/core-design-system/* pranesh.g@harness.io diff --git a/Dockerfile b/Dockerfile index dc99156a66..52f4c46e2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-slim AS base +FROM us-west1-docker.pkg.dev/gar-setup/docker/node:20-slim AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" # install pnpm @@ -16,7 +16,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile # build all the packages and apps except portal and design-system RUN pnpm --filter \!portal --filter \!design-system run build -FROM alpine:3.21 AS final +FROM us-west1-docker.pkg.dev/gar-setup/docker/alpine:3.21 AS final COPY --from=build /canary/apps/gitness/dist /canary-dist WORKDIR /canary-dist diff --git a/Dockerfile.mfe b/Dockerfile.mfe index 51dd87124d..719f556315 100644 --- a/Dockerfile.mfe +++ b/Dockerfile.mfe @@ -1,4 +1,4 @@ -FROM node:20-slim AS base +FROM us-west1-docker.pkg.dev/gar-setup/docker/node:20-slim AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" # install pnpm @@ -20,7 +20,7 @@ WORKDIR /canary/apps/gitness RUN rm -rf dist RUN pnpm run build:webpack -FROM alpine:3.21 AS final +FROM us-west1-docker.pkg.dev/gar-setup/docker/alpine:3.21 AS final COPY --from=build /canary/apps/gitness/dist /canary-dist WORKDIR /canary-dist diff --git a/README.md b/README.md index 1547eb0e5f..3c20c93992 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Welcome to the Harness Canary monorepo! This repository contains multiple projec # Projects - [@harnessio/canary](./packages/canary/) - Harness Canary UI components library built on top of [Radix UI](https://www.radix-ui.com/) and [ShadCN UI](https://ui.shadcn.com/). -- [@harnessio/views](./packages/views/) - Harness Unified UI View Fragments. # Getting Started diff --git a/apps/design-system/package.json b/apps/design-system/package.json index 63f51f9041..0852eac9b2 100644 --- a/apps/design-system/package.json +++ b/apps/design-system/package.json @@ -13,9 +13,11 @@ "typecheck": "tsc -b" }, "dependencies": { + "@harnessio/forms": "workspace:*", "@harnessio/pipeline-graph": "workspace:*", "@harnessio/ui": "workspace:*", "@harnessio/yaml-editor": "workspace:*", + "@tanstack/react-table": "^8.21.3", "@types/lodash-es": "^4.17.12", "clsx": "^2.1.1", "lodash-es": "^4.17.21", diff --git a/apps/design-system/src/App.tsx b/apps/design-system/src/App.tsx index 11f42159a1..153a42f0ff 100644 --- a/apps/design-system/src/App.tsx +++ b/apps/design-system/src/App.tsx @@ -1,26 +1,21 @@ import { FC } from 'react' -import { - createBrowserRouter, - Link, - Navigate, - NavLink, - Outlet, - RouterProvider, - useMatches, - useSearchParams -} from 'react-router-dom' +import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom' -import ComponentPage from '@/pages/component-page' import ViewPreview from '@/pages/view-preview/view-preview' -import DocsLayout from '@components/docs-layout/docs-layout' import { useThemeStore } from '@utils/theme-utils' -import { RouterContextProvider, ThemeProvider } from '@harnessio/ui/context' +import { ThemeProvider, TranslationProvider } from '@harnessio/ui/context' + +import AppRouterProvider from './AppRouterProvider' const router = createBrowserRouter([ - { path: '/view-preview/*', element: }, - { path: '/docs/*', element: , children: [{ path: 'components/*', element: }] }, - { path: '/*', element: } + { + element: , + children: [ + { path: '/view-preview/*', element: }, + { path: '/*', element: } + ] + } ]) const App: FC = () => { @@ -28,17 +23,9 @@ const App: FC = () => { return ( - + - + ) } diff --git a/apps/design-system/src/AppRouterProvider.tsx b/apps/design-system/src/AppRouterProvider.tsx new file mode 100644 index 0000000000..378d850bc6 --- /dev/null +++ b/apps/design-system/src/AppRouterProvider.tsx @@ -0,0 +1,35 @@ +import { FC } from 'react' +import { + Link, + NavLink, + Outlet, + useLocation, + useMatches, + useNavigate, + useParams, + useSearchParams +} from 'react-router-dom' + +import { RouterContextProvider } from '@harnessio/ui/context' + +const AppRouterProvider: FC = () => { + const navigate = useNavigate() + const location = useLocation() + + return ( + + + + ) +} + +export default AppRouterProvider diff --git a/apps/design-system/src/components/docs-layout/docs-layout.module.css b/apps/design-system/src/components/docs-layout/docs-layout.module.css deleted file mode 100644 index 5e38d481ba..0000000000 --- a/apps/design-system/src/components/docs-layout/docs-layout.module.css +++ /dev/null @@ -1,10 +0,0 @@ -.layout { - display: grid; - grid-template-columns: auto 1fr; -} - -.navbar { - position: sticky; - top: 0; - left: 0; -} diff --git a/apps/design-system/src/components/docs-layout/docs-layout.tsx b/apps/design-system/src/components/docs-layout/docs-layout.tsx deleted file mode 100644 index 720b32955d..0000000000 --- a/apps/design-system/src/components/docs-layout/docs-layout.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { FC, useEffect } from 'react' -import { Outlet } from 'react-router-dom' - -import '@harnessio/ui/styles.css' - -import DocsNavbar from '@components/docs-navbar/docs-navbar' - -import css from './docs-layout.module.css' - -const DocsLayout: FC = () => { - // TODO: expose this via a UI element to switch between light-std-std and dark-std-std - useEffect(() => document.body.classList.add('light-std-std'), []) - - return ( -
- - -
- ) -} - -export default DocsLayout diff --git a/apps/design-system/src/components/docs-navbar/docs-navbar.module.css b/apps/design-system/src/components/docs-navbar/docs-navbar.module.css deleted file mode 100644 index bc49ede767..0000000000 --- a/apps/design-system/src/components/docs-navbar/docs-navbar.module.css +++ /dev/null @@ -1,9 +0,0 @@ -.content { - overflow: hidden; -} - -.viewLink { - display: flex; - align-items: baseline; - gap: 0.5rem; -} diff --git a/apps/design-system/src/components/docs-navbar/docs-navbar.tsx b/apps/design-system/src/components/docs-navbar/docs-navbar.tsx deleted file mode 100644 index e12eb24310..0000000000 --- a/apps/design-system/src/components/docs-navbar/docs-navbar.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { FC } from 'react' -import { Link, useLocation } from 'react-router-dom' - -import { viewPreviews } from '@/pages/view-preview/view-preview' -import { componentPages } from '@subjects/components/componentPages' - -import { Icon, NavbarSkeleton, ScrollArea } from '@harnessio/ui/components' - -import css from './docs-navbar.module.css' - -export interface DocsNavbarProps { - className?: string -} - -const DocsNavbar: FC = ({ className }) => { - const location = useLocation() - - return ( - - - - - - - - - - - - {componentPages.map(({ name, path }) => ( - - - - ))} - - - {Object.entries(viewPreviews).map(([groupKey, group]) => ( - - {Object.entries(group.items).map(([path, { label }]) => ( - - - - ))} - - ))} - - - - - - - - - - ) -} - -export default DocsNavbar diff --git a/apps/design-system/src/components/docs-page/code-block.tsx b/apps/design-system/src/components/docs-page/code-block.tsx deleted file mode 100644 index 29e67d0522..0000000000 --- a/apps/design-system/src/components/docs-page/code-block.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { FC } from 'react' - -import { MarkdownViewer } from '@harnessio/ui/components' - -export interface CodeBlockProps { - code: string - language?: string -} - -const CodeBlock: FC = ({ code, language = 'typescript tsx' }) => ( - -) - -export default CodeBlock diff --git a/apps/design-system/src/components/docs-page/component-example.tsx b/apps/design-system/src/components/docs-page/component-example.tsx deleted file mode 100644 index 0836579c3c..0000000000 --- a/apps/design-system/src/components/docs-page/component-example.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { FC, useMemo } from 'react' - -import Example, { ExampleProps } from '@components/docs-page/example' - -import * as components from '@harnessio/ui/components' - -export type ComponentExampleProps = Omit & { - scope?: ExampleProps['scope'] -} - -const ComponentExample: FC = ({ code, scope }) => { - const combinedScope = useMemo(() => ({ ...components, ...scope }), [scope]) - - return -} - -export default ComponentExample diff --git a/apps/design-system/src/components/docs-page/docs-page.tsx b/apps/design-system/src/components/docs-page/docs-page.tsx deleted file mode 100644 index 5f3bdaf0b6..0000000000 --- a/apps/design-system/src/components/docs-page/docs-page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import CodeBlock from './code-block.tsx' -import ComponentExample from './component-example' -import Example from './example' -import PropsTable from './props-table.tsx' -import Root from './root' -import Section from './section' -import SubSection from './sub-section.tsx' -import Summary from './summary' - -export const DocsPage = { - Root, - Summary, - Section, - SubSection, - Example, - ComponentExample, - CodeBlock, - PropsTable -} diff --git a/apps/design-system/src/components/docs-page/example-layout.module.css b/apps/design-system/src/components/docs-page/example-layout.module.css deleted file mode 100644 index a98ab7e96f..0000000000 --- a/apps/design-system/src/components/docs-page/example-layout.module.css +++ /dev/null @@ -1,7 +0,0 @@ -.layout { - display: flex; - flex-direction: column; - gap: 0.5rem; - justify-content: center; - align-items: center; -} diff --git a/apps/design-system/src/components/docs-page/example-layout.tsx b/apps/design-system/src/components/docs-page/example-layout.tsx deleted file mode 100644 index c4006b80f8..0000000000 --- a/apps/design-system/src/components/docs-page/example-layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FC, PropsWithChildren } from 'react' - -import css from './example-layout.module.css' - -const ExampleLayout: FC>> = ({ children }) => ( -
{children}
-) - -export default ExampleLayout diff --git a/apps/design-system/src/components/docs-page/example.module.css b/apps/design-system/src/components/docs-page/example.module.css deleted file mode 100644 index a2f3e54462..0000000000 --- a/apps/design-system/src/components/docs-page/example.module.css +++ /dev/null @@ -1,48 +0,0 @@ -.root { - border: 1px solid var(--preview-border, #eaeaea); - border-radius: 6px; - margin-top: 20px; - margin-bottom: 20px; - overflow: hidden; -} - -.preview { - padding: 24px; -} - -.editor { - background: var(--preview-background, #f7f7f7); - border-top: 1px solid var(--preview-border, #eaeaea); - list-style-type: none; - - summary { - padding: 6px 24px; - color: var(--preview-text, #666); - cursor: pointer; - user-select: none; - list-style-type: none; - line-height: 24px; - display: flex; - align-items: center; - } - - summary:before { - content: ''; - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiM2NjYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS11bmZvbGQtdmVydGljYWwiPjxwYXRoIGQ9Ik0xMiAyMnYtNiIvPjxwYXRoIGQ9Ik0xMiA4VjIiLz48cGF0aCBkPSJNNCAxMkgyIi8+PHBhdGggZD0iTTEwIDEySDgiLz48cGF0aCBkPSJNMTYgMTJoLTIiLz48cGF0aCBkPSJNMjIgMTJoLTIiLz48cGF0aCBkPSJtMTUgMTktMyAzLTMtMyIvPjxwYXRoIGQ9Im0xNSA1LTMtMy0zIDMiLz48L3N2Zz4=); - width: 16px; - height: 16px; - display: inline-flex; - margin-right: 6px; - } - - &[open] summary:before { - background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiM2NjYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkLXZlcnRpY2FsIj48cGF0aCBkPSJNMTIgMjJ2LTYiLz48cGF0aCBkPSJNMTIgOFYyIi8+PHBhdGggZD0iTTQgMTJIMiIvPjxwYXRoIGQ9Ik0xMCAxMkg4Ii8+PHBhdGggZD0iTTE2IDEyaC0yIi8+PHBhdGggZD0iTTIyIDEyaC0yIi8+PHBhdGggZD0ibTE1IDE5LTMtMy0zIDMiLz48cGF0aCBkPSJtMTUgNS0zIDMtMy0zIi8+PC9zdmc+); - } -} - -body[theme='dark'] { - --preview-border: #2f2e30; - --preview-background: #202023; - --preview-text: #a1a1aa; - --preview-text: #666666; -} diff --git a/apps/design-system/src/components/docs-page/example.tsx b/apps/design-system/src/components/docs-page/example.tsx deleted file mode 100644 index 427e13229a..0000000000 --- a/apps/design-system/src/components/docs-page/example.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import { ComponentProps, FC, useMemo } from 'react' -import { LiveEditor, LiveError, LivePreview, LiveProvider } from 'react-live' - -import ExampleLayout from '@components/docs-page/example-layout' - -import css from './example.module.css' - -type LiveProviderProps = ComponentProps - -export type ExampleProps = Pick - -const Example: FC = ({ code, scope }) => { - const scopeWithLayout = useMemo(() => ({ ...scope, ExampleLayout }), [scope]) - - return ( -
- ${code}`} scope={scopeWithLayout} theme={theme}> -
- - -
-
- Code Editor - -
-
-
- ) -} - -export default Example - -const theme: LiveProviderProps['theme'] = { - plain: { - backgroundColor: '#fff', - color: '#1f2937', // ? - fontWeight: '400', - fontStyle: 'normal', - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - fontFamily: 'Roboto Mono, JetBrains Mono, monospace', - fontSize: '13px', - textRendering: 'geometricPrecision' - }, - styles: [ - { - types: ['comment', 'prolog', 'doctype', 'cdata', 'punctuation'], - style: { - color: '#374151' - } - }, - { - types: ['namespace'], - style: { - opacity: 1 - } - }, - { - types: ['tag', 'operator', 'number'], - style: { - color: '#1d4ed8', - fontWeight: '500' - } - }, - { - types: ['property', 'function'], - style: { - color: '#a21caf' - } - }, - { - types: ['tag-id', 'selector', 'atrule-id'], - style: { - color: '#eeebff' - } - }, - { - types: ['attr-name'], - style: { - color: '#a21caf' - } - }, - { - types: [ - 'boolean', - 'string', - 'entity', - 'url', - 'attr-value', - 'keyword', - 'control', - 'directive', - 'unit', - 'statement', - 'regex', - 'at-rule', - 'placeholder', - 'variable' - ], - style: { - color: '#06b6d4' - } - }, - { - types: ['deleted'], - style: { - textDecorationLine: 'line-through' - } - }, - { - types: ['language-javascript', 'script'], - style: { - color: '#1d4ed8' - } - }, - { - types: ['inserted'], - style: { - textDecorationLine: 'underline' - } - }, - { - types: ['italic'], - style: { - fontStyle: 'italic' - } - }, - { - types: ['important', 'bold'], - style: { - fontWeight: 'bold' - } - }, - { - types: ['important'], - style: { - color: '#c4b9fe' - } - } - ] -} diff --git a/apps/design-system/src/components/docs-page/props-table.tsx b/apps/design-system/src/components/docs-page/props-table.tsx deleted file mode 100644 index 5c9239e624..0000000000 --- a/apps/design-system/src/components/docs-page/props-table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { FC } from 'react' - -import { Table } from '@harnessio/ui/components' - -interface PropDescription { - name: string - required?: boolean - defaultValue?: string - description?: string -} - -export interface PropsTableProps { - props: PropDescription[] -} - -const PropsTable: FC = ({ props }) => ( - - - - Prop - Required - Default - - - - {props.map(({ name, required, defaultValue, description }) => ( - - {name} - {required ? 'yup' : 'nope'} - {defaultValue} - - ))} - - -) - -export default PropsTable diff --git a/apps/design-system/src/components/docs-page/root.module.css b/apps/design-system/src/components/docs-page/root.module.css deleted file mode 100644 index f995e727b3..0000000000 --- a/apps/design-system/src/components/docs-page/root.module.css +++ /dev/null @@ -1,13 +0,0 @@ -.root { - padding: 4rem; - display: flex; - justify-content: center; -} - -.content { - width: 100%; - max-width: 960px; - display: flex; - flex-direction: column; - gap: 2rem; -} diff --git a/apps/design-system/src/components/docs-page/root.tsx b/apps/design-system/src/components/docs-page/root.tsx deleted file mode 100644 index 5a669ea3aa..0000000000 --- a/apps/design-system/src/components/docs-page/root.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { FC, PropsWithChildren } from 'react' - -import css from './root.module.css' - -const Root: FC>> = ({ children }) => ( -
-
{children}
-
-) - -export default Root diff --git a/apps/design-system/src/components/docs-page/section.module.css b/apps/design-system/src/components/docs-page/section.module.css deleted file mode 100644 index ae4721f4d7..0000000000 --- a/apps/design-system/src/components/docs-page/section.module.css +++ /dev/null @@ -1,5 +0,0 @@ -.section { - display: flex; - flex-direction: column; - gap: 1rem; -} diff --git a/apps/design-system/src/components/docs-page/section.tsx b/apps/design-system/src/components/docs-page/section.tsx deleted file mode 100644 index 42297ec8fb..0000000000 --- a/apps/design-system/src/components/docs-page/section.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { FC, PropsWithChildren, ReactNode } from 'react' - -import { Text } from '@harnessio/ui/components' - -import css from './section.module.css' - -export interface SectionProps extends PropsWithChildren> { - title: string - description?: ReactNode -} - -const Section: FC = ({ title, description, children }) => ( -
- - {title} - - {description} - {children} -
-) - -export default Section diff --git a/apps/design-system/src/components/docs-page/sub-section.tsx b/apps/design-system/src/components/docs-page/sub-section.tsx deleted file mode 100644 index 34728c0f77..0000000000 --- a/apps/design-system/src/components/docs-page/sub-section.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { FC, PropsWithChildren, ReactNode } from 'react' - -import { Text } from '@harnessio/ui/components' - -import css from './section.module.css' - -export interface SubSectionProps extends PropsWithChildren> { - title: string - description?: ReactNode -} - -const SubSection: FC = ({ title, description, children }) => ( -
- - {title} - - {description} - {children} -
-) - -export default SubSection diff --git a/apps/design-system/src/components/docs-page/summary.tsx b/apps/design-system/src/components/docs-page/summary.tsx deleted file mode 100644 index 634051478e..0000000000 --- a/apps/design-system/src/components/docs-page/summary.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { FC, PropsWithChildren } from 'react' - -import { Text } from '@harnessio/ui/components' - -export interface SummaryProps extends PropsWithChildren> { - title: string -} - -const Summary: FC = ({ title, children }) => ( -
- - {title} - - {children} -
-) - -export default Summary diff --git a/apps/design-system/src/pages/component-page.tsx b/apps/design-system/src/pages/component-page.tsx deleted file mode 100644 index 2e84c00371..0000000000 --- a/apps/design-system/src/pages/component-page.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { FC } from 'react' -import { Route, Routes } from 'react-router-dom' - -import { componentPages } from '@subjects/components/componentPages' - -const ComponentPage: FC = () => ( - - {componentPages.map(props => ( - - ))} - -) - -export default ComponentPage diff --git a/apps/design-system/src/pages/view-preview/app-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/app-view-wrapper.tsx index 71d7111c46..0c80443429 100644 --- a/apps/design-system/src/pages/view-preview/app-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/app-view-wrapper.tsx @@ -1,21 +1,23 @@ import { FC, PropsWithChildren, ReactNode, useCallback, useState } from 'react' import { Outlet, Route, Routes } from 'react-router-dom' -import { useThemeStore } from '@utils/theme-utils' -import { noop, useTranslationStore } from '@utils/viewUtils' +import { noop } from '@utils/viewUtils' -import { AppSidebar, MoreSubmenu, NavbarItemType, SettingsMenu, Sidebar } from '@harnessio/ui/components' +import { NavbarItemType, Sidebar } from '@harnessio/ui/components' +import { MainContentLayout, SidebarView } from '@harnessio/ui/views' import { useRootViewWrapperStore } from './root-view-wrapper-store' export interface AppViewWrapperProps { asChild?: boolean breadcrumbs?: ReactNode + childrenWrapperClassName?: string } export const AppViewWrapper: FC> = ({ children, breadcrumbs, + childrenWrapperClassName, asChild = false }) => { const [showMoreMenu, setShowMoreMenu] = useState(false) @@ -23,7 +25,7 @@ export const AppViewWrapper: FC> = ({ const [pinnedMenu, setPinnedMenu] = useState([ { id: 0, - iconName: 'repositories-gradient', + iconName: 'repository', title: 'Repositories', description: 'Integrated & familiar git experience.', to: '/pixel/repos', @@ -31,7 +33,7 @@ export const AppViewWrapper: FC> = ({ }, { id: 1, - iconName: 'pipelines-gradient', + iconName: 'pipeline', title: 'Pipelines', description: 'Up to 4X faster than other solutions.', to: '/pipelines', @@ -39,14 +41,14 @@ export const AppViewWrapper: FC> = ({ }, { id: 3, - iconName: 'database-gradient', + iconName: 'database', title: 'Databases', description: 'Manage all your infrastructure.', to: '/databases' }, { id: 7, - iconName: 'dev-portal-gradient', + iconName: 'dev-portal', title: 'Developer Portal', description: 'Built for developers, onboard in minutes.', to: '/developer/portal' @@ -59,7 +61,7 @@ export const AppViewWrapper: FC> = ({ }, { id: 9, - iconName: 'dev-insights-gradient', + iconName: 'developer-insights', title: 'Developer Insights', description: 'Actionable insights on SDLC.', to: '/developer/insights' @@ -72,14 +74,14 @@ export const AppViewWrapper: FC> = ({ setPinnedMenu(current => (pin ? [...current, item] : current.filter(pinnedItem => pinnedItem !== item))) }, []) - const onToggleMoreMenu = useCallback(() => { + const onToggleMoreMenu = useCallback((state?: boolean) => { setShowSettingsMenu(false) - setShowMoreMenu(current => !current) + setShowMoreMenu(current => state ?? !current) }, []) - const onToggleSettingsMenu = useCallback(() => { + const onToggleSettingsMenu = useCallback((state?: boolean) => { setShowMoreMenu(false) - setShowSettingsMenu(current => !current) + setShowSettingsMenu(current => state ?? !current) }, []) return ( @@ -88,7 +90,7 @@ export const AppViewWrapper: FC> = ({ path="*" element={ - > = ({ pinnedMenuItems={pinnedMenu} handleChangePinnedMenuItem={setPinned} handleRemoveRecentMenuItem={noop} - useTranslationStore={useTranslationStore} - useThemeStore={useThemeStore} + changeLanguage={noop} + lang="en" + moreMenu={moreMenu} + settingsMenu={settingsMenu} /> -
- {breadcrumbs} + {breadcrumbs} + -
- - +
} 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 1d28c3e953..0221155fab 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, useTranslationStore } from '@utils/viewUtils' +import { noop } from '@utils/viewUtils' import { FileExplorer } from '@harnessio/ui/components' import { CommitDiff, CommitSidebar, ICommitDetailsStore } from '@harnessio/ui/views' @@ -13,16 +13,12 @@ export const CommitDetailsDiffViewWrapper: FC = () => { return ( <> - {}} - filesList={repoFilesStore.filesList} - > + {}} filesList={repoFilesStore.filesList}> {renderEntries(repoFilesStore.filesTreeData, '')} - + ) } diff --git a/apps/design-system/src/pages/view-preview/profile-settings-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/profile-settings-view-wrapper.tsx index c63b998dd0..da1e48355c 100644 --- a/apps/design-system/src/pages/view-preview/profile-settings-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/profile-settings-view-wrapper.tsx @@ -1,14 +1,12 @@ import { FC, HTMLAttributes, PropsWithChildren } from 'react' import { Route, Routes } from 'react-router-dom' -import { useTranslationStore } from '@utils/viewUtils' - import { ProfileSettingsLayout } from '@harnessio/ui/views' export const ProfileSettingsViewWrapper: FC>> = ({ children }) => { return ( - }> + }> 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 bb3560bfd3..5837549b5b 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,17 +1,15 @@ import { FC, HTMLAttributes, PropsWithChildren } from 'react' import { Route } from 'react-router-dom' -import { useTranslationStore } from '@utils/viewUtils' - -import { ProjectSettingsTabNav } from '@harnessio/ui/views' +import { ProjectSettingsTabNav, SubHeaderWrapper } 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 86a4c05ef8..e9c9484779 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,9 +2,9 @@ import { FC, PropsWithChildren, useCallback } from 'react' import { Route } from 'react-router-dom' import { pullRequestStore } from '@subjects/views/pull-request-conversation/pull-request-store' -import { useTranslationStore } from '@utils/viewUtils' +import { noop } from 'lodash-es' -import { PullRequestLayout } from '@harnessio/ui/views' +import { BranchSelectorV2, PullRequestLayout } from '@harnessio/ui/views' import RootViewWrapper from './root-view-wrapper' @@ -21,13 +21,29 @@ const PullRequestLayoutWrapper: FC { return Promise.resolve() }} + updateTargetBranch={() => { + return Promise.resolve() + }} + branchSelectorRenderer={() => ( + + )} /> } > diff --git a/apps/design-system/src/pages/view-preview/repo-files-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/repo-files-view-wrapper.tsx index ae5c94ca46..fca62c5bde 100644 --- a/apps/design-system/src/pages/view-preview/repo-files-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/repo-files-view-wrapper.tsx @@ -1,53 +1,39 @@ -import { FC, PropsWithChildren, useCallback } from 'react' +import { FC, HTMLAttributes, PropsWithChildren } from 'react' import { repoFilesStore } from '@subjects/views/repo-files/components/repo-files-store' import { renderEntries } from '@utils/fileViewUtils' -import { noop, useTranslationStore } from '@utils/viewUtils' +import { noop } from '@utils/viewUtils' import { FileExplorer } from '@harnessio/ui/components' -import { BranchSelectorTab, IBranchSelectorStore, RepoSidebar as RepoSidebarView } from '@harnessio/ui/views' - -export const RepoFilesViewWrapper: FC>> = ({ children }) => { - const useRepoBranchesStore = useCallback( - (): IBranchSelectorStore => ({ - ...repoFilesStore.branchSelectorStore, - selectedRefType: BranchSelectorTab.BRANCHES, - setSelectedBranchTag: noop, - setSelectedRefType: noop, - xNextPage: 0, - xPrevPage: 0, - page: 1, - setPage: noop, - defaultBranch: '', - branchList: [], - setTagList: noop, - setSpaceIdAndRepoId: noop, - setBranchList: noop, - setDefaultBranch: noop, - setPaginationFromHeaders: noop - }), - [] - ) +import { BranchSelectorV2, RepoSidebar as RepoSidebarView } from '@harnessio/ui/views' +export const RepoFilesViewWrapper: FC>> = ({ children }) => { return ( -
+
( + + )} > {renderEntries(repoFilesStore.filesTreeData, '')} - {/* 100vh = screen height - (55px Breadcrumbs Height + 45px SubHeader Height = 100px) */} - {/* Total height of both the divs should be 100vh */} -
{children}
+
{children}
) } diff --git a/apps/design-system/src/pages/view-preview/repo-settings-view-wrapper.tsx b/apps/design-system/src/pages/view-preview/repo-settings-view-wrapper.tsx index d661dc19d2..9166805e63 100644 --- a/apps/design-system/src/pages/view-preview/repo-settings-view-wrapper.tsx +++ b/apps/design-system/src/pages/view-preview/repo-settings-view-wrapper.tsx @@ -1,14 +1,12 @@ import { FC, PropsWithChildren } from 'react' import { Route, Routes } from 'react-router-dom' -import { useTranslationStore } from '@utils/viewUtils' - import { RepoSettingsLayout } from '@harnessio/ui/views' export const RepoSettingsViewWrapper: 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 687f9c1248..04ee38e619 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,22 +1,25 @@ import { FC, PropsWithChildren } from 'react' import { Route } from 'react-router-dom' -import { useTranslationStore } from '@utils/viewUtils' +import { noop } from '@tanstack/react-table' import { RepoSubheader } from '@harnessio/ui/components' +import { RepoHeader, SubHeaderWrapper } from '@harnessio/ui/views' import RootViewWrapper from './root-view-wrapper' -const RepoViewWrapper: FC>> = ({ children }) => ( - +const RepoViewWrapper: FC< + PropsWithChildren & { childrenWrapperClassName?: string }> +> = ({ children, childrenWrapperClassName }) => ( + - + + + + {children} } diff --git a/apps/design-system/src/pages/view-preview/root-view-wrapper-store.tsx b/apps/design-system/src/pages/view-preview/root-view-wrapper-store.tsx index 6b55f21a57..abc3eaebf1 100644 --- a/apps/design-system/src/pages/view-preview/root-view-wrapper-store.tsx +++ b/apps/design-system/src/pages/view-preview/root-view-wrapper-store.tsx @@ -1,7 +1,7 @@ import { MenuGroupType, MenuGroupTypes } from '@harnessio/ui/components' export const useRootViewWrapperStore = () => { - const moreMenu = [ + const moreMenu: MenuGroupType[] = [ { groupId: 0, title: 'Devops', @@ -9,49 +9,49 @@ export const useRootViewWrapperStore = () => { items: [ { id: 0, - iconName: 'repositories-gradient', + iconName: 'repository', title: 'Repositories', description: 'Integrated & familiar git experience.', to: '/iatopilskii/repos' }, { id: 1, - iconName: 'pipelines-gradient', + iconName: 'pipeline', title: 'Pipelines', description: 'Up to 4X faster than other solutions.', to: '/pipelines' }, { id: 2, - iconName: 'execution-gradient', + iconName: 'executions', title: 'Executions', description: 'Optimize feature rollout velocity.', to: '/:spaceId/repos/:repoId/pipelines/:pipelineId/executions' }, { id: 3, - iconName: 'database-gradient', + iconName: 'database', title: 'Databases', description: 'Manage all your infrastructure.', to: '/databases' }, { id: 4, - iconName: 'artifacts-gradient', + iconName: 'artifact', title: 'Artifacts', description: 'Validate service resilience.', to: '/artifacts' }, { id: 5, - iconName: 'infrastructure-gradient', + iconName: 'infrastructure', title: 'Infrastructure', description: 'Manage all your infrastructure.', to: '/infrastructure-as-code' }, { id: 6, - iconName: 'flag-gradient', + iconName: 'featured-flags', title: 'Feature Flags', description: 'Optimize feature rollout velocity.', to: '/feature-flags' @@ -65,21 +65,21 @@ export const useRootViewWrapperStore = () => { items: [ { id: 7, - iconName: 'dev-portal-gradient', + iconName: 'dev-portal', title: 'Developer Portal', description: 'Built for developers, onboard in minutes.', to: '/developer/portal' }, { id: 8, - iconName: 'dev-envs-gradient', + iconName: 'developer-environments', title: 'Developer Environments', description: 'Integrated & familiar git experience.', to: '/developer/environments' }, { id: 9, - iconName: 'dev-insights-gradient', + iconName: 'developer-insights', title: 'Developer Insights', description: 'Actionable insights on SDLC.', to: '/developer/insights' @@ -93,14 +93,14 @@ export const useRootViewWrapperStore = () => { items: [ { id: 10, - iconName: 'security-tests-gradient', + iconName: 'security-test', title: 'Security Tests', description: 'Shift left security testing.', to: '/security-tests' }, { id: 11, - iconName: 'supply-chain-gradient', + iconName: 'supply-chain', title: 'Supply Chain', description: 'Artifact integrity and governance.', to: '/supply-chain' @@ -114,7 +114,7 @@ export const useRootViewWrapperStore = () => { items: [ { id: 12, - iconName: 'cloud-costs-gradient', + iconName: 'cloud-costs', title: 'Cloud Costs', description: 'Intelligent cost management.', to: '/cloud-costs' @@ -128,14 +128,14 @@ export const useRootViewWrapperStore = () => { items: [ { id: 13, - iconName: 'incidents-gradient', + iconName: 'warning-triangle', title: 'Incidents', description: 'Shift left security testing.', to: '/incidents' }, { id: 14, - iconName: 'chaos-engineering-gradient', + iconName: 'chaos-engineering', title: 'Chaos Engineering', description: 'Validate service resilience.', to: '/chaos' @@ -149,16 +149,16 @@ export const useRootViewWrapperStore = () => { items: [ { id: 15, - iconName: 'dashboards-gradient', + iconName: 'dashboard', title: 'Dashboard', description: 'Intelligent cost management.', to: '/cloud-costs' } ] } - ] as MenuGroupType[] + ] - const settingsMenu = [ + const settingsMenu: MenuGroupType[] = [ { groupId: 6, title: 'General', @@ -166,13 +166,13 @@ export const useRootViewWrapperStore = () => { items: [ { id: 16, - iconName: 'settings-2', + iconName: 'settings', title: 'Settings', to: '/iatopilskii/settings/general' }, { id: 17, - iconName: 'notification', + iconName: 'bell', title: 'Notifications', to: '/notifications' } @@ -185,13 +185,13 @@ export const useRootViewWrapperStore = () => { items: [ { id: 18, - iconName: 'wrench', + iconName: 'services', title: 'Services', to: '/service-reliability' }, { id: 19, - iconName: 'environment', + iconName: 'environments', title: 'Environments', to: '/environments' }, @@ -203,7 +203,7 @@ export const useRootViewWrapperStore = () => { }, { id: 21, - iconName: 'hierarchy', + iconName: 'delegates', title: 'Delegeates', to: '/file-store' }, @@ -215,25 +215,25 @@ export const useRootViewWrapperStore = () => { }, { id: 23, - iconName: 'file-icon', + iconName: 'page', title: 'File Store', to: '/delegates' }, { id: 24, - iconName: 'sidebar-icon', + iconName: 'sidebar', title: 'Templates', to: '/templates' }, { id: 25, - iconName: 'variable', + iconName: 'variables', title: 'Variables', to: '/variables' }, { id: 26, - iconName: 'clock-icon', + iconName: 'clock', title: 'SLO Downtime', to: '/slo-downtime' }, @@ -251,13 +251,13 @@ export const useRootViewWrapperStore = () => { }, { id: 29, - iconName: 'stack', + iconName: 'overrides', title: 'Overrides', to: '/overrides' }, { id: 30, - iconName: 'bookmark-icon', + iconName: 'bookmark', title: 'Certificates', to: '/certificates' }, @@ -282,25 +282,25 @@ export const useRootViewWrapperStore = () => { }, { id: 33, - iconName: 'users', + iconName: 'group-1', title: 'User Groups', to: '/admin/user-groups' }, { id: 34, - iconName: 'account-icon', + iconName: 'service-accounts', title: 'Service Accounts', to: '/admin/service-accounts' }, { id: 35, - iconName: 'folder-icon', + iconName: 'folder', title: 'Resource Groups', to: '/admin/resource-groups' }, { id: 36, - iconName: 'briefcase', + iconName: 'roles', title: 'Roles', to: '/admin/roles' } @@ -319,7 +319,7 @@ export const useRootViewWrapperStore = () => { }, { id: 38, - iconName: 'snow', + iconName: 'snowflake', title: 'Freeze Windows', to: '/freeze-windows' } @@ -332,13 +332,13 @@ export const useRootViewWrapperStore = () => { items: [ { id: 39, - iconName: 'ticket', + iconName: 'externaltickets', title: 'External Tickets', to: '/external-tickets' } ] } - ] as MenuGroupType[] + ] return { moreMenu, settingsMenu } } 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 2656a8e159..132b37ac8a 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 @@ -4,30 +4,33 @@ import { Breadcrumb, Topbar } from '@harnessio/ui/components' import { AppViewWrapper, AppViewWrapperProps } from './app-view-wrapper' -const RootViewWrapper: FC>> = ({ children, asChild }) => { +const RootViewWrapper: FC>> = ({ + children, + asChild, + childrenWrapperClassName +}) => { return ( - - - - - - Lorem - - - - Ipsum - - - Dolor - - - - -
+ + + + + + Lorem + + + + Ipsum + + + Dolor + + + + } > {children} diff --git a/apps/design-system/src/pages/view-preview/view-preview.tsx b/apps/design-system/src/pages/view-preview/view-preview.tsx index 423d78ecda..d01a79839c 100644 --- a/apps/design-system/src/pages/view-preview/view-preview.tsx +++ b/apps/design-system/src/pages/view-preview/view-preview.tsx @@ -6,11 +6,20 @@ import { Navigate, Route, Routes } from 'react-router-dom' import { ProfileSettingsViewWrapper } from '@/pages/view-preview/profile-settings-view-wrapper.tsx' import { RepoSettingsViewWrapper } from '@/pages/view-preview/repo-settings-view-wrapper' +import { ConnectorsDetailsPageWrapper } from '@subjects/views/connectors/connector-details' +import { ConnectorsPage } from '@subjects/views/connectors/connectors' +import { ConnectorInputExample } from '@subjects/views/connectors/connectors-input' +import { ConnectorsListPageWrapper } from '@subjects/views/connectors/connectors-list' +import DataTableDemo from '@subjects/views/data-table-demo' +import { DelegateConnectivityWrapper } from '@subjects/views/delegates/delegate-connectivity' +import { DelegateSelector } from '@subjects/views/delegates/delegate-selector' +import DraggableCardsDemo from '@subjects/views/draggable-cards-demo' import ExecutionListWrapper from '@subjects/views/execution-list/execution-list' import { LabelsForm } from '@subjects/views/labels/labels-form' import { ProjectLabelsList } from '@subjects/views/labels/project-labels-list' import { RepoLabelsList } from '@subjects/views/labels/repo-labels-list' import { LandingPagePreview } from '@subjects/views/landing-page/landing-page-view' +import { MultipleSelectorWithDisabledOption } from '@subjects/views/multi-select-demo' import PipelineGraphWrapper from '@subjects/views/pipeline-graph/pipeline-graph' import PipelineGraphMinimalWrapper from '@subjects/views/pipeline-graph/pipeline-graph-minimal' import PipelineListWrapper from '@subjects/views/pipeline-list/pipeline-list' @@ -39,14 +48,18 @@ import RepoSummaryViewWrapper from '@subjects/views/repo-summary/repo-summary' import { RepoTagsList } from '@subjects/views/repo-tags/repo-tags-list' import { RepoWebhooksCreate } from '@subjects/views/repo-webhooks-create/repo-webhooks-list' import { RepoWebhooksList } from '@subjects/views/repo-webhooks-list/repo-webhooks-list' -import { SecretsPage } from '@subjects/views/secrets/secrets' +import { SearchPagePreview } from '@subjects/views/search-page/search-page-preview' +import { SecretInputExample } from '@subjects/views/secrets/secret-input' +import { SecretsListPage } from '@subjects/views/secrets/secrets-list' +import { SecretsMultiSelectPage } from '@subjects/views/secrets/secrets-multi-select' import { SignInView } from '@subjects/views/signin' import { SignUpView } from '@subjects/views/signup' import { SpaceSettingsMembers } from '@subjects/views/space-settings-members/space-settings-members' +import TableV2Demo from '@subjects/views/table-v2-demo' +import { ViewOnlyView } from '@subjects/views/templates/view-only' import UnifiedPipelineStudioWrapper from '@subjects/views/unified-pipeline-studio/unified-pipeline-studio' -import { useTranslationStore } from '@utils/viewUtils' -import { ChatEmptyPreviewWrapper, ChatPreviewWrapper } from '@harnessio/ui/components' +import { ChatEmptyPreviewWrapper, ChatPreviewWrapper, TooltipProvider } from '@harnessio/ui/components' import { NotFoundPage } from '@harnessio/ui/views' import { AppViewWrapper } from './app-view-wrapper' @@ -83,6 +96,14 @@ export const viewPreviews: Record = { repository: { label: 'Repository', items: { + 'repo-search': { + label: 'Search', + element: ( + + + + ) + }, 'repo-create': { label: 'Create Repository', element: ( @@ -262,7 +283,7 @@ export const viewPreviews: Record = { element: ( - + ) @@ -283,7 +304,7 @@ export const viewPreviews: Record = { 'unified-pipeline-studio': { label: 'Unified Pipeline Studio', element: ( - + ) @@ -487,27 +508,100 @@ export const viewPreviews: Record = { } } }, - secrets: { - label: 'Secrets', + multiSelect: { + label: 'Multi Select Demo', + items: { + 'multi-select-demo': { + label: 'Multi Select Demo', + element: + } + } + }, + tableV2: { + label: 'Table V2 Demo', + items: { + 'table-v2-demo': { + label: 'Table V2 Demo', + element: + }, + 'data-table-demo': { + label: 'Data Table Demo', + element: + } + } + }, + platform: { + label: 'Platform', items: { 'secrets-page': { label: 'Secrets Page', - element: + element: + }, + 'secrets-list-page': { + label: 'Secrets List Page', + element: + }, + 'secrets-multi-select-page': { + label: 'Secrets Multi Select Page', + element: + }, + 'connectors-list-page': { + label: 'Connectors List Page', + element: + }, + 'connectors-details-page': { + label: 'Connectors Details Page', + element: + }, + 'create-edit-connector': { + label: 'Create or Edit Connector', + element: + }, + 'connector-reference': { + label: 'Connector Reference', + element: + }, + 'delegate-selector': { + label: 'Delegate Selector', + element: + }, + 'delegate-connectivity': { + label: 'Delegate Connectivity', + element: + }, + 'draggable-cards-demo': { + label: 'Draggable Cards Demo', + element: } } }, + project: { label: 'Project', items: { 'project-create': { label: 'Project Create', element: }, 'project-create-additional': { label: 'Project Create Additional', element: } } + }, + + templates: { + label: 'Templates', + items: { + 'view-only': { + label: 'View only', + element: ( + + + + ) + } + } } } const ViewPreview: FC = () => { return ( - <> + {Object.entries(viewPreviews).map(([_, group]) => Object.entries(group.items).map(([route, { element }]) => ( @@ -517,7 +611,7 @@ const ViewPreview: FC = () => { } /> - + ) } diff --git a/apps/design-system/src/pages/view-preview/view-settings.module.css b/apps/design-system/src/pages/view-preview/view-settings.module.css index 5d9baa9d6a..ff71f85182 100644 --- a/apps/design-system/src/pages/view-preview/view-settings.module.css +++ b/apps/design-system/src/pages/view-preview/view-settings.module.css @@ -1,16 +1,17 @@ .viewSettings { position: fixed; + z-index: 20; bottom: 0.5rem; right: 0.5rem; &[data-show='show'] { display: flex; flex-direction: column; - border: 1px solid hsl(var(--canary-border-01)); + border: 1px solid var(--cn-border-2); border-radius: 0.25rem; padding: 1rem; width: 20rem; - background: hsl(var(--canary-background-01)); + background: var(--cn-bg-1); } } diff --git a/apps/design-system/src/pages/view-preview/view-settings.tsx b/apps/design-system/src/pages/view-preview/view-settings.tsx index fd920cb976..88c73c2518 100644 --- a/apps/design-system/src/pages/view-preview/view-settings.tsx +++ b/apps/design-system/src/pages/view-preview/view-settings.tsx @@ -4,11 +4,13 @@ import { useLocation, useNavigate } from 'react-router-dom' import { getTheme, Themes } from '@utils/theme-utils' import { clsx } from 'clsx' -import { Button, Icon, Select, Spacer } from '@harnessio/ui/components' +import { Button, IconV2, Select, SelectGroupOption, SelectValueOption, Spacer } from '@harnessio/ui/components' import { viewPreviews } from './view-preview' import css from './view-settings.module.css' +const themeOptions: SelectValueOption[] = Object.values(Themes).map(theme => ({ label: theme, value: theme })) + export interface ViewSettingsProps { routes: string[] } @@ -17,6 +19,11 @@ const ViewSettings: FC = ({ routes }) => { const [showSettings, setShowSettings] = useState(false) const [currentTheme, setCurrentTheme] = useState(getTheme()) + const viewOptions: SelectGroupOption[] = Object.entries(viewPreviews).map(([_, group]) => ({ + label: group.label, + options: Object.entries(group.items).map(([path, { label }]) => ({ label, value: path })) + })) + useEffect(() => { const bodyClass = document.body.classList @@ -36,49 +43,43 @@ const ViewSettings: FC = ({ routes }) => { [pathname, routes] ) + const onValueChange = (newTheme: Themes) => { + setCurrentTheme(newTheme) + } + return ( -