move to sidebar
This commit is contained in:
+151
-133
@@ -345,6 +345,8 @@ const AppLayout = () => {
|
|||||||
);
|
);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [isCreateFolderModalOpen, setCreateFolderModalOpen] = useState(false);
|
const [isCreateFolderModalOpen, setCreateFolderModalOpen] = useState(false);
|
||||||
|
const [isTagsModalOpen, setTagsModalOpen] = useState(false);
|
||||||
|
const [isCorrespondentsModalOpen, setCorrespondentsModalOpen] = useState(false);
|
||||||
const [newFolderName, setNewFolderName] = useState('');
|
const [newFolderName, setNewFolderName] = useState('');
|
||||||
const [createFolderError, setCreateFolderError] = useState('');
|
const [createFolderError, setCreateFolderError] = useState('');
|
||||||
const [creatingFolder, setCreatingFolder] = useState(false);
|
const [creatingFolder, setCreatingFolder] = useState(false);
|
||||||
@@ -423,13 +425,9 @@ const AppLayout = () => {
|
|||||||
const documentsRouteMatch = useMatch('/documents');
|
const documentsRouteMatch = useMatch('/documents');
|
||||||
const documentsFolderRouteMatch = useMatch('/documents/folder/:folderId');
|
const documentsFolderRouteMatch = useMatch('/documents/folder/:folderId');
|
||||||
const documentsDetailRouteMatch = useMatch('/documents/:documentId');
|
const documentsDetailRouteMatch = useMatch('/documents/:documentId');
|
||||||
const tagsRouteMatch = useMatch('/tags');
|
|
||||||
const correspondentsRouteMatch = useMatch('/correspondents');
|
|
||||||
const isDocumentsRoute = Boolean(
|
const isDocumentsRoute = Boolean(
|
||||||
documentsRouteMatch || documentsFolderRouteMatch || documentsDetailRouteMatch,
|
documentsRouteMatch || documentsFolderRouteMatch || documentsDetailRouteMatch,
|
||||||
);
|
);
|
||||||
const isTagsRoute = Boolean(tagsRouteMatch);
|
|
||||||
const isCorrespondentsRoute = Boolean(correspondentsRouteMatch);
|
|
||||||
const toggleTagFilter = useCallback((tagId) => {
|
const toggleTagFilter = useCallback((tagId) => {
|
||||||
if (!tagId) return;
|
if (!tagId) return;
|
||||||
setActiveTagFilters((previous) =>
|
setActiveTagFilters((previous) =>
|
||||||
@@ -455,6 +453,10 @@ const AppLayout = () => {
|
|||||||
setSearchLoading(false);
|
setSearchLoading(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleSearchChange = useCallback((value) => {
|
||||||
|
setSearchQuery(value);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleSearchSubmit = useCallback(() => {
|
const handleSearchSubmit = useCallback(() => {
|
||||||
if (!navigate) return;
|
if (!navigate) return;
|
||||||
const targetFolder = selectedFolder && selectedFolder !== 'root' ? selectedFolder : 'root';
|
const targetFolder = selectedFolder && selectedFolder !== 'root' ? selectedFolder : 'root';
|
||||||
@@ -3682,6 +3684,24 @@ const AppLayout = () => {
|
|||||||
setCreateFolderError('');
|
setCreateFolderError('');
|
||||||
}, [creatingFolder]);
|
}, [creatingFolder]);
|
||||||
|
|
||||||
|
const openTagsModal = useCallback(() => {
|
||||||
|
setCorrespondentsModalOpen(false);
|
||||||
|
setTagsModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const closeTagsModal = useCallback(() => {
|
||||||
|
setTagsModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const openCorrespondentsModal = useCallback(() => {
|
||||||
|
setTagsModalOpen(false);
|
||||||
|
setCorrespondentsModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const closeCorrespondentsModal = useCallback(() => {
|
||||||
|
setCorrespondentsModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleCreateFolderSubmit = useCallback(
|
const handleCreateFolderSubmit = useCallback(
|
||||||
async (event) => {
|
async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -3742,6 +3762,31 @@ const AppLayout = () => {
|
|||||||
};
|
};
|
||||||
}, [isCreateFolderModalOpen, closeCreateFolderModal]);
|
}, [isCreateFolderModalOpen, closeCreateFolderModal]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTagsModalOpen(false);
|
||||||
|
setCorrespondentsModalOpen(false);
|
||||||
|
}, [location.pathname]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isTagsModalOpen && !isCorrespondentsModalOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
event.preventDefault();
|
||||||
|
if (isTagsModalOpen) {
|
||||||
|
closeTagsModal();
|
||||||
|
} else if (isCorrespondentsModalOpen) {
|
||||||
|
closeCorrespondentsModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('keydown', handleKeyDown);
|
||||||
|
};
|
||||||
|
}, [isTagsModalOpen, isCorrespondentsModalOpen, closeTagsModal, closeCorrespondentsModal]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!token) return undefined;
|
if (!token) return undefined;
|
||||||
|
|
||||||
@@ -4442,6 +4487,16 @@ const AppLayout = () => {
|
|||||||
correspondents,
|
correspondents,
|
||||||
activeCorrespondentIds: activeCorrespondentFilters,
|
activeCorrespondentIds: activeCorrespondentFilters,
|
||||||
onToggleCorrespondentFilter: toggleCorrespondentFilter,
|
onToggleCorrespondentFilter: toggleCorrespondentFilter,
|
||||||
|
appStatus,
|
||||||
|
loading,
|
||||||
|
previewActive,
|
||||||
|
searchQuery,
|
||||||
|
onSearchChange: handleSearchChange,
|
||||||
|
onSearchSubmit: handleSearchSubmit,
|
||||||
|
onSearchClear: clearFilters,
|
||||||
|
isFilterActive,
|
||||||
|
onLogout: handleLogout,
|
||||||
|
status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const resolveThumbnailUrlForDoc = useCallback(
|
const resolveThumbnailUrlForDoc = useCallback(
|
||||||
@@ -4585,7 +4640,6 @@ const AppLayout = () => {
|
|||||||
tags,
|
tags,
|
||||||
refreshTags,
|
refreshTags,
|
||||||
handleTagUpdate,
|
handleTagUpdate,
|
||||||
handleTagCreate,
|
|
||||||
handleTagDelete,
|
handleTagDelete,
|
||||||
handleDocumentTagAttach,
|
handleDocumentTagAttach,
|
||||||
correspondents,
|
correspondents,
|
||||||
@@ -4610,6 +4664,8 @@ const AppLayout = () => {
|
|||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
notifyApiError,
|
notifyApiError,
|
||||||
resolveApiPath,
|
resolveApiPath,
|
||||||
|
openTagsModal,
|
||||||
|
openCorrespondentsModal,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
token,
|
token,
|
||||||
@@ -4622,7 +4678,6 @@ const AppLayout = () => {
|
|||||||
tags,
|
tags,
|
||||||
refreshTags,
|
refreshTags,
|
||||||
handleTagUpdate,
|
handleTagUpdate,
|
||||||
handleTagCreate,
|
|
||||||
handleTagDelete,
|
handleTagDelete,
|
||||||
handleDocumentTagAttach,
|
handleDocumentTagAttach,
|
||||||
correspondents,
|
correspondents,
|
||||||
@@ -4647,6 +4702,8 @@ const AppLayout = () => {
|
|||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
notifyApiError,
|
notifyApiError,
|
||||||
resolveApiPath,
|
resolveApiPath,
|
||||||
|
openTagsModal,
|
||||||
|
openCorrespondentsModal,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -4667,81 +4724,6 @@ const AppLayout = () => {
|
|||||||
active={dropOverlayState.active}
|
active={dropOverlayState.active}
|
||||||
folderName={dropOverlayState.folderName}
|
folderName={dropOverlayState.folderName}
|
||||||
/>
|
/>
|
||||||
<header className="app-bar">
|
|
||||||
<div className="app-bar__main">
|
|
||||||
<div className="app-bar__meta">
|
|
||||||
<h1>Papercrate</h1>
|
|
||||||
<span className="app-bar__hint">
|
|
||||||
{appStatus === 'bootstrapping' && loading
|
|
||||||
? 'Loading your library…'
|
|
||||||
: previewActive
|
|
||||||
? 'Viewing document preview. Press ← Back to return to the library.'
|
|
||||||
: 'Drag files here to upload.'}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div className="app-bar__search">
|
|
||||||
<input
|
|
||||||
type="search"
|
|
||||||
value={searchQuery}
|
|
||||||
onChange={(event) => setSearchQuery(event.target.value)}
|
|
||||||
placeholder="Search documents"
|
|
||||||
aria-label="Search documents"
|
|
||||||
onKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
event.preventDefault();
|
|
||||||
handleSearchSubmit();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{isFilterActive && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="app-bar__search-clear"
|
|
||||||
onClick={clearFilters}
|
|
||||||
>
|
|
||||||
Clear
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="app-bar__right">
|
|
||||||
<div className="app-bar__links">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`app-bar__link${isDocumentsRoute ? ' active' : ''}`}
|
|
||||||
onClick={() => navigate('/documents')}
|
|
||||||
>
|
|
||||||
Documents
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`app-bar__link${isTagsRoute ? ' active' : ''}`}
|
|
||||||
onClick={() => navigate('/tags')}
|
|
||||||
>
|
|
||||||
Tags
|
|
||||||
<span className="app-bar__link-count">{tags.length}</span>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`app-bar__link${isCorrespondentsRoute ? ' active' : ''}`}
|
|
||||||
onClick={() => navigate('/correspondents')}
|
|
||||||
>
|
|
||||||
Correspondents
|
|
||||||
<span className="app-bar__link-count">{correspondents.length}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{status && (
|
|
||||||
<div className="app-bar__status">
|
|
||||||
<StatusBanner status={status} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="app-bar__actions">
|
|
||||||
<button className="secondary" onClick={handleLogout}>
|
|
||||||
Log out
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<Outlet />
|
<Outlet />
|
||||||
{isCreateFolderModalOpen && (
|
{isCreateFolderModalOpen && (
|
||||||
<div
|
<div
|
||||||
@@ -4791,6 +4773,74 @@ const AppLayout = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{isTagsModalOpen && (
|
||||||
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
role="presentation"
|
||||||
|
onClick={closeTagsModal}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="modal modal--panel"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="tags-modal-title"
|
||||||
|
onClick={(event) => event.stopPropagation()}
|
||||||
|
>
|
||||||
|
<div className="panel-modal__header">
|
||||||
|
<h3 id="tags-modal-title">Manage Tags</h3>
|
||||||
|
<button type="button" className="secondary" onClick={closeTagsModal}>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="panel-modal__body">
|
||||||
|
<TagsPanel
|
||||||
|
tags={tags}
|
||||||
|
onRefresh={refreshTags}
|
||||||
|
onCreateTag={handleTagCreate}
|
||||||
|
onUpdateTag={handleTagUpdate}
|
||||||
|
onDeleteTag={handleTagDelete}
|
||||||
|
onNotify={setStatusMessage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isCorrespondentsModalOpen && (
|
||||||
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
role="presentation"
|
||||||
|
onClick={closeCorrespondentsModal}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="modal modal--panel"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="correspondents-modal-title"
|
||||||
|
onClick={(event) => event.stopPropagation()}
|
||||||
|
>
|
||||||
|
<div className="panel-modal__header">
|
||||||
|
<h3 id="correspondents-modal-title">Manage Correspondents</h3>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="secondary"
|
||||||
|
onClick={closeCorrespondentsModal}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="panel-modal__body">
|
||||||
|
<CorrespondentsPanel
|
||||||
|
correspondents={correspondents}
|
||||||
|
onRefresh={refreshCorrespondents}
|
||||||
|
onCreate={handleCorrespondentCreate}
|
||||||
|
onUpdate={handleCorrespondentUpdate}
|
||||||
|
onDelete={handleCorrespondentDelete}
|
||||||
|
onNotify={setStatusMessage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</AppShellContext.Provider>
|
</AppShellContext.Provider>
|
||||||
);
|
);
|
||||||
@@ -4803,20 +4853,35 @@ const DocumentsRoute = () => {
|
|||||||
detailPanelProps,
|
detailPanelProps,
|
||||||
workspaceMode,
|
workspaceMode,
|
||||||
skeuoWorkspaceProps,
|
skeuoWorkspaceProps,
|
||||||
|
openTagsModal,
|
||||||
|
openCorrespondentsModal,
|
||||||
} = useAppShell();
|
} = useAppShell();
|
||||||
|
|
||||||
|
const sidebarPropsWithActions = useMemo(
|
||||||
|
() => ({
|
||||||
|
...sidebarProps,
|
||||||
|
onManageTags: openTagsModal,
|
||||||
|
onManageCorrespondents: openCorrespondentsModal,
|
||||||
|
}),
|
||||||
|
[sidebarProps, openTagsModal, openCorrespondentsModal],
|
||||||
|
);
|
||||||
|
|
||||||
if (workspaceMode === 'skeuo') {
|
if (workspaceMode === 'skeuo') {
|
||||||
return (
|
return (
|
||||||
<DocumentsLayout sidebarProps={sidebarProps}>
|
<DocumentsLayout sidebarProps={sidebarPropsWithActions}>
|
||||||
<SkeuomorphicWorkspace {...skeuoWorkspaceProps} />
|
<div className="main-content">
|
||||||
|
<SkeuomorphicWorkspace {...skeuoWorkspaceProps} />
|
||||||
|
</div>
|
||||||
</DocumentsLayout>
|
</DocumentsLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocumentsLayout sidebarProps={sidebarProps}>
|
<DocumentsLayout sidebarProps={sidebarPropsWithActions}>
|
||||||
<DocumentsTable {...documentsTableProps} />
|
<div className="main-content main-content--documents">
|
||||||
<DetailPanel {...detailPanelProps} />
|
<DocumentsTable {...documentsTableProps} />
|
||||||
|
<DetailPanel {...detailPanelProps} />
|
||||||
|
</div>
|
||||||
</DocumentsLayout>
|
</DocumentsLayout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -4951,51 +5016,6 @@ const LoginRoute = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function TagsRoute() {
|
|
||||||
const {
|
|
||||||
tags,
|
|
||||||
refreshTags,
|
|
||||||
handleTagUpdate,
|
|
||||||
handleTagDelete,
|
|
||||||
setStatusMessage,
|
|
||||||
} = useAppShell();
|
|
||||||
return (
|
|
||||||
<main className="panels-main">
|
|
||||||
<TagsPanel
|
|
||||||
tags={tags}
|
|
||||||
onRefresh={refreshTags}
|
|
||||||
onUpdateTag={handleTagUpdate}
|
|
||||||
onDeleteTag={handleTagDelete}
|
|
||||||
onNotify={setStatusMessage}
|
|
||||||
/>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CorrespondentsRoute() {
|
|
||||||
const {
|
|
||||||
correspondents,
|
|
||||||
refreshCorrespondents,
|
|
||||||
handleCorrespondentCreate,
|
|
||||||
handleCorrespondentUpdate,
|
|
||||||
handleCorrespondentDelete,
|
|
||||||
setStatusMessage,
|
|
||||||
} = useAppShell();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<main className="panels-main">
|
|
||||||
<CorrespondentsPanel
|
|
||||||
correspondents={correspondents}
|
|
||||||
onRefresh={refreshCorrespondents}
|
|
||||||
onCreate={handleCorrespondentCreate}
|
|
||||||
onUpdate={handleCorrespondentUpdate}
|
|
||||||
onDelete={handleCorrespondentDelete}
|
|
||||||
onNotify={setStatusMessage}
|
|
||||||
/>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const AppRouter = () => (
|
const AppRouter = () => (
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/account/login" element={<LoginRoute />} />
|
<Route path="/account/login" element={<LoginRoute />} />
|
||||||
@@ -5004,8 +5024,6 @@ const AppRouter = () => (
|
|||||||
<Route path="/documents" element={<DocumentsRoute />} />
|
<Route path="/documents" element={<DocumentsRoute />} />
|
||||||
<Route path="/documents/folder/:folderId" element={<DocumentsRoute />} />
|
<Route path="/documents/folder/:folderId" element={<DocumentsRoute />} />
|
||||||
<Route path="/documents/:documentId" element={<DocumentViewerRoute />} />
|
<Route path="/documents/:documentId" element={<DocumentViewerRoute />} />
|
||||||
<Route path="/tags" element={<TagsRoute />} />
|
|
||||||
<Route path="/correspondents" element={<CorrespondentsRoute />} />
|
|
||||||
<Route path="*" element={<Navigate to="/documents" replace />} />
|
<Route path="*" element={<Navigate to="/documents" replace />} />
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -136,6 +136,18 @@ const Sidebar = ({
|
|||||||
correspondents = [],
|
correspondents = [],
|
||||||
activeCorrespondentIds = [],
|
activeCorrespondentIds = [],
|
||||||
onToggleCorrespondentFilter,
|
onToggleCorrespondentFilter,
|
||||||
|
onManageTags,
|
||||||
|
onManageCorrespondents,
|
||||||
|
searchQuery = '',
|
||||||
|
onSearchChange,
|
||||||
|
onSearchSubmit,
|
||||||
|
onSearchClear,
|
||||||
|
isFilterActive,
|
||||||
|
appStatus,
|
||||||
|
loading,
|
||||||
|
previewActive,
|
||||||
|
onLogout,
|
||||||
|
status,
|
||||||
}) => {
|
}) => {
|
||||||
const sortedCorrespondents = useMemo(
|
const sortedCorrespondents = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -150,6 +162,27 @@ const Sidebar = ({
|
|||||||
);
|
);
|
||||||
const handleToggleTag = onToggleTagFilter || (() => {});
|
const handleToggleTag = onToggleTagFilter || (() => {});
|
||||||
const activeTagSet = new Set(activeTagIds);
|
const activeTagSet = new Set(activeTagIds);
|
||||||
|
const handleManageTags = onManageTags || (() => {});
|
||||||
|
const handleManageCorrespondents = onManageCorrespondents || (() => {});
|
||||||
|
const handleSearchInputChange = useCallback(
|
||||||
|
(event) => {
|
||||||
|
onSearchChange?.(event.target.value);
|
||||||
|
},
|
||||||
|
[onSearchChange],
|
||||||
|
);
|
||||||
|
const handleSearchFormSubmit = useCallback(
|
||||||
|
(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
onSearchSubmit?.();
|
||||||
|
},
|
||||||
|
[onSearchSubmit],
|
||||||
|
);
|
||||||
|
const handleSearchClear = useCallback(() => {
|
||||||
|
onSearchClear?.();
|
||||||
|
}, [onSearchClear]);
|
||||||
|
const handleLogoutClick = useCallback(() => {
|
||||||
|
onLogout?.();
|
||||||
|
}, [onLogout]);
|
||||||
|
|
||||||
const renderNodes = useCallback(
|
const renderNodes = useCallback(
|
||||||
(ids, depth) =>
|
(ids, depth) =>
|
||||||
@@ -193,9 +226,39 @@ const Sidebar = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const rootNode = folderNodes.get('root');
|
const rootNode = folderNodes.get('root');
|
||||||
|
const hintText = appStatus === 'bootstrapping' && loading
|
||||||
|
? 'Loading your library…'
|
||||||
|
: previewActive
|
||||||
|
? 'Viewing document preview. Press ← Back to return to the library.'
|
||||||
|
: 'Drag files here to upload.';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="sidebar column">
|
<aside className="sidebar column">
|
||||||
|
<div className="sidebar__meta">
|
||||||
|
<h1 className="sidebar__title">Papercrate</h1>
|
||||||
|
<span className="sidebar__hint">{hintText}</span>
|
||||||
|
{onSearchChange && (
|
||||||
|
<form className="sidebar__search" onSubmit={handleSearchFormSubmit}>
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={handleSearchInputChange}
|
||||||
|
placeholder="Search documents"
|
||||||
|
aria-label="Search documents"
|
||||||
|
/>
|
||||||
|
{isFilterActive && (
|
||||||
|
<button type="button" onClick={handleSearchClear}>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
{status && (
|
||||||
|
<div className="sidebar__status">
|
||||||
|
<div className={`status-banner ${status.variant}`}>{status.message}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div className="sidebar-section sidebar-section--folders">
|
<div className="sidebar-section sidebar-section--folders">
|
||||||
<div className="sidebar-section__header">
|
<div className="sidebar-section__header">
|
||||||
<h3>Folders</h3>
|
<h3>Folders</h3>
|
||||||
@@ -206,8 +269,14 @@ const Sidebar = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="sidebar-section">
|
<div className="sidebar-section">
|
||||||
<div className="sidebar-section__header">
|
<div className="sidebar-section__header">
|
||||||
<h3>Tags</h3>
|
<button
|
||||||
<span className="meta">{tags.length}</span>
|
type="button"
|
||||||
|
className="sidebar-section__title"
|
||||||
|
onClick={handleManageTags}
|
||||||
|
>
|
||||||
|
<h3>Tags</h3>
|
||||||
|
<span className="meta">{tags.length}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`sidebar-tag-cloud${
|
className={`sidebar-tag-cloud${
|
||||||
@@ -257,8 +326,14 @@ const Sidebar = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="sidebar-section">
|
<div className="sidebar-section">
|
||||||
<div className="sidebar-section__header">
|
<div className="sidebar-section__header">
|
||||||
<h3>Correspondents</h3>
|
<button
|
||||||
<span className="meta">{correspondents.length}</span>
|
type="button"
|
||||||
|
className="sidebar-section__title"
|
||||||
|
onClick={handleManageCorrespondents}
|
||||||
|
>
|
||||||
|
<h3>Correspondents</h3>
|
||||||
|
<span className="meta">{correspondents.length}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<ul className="sidebar-correspondent-list">
|
<ul className="sidebar-correspondent-list">
|
||||||
{sortedCorrespondents.length ? (
|
{sortedCorrespondents.length ? (
|
||||||
@@ -293,6 +368,11 @@ const Sidebar = ({
|
|||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="sidebar__footer">
|
||||||
|
<button className="secondary" type="button" onClick={handleLogoutClick}>
|
||||||
|
Log out
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+157
-180
@@ -4,7 +4,7 @@
|
|||||||
--bg: #f6f6f6;
|
--bg: #f6f6f6;
|
||||||
--surface: #fbfbfb;
|
--surface: #fbfbfb;
|
||||||
--surface-subtle: #f3f3f3;
|
--surface-subtle: #f3f3f3;
|
||||||
--fg: #1e2127;
|
--fg: #2b2b2b;
|
||||||
--muted: #646a75;
|
--muted: #646a75;
|
||||||
--sidebar-fg: #5f6672;
|
--sidebar-fg: #5f6672;
|
||||||
--border: #dde1e6;
|
--border: #dde1e6;
|
||||||
@@ -14,11 +14,9 @@
|
|||||||
--overlay-backdrop: rgba(30, 33, 39, 0.45);
|
--overlay-backdrop: rgba(30, 33, 39, 0.45);
|
||||||
--overlay-shadow: rgba(30, 33, 39, 0.18);
|
--overlay-shadow: rgba(30, 33, 39, 0.18);
|
||||||
|
|
||||||
--app-bar-background: var(--surface-subtle);
|
|
||||||
|
|
||||||
/* Accent (primary action, selection, focus) */
|
/* Accent (primary action, selection, focus) */
|
||||||
--accent: #3f6ad8;
|
--accent: #3f6ad8;
|
||||||
--accent-hover: #365cb9;
|
--accent-hover: #9bb6ff;
|
||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
|
|
||||||
/* Soft tints & outlines (for chips, row hovers, subtle fills) */
|
/* Soft tints & outlines (for chips, row hovers, subtle fills) */
|
||||||
@@ -205,7 +203,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
.view-toggle {
|
.view-toggle {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
@@ -251,151 +248,32 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-bar {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.4rem;
|
|
||||||
padding: 0.6rem 1.5rem 0.4rem;
|
|
||||||
background: var(--app-bar-background);
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__main {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__meta {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.2rem;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__hint {
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__status {
|
|
||||||
margin: 0 1rem;
|
|
||||||
min-width: 220px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__status .status-banner {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__search {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
flex: 1 1 320px;
|
|
||||||
max-width: 420px;
|
|
||||||
min-width: 240px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__search input[type='search'] {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 180px;
|
|
||||||
padding: 0.4rem 0.6rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
background: var(--surface-subtle);
|
|
||||||
color: var(--fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__search input[type='search']:focus {
|
|
||||||
outline: 2px solid var(--accent);
|
|
||||||
outline-offset: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__search-clear {
|
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--accent);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0.2rem 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__search-clear:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__right {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.75rem;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__links {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__link {
|
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--muted);
|
|
||||||
font: inherit;
|
|
||||||
padding: 0.3rem 0.65rem;
|
|
||||||
border-radius: 999px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.35rem;
|
|
||||||
transition: background 0.15s ease, color 0.15s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__link:hover {
|
|
||||||
background: var(--sidebar-hover-bg);
|
|
||||||
color: var(--fg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__link:focus-visible {
|
|
||||||
outline: 2px solid var(--accent);
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__link.active {
|
|
||||||
background: var(--sidebar-active-bg);
|
|
||||||
color: var(--fg);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-bar__link-count {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.documents-main {
|
.documents-main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 20rem minmax(0, 1fr) 30rem;
|
grid-template-columns: 20rem minmax(0, 1fr);
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
background: var(--surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.documents-main .main-content--documents {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) 30rem;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.documents-main .main-content--documents > * {
|
||||||
|
min-width: 0;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.panels-main {
|
.panels-main {
|
||||||
@@ -558,7 +436,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
.preview-workspace__object {
|
.preview-workspace__object {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags-panel__body {
|
.tags-panel__body {
|
||||||
@@ -580,7 +457,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
.tags-table td {
|
.tags-table td {
|
||||||
padding: 0.45rem 0.6rem;
|
padding: 0.45rem 0.6rem;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-bottom: 1px solid var(--divider);
|
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +514,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
width: 2.25rem;
|
width: 2.25rem;
|
||||||
height: 2.25rem;
|
height: 2.25rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: none;
|
|
||||||
background: none;
|
background: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -659,6 +534,24 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tags-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.6rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-actions__form {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-actions__form input[type='text'] {
|
||||||
|
min-width: 14rem;
|
||||||
|
}
|
||||||
|
|
||||||
.correspondents-actions__form {
|
.correspondents-actions__form {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
@@ -680,7 +573,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
border: 1px solid var(--border-subtle);
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.15rem 0.5rem;
|
padding: 0.15rem 0.5rem;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
@@ -729,7 +621,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.preview-workspace__metadata {
|
.preview-workspace__metadata {
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
@@ -744,7 +635,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
|
|
||||||
.column {
|
.column {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -760,7 +650,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0 0 0.5rem;
|
padding: 0 0 0.5rem;
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.column-header__titles {
|
.column-header__titles {
|
||||||
@@ -940,7 +829,69 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
color: var(--sidebar-fg);
|
color: var(--sidebar-fg);
|
||||||
border-right: 1px solid var(--border);
|
box-shadow: inset -12px 0 24px -12px var(--shadow-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__hint {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
margin-top: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__search input[type='search'] {
|
||||||
|
flex: 1;
|
||||||
|
padding: 0.4rem 0.6rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--surface);
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__search button {
|
||||||
|
padding: 0.35rem 0.75rem;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__search button:hover:not([disabled]) {
|
||||||
|
background: var(--sidebar-hover-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__status {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__footer {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar__footer button {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-section:first-of-type,
|
.sidebar-section:first-of-type,
|
||||||
@@ -957,21 +908,45 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 0.75rem;
|
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
text-transform: uppercase;
|
}
|
||||||
letter-spacing: 0.04em;
|
|
||||||
|
.sidebar-section__title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.4rem;
|
||||||
|
width: 100%;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 0.25rem 0.35rem;
|
||||||
|
margin: -0.25rem -0.35rem;
|
||||||
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-section__title:hover:not([disabled]),
|
||||||
|
.sidebar-section__title:focus-visible {
|
||||||
|
background: var(--sidebar-hover-bg);
|
||||||
|
color: var(--fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-section__title:hover:not([disabled]) h3,
|
||||||
|
.sidebar-section__title:focus-visible h3 {
|
||||||
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-section__header h3 {
|
.sidebar-section__header h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.75rem;
|
font-size: 0.9rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-item {
|
.sidebar-item {
|
||||||
border: none;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
padding: 0.16rem 0.26rem;
|
padding: 0.16rem 0.26rem;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@@ -1020,7 +995,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-tag-pill {
|
.sidebar-tag-pill {
|
||||||
border: 1px solid var(--sidebar-pill-border, rgba(15, 23, 42, 0.08));
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.25rem 0.6rem;
|
padding: 0.25rem 0.6rem;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
@@ -1096,7 +1070,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
|
|
||||||
.documents-panel {
|
.documents-panel {
|
||||||
padding: 1.25rem 1.25rem 0 1.25rem;
|
padding: 1.25rem 1.25rem 0 1.25rem;
|
||||||
background-color: var(--surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags-panel,
|
.tags-panel,
|
||||||
@@ -1130,12 +1103,10 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
.documents-panel .column-toolbar {
|
.documents-panel .column-toolbar {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding-bottom: 0.4rem;
|
padding-bottom: 0.4rem;
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.documents-panel .documents-scroll {
|
.documents-panel .documents-scroll {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border: none;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding-right: 0.3rem;
|
padding-right: 0.3rem;
|
||||||
@@ -1149,15 +1120,11 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.documents-panel thead th {
|
.documents-panel thead th {
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
background-color: var(--surface);
|
background-color: var(--surface);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding: 0.45rem 0.6rem;
|
padding: 0.45rem 0.6rem;
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1268,14 +1235,9 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
|
|
||||||
.documents-panel tbody tr {
|
.documents-panel tbody tr {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
transition: background 0.15s ease;
|
transition: background 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.documents-panel tbody tr:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.documents-panel tbody tr:hover {
|
.documents-panel tbody tr:hover {
|
||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1438,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
font-size: 0.74rem;
|
font-size: 0.74rem;
|
||||||
border: 1px solid transparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-chip {
|
.tag-chip {
|
||||||
@@ -1509,7 +1470,7 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
position: relative;
|
position: relative;
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border-left: 1px solid var(--border);
|
box-shadow: 0 0 24px var(--shadow-faint);
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-panel .column-body {
|
.detail-panel .column-body {
|
||||||
@@ -1535,7 +1496,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
background: var(--surface-soft);
|
background: var(--surface-soft);
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
|
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
|
||||||
}
|
}
|
||||||
@@ -1553,7 +1513,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 360px;
|
min-height: 360px;
|
||||||
height: 60vh;
|
height: 60vh;
|
||||||
border: none;
|
|
||||||
background: var(--surface-subtle);
|
background: var(--surface-subtle);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
|
box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
|
||||||
@@ -1582,7 +1541,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
|
|
||||||
.preview-pane {
|
.preview-pane {
|
||||||
margin-top: 0.4rem;
|
margin-top: 0.4rem;
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
min-height: 220px;
|
min-height: 220px;
|
||||||
@@ -1745,7 +1703,6 @@ button.icon-button.ghost:hover:not([disabled]) {
|
|||||||
height: 2.2em;
|
height: 2.2em;
|
||||||
padding: 0.45em;
|
padding: 0.45em;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
border: none;
|
|
||||||
background: rgba(0, 0, 0, 0.55);
|
background: rgba(0, 0, 0, 0.55);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -1930,7 +1887,6 @@ form.inline {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border: 1px solid var(--border);
|
|
||||||
}
|
}
|
||||||
.modal-backdrop {
|
.modal-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -1945,7 +1901,6 @@ form.inline {
|
|||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-shadow: 0 18px 42px var(--overlay-shadow);
|
box-shadow: 0 18px 42px var(--overlay-shadow);
|
||||||
width: min(360px, 100%);
|
width: min(360px, 100%);
|
||||||
@@ -1955,6 +1910,29 @@ form.inline {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal--panel {
|
||||||
|
width: min(80vw, 960px);
|
||||||
|
max-height: 90vh;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-modal__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 1rem 1.5rem;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-modal__body {
|
||||||
|
flex: 1;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.modal h3 {
|
.modal h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.15rem;
|
font-size: 1.15rem;
|
||||||
@@ -2014,7 +1992,6 @@ form.inline {
|
|||||||
.login-card {
|
.login-card {
|
||||||
width: min(340px, 100%);
|
width: min(340px, 100%);
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 1.75rem;
|
padding: 1.75rem;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { getTagColorStyle, HEX_COLOR_PATTERN } from '../utils/colors';
|
import { getTagColorStyle, HEX_COLOR_PATTERN } from '../utils/colors';
|
||||||
|
|
||||||
function TagsPanel({ tags, onRefresh, onUpdateTag, onDeleteTag, onNotify }) {
|
function TagsPanel({
|
||||||
|
tags,
|
||||||
|
onRefresh,
|
||||||
|
onCreateTag,
|
||||||
|
onUpdateTag,
|
||||||
|
onDeleteTag,
|
||||||
|
onNotify,
|
||||||
|
}) {
|
||||||
const [editingId, setEditingId] = useState(null);
|
const [editingId, setEditingId] = useState(null);
|
||||||
const [draftLabel, setDraftLabel] = useState('');
|
const [draftLabel, setDraftLabel] = useState('');
|
||||||
const [draftColor, setDraftColor] = useState('');
|
const [draftColor, setDraftColor] = useState('');
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
const [deletingId, setDeletingId] = useState(null);
|
const [deletingId, setDeletingId] = useState(null);
|
||||||
|
const [createLabel, setCreateLabel] = useState('');
|
||||||
|
const [createColor, setCreateColor] = useState('');
|
||||||
|
const [creating, setCreating] = useState(false);
|
||||||
|
|
||||||
const startEdit = useCallback((tag) => {
|
const startEdit = useCallback((tag) => {
|
||||||
setEditingId(tag.id);
|
setEditingId(tag.id);
|
||||||
@@ -98,6 +108,44 @@ function TagsPanel({ tags, onRefresh, onUpdateTag, onDeleteTag, onNotify }) {
|
|||||||
[onDeleteTag, editingId, cancelEdit, onNotify],
|
[onDeleteTag, editingId, cancelEdit, onNotify],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleCreate = useCallback(
|
||||||
|
async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (typeof onCreateTag !== 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const trimmedLabel = createLabel.trim();
|
||||||
|
if (!trimmedLabel) {
|
||||||
|
onNotify?.('Tag label cannot be empty.', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const trimmedColor = createColor.trim();
|
||||||
|
const colorPattern = /^#([0-9a-fA-F]{6})$/;
|
||||||
|
if (trimmedColor && !colorPattern.test(trimmedColor)) {
|
||||||
|
onNotify?.('Colors must use the #RRGGBB format.', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setCreating(true);
|
||||||
|
try {
|
||||||
|
await onCreateTag({
|
||||||
|
label: trimmedLabel,
|
||||||
|
color: trimmedColor ? trimmedColor : null,
|
||||||
|
});
|
||||||
|
setCreateLabel('');
|
||||||
|
setCreateColor('');
|
||||||
|
} catch (createError) {
|
||||||
|
const message = createError?.message || 'Failed to create tag.';
|
||||||
|
onNotify?.(message, 'error');
|
||||||
|
} finally {
|
||||||
|
setCreating(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[createLabel, createColor, onCreateTag, onNotify],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="tags-panel column">
|
<section className="tags-panel column">
|
||||||
<div className="column-header">
|
<div className="column-header">
|
||||||
@@ -105,12 +153,42 @@ function TagsPanel({ tags, onRefresh, onUpdateTag, onDeleteTag, onNotify }) {
|
|||||||
<h2>Tags</h2>
|
<h2>Tags</h2>
|
||||||
<div className="column-subtitle">{tags.length} total</div>
|
<div className="column-subtitle">{tags.length} total</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="header-actions">
|
<div className="header-actions tags-actions">
|
||||||
|
<form className="tags-actions__form" onSubmit={handleCreate}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="New tag label"
|
||||||
|
value={createLabel}
|
||||||
|
onChange={(event) => setCreateLabel(event.target.value)}
|
||||||
|
disabled={creating}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
className="tags-table__color-picker"
|
||||||
|
value={createColor || '#3366ff'}
|
||||||
|
onChange={(event) => setCreateColor(event.target.value)}
|
||||||
|
disabled={creating}
|
||||||
|
aria-label="Tag color (optional)"
|
||||||
|
/>
|
||||||
|
{createColor && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="secondary"
|
||||||
|
onClick={() => setCreateColor('')}
|
||||||
|
disabled={creating}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<button type="submit" disabled={creating || !createLabel.trim()}>
|
||||||
|
{creating ? 'Creating…' : 'Create'}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
<button
|
<button
|
||||||
className="secondary"
|
className="secondary"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onRefresh}
|
onClick={onRefresh}
|
||||||
disabled={saving || Boolean(deletingId)}
|
disabled={saving || creating || Boolean(deletingId)}
|
||||||
>
|
>
|
||||||
Refresh
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user