diff --git a/.gitignore b/.gitignore index 5ec7fcce46..aa0fa792ef 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,7 @@ tsconfig.tsbuildinfo *storybook.log storybook-static/ -yaml-editor-test/ \ No newline at end of file +yaml-editor-test/ + +#cursor +.cursor \ No newline at end of file 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 index bc49ede767..bbab91fa71 100644 --- a/apps/design-system/src/components/docs-navbar/docs-navbar.module.css +++ b/apps/design-system/src/components/docs-navbar/docs-navbar.module.css @@ -1,5 +1,8 @@ .content { overflow: hidden; + :global(.select-root) { + margin: 0.5rem 1rem; + } } .viewLink { diff --git a/apps/design-system/src/components/docs-navbar/docs-navbar.tsx b/apps/design-system/src/components/docs-navbar/docs-navbar.tsx index beeb10b6a5..4d8a87ded9 100644 --- a/apps/design-system/src/components/docs-navbar/docs-navbar.tsx +++ b/apps/design-system/src/components/docs-navbar/docs-navbar.tsx @@ -1,10 +1,10 @@ import { FC } from 'react' -import { Link, useLocation } from 'react-router-dom' +import { Link, useLocation, useNavigate } 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 { Icon, NavbarSkeleton, ScrollArea, Select } from '@harnessio/ui/components' import css from './docs-navbar.module.css' @@ -14,6 +14,7 @@ export interface DocsNavbarProps { const DocsNavbar: FC = ({ className }) => { const location = useLocation() + const navigate = useNavigate() return ( @@ -33,14 +34,23 @@ const DocsNavbar: FC = ({ className }) => { ))} - - {Object.keys(viewPreviews).map(path => ( - - - - - ))} - + + {Object.entries(viewPreviews).map(([groupKey, group]) => ( + + navigate(`/view-preview/${path}`)} + > + + {Object.entries(group.items).map(([path, { label }]) => ( + + {label} + + ))} + + + + ))} 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 53fecad03c..daf69b6e0b 100644 --- a/apps/design-system/src/pages/view-preview/view-preview.tsx +++ b/apps/design-system/src/pages/view-preview/view-preview.tsx @@ -58,256 +58,447 @@ import RepoViewWrapper from './repo-view-wrapper' import RootViewWrapper from './root-view-wrapper' import ViewSettings from './view-settings' -export const viewPreviews: Record = { - signin: , - signup: , - 'repo-create': ( - - - - ), - 'repo-import': ( - - - - ), - 'repo-summary': ( - - - - ), - 'repo-empty': ( - - - - ), - 'repo-list': ( - - - - ), - 'repo-tags': ( - - - - ), - 'pull-request-list': ( - - - - ), - 'pull-request-compare': ( - - - - ), - 'pull-request-conversation': ( - - - - ), - 'pull-request-conversation-1': ( - - - - ), - 'pull-request-commits': ( - - - - ), - 'pull-request-changes': ( - - - - ), - 'pull-request-changes-1': ( - - - - ), - 'repo-files-list': ( - - - - - - ), - 'repo-files-json-view': ( - - - - - - ), - 'repo-files-markdown-view': ( - - - - - - ), - 'repo-files-edit-view': ( - - - - - - ), - 'commit-details': ( - - - - - - ), - 'pipeline-list': ( - - - - ), - 'pipeline-studio': , - 'pipeline-graph': ( - - - - ), - 'chat-preview': ( - - - - ), - 'chat-empty-preview': ( - - - - ), - 'pipeline-graph-minimal': ( - - - - ), - 'execution-list': ( - - - - ), - 'repo-commits-list': ( - - - - ), - 'webhooks-list': ( - - - - - - ), - 'webhooks-create': ( - - - - - - ), - 'repo-branches': ( - - - - ), - 'general-settings': ( - - - - - - ), - 'create-rule': ( - - - - - - ), - 'rule-not-found': ( - - - - - - ), - 'repo-labels-list': ( - - - - - - ), - 'space-settings-labels': ( - - - - ), - 'space-settings-members': ( - - - - ), - 'project-settings': ( - - - - ), - 'profile-settings': ( - - - - - - ), - 'profile-settings-keys': ( - - - - - - ), - 'label-form': ( - - - - ), - 'execution-details/logs': ( - - - - ), - 'execution-details/graph': ( - - - - ), - 'user-management': ( - - - - ) +export interface ViewPreviewGroup { + label: string + items: Record< + string, + { + label: string + element: ReactNode + } + > } -const routeEntries = Object.entries(viewPreviews) -const routeKeys = Object.keys(viewPreviews) +export const viewPreviews: Record = { + auth: { + label: 'Auth', + items: { + signin: { label: 'Sign In', element: }, + signup: { label: 'Sign Up', element: } + } + }, + repository: { + label: 'Repository', + items: { + 'repo-create': { + label: 'Create Repository', + element: ( + + + + ) + }, + 'repo-import': { + label: 'Import Repository', + element: ( + + + + ) + }, + 'repo-summary': { + label: 'Repository Summary', + element: ( + + + + ) + }, + 'repo-empty': { + label: 'Empty Repository', + element: ( + + + + ) + }, + 'repo-list': { + label: 'Repository List', + element: ( + + + + ) + }, + 'repo-commits-list': { + label: 'Repository Commits', + element: ( + + + + ) + }, + 'repo-branches': { + label: 'Repository Branches', + element: ( + + + + ) + }, + 'repo-tags': { + label: 'Repository Tags', + element: ( + + + + ) + }, + 'commit-details': { + label: 'Commit Details', + element: ( + + + + + + ) + } + } + }, + files: { + label: 'Files', + items: { + 'repo-files-list': { + label: 'Files List', + element: ( + + + + + + ) + }, + 'repo-files-json-view': { + label: 'JSON View', + element: ( + + + + + + ) + }, + 'repo-files-markdown-view': { + label: 'Markdown View', + element: ( + + + + + + ) + }, + 'repo-files-edit-view': { + label: 'Edit View', + element: ( + + + + + + ) + } + } + }, + settings: { + label: 'Settings', + items: { + 'general-settings': { + label: 'General Settings', + element: ( + + + + + + ) + }, + 'webhooks-list': { + label: 'Webhooks List', + element: ( + + + + + + ) + }, + 'webhooks-create': { + label: 'Create Webhook', + element: ( + + + + + + ) + }, + 'create-rule': { + label: 'Create Rule', + element: ( + + + + + + ) + }, + 'repo-labels-list': { + label: 'Labels List', + element: ( + + + + + + ) + }, + 'rule-not-found': { + label: 'Rule Not Found', + element: ( + + + + + + ) + } + } + }, + pipeline: { + label: 'Pipeline', + items: { + 'pipeline-list': { + label: 'Pipeline List', + element: ( + + + + ) + }, + 'pipeline-studio': { + label: 'Pipeline Studio', + element: + }, + 'pipeline-graph': { + label: 'Pipeline Graph', + element: ( + + + + ) + }, + 'pipeline-graph-minimal': { + label: 'Pipeline Graph Minimal', + element: ( + + + + ) + } + } + }, + execution: { + label: 'Execution', + items: { + 'execution-list': { + label: 'Execution List', + element: ( + + + + ) + }, + 'execution-details/logs': { + label: 'Execution Logs', + element: ( + + + + ) + }, + 'execution-details/graph': { + label: 'Execution Graph', + element: ( + + + + ) + } + } + }, + pullRequest: { + label: 'Pull Request', + items: { + 'pull-request-list': { + label: 'Pull Request List', + element: ( + + + + ) + }, + 'pull-request-compare': { + label: 'Pull Request Compare', + element: ( + + + + ) + }, + 'pull-request-conversation': { + label: 'Pull Request Conversation', + element: ( + + + + ) + }, + 'pull-request-conversation-1': { + label: 'Pull Request Conversation Complex', + element: ( + + + + ) + }, + 'pull-request-changes': { + label: 'Pull Request Changes', + element: ( + + + + ) + }, + 'pull-request-changes-1': { + label: 'Pull Request Changes Complex', + element: ( + + + + ) + }, + 'pull-request-commits': { + label: 'Pull Request Commits', + element: ( + + + + ) + } + } + }, + profile: { + label: 'Profile', + items: { + 'profile-settings': { + label: 'Profile Settings', + element: ( + + + + + + ) + }, + 'profile-settings-keys': { + label: 'Profile Settings Keys', + element: ( + + + + + + ) + } + } + }, + space: { + label: 'Space', + items: { + 'space-settings-labels': { + label: 'Space Labels', + element: ( + + + + ) + }, + 'space-settings-members': { + label: 'Space Members', + element: ( + + + + ) + }, + 'project-settings': { + label: 'Project Settings', + element: ( + + + + ) + }, + 'label-form': { + label: 'Label Form', + element: ( + + + + ) + } + } + }, + chat: { + label: 'Chat', + items: { + 'chat-empty-preview': { + label: 'Chat Empty Preview', + element: ( + + + + ) + }, + 'chat-preview': { + label: 'Chat Preview', + element: ( + + + + ) + } + } + }, + userManagement: { + label: 'User Management', + items: { + 'user-management': { + label: 'User Management', + element: ( + + + + ) + } + } + } +} const ViewPreview: FC = () => { return ( <> - {routeEntries.map(([route, node]) => { - return - })} - } /> + {Object.entries(viewPreviews).map(([_, group]) => + Object.entries(group.items).map(([route, { element }]) => ( + + )) + )} + } /> - + ) }