@locusai/web 0.1.7 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/next.config.js +15 -2
- package/package.json +26 -3
- package/src/app/(auth)/invite/page.tsx +109 -0
- package/src/app/(auth)/layout.tsx +19 -0
- package/src/app/(auth)/login/page.tsx +65 -0
- package/src/app/(auth)/onboarding/workspace/page.tsx +46 -0
- package/src/app/(auth)/register/page.tsx +165 -0
- package/src/app/(dashboard)/activity/page.tsx +7 -0
- package/src/app/(dashboard)/backlog/page.tsx +195 -0
- package/src/app/(dashboard)/board/page.tsx +141 -0
- package/src/app/(dashboard)/layout.tsx +32 -0
- package/src/app/(dashboard)/page.tsx +14 -0
- package/src/app/(dashboard)/settings/page.tsx +161 -0
- package/src/app/(dashboard)/settings/team/page.tsx +75 -0
- package/src/app/globals.css +259 -0
- package/src/app/layout.tsx +10 -20
- package/src/app/providers.tsx +26 -3
- package/src/components/AuthLayoutUI.tsx +53 -0
- package/src/components/BoardFilter.tsx +75 -74
- package/src/components/CreateModal/CreateModal.tsx +142 -0
- package/src/components/CreateModal/index.ts +1 -0
- package/src/components/Editor.tsx +279 -0
- package/src/components/Header.tsx +99 -12
- package/src/components/PageLayout.tsx +69 -0
- package/src/components/PropertyItem.tsx +55 -9
- package/src/components/Sidebar.tsx +280 -36
- package/src/components/SprintCreateModal.tsx +84 -0
- package/src/components/TaskCard.tsx +196 -78
- package/src/components/TaskCreateModal.tsx +181 -178
- package/src/components/TaskPanel.tsx +140 -692
- package/src/components/WorkspaceCreateModal.tsx +97 -0
- package/src/components/WorkspaceProtected.tsx +91 -0
- package/src/components/auth/InviteSteps.tsx +220 -0
- package/src/components/auth/LoginSteps.tsx +86 -0
- package/src/components/auth/RegisterSteps.tsx +371 -0
- package/src/components/auth/index.ts +3 -0
- package/src/components/backlog/BacklogList.tsx +92 -0
- package/src/components/backlog/BacklogSection.tsx +137 -0
- package/src/components/backlog/CompletedSprintItem.tsx +95 -0
- package/src/components/backlog/CompletedSprintsSection.tsx +77 -0
- package/src/components/backlog/SprintSection.tsx +155 -0
- package/src/components/backlog/constants.ts +26 -0
- package/src/components/board/BoardColumn.tsx +97 -0
- package/src/components/board/BoardContent.tsx +84 -0
- package/src/components/board/BoardEmptyState.tsx +82 -0
- package/src/components/board/BoardHeader.tsx +47 -0
- package/src/components/board/SprintMindmap.tsx +65 -0
- package/src/components/board/constants.ts +40 -0
- package/src/components/board/index.ts +5 -0
- package/src/components/common/ErrorState.tsx +124 -0
- package/src/components/common/LoadingState.tsx +83 -0
- package/src/components/common/index.ts +40 -0
- package/src/components/dashboard/ActivityFeed.tsx +77 -0
- package/src/components/dashboard/ActivityItem.tsx +207 -0
- package/src/components/dashboard/QuickActions.tsx +50 -0
- package/src/components/dashboard/StatCard.tsx +79 -0
- package/src/components/dnd/index.tsx +51 -0
- package/src/components/docs/DocsEditorArea.tsx +87 -0
- package/src/components/docs/DocsHeaderActions.tsx +121 -0
- package/src/components/docs/DocsSidebar.tsx +351 -0
- package/src/components/index.ts +7 -0
- package/src/components/onboarding/StepProgress.tsx +21 -0
- package/src/components/onboarding/index.ts +1 -0
- package/src/components/settings/ApiKeyConfirmationModal.tsx +81 -0
- package/src/components/settings/ApiKeyCreatedModal.tsx +96 -0
- package/src/components/settings/ApiKeysList.tsx +143 -0
- package/src/components/settings/ApiKeysSettings.tsx +144 -0
- package/src/components/settings/InviteMemberModal.tsx +106 -0
- package/src/components/settings/ProjectSetupGuide.tsx +147 -0
- package/src/components/settings/SettingItem.tsx +32 -0
- package/src/components/settings/SettingSection.tsx +50 -0
- package/src/components/settings/TeamInvitationsList.tsx +90 -0
- package/src/components/settings/TeamMembersList.tsx +95 -0
- package/src/components/settings/index.ts +8 -0
- package/src/components/task-panel/TaskActivity.tsx +127 -0
- package/src/components/task-panel/TaskChecklist.tsx +142 -0
- package/src/components/task-panel/TaskDescription.tsx +201 -0
- package/src/components/task-panel/TaskDocs.tsx +137 -0
- package/src/components/task-panel/TaskHeader.tsx +125 -0
- package/src/components/task-panel/TaskProperties.tsx +111 -0
- package/src/components/task-panel/index.ts +12 -0
- package/src/components/typography/EmptyStateText.tsx +59 -0
- package/src/components/typography/MetadataText.tsx +65 -0
- package/src/components/typography/SecondaryText.tsx +60 -0
- package/src/components/typography/SectionLabel.tsx +60 -0
- package/src/components/typography/index.ts +14 -0
- package/src/components/typography-scales.tsx +218 -0
- package/src/components/ui/Avatar.tsx +123 -0
- package/src/components/ui/Badge.tsx +69 -2
- package/src/components/ui/Button.tsx +71 -30
- package/src/components/ui/Checkbox.tsx +34 -0
- package/src/components/ui/Dropdown.tsx +67 -1
- package/src/components/ui/EmptyState.tsx +129 -0
- package/src/components/ui/Input.tsx +53 -6
- package/src/components/ui/Modal.tsx +45 -12
- package/src/components/ui/OtpInput.tsx +148 -0
- package/src/components/ui/Skeleton.tsx +36 -0
- package/src/components/ui/Spinner.tsx +112 -0
- package/src/components/ui/Textarea.tsx +28 -3
- package/src/components/ui/Toast.tsx +99 -0
- package/src/components/ui/Toggle.tsx +63 -0
- package/src/components/ui/constants.ts +108 -0
- package/src/components/ui/index.ts +7 -0
- package/src/context/AuthContext.tsx +140 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/backlog/index.ts +13 -0
- package/src/hooks/backlog/useBacklogActions.ts +144 -0
- package/src/hooks/backlog/useBacklogComposite.ts +73 -0
- package/src/hooks/backlog/useBacklogData.ts +74 -0
- package/src/hooks/backlog/useBacklogDragDrop.ts +118 -0
- package/src/hooks/backlog/useBacklogUI.ts +74 -0
- package/src/hooks/index.ts +22 -0
- package/src/hooks/task-panel/index.ts +13 -0
- package/src/hooks/task-panel/useTaskActions.ts +200 -0
- package/src/hooks/task-panel/useTaskComputedValues.ts +30 -0
- package/src/hooks/task-panel/useTaskData.ts +78 -0
- package/src/hooks/task-panel/useTaskPanelComposite.ts +161 -0
- package/src/hooks/task-panel/useTaskUIState.ts +80 -0
- package/src/hooks/useAuthLayoutLogic.ts +43 -0
- package/src/hooks/useAuthenticatedUser.ts +36 -0
- package/src/hooks/useAuthenticatedUserWithOrg.ts +41 -0
- package/src/hooks/useBacklog.ts +303 -0
- package/src/hooks/useBoard.ts +230 -0
- package/src/hooks/useDashboardLayout.ts +49 -0
- package/src/hooks/useDocs.ts +279 -0
- package/src/hooks/useDocsQuery.ts +99 -0
- package/src/hooks/useDocsSidebarState.ts +104 -0
- package/src/hooks/useFormState.ts +40 -0
- package/src/hooks/useGlobalKeydowns.ts +52 -0
- package/src/hooks/useInviteForm.ts +122 -0
- package/src/hooks/useLoginForm.ts +84 -0
- package/src/hooks/useMutationWithToast.ts +56 -0
- package/src/hooks/useOrganizationQuery.ts +55 -0
- package/src/hooks/useRegisterForm.ts +216 -0
- package/src/hooks/useSprintsQuery.ts +38 -0
- package/src/hooks/useTaskDescription.ts +102 -0
- package/src/hooks/useTaskPanel.ts +341 -0
- package/src/hooks/useTasksQuery.ts +39 -0
- package/src/hooks/useTeamManagement.ts +92 -0
- package/src/hooks/useWorkspaceCreateForm.ts +70 -0
- package/src/hooks/useWorkspaceId.ts +29 -0
- package/src/lib/api-client.ts +40 -23
- package/src/lib/config.ts +25 -0
- package/src/lib/constants.ts +83 -0
- package/src/lib/options.ts +96 -0
- package/src/lib/query-keys.ts +91 -0
- package/src/lib/typography.ts +103 -0
- package/src/lib/utils.ts +4 -0
- package/src/lib/validation.ts +192 -0
- package/src/services/index.ts +7 -3
- package/src/services/notifications.ts +80 -0
- package/src/utils/env.utils.ts +15 -0
- package/src/views/ActivityView.tsx +123 -0
- package/src/views/Dashboard.tsx +126 -0
- package/src/views/Docs.tsx +98 -612
- package/tsconfig.tsbuildinfo +1 -1
- package/.next/BUILD_ID +0 -1
- package/.next/app-build-manifest.json +0 -55
- package/.next/app-path-routes-manifest.json +0 -8
- package/.next/build-manifest.json +0 -33
- package/.next/cache/.previewinfo +0 -1
- package/.next/cache/.rscinfo +0 -1
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/cache/config.json +0 -7
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/diagnostics/build-diagnostics.json +0 -6
- package/.next/diagnostics/framework.json +0 -1
- package/.next/export-detail.json +0 -5
- package/.next/export-marker.json +0 -6
- package/.next/images-manifest.json +0 -57
- package/.next/next-minimal-server.js.nft.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -137
- package/.next/react-loadable-manifest.json +0 -32
- package/.next/required-server-files.json +0 -324
- package/.next/routes-manifest.json +0 -77
- package/.next/server/app/_not-found/page.js +0 -2
- package/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
- package/.next/server/app/_not-found.html +0 -1
- package/.next/server/app/_not-found.meta +0 -8
- package/.next/server/app/_not-found.rsc +0 -21
- package/.next/server/app/backlog/page.js +0 -2
- package/.next/server/app/backlog/page.js.nft.json +0 -1
- package/.next/server/app/backlog/page_client-reference-manifest.js +0 -1
- package/.next/server/app/backlog.html +0 -1
- package/.next/server/app/backlog.meta +0 -7
- package/.next/server/app/backlog.rsc +0 -25
- package/.next/server/app/docs/page.js +0 -97
- package/.next/server/app/docs/page.js.nft.json +0 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +0 -1
- package/.next/server/app/docs.html +0 -1
- package/.next/server/app/docs.meta +0 -7
- package/.next/server/app/docs.rsc +0 -26
- package/.next/server/app/favicon.ico/route.js +0 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +0 -1
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +0 -1
- package/.next/server/app/index.html +0 -1
- package/.next/server/app/index.meta +0 -7
- package/.next/server/app/index.rsc +0 -25
- package/.next/server/app/page.js +0 -2
- package/.next/server/app/page.js.nft.json +0 -1
- package/.next/server/app/page_client-reference-manifest.js +0 -1
- package/.next/server/app/settings/page.js +0 -2
- package/.next/server/app/settings/page.js.nft.json +0 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +0 -1
- package/.next/server/app/settings.html +0 -1
- package/.next/server/app/settings.meta +0 -7
- package/.next/server/app/settings.rsc +0 -25
- package/.next/server/app-paths-manifest.json +0 -8
- package/.next/server/chunks/496.js +0 -6
- package/.next/server/chunks/585.js +0 -1
- package/.next/server/chunks/665.js +0 -1
- package/.next/server/chunks/699.js +0 -22
- package/.next/server/chunks/852.js +0 -7
- package/.next/server/functions-config-manifest.json +0 -4
- package/.next/server/interception-route-rewrite-manifest.js +0 -1
- package/.next/server/middleware-build-manifest.js +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/.next/server/next-font-manifest.js +0 -1
- package/.next/server/next-font-manifest.json +0 -1
- package/.next/server/pages/404.html +0 -1
- package/.next/server/pages/500.html +0 -1
- package/.next/server/pages/_app.js +0 -1
- package/.next/server/pages/_app.js.nft.json +0 -1
- package/.next/server/pages/_document.js +0 -1
- package/.next/server/pages/_document.js.nft.json +0 -1
- package/.next/server/pages/_error.js +0 -19
- package/.next/server/pages/_error.js.nft.json +0 -1
- package/.next/server/pages-manifest.json +0 -6
- package/.next/server/server-reference-manifest.js +0 -1
- package/.next/server/server-reference-manifest.json +0 -1
- package/.next/server/webpack-runtime.js +0 -1
- package/.next/static/D0NXe04ZCLNDckV_quc8g/_buildManifest.js +0 -1
- package/.next/static/D0NXe04ZCLNDckV_quc8g/_ssgManifest.js +0 -1
- package/.next/static/chunks/138.b98511c56423f8bb.js +0 -1
- package/.next/static/chunks/146-34259952c594a3b0.js +0 -1
- package/.next/static/chunks/337-d3bb75304d130513.js +0 -1
- package/.next/static/chunks/477.1a6ecfe53375bd9c.js +0 -1
- package/.next/static/chunks/487-1808785ba665f784.js +0 -1
- package/.next/static/chunks/544.a9569941cc886e9d.js +0 -1
- package/.next/static/chunks/87c73c54-1f4741035a95c140.js +0 -1
- package/.next/static/chunks/902-d6926825a9fe8784.js +0 -1
- package/.next/static/chunks/955-c8f8f6235ae8f8c6.js +0 -1
- package/.next/static/chunks/996.e0a334e6ae90900e.js +0 -1
- package/.next/static/chunks/app/_not-found/page-44b1804abb44a34d.js +0 -1
- package/.next/static/chunks/app/backlog/page-dce1450769bfae8f.js +0 -1
- package/.next/static/chunks/app/docs/page-1efee819f25492cb.js +0 -1
- package/.next/static/chunks/app/layout-05f504c042b9f7ee.js +0 -1
- package/.next/static/chunks/app/page-3fd91aaaa4776ced.js +0 -1
- package/.next/static/chunks/app/settings/page-84e16c9638d657e4.js +0 -1
- package/.next/static/chunks/framework-152a1bc8c81c7458.js +0 -1
- package/.next/static/chunks/main-843ab130fc1be309.js +0 -1
- package/.next/static/chunks/main-app-123e879c5a937a00.js +0 -1
- package/.next/static/chunks/pages/_app-a050a8e6e4fb04cf.js +0 -1
- package/.next/static/chunks/pages/_error-3e422ffd891594de.js +0 -1
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/.next/static/chunks/webpack-99a10a055b5bb9c4.js +0 -1
- package/.next/static/css/13e8617b72f9d3aa.css +0 -1
- package/.next/static/css/8aea088cdc4338f0.css +0 -1
- package/.next/static/css/b301ab0424111664.css +0 -1
- package/.next/static/media/24c15609eaa28576-s.woff2 +0 -0
- package/.next/static/media/2c07349e02a7b712-s.woff2 +0 -0
- package/.next/static/media/456105d6ea6d39e0-s.woff2 +0 -0
- package/.next/static/media/47cbc4e2adbc5db9-s.p.woff2 +0 -0
- package/.next/static/media/4f77bef990aad698-s.woff2 +0 -0
- package/.next/static/media/627d916fd739a539-s.woff2 +0 -0
- package/.next/static/media/63b255f18bea0ca9-s.woff2 +0 -0
- package/.next/static/media/70bd82ac89b4fa42-s.woff2 +0 -0
- package/.next/static/media/84602850c8fd81c3-s.woff2 +0 -0
- package/.next/trace +0 -46
- package/.next/types/app/backlog/page.ts +0 -84
- package/.next/types/app/docs/page.ts +0 -84
- package/.next/types/app/layout.ts +0 -84
- package/.next/types/app/page.ts +0 -84
- package/.next/types/app/settings/page.ts +0 -84
- package/.next/types/cache-life.d.ts +0 -141
- package/.next/types/package.json +0 -1
- package/next-env.d.ts +0 -5
- package/out/404.html +0 -1
- package/out/_next/static/D0NXe04ZCLNDckV_quc8g/_buildManifest.js +0 -1
- package/out/_next/static/D0NXe04ZCLNDckV_quc8g/_ssgManifest.js +0 -1
- package/out/_next/static/chunks/138.b98511c56423f8bb.js +0 -1
- package/out/_next/static/chunks/146-34259952c594a3b0.js +0 -1
- package/out/_next/static/chunks/337-d3bb75304d130513.js +0 -1
- package/out/_next/static/chunks/477.1a6ecfe53375bd9c.js +0 -1
- package/out/_next/static/chunks/487-1808785ba665f784.js +0 -1
- package/out/_next/static/chunks/544.a9569941cc886e9d.js +0 -1
- package/out/_next/static/chunks/87c73c54-1f4741035a95c140.js +0 -1
- package/out/_next/static/chunks/902-d6926825a9fe8784.js +0 -1
- package/out/_next/static/chunks/955-c8f8f6235ae8f8c6.js +0 -1
- package/out/_next/static/chunks/996.e0a334e6ae90900e.js +0 -1
- package/out/_next/static/chunks/app/_not-found/page-44b1804abb44a34d.js +0 -1
- package/out/_next/static/chunks/app/backlog/page-dce1450769bfae8f.js +0 -1
- package/out/_next/static/chunks/app/docs/page-1efee819f25492cb.js +0 -1
- package/out/_next/static/chunks/app/layout-05f504c042b9f7ee.js +0 -1
- package/out/_next/static/chunks/app/page-3fd91aaaa4776ced.js +0 -1
- package/out/_next/static/chunks/app/settings/page-84e16c9638d657e4.js +0 -1
- package/out/_next/static/chunks/framework-152a1bc8c81c7458.js +0 -1
- package/out/_next/static/chunks/main-843ab130fc1be309.js +0 -1
- package/out/_next/static/chunks/main-app-123e879c5a937a00.js +0 -1
- package/out/_next/static/chunks/pages/_app-a050a8e6e4fb04cf.js +0 -1
- package/out/_next/static/chunks/pages/_error-3e422ffd891594de.js +0 -1
- package/out/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/out/_next/static/chunks/webpack-99a10a055b5bb9c4.js +0 -1
- package/out/_next/static/css/13e8617b72f9d3aa.css +0 -1
- package/out/_next/static/css/8aea088cdc4338f0.css +0 -1
- package/out/_next/static/css/b301ab0424111664.css +0 -1
- package/out/_next/static/media/24c15609eaa28576-s.woff2 +0 -0
- package/out/_next/static/media/2c07349e02a7b712-s.woff2 +0 -0
- package/out/_next/static/media/456105d6ea6d39e0-s.woff2 +0 -0
- package/out/_next/static/media/47cbc4e2adbc5db9-s.p.woff2 +0 -0
- package/out/_next/static/media/4f77bef990aad698-s.woff2 +0 -0
- package/out/_next/static/media/627d916fd739a539-s.woff2 +0 -0
- package/out/_next/static/media/63b255f18bea0ca9-s.woff2 +0 -0
- package/out/_next/static/media/70bd82ac89b4fa42-s.woff2 +0 -0
- package/out/_next/static/media/84602850c8fd81c3-s.woff2 +0 -0
- package/out/backlog.html +0 -1
- package/out/backlog.txt +0 -25
- package/out/docs.html +0 -1
- package/out/docs.txt +0 -26
- package/out/favicon.ico +0 -0
- package/out/index.html +0 -1
- package/out/index.txt +0 -25
- package/out/logo.png +0 -0
- package/out/settings.html +0 -1
- package/out/settings.txt +0 -25
- package/src/app/backlog/page.tsx +0 -19
- package/src/app/page.tsx +0 -16
- package/src/app/settings/page.tsx +0 -194
- package/src/hooks/useTasks.ts +0 -119
- package/src/services/doc.service.ts +0 -27
- package/src/services/sprint.service.ts +0 -24
- package/src/services/task.service.ts +0 -75
- package/src/views/Backlog.tsx +0 -691
- package/src/views/Board.tsx +0 -306
- /package/src/app/{docs → (dashboard)/docs}/page.tsx +0 -0
package/src/views/Docs.tsx
CHANGED
|
@@ -1,625 +1,111 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
FileCode,
|
|
9
|
-
FileText,
|
|
10
|
-
Filter,
|
|
11
|
-
Folder,
|
|
12
|
-
FolderOpen,
|
|
13
|
-
Lightbulb,
|
|
14
|
-
Palette,
|
|
15
|
-
Plus,
|
|
16
|
-
Save,
|
|
17
|
-
Search,
|
|
18
|
-
Users,
|
|
19
|
-
X,
|
|
20
|
-
} from "lucide-react";
|
|
21
|
-
import { useCallback, useEffect, useState } from "react";
|
|
22
|
-
import { Button, Input } from "@/components/ui";
|
|
23
|
-
import { cn } from "@/lib/utils";
|
|
24
|
-
import { DocNode, docService } from "@/services";
|
|
25
|
-
|
|
26
|
-
// Document categories for role-based filtering
|
|
27
|
-
const DOC_CATEGORIES = [
|
|
28
|
-
{
|
|
29
|
-
id: "all",
|
|
30
|
-
label: "All Documents",
|
|
31
|
-
icon: BookOpen,
|
|
32
|
-
color: "text-foreground",
|
|
33
|
-
bgColor: "bg-secondary",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "product",
|
|
37
|
-
label: "Product",
|
|
38
|
-
icon: Lightbulb,
|
|
39
|
-
color: "text-amber-500",
|
|
40
|
-
bgColor: "bg-amber-500/10",
|
|
41
|
-
description: "PRDs, roadmaps, specs",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "engineering",
|
|
45
|
-
label: "Engineering",
|
|
46
|
-
icon: Code,
|
|
47
|
-
color: "text-blue-500",
|
|
48
|
-
bgColor: "bg-blue-500/10",
|
|
49
|
-
description: "Technical docs, APIs",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: "design",
|
|
53
|
-
label: "Design",
|
|
54
|
-
icon: Palette,
|
|
55
|
-
color: "text-purple-500",
|
|
56
|
-
bgColor: "bg-purple-500/10",
|
|
57
|
-
description: "UI specs, guidelines",
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: "team",
|
|
61
|
-
label: "Team",
|
|
62
|
-
icon: Users,
|
|
63
|
-
color: "text-emerald-500",
|
|
64
|
-
bgColor: "bg-emerald-500/10",
|
|
65
|
-
description: "Processes, onboarding",
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
// Template options for new documents
|
|
70
|
-
const DOC_TEMPLATES = [
|
|
71
|
-
{ id: "blank", label: "Blank Document", content: "# Untitled\n\n" },
|
|
72
|
-
{
|
|
73
|
-
id: "prd",
|
|
74
|
-
label: "Product Spec (PRD)",
|
|
75
|
-
category: "product",
|
|
76
|
-
content: `# Product Requirements Document
|
|
77
|
-
|
|
78
|
-
## Overview
|
|
79
|
-
Brief description of the feature/product.
|
|
80
|
-
|
|
81
|
-
## Goals
|
|
82
|
-
- Goal 1
|
|
83
|
-
- Goal 2
|
|
84
|
-
|
|
85
|
-
## User Stories
|
|
86
|
-
As a [user type], I want [action] so that [benefit].
|
|
87
|
-
|
|
88
|
-
## Requirements
|
|
89
|
-
### Functional Requirements
|
|
90
|
-
1.
|
|
91
|
-
|
|
92
|
-
### Non-Functional Requirements
|
|
93
|
-
1.
|
|
94
|
-
|
|
95
|
-
## Success Metrics
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
## Timeline
|
|
99
|
-
| Phase | Description | Date |
|
|
100
|
-
|-------|-------------|------|
|
|
101
|
-
| | | |
|
|
102
|
-
`,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: "technical",
|
|
106
|
-
label: "Technical Design",
|
|
107
|
-
category: "engineering",
|
|
108
|
-
content: `# Technical Design Document
|
|
109
|
-
|
|
110
|
-
## Summary
|
|
111
|
-
Brief technical overview.
|
|
112
|
-
|
|
113
|
-
## Architecture
|
|
114
|
-
Describe the system architecture.
|
|
115
|
-
|
|
116
|
-
## API Design
|
|
117
|
-
\`\`\`typescript
|
|
118
|
-
// API endpoints
|
|
119
|
-
\`\`\`
|
|
120
|
-
|
|
121
|
-
## Database Schema
|
|
122
|
-
\`\`\`sql
|
|
123
|
-
-- Schema changes
|
|
124
|
-
\`\`\`
|
|
125
|
-
|
|
126
|
-
## Implementation Plan
|
|
127
|
-
1.
|
|
128
|
-
|
|
129
|
-
## Testing Strategy
|
|
130
|
-
- Unit tests
|
|
131
|
-
- Integration tests
|
|
132
|
-
|
|
133
|
-
## Rollout Plan
|
|
134
|
-
-
|
|
135
|
-
`,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: "api",
|
|
139
|
-
label: "API Documentation",
|
|
140
|
-
category: "engineering",
|
|
141
|
-
content: `# API Documentation
|
|
142
|
-
|
|
143
|
-
## Endpoints
|
|
144
|
-
|
|
145
|
-
### GET /api/resource
|
|
146
|
-
Description of the endpoint.
|
|
147
|
-
|
|
148
|
-
**Parameters:**
|
|
149
|
-
| Name | Type | Required | Description |
|
|
150
|
-
|------|------|----------|-------------|
|
|
151
|
-
| | | | |
|
|
152
|
-
|
|
153
|
-
**Response:**
|
|
154
|
-
\`\`\`json
|
|
155
|
-
{
|
|
156
|
-
"data": []
|
|
157
|
-
}
|
|
158
|
-
\`\`\`
|
|
159
|
-
|
|
160
|
-
### POST /api/resource
|
|
161
|
-
`,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: "runbook",
|
|
165
|
-
label: "Runbook",
|
|
166
|
-
category: "engineering",
|
|
167
|
-
content: `# Runbook: [Service Name]
|
|
168
|
-
|
|
169
|
-
## Overview
|
|
170
|
-
What this service does.
|
|
171
|
-
|
|
172
|
-
## Common Issues
|
|
173
|
-
|
|
174
|
-
### Issue 1
|
|
175
|
-
**Symptoms:**
|
|
176
|
-
**Resolution:**
|
|
177
|
-
|
|
178
|
-
## Monitoring
|
|
179
|
-
- Dashboard:
|
|
180
|
-
- Alerts:
|
|
181
|
-
|
|
182
|
-
## Contacts
|
|
183
|
-
- Team:
|
|
184
|
-
- Escalation:
|
|
185
|
-
`,
|
|
186
|
-
},
|
|
187
|
-
];
|
|
3
|
+
import { DocsEditorArea } from "@/components/docs/DocsEditorArea";
|
|
4
|
+
import { DocsHeaderActions } from "@/components/docs/DocsHeaderActions";
|
|
5
|
+
import { DocsSidebar } from "@/components/docs/DocsSidebar";
|
|
6
|
+
import { PageLayout } from "@/components/PageLayout";
|
|
7
|
+
import { useDocs, useGlobalKeydowns } from "@/hooks";
|
|
188
8
|
|
|
189
9
|
export function Docs() {
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
10
|
+
const {
|
|
11
|
+
docs,
|
|
12
|
+
groups,
|
|
13
|
+
docsByGroup,
|
|
14
|
+
selectedId,
|
|
15
|
+
setSelectedId,
|
|
16
|
+
selectedDoc,
|
|
17
|
+
content,
|
|
18
|
+
setContent,
|
|
19
|
+
hasUnsavedChanges,
|
|
20
|
+
isCreating,
|
|
21
|
+
setIsCreating,
|
|
22
|
+
newFileName,
|
|
23
|
+
setNewFileName,
|
|
24
|
+
selectedTemplate,
|
|
25
|
+
setSelectedTemplate,
|
|
26
|
+
contentMode,
|
|
27
|
+
setContentMode,
|
|
28
|
+
searchQuery,
|
|
29
|
+
setSearchQuery,
|
|
30
|
+
selectedGroupId,
|
|
31
|
+
setSelectedGroupId,
|
|
32
|
+
handleSave,
|
|
33
|
+
handleCreateFile,
|
|
34
|
+
handleDelete,
|
|
35
|
+
handleCreateGroup,
|
|
36
|
+
handleGroupChange,
|
|
37
|
+
} = useDocs();
|
|
38
|
+
|
|
39
|
+
useGlobalKeydowns({
|
|
40
|
+
onCloseCreateTask: () => {
|
|
41
|
+
if (isCreating) setIsCreating(false);
|
|
42
|
+
else if (selectedId) setSelectedId(null);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const headerActions = (
|
|
47
|
+
<DocsHeaderActions
|
|
48
|
+
selectedDoc={selectedDoc}
|
|
49
|
+
contentMode={contentMode}
|
|
50
|
+
setContentMode={setContentMode}
|
|
51
|
+
onNewDoc={() => setIsCreating(true)}
|
|
52
|
+
onSave={handleSave}
|
|
53
|
+
hasUnsavedChanges={hasUnsavedChanges}
|
|
54
|
+
groups={groups}
|
|
55
|
+
onGroupChange={handleGroupChange}
|
|
56
|
+
/>
|
|
202
57
|
);
|
|
203
58
|
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
collectFolders(data);
|
|
221
|
-
setExpandedFolders(folders);
|
|
222
|
-
} catch (err) {
|
|
223
|
-
console.error("Failed to fetch doc tree", err);
|
|
224
|
-
}
|
|
225
|
-
}, []);
|
|
226
|
-
|
|
227
|
-
useEffect(() => {
|
|
228
|
-
fetchTree();
|
|
229
|
-
}, [fetchTree]);
|
|
230
|
-
|
|
231
|
-
useEffect(() => {
|
|
232
|
-
if (selectedPath) {
|
|
233
|
-
docService.read(selectedPath).then((data) => {
|
|
234
|
-
setContent(data.content || "");
|
|
235
|
-
setOriginalContent(data.content || "");
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}, [selectedPath]);
|
|
239
|
-
|
|
240
|
-
const handleSave = async () => {
|
|
241
|
-
if (!selectedPath) return;
|
|
242
|
-
try {
|
|
243
|
-
await docService.write(selectedPath, content);
|
|
244
|
-
setOriginalContent(content);
|
|
245
|
-
} catch (err) {
|
|
246
|
-
console.error("Failed to save document", err);
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const handleCreateFile = async () => {
|
|
251
|
-
if (!newFileName.trim()) return;
|
|
252
|
-
|
|
253
|
-
// Build path with category prefix
|
|
254
|
-
let path = newFileName;
|
|
255
|
-
if (activeCategory !== "all" && !newFileName.includes("/")) {
|
|
256
|
-
path = `${activeCategory}/${newFileName}`;
|
|
257
|
-
}
|
|
258
|
-
if (!path.endsWith(".md")) path += ".md";
|
|
259
|
-
|
|
260
|
-
const template = DOC_TEMPLATES.find((t) => t.id === selectedTemplate);
|
|
261
|
-
const initialContent =
|
|
262
|
-
template?.content ||
|
|
263
|
-
`# ${newFileName.split("/").pop()?.replace(".md", "") || "New Document"}\n\n`;
|
|
264
|
-
|
|
265
|
-
try {
|
|
266
|
-
await docService.write(path, initialContent);
|
|
267
|
-
setIsCreating(false);
|
|
268
|
-
setNewFileName("");
|
|
269
|
-
setSelectedTemplate("blank");
|
|
270
|
-
fetchTree();
|
|
271
|
-
setSelectedPath(path);
|
|
272
|
-
} catch (err) {
|
|
273
|
-
console.error("Failed to create file", err);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const toggleFolder = (path: string) => {
|
|
278
|
-
setExpandedFolders((prev) => {
|
|
279
|
-
const next = new Set(prev);
|
|
280
|
-
if (next.has(path)) {
|
|
281
|
-
next.delete(path);
|
|
282
|
-
} else {
|
|
283
|
-
next.add(path);
|
|
284
|
-
}
|
|
285
|
-
return next;
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
// Filter documents based on search and category
|
|
290
|
-
const filterNodes = (nodes: DocNode[]): DocNode[] => {
|
|
291
|
-
return nodes
|
|
292
|
-
.map((node) => {
|
|
293
|
-
if (node.type === "directory") {
|
|
294
|
-
const filteredChildren = node.children
|
|
295
|
-
? filterNodes(node.children)
|
|
296
|
-
: [];
|
|
297
|
-
// Keep directory if it has matching children or matches search
|
|
298
|
-
if (
|
|
299
|
-
filteredChildren.length > 0 ||
|
|
300
|
-
node.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
301
|
-
) {
|
|
302
|
-
return { ...node, children: filteredChildren };
|
|
303
|
-
}
|
|
304
|
-
return null;
|
|
305
|
-
} else {
|
|
306
|
-
// File node - check category and search
|
|
307
|
-
const matchesCategory =
|
|
308
|
-
activeCategory === "all" ||
|
|
309
|
-
node.path.toLowerCase().startsWith(activeCategory);
|
|
310
|
-
const matchesSearch = node.name
|
|
311
|
-
.toLowerCase()
|
|
312
|
-
.includes(searchQuery.toLowerCase());
|
|
313
|
-
if (matchesCategory && matchesSearch) return node;
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
})
|
|
317
|
-
.filter(Boolean) as DocNode[];
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const filteredTree = filterNodes(tree);
|
|
321
|
-
|
|
322
|
-
const renderTree = (nodes: DocNode[], depth = 0) => {
|
|
323
|
-
return nodes.map((node) => {
|
|
324
|
-
const isExpanded = expandedFolders.has(node.path);
|
|
325
|
-
const isSelected = selectedPath === node.path;
|
|
326
|
-
|
|
327
|
-
if (node.type === "directory") {
|
|
328
|
-
return (
|
|
329
|
-
<div key={node.path}>
|
|
330
|
-
<button
|
|
331
|
-
className={cn(
|
|
332
|
-
"flex items-center gap-2 w-full px-3 py-2 text-sm font-medium rounded-lg transition-all hover:bg-secondary/50",
|
|
333
|
-
"text-muted-foreground"
|
|
334
|
-
)}
|
|
335
|
-
style={{ paddingLeft: `${12 + depth * 16}px` }}
|
|
336
|
-
onClick={() => toggleFolder(node.path)}
|
|
337
|
-
>
|
|
338
|
-
{isExpanded ? (
|
|
339
|
-
<FolderOpen size={16} className="text-amber-500 shrink-0" />
|
|
340
|
-
) : (
|
|
341
|
-
<Folder size={16} className="text-amber-500 shrink-0" />
|
|
342
|
-
)}
|
|
343
|
-
<span className="truncate">{node.name}</span>
|
|
344
|
-
<span className="ml-auto text-[10px] text-muted-foreground/50">
|
|
345
|
-
{node.children?.length || 0}
|
|
346
|
-
</span>
|
|
347
|
-
</button>
|
|
348
|
-
{isExpanded &&
|
|
349
|
-
node.children &&
|
|
350
|
-
renderTree(node.children, depth + 1)}
|
|
351
|
-
</div>
|
|
352
|
-
);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Determine file icon based on path/name
|
|
356
|
-
const getFileIcon = () => {
|
|
357
|
-
const pathLower = node.path.toLowerCase();
|
|
358
|
-
if (pathLower.includes("api") || pathLower.includes("technical"))
|
|
359
|
-
return <FileCode size={16} className="text-blue-400" />;
|
|
360
|
-
if (pathLower.includes("product") || pathLower.includes("prd"))
|
|
361
|
-
return <Lightbulb size={16} className="text-amber-400" />;
|
|
362
|
-
if (pathLower.includes("design"))
|
|
363
|
-
return <Palette size={16} className="text-purple-400" />;
|
|
364
|
-
return <FileText size={16} />;
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<button
|
|
369
|
-
key={node.path}
|
|
370
|
-
className={cn(
|
|
371
|
-
"flex items-center gap-2 w-full px-3 py-2 text-sm font-medium rounded-lg transition-all",
|
|
372
|
-
isSelected
|
|
373
|
-
? "bg-primary text-primary-foreground"
|
|
374
|
-
: "text-muted-foreground hover:bg-secondary/50 hover:text-foreground"
|
|
375
|
-
)}
|
|
376
|
-
style={{ paddingLeft: `${12 + depth * 16}px` }}
|
|
377
|
-
onClick={() => setSelectedPath(node.path)}
|
|
378
|
-
>
|
|
379
|
-
<span className="shrink-0">{getFileIcon()}</span>
|
|
380
|
-
<span className="truncate">{node.name.replace(".md", "")}</span>
|
|
381
|
-
</button>
|
|
382
|
-
);
|
|
383
|
-
});
|
|
384
|
-
};
|
|
59
|
+
const headerStats = (
|
|
60
|
+
<div className="flex items-center gap-2">
|
|
61
|
+
<span className="text-primary font-bold">{docs.length} documents</span>
|
|
62
|
+
{selectedDoc && (
|
|
63
|
+
<>
|
|
64
|
+
<span className="w-1 h-1 rounded-full bg-muted-foreground/30" />
|
|
65
|
+
<span className="font-mono text-[10px] uppercase tracking-tighter opacity-70">
|
|
66
|
+
{selectedId}
|
|
67
|
+
</span>
|
|
68
|
+
</>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
385
72
|
|
|
386
73
|
return (
|
|
387
|
-
<
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
value={searchQuery}
|
|
413
|
-
onChange={(e) => setSearchQuery(e.target.value)}
|
|
414
|
-
className="h-9 pl-9 text-sm bg-secondary/40"
|
|
415
|
-
/>
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
|
|
419
|
-
{/* Category Filters */}
|
|
420
|
-
<div className="p-3 border-b border-border/50">
|
|
421
|
-
<div className="flex items-center gap-1.5 text-[10px] text-muted-foreground uppercase tracking-wider mb-2 px-1">
|
|
422
|
-
<Filter size={12} />
|
|
423
|
-
Categories
|
|
424
|
-
</div>
|
|
425
|
-
<div className="flex flex-wrap gap-1.5">
|
|
426
|
-
{DOC_CATEGORIES.map((cat) => {
|
|
427
|
-
const Icon = cat.icon;
|
|
428
|
-
return (
|
|
429
|
-
<button
|
|
430
|
-
key={cat.id}
|
|
431
|
-
className={cn(
|
|
432
|
-
"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all",
|
|
433
|
-
activeCategory === cat.id
|
|
434
|
-
? `${cat.bgColor} ${cat.color}`
|
|
435
|
-
: "text-muted-foreground hover:bg-secondary/50"
|
|
436
|
-
)}
|
|
437
|
-
onClick={() => setActiveCategory(cat.id)}
|
|
438
|
-
>
|
|
439
|
-
<Icon size={12} />
|
|
440
|
-
{cat.label}
|
|
441
|
-
</button>
|
|
442
|
-
);
|
|
443
|
-
})}
|
|
444
|
-
</div>
|
|
445
|
-
</div>
|
|
446
|
-
|
|
447
|
-
{/* Create New Document Modal */}
|
|
448
|
-
{isCreating && (
|
|
449
|
-
<div className="p-4 bg-secondary/30 border-b border-border/50 animate-in fade-in slide-in-from-top-2 duration-200">
|
|
450
|
-
<div className="flex items-center justify-between mb-3">
|
|
451
|
-
<span className="text-xs font-semibold text-foreground">
|
|
452
|
-
New Document
|
|
453
|
-
</span>
|
|
454
|
-
<button
|
|
455
|
-
className="text-muted-foreground hover:text-foreground"
|
|
456
|
-
onClick={() => setIsCreating(false)}
|
|
457
|
-
>
|
|
458
|
-
<X size={14} />
|
|
459
|
-
</button>
|
|
460
|
-
</div>
|
|
74
|
+
<PageLayout
|
|
75
|
+
title="Library"
|
|
76
|
+
description={headerStats}
|
|
77
|
+
actions={headerActions}
|
|
78
|
+
contentClassName="p-0 flex h-full gap-6 overflow-hidden pt-2 pb-6"
|
|
79
|
+
>
|
|
80
|
+
<DocsSidebar
|
|
81
|
+
groups={groups}
|
|
82
|
+
docsByGroup={docsByGroup}
|
|
83
|
+
selectedId={selectedId}
|
|
84
|
+
onSelect={setSelectedId}
|
|
85
|
+
searchQuery={searchQuery}
|
|
86
|
+
onSearchChange={setSearchQuery}
|
|
87
|
+
isCreating={isCreating}
|
|
88
|
+
setIsCreating={setIsCreating}
|
|
89
|
+
newFileName={newFileName}
|
|
90
|
+
setNewFileName={setNewFileName}
|
|
91
|
+
selectedTemplate={selectedTemplate}
|
|
92
|
+
onTemplateSelect={setSelectedTemplate}
|
|
93
|
+
onCreateFile={handleCreateFile}
|
|
94
|
+
onDelete={handleDelete}
|
|
95
|
+
onCreateGroup={handleCreateGroup}
|
|
96
|
+
selectedGroupId={selectedGroupId}
|
|
97
|
+
onGroupSelect={setSelectedGroupId}
|
|
98
|
+
/>
|
|
461
99
|
|
|
462
|
-
<Input
|
|
463
|
-
autoFocus
|
|
464
|
-
placeholder="document-name"
|
|
465
|
-
value={newFileName}
|
|
466
|
-
onChange={(e) => setNewFileName(e.target.value)}
|
|
467
|
-
onKeyDown={(e) => {
|
|
468
|
-
if (e.key === "Enter") handleCreateFile();
|
|
469
|
-
if (e.key === "Escape") setIsCreating(false);
|
|
470
|
-
}}
|
|
471
|
-
className="h-9 mb-3"
|
|
472
|
-
/>
|
|
473
|
-
|
|
474
|
-
<div className="mb-3">
|
|
475
|
-
<label className="text-[10px] uppercase tracking-wider text-muted-foreground mb-2 block">
|
|
476
|
-
Template
|
|
477
|
-
</label>
|
|
478
|
-
<div className="grid grid-cols-2 gap-1.5">
|
|
479
|
-
{DOC_TEMPLATES.slice(0, 4).map((template) => (
|
|
480
|
-
<button
|
|
481
|
-
key={template.id}
|
|
482
|
-
className={cn(
|
|
483
|
-
"px-2.5 py-2 text-[11px] font-medium rounded-lg border transition-all text-left",
|
|
484
|
-
selectedTemplate === template.id
|
|
485
|
-
? "border-primary bg-primary/10 text-foreground"
|
|
486
|
-
: "border-border/50 text-muted-foreground hover:border-border hover:bg-secondary/30"
|
|
487
|
-
)}
|
|
488
|
-
onClick={() => setSelectedTemplate(template.id)}
|
|
489
|
-
>
|
|
490
|
-
{template.label}
|
|
491
|
-
</button>
|
|
492
|
-
))}
|
|
493
|
-
</div>
|
|
494
|
-
</div>
|
|
495
|
-
|
|
496
|
-
<Button
|
|
497
|
-
size="sm"
|
|
498
|
-
className="w-full h-8"
|
|
499
|
-
onClick={handleCreateFile}
|
|
500
|
-
disabled={!newFileName.trim()}
|
|
501
|
-
>
|
|
502
|
-
Create Document
|
|
503
|
-
</Button>
|
|
504
|
-
</div>
|
|
505
|
-
)}
|
|
506
|
-
|
|
507
|
-
{/* File Tree */}
|
|
508
|
-
<div className="flex-1 overflow-y-auto p-2">
|
|
509
|
-
{filteredTree.length > 0 ? (
|
|
510
|
-
renderTree(filteredTree)
|
|
511
|
-
) : (
|
|
512
|
-
<div className="flex flex-col items-center justify-center h-full text-center p-4">
|
|
513
|
-
<File size={32} className="text-muted-foreground/30 mb-2" />
|
|
514
|
-
<p className="text-sm text-muted-foreground">No documents</p>
|
|
515
|
-
<p className="text-xs text-muted-foreground/60">
|
|
516
|
-
Create your first document
|
|
517
|
-
</p>
|
|
518
|
-
</div>
|
|
519
|
-
)}
|
|
520
|
-
</div>
|
|
521
|
-
</aside>
|
|
522
|
-
|
|
523
|
-
{/* Main Content */}
|
|
524
100
|
<main className="flex-1 flex flex-col min-w-0">
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
</div>
|
|
533
|
-
<div className="flex flex-col min-w-0">
|
|
534
|
-
<span className="font-semibold text-foreground truncate">
|
|
535
|
-
{selectedPath?.split("/").pop()?.replace(".md", "")}
|
|
536
|
-
</span>
|
|
537
|
-
<span className="text-[11px] text-muted-foreground truncate flex items-center gap-1.5">
|
|
538
|
-
<span className="opacity-60">/</span>
|
|
539
|
-
{selectedPath}
|
|
540
|
-
{hasUnsavedChanges && (
|
|
541
|
-
<span className="w-1.5 h-1.5 rounded-full bg-amber-500 ml-1" />
|
|
542
|
-
)}
|
|
543
|
-
</span>
|
|
544
|
-
</div>
|
|
545
|
-
</div>
|
|
546
|
-
<div className="flex items-center gap-3">
|
|
547
|
-
<div className="flex bg-secondary/50 p-1 rounded-lg border border-border/50">
|
|
548
|
-
<button
|
|
549
|
-
className={cn(
|
|
550
|
-
"px-3 py-1.5 text-xs font-semibold rounded-md transition-all",
|
|
551
|
-
contentMode === "edit"
|
|
552
|
-
? "bg-background text-foreground shadow-sm"
|
|
553
|
-
: "text-muted-foreground hover:text-foreground"
|
|
554
|
-
)}
|
|
555
|
-
onClick={() => setContentMode("edit")}
|
|
556
|
-
>
|
|
557
|
-
Edit
|
|
558
|
-
</button>
|
|
559
|
-
<button
|
|
560
|
-
className={cn(
|
|
561
|
-
"px-3 py-1.5 text-xs font-semibold rounded-md transition-all",
|
|
562
|
-
contentMode === "preview"
|
|
563
|
-
? "bg-background text-foreground shadow-sm"
|
|
564
|
-
: "text-muted-foreground hover:text-foreground"
|
|
565
|
-
)}
|
|
566
|
-
onClick={() => setContentMode("preview")}
|
|
567
|
-
>
|
|
568
|
-
Preview
|
|
569
|
-
</button>
|
|
570
|
-
</div>
|
|
571
|
-
<Button
|
|
572
|
-
onClick={handleSave}
|
|
573
|
-
className="h-9"
|
|
574
|
-
disabled={!hasUnsavedChanges}
|
|
575
|
-
>
|
|
576
|
-
<Save size={14} className="mr-2" />
|
|
577
|
-
Save
|
|
578
|
-
</Button>
|
|
579
|
-
</div>
|
|
580
|
-
</header>
|
|
581
|
-
|
|
582
|
-
{/* Editor */}
|
|
583
|
-
<div className="flex-1 bg-card/50 border border-border/50 rounded-xl overflow-hidden p-4 markdown-container">
|
|
584
|
-
<MDEditor
|
|
585
|
-
value={content}
|
|
586
|
-
onChange={(v) => setContent(v || "")}
|
|
587
|
-
height="100%"
|
|
588
|
-
preview={contentMode}
|
|
589
|
-
hideToolbar={contentMode === "preview"}
|
|
590
|
-
className="bg-transparent! border-none! text-foreground!"
|
|
591
|
-
/>
|
|
592
|
-
</div>
|
|
593
|
-
</div>
|
|
594
|
-
) : (
|
|
595
|
-
<div className="h-full flex items-center justify-center">
|
|
596
|
-
<div className="max-w-lg w-full p-10 bg-card/50 border border-border/50 rounded-2xl flex flex-col items-center text-center space-y-5">
|
|
597
|
-
<div className="p-5 bg-secondary/50 rounded-2xl">
|
|
598
|
-
<BookOpen size={40} className="text-muted-foreground/40" />
|
|
599
|
-
</div>
|
|
600
|
-
<div>
|
|
601
|
-
<h2 className="text-xl font-bold text-foreground mb-2">
|
|
602
|
-
Welcome to Documentation
|
|
603
|
-
</h2>
|
|
604
|
-
<p className="text-muted-foreground text-sm leading-relaxed max-w-sm">
|
|
605
|
-
Select a document from the sidebar or create a new one using
|
|
606
|
-
templates for PRDs, technical specs, and more.
|
|
607
|
-
</p>
|
|
608
|
-
</div>
|
|
609
|
-
<div className="flex gap-2 pt-2">
|
|
610
|
-
<Button
|
|
611
|
-
variant="secondary"
|
|
612
|
-
size="sm"
|
|
613
|
-
onClick={() => setIsCreating(true)}
|
|
614
|
-
>
|
|
615
|
-
<Plus size={14} className="mr-1.5" />
|
|
616
|
-
New Document
|
|
617
|
-
</Button>
|
|
618
|
-
</div>
|
|
619
|
-
</div>
|
|
620
|
-
</div>
|
|
621
|
-
)}
|
|
101
|
+
<DocsEditorArea
|
|
102
|
+
selectedDoc={selectedDoc}
|
|
103
|
+
content={content}
|
|
104
|
+
onContentChange={setContent}
|
|
105
|
+
contentMode={contentMode}
|
|
106
|
+
onNewDoc={() => setIsCreating(true)}
|
|
107
|
+
/>
|
|
622
108
|
</main>
|
|
623
|
-
</
|
|
109
|
+
</PageLayout>
|
|
624
110
|
);
|
|
625
111
|
}
|