mirror of
https://github.com/docmost/docmost.git
synced 2026-08-26 00:07:04 +08:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14840ef065 | ||
|
|
83d7ee4460 | ||
|
|
fc90fbd8c0 | ||
|
|
a0ec93506c | ||
|
|
a415b86193 | ||
|
|
702f8b7a41 | ||
|
|
95cef61927 | ||
|
|
7bd73f77a4 |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
FROM node:26-slim AS base
|
FROM node:26-slim AS base
|
||||||
LABEL org.opencontainers.image.source="https://github.com/docmost/docmost"
|
LABEL org.opencontainers.image.source="https://github.com/docmost/docmost"
|
||||||
|
|
||||||
RUN npm install -g pnpm@11.15.1
|
RUN npm install -g pnpm@11.23.0
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
|
|||||||
+77
-45
@@ -1,60 +1,92 @@
|
|||||||
|
import { lazy, Suspense, useEffect } from "react";
|
||||||
import { Navigate, Route, Routes } from "react-router-dom";
|
import { Navigate, Route, Routes } from "react-router-dom";
|
||||||
import SetupWorkspace from "@/pages/auth/setup-workspace.tsx";
|
|
||||||
import LoginPage from "@/pages/auth/login";
|
|
||||||
import Home from "@/pages/dashboard/home";
|
|
||||||
import Page from "@/pages/page/page";
|
|
||||||
import AccountSettings from "@/pages/settings/account/account-settings";
|
|
||||||
import WorkspaceMembers from "@/pages/settings/workspace/workspace-members";
|
|
||||||
import WorkspaceSettings from "@/pages/settings/workspace/workspace-settings";
|
|
||||||
import Groups from "@/pages/settings/group/groups";
|
|
||||||
import GroupInfo from "./pages/settings/group/group-info";
|
|
||||||
import Spaces from "@/pages/settings/space/spaces.tsx";
|
|
||||||
import { Error404 } from "@/components/ui/error-404.tsx";
|
|
||||||
import AccountPreferences from "@/pages/settings/account/account-preferences.tsx";
|
|
||||||
import SpaceHome from "@/pages/space/space-home.tsx";
|
|
||||||
import PageRedirect from "@/pages/page/page-redirect.tsx";
|
|
||||||
import Layout from "@/components/layouts/global/layout.tsx";
|
import Layout from "@/components/layouts/global/layout.tsx";
|
||||||
import InviteSignup from "@/pages/auth/invite-signup.tsx";
|
import { Error404 } from "@/components/ui/error-404.tsx";
|
||||||
import ForgotPassword from "@/pages/auth/forgot-password.tsx";
|
|
||||||
import PasswordReset from "./pages/auth/password-reset";
|
|
||||||
import Billing from "@/ee/billing/pages/billing.tsx";
|
|
||||||
import CloudLogin from "@/ee/pages/cloud-login.tsx";
|
|
||||||
import CreateWorkspace from "@/ee/pages/create-workspace.tsx";
|
|
||||||
import { isCloud } from "@/lib/config.ts";
|
import { isCloud } from "@/lib/config.ts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import Security from "@/ee/security/pages/security.tsx";
|
|
||||||
import License from "@/ee/licence/pages/license.tsx";
|
|
||||||
import { useRedirectToCloudSelect } from "@/ee/hooks/use-redirect-to-cloud-select.tsx";
|
import { useRedirectToCloudSelect } from "@/ee/hooks/use-redirect-to-cloud-select.tsx";
|
||||||
import SharedPage from "@/pages/share/shared-page.tsx";
|
|
||||||
import PdfRenderPage from "@/ee/pdf-export/pdf-render-page.tsx";
|
|
||||||
import Shares from "@/pages/settings/shares/shares.tsx";
|
|
||||||
import ShareLayout from "@/features/share/components/share-layout.tsx";
|
|
||||||
import ShareRedirect from "@/pages/share/share-redirect.tsx";
|
|
||||||
import { useTrackOrigin } from "@/hooks/use-track-origin";
|
import { useTrackOrigin } from "@/hooks/use-track-origin";
|
||||||
import SpacesPage from "@/pages/spaces/spaces.tsx";
|
|
||||||
import { MfaChallengePage } from "@/ee/mfa/pages/mfa-challenge-page";
|
const SetupWorkspace = lazy(() => import("@/pages/auth/setup-workspace.tsx"));
|
||||||
import { MfaSetupRequiredPage } from "@/ee/mfa/pages/mfa-setup-required-page";
|
const LoginPage = lazy(() => import("@/pages/auth/login"));
|
||||||
import SpaceTrash from "@/pages/space/space-trash.tsx";
|
const Home = lazy(() => import("@/pages/dashboard/home"));
|
||||||
import UserApiKeys from "@/ee/api-key/pages/user-api-keys";
|
const Page = lazy(() => import("@/pages/page/page"));
|
||||||
import WorkspaceApiKeys from "@/ee/api-key/pages/workspace-api-keys";
|
const AccountSettings = lazy(
|
||||||
import AiSettings from "@/ee/ai/pages/ai-settings.tsx";
|
() => import("@/pages/settings/account/account-settings"),
|
||||||
import BasePage from "@/ee/base/pages/base-page.tsx";
|
);
|
||||||
import AuditLogs from "@/ee/audit/pages/audit-logs.tsx";
|
const WorkspaceMembers = lazy(
|
||||||
import VerifiedPages from "@/ee/page-verification/pages/verified-pages.tsx";
|
() => import("@/pages/settings/workspace/workspace-members"),
|
||||||
import TemplateList from "@/ee/template/pages/template-list";
|
);
|
||||||
import TemplateEditor from "@/ee/template/pages/template-editor";
|
const WorkspaceSettings = lazy(
|
||||||
import FavoritesPage from "@/pages/favorites/favorites-page";
|
() => import("@/pages/settings/workspace/workspace-settings"),
|
||||||
import AiChat from "@/ee/ai-chat/pages/ai-chat.tsx";
|
);
|
||||||
import VerifyEmail from "@/ee/pages/verify-email.tsx";
|
const Groups = lazy(() => import("@/pages/settings/group/groups"));
|
||||||
import LabelPage from "@/pages/label/label-page";
|
const GroupInfo = lazy(() => import("./pages/settings/group/group-info"));
|
||||||
|
const Spaces = lazy(() => import("@/pages/settings/space/spaces.tsx"));
|
||||||
|
const AccountPreferences = lazy(
|
||||||
|
() => import("@/pages/settings/account/account-preferences.tsx"),
|
||||||
|
);
|
||||||
|
const SpaceHome = lazy(() => import("@/pages/space/space-home.tsx"));
|
||||||
|
const PageRedirect = lazy(() => import("@/pages/page/page-redirect.tsx"));
|
||||||
|
const InviteSignup = lazy(() => import("@/pages/auth/invite-signup.tsx"));
|
||||||
|
const ForgotPassword = lazy(() => import("@/pages/auth/forgot-password.tsx"));
|
||||||
|
const PasswordReset = lazy(() => import("./pages/auth/password-reset"));
|
||||||
|
const Billing = lazy(() => import("@/ee/billing/pages/billing.tsx"));
|
||||||
|
const CloudLogin = lazy(() => import("@/ee/pages/cloud-login.tsx"));
|
||||||
|
const CreateWorkspace = lazy(() => import("@/ee/pages/create-workspace.tsx"));
|
||||||
|
const Security = lazy(() => import("@/ee/security/pages/security.tsx"));
|
||||||
|
const License = lazy(() => import("@/ee/licence/pages/license.tsx"));
|
||||||
|
const SharedPage = lazy(() => import("@/pages/share/shared-page.tsx"));
|
||||||
|
const PdfRenderPage = lazy(() => import("@/ee/pdf-export/pdf-render-page.tsx"));
|
||||||
|
const Shares = lazy(() => import("@/pages/settings/shares/shares.tsx"));
|
||||||
|
const ShareLayout = lazy(
|
||||||
|
() => import("@/features/share/components/share-layout.tsx"),
|
||||||
|
);
|
||||||
|
const ShareRedirect = lazy(() => import("@/pages/share/share-redirect.tsx"));
|
||||||
|
const SpacesPage = lazy(() => import("@/pages/spaces/spaces.tsx"));
|
||||||
|
const MfaChallengePage = lazy(() =>
|
||||||
|
import("@/ee/mfa/pages/mfa-challenge-page").then((m) => ({
|
||||||
|
default: m.MfaChallengePage,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
const MfaSetupRequiredPage = lazy(() =>
|
||||||
|
import("@/ee/mfa/pages/mfa-setup-required-page").then((m) => ({
|
||||||
|
default: m.MfaSetupRequiredPage,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
const SpaceTrash = lazy(() => import("@/pages/space/space-trash.tsx"));
|
||||||
|
const UserApiKeys = lazy(() => import("@/ee/api-key/pages/user-api-keys"));
|
||||||
|
const WorkspaceApiKeys = lazy(
|
||||||
|
() => import("@/ee/api-key/pages/workspace-api-keys"),
|
||||||
|
);
|
||||||
|
const AiSettings = lazy(() => import("@/ee/ai/pages/ai-settings.tsx"));
|
||||||
|
const BasePage = lazy(() => import("@/ee/base/pages/base-page.tsx"));
|
||||||
|
const AuditLogs = lazy(() => import("@/ee/audit/pages/audit-logs.tsx"));
|
||||||
|
const VerifiedPages = lazy(
|
||||||
|
() => import("@/ee/page-verification/pages/verified-pages.tsx"),
|
||||||
|
);
|
||||||
|
const TemplateList = lazy(() => import("@/ee/template/pages/template-list"));
|
||||||
|
const TemplateEditor = lazy(
|
||||||
|
() => import("@/ee/template/pages/template-editor"),
|
||||||
|
);
|
||||||
|
const FavoritesPage = lazy(() => import("@/pages/favorites/favorites-page"));
|
||||||
|
const AiChat = lazy(() => import("@/ee/ai-chat/pages/ai-chat.tsx"));
|
||||||
|
const VerifyEmail = lazy(() => import("@/ee/pages/verify-email.tsx"));
|
||||||
|
const LabelPage = lazy(() => import("@/pages/label/label-page"));
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
useRedirectToCloudSelect();
|
useRedirectToCloudSelect();
|
||||||
useTrackOrigin();
|
useTrackOrigin();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// warm the editor chunk so opening a page doesn't wait on the network
|
||||||
|
const timer = setTimeout(() => import("@/pages/page/page"), 3000);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Suspense fallback={null}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route index element={<Navigate to="/home" />} />
|
<Route index element={<Navigate to="/home" />} />
|
||||||
<Route path={"/login"} element={<LoginPage />} />
|
<Route path={"/login"} element={<LoginPage />} />
|
||||||
@@ -135,6 +167,6 @@ export default function App() {
|
|||||||
|
|
||||||
<Route path="*" element={<Error404 />} />
|
<Route path="*" element={<Error404 />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,30 @@
|
|||||||
import { ActionIcon, Box, Group, ScrollArea, Title, Tooltip } from "@mantine/core";
|
import { ActionIcon, Box, Group, ScrollArea, Title, Tooltip } from "@mantine/core";
|
||||||
import { IconX } from "@tabler/icons-react";
|
import { IconX } from "@tabler/icons-react";
|
||||||
import CommentListWithTabs from "@/features/comment/components/comment-list-with-tabs.tsx";
|
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { asideStateAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
import { asideStateAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
||||||
import React, { ReactNode, useEffect } from "react";
|
import React, { lazy, ReactNode, Suspense, useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { TableOfContents } from "@/features/editor/components/table-of-contents/table-of-contents.tsx";
|
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import { pageEditorAtom } from "@/features/editor/atoms/editor-atoms.ts";
|
import { pageEditorAtom } from "@/features/editor/atoms/editor-atoms.ts";
|
||||||
import AsideChatPanel from "@/ee/ai-chat/components/aside-chat-panel";
|
|
||||||
import { PageDetailsAside } from "@/features/page-details/components/page-details-aside.tsx";
|
|
||||||
import { ASIDE_PANEL_ID } from "@/hooks/use-toggle-aside.tsx";
|
import { ASIDE_PANEL_ID } from "@/hooks/use-toggle-aside.tsx";
|
||||||
|
|
||||||
|
const CommentListWithTabs = lazy(
|
||||||
|
() => import("@/features/comment/components/comment-list-with-tabs.tsx"),
|
||||||
|
);
|
||||||
|
const TableOfContents = lazy(() =>
|
||||||
|
import(
|
||||||
|
"@/features/editor/components/table-of-contents/table-of-contents.tsx"
|
||||||
|
).then((m) => ({ default: m.TableOfContents })),
|
||||||
|
);
|
||||||
|
const AsideChatPanel = lazy(
|
||||||
|
() => import("@/ee/ai-chat/components/aside-chat-panel"),
|
||||||
|
);
|
||||||
|
const PageDetailsAside = lazy(() =>
|
||||||
|
import("@/features/page-details/components/page-details-aside.tsx").then(
|
||||||
|
(m) => ({ default: m.PageDetailsAside }),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
export default function Aside() {
|
export default function Aside() {
|
||||||
const [{ tab, isAsideOpen }, setAsideState] = useAtom(asideStateAtom);
|
const [{ tab, isAsideOpen }, setAsideState] = useAtom(asideStateAtom);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -68,17 +81,19 @@ export default function Aside() {
|
|||||||
</Group>
|
</Group>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{tab === "comments" || tab === "chat" ? (
|
<Suspense fallback={null}>
|
||||||
component
|
{tab === "comments" || tab === "chat" ? (
|
||||||
) : (
|
component
|
||||||
<ScrollArea
|
) : (
|
||||||
style={{ height: "85vh" }}
|
<ScrollArea
|
||||||
scrollbarSize={5}
|
style={{ height: "85vh" }}
|
||||||
type="scroll"
|
scrollbarSize={5}
|
||||||
>
|
type="scroll"
|
||||||
<div style={{ paddingBottom: "200px" }}>{component}</div>
|
>
|
||||||
</ScrollArea>
|
<div style={{ paddingBottom: "200px" }}>{component}</div>
|
||||||
)}
|
</ScrollArea>
|
||||||
|
)}
|
||||||
|
</Suspense>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import {
|
|||||||
sidebarWidthAtom,
|
sidebarWidthAtom,
|
||||||
} from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
} from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
||||||
import { SpaceSidebar } from "@/features/space/components/sidebar/space-sidebar.tsx";
|
import { SpaceSidebar } from "@/features/space/components/sidebar/space-sidebar.tsx";
|
||||||
import AiChatSidebar from "@/ee/ai-chat/components/ai-chat-sidebar.tsx";
|
|
||||||
|
const AiChatSidebar = React.lazy(
|
||||||
|
() => import("@/ee/ai-chat/components/ai-chat-sidebar.tsx"),
|
||||||
|
);
|
||||||
import { AppHeader } from "@/components/layouts/global/app-header.tsx";
|
import { AppHeader } from "@/components/layouts/global/app-header.tsx";
|
||||||
import Aside from "@/components/layouts/global/aside.tsx";
|
import Aside from "@/components/layouts/global/aside.tsx";
|
||||||
import classes from "./app-shell.module.css";
|
import classes from "./app-shell.module.css";
|
||||||
@@ -126,7 +129,11 @@ export default function GlobalAppShell({
|
|||||||
)}
|
)}
|
||||||
{isSpaceRoute && <SpaceSidebar />}
|
{isSpaceRoute && <SpaceSidebar />}
|
||||||
{isSettingsRoute && <SettingsSidebar />}
|
{isSettingsRoute && <SettingsSidebar />}
|
||||||
{isAiRoute && <AiChatSidebar />}
|
{isAiRoute && (
|
||||||
|
<React.Suspense fallback={null}>
|
||||||
|
<AiChatSidebar />
|
||||||
|
</React.Suspense>
|
||||||
|
)}
|
||||||
{showGlobalSidebar && <GlobalSidebar />}
|
{showGlobalSidebar && <GlobalSidebar />}
|
||||||
</AppShell.Navbar>
|
</AppShell.Navbar>
|
||||||
<AppShell.Main id={MAIN_CONTENT_ID} tabIndex={-1}>
|
<AppShell.Main id={MAIN_CONTENT_ID} tabIndex={-1}>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
Button,
|
Button,
|
||||||
|
MultiSelect,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconPlus, IconTrash } from "@tabler/icons-react";
|
import { IconPlus, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import {
|
||||||
@@ -52,6 +53,9 @@ const NO_VALUE_OPERATORS: FilterOperator[] = ["isEmpty", "isNotEmpty"];
|
|||||||
// stored value so a stale shape isn't sent to the engine.
|
// stored value so a stale shape isn't sent to the engine.
|
||||||
function valueClass(op: FilterOperator, inputKind: string): string {
|
function valueClass(op: FilterOperator, inputKind: string): string {
|
||||||
if (NO_VALUE_OPERATORS.includes(op)) return "none";
|
if (NO_VALUE_OPERATORS.includes(op)) return "none";
|
||||||
|
if (inputKind === "choices") {
|
||||||
|
return op === "any" || op === "none" ? "choicesMulti" : "choicesSingle";
|
||||||
|
}
|
||||||
if (inputKind === "person") {
|
if (inputKind === "person") {
|
||||||
return op === "any" || op === "none" ? "personMulti" : "personSingle";
|
return op === "any" || op === "none" ? "personMulti" : "personSingle";
|
||||||
}
|
}
|
||||||
@@ -70,6 +74,10 @@ function getOperatorsForType(type: string): FilterOperator[] {
|
|||||||
DEFAULT_FILTER_OPERATORS) as FilterOperator[];
|
DEFAULT_FILTER_OPERATORS) as FilterOperator[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isMultiChoice(op: FilterCondition["op"]): boolean {
|
||||||
|
return op === "any" || op === "none";
|
||||||
|
}
|
||||||
|
|
||||||
function FilterValueInput({
|
function FilterValueInput({
|
||||||
condition,
|
condition,
|
||||||
property,
|
property,
|
||||||
@@ -121,6 +129,32 @@ function FilterValueInput({
|
|||||||
const typeOptions = property.typeOptions as SelectTypeOptions | undefined;
|
const typeOptions = property.typeOptions as SelectTypeOptions | undefined;
|
||||||
const choices = typeOptions?.choices ?? [];
|
const choices = typeOptions?.choices ?? [];
|
||||||
const choiceOptions = choices.map((c) => ({ value: c.id, label: c.name }));
|
const choiceOptions = choices.map((c) => ({ value: c.id, label: c.name }));
|
||||||
|
|
||||||
|
if (isMultiChoice(condition.op)) {
|
||||||
|
const { value } = condition;
|
||||||
|
const selected = (
|
||||||
|
Array.isArray(value) ? value : value ? [value] : []
|
||||||
|
).filter((id) => choices.some((c) => c.id === id));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MultiSelect
|
||||||
|
size="xs"
|
||||||
|
data={choiceOptions}
|
||||||
|
comboboxProps={{ withinPortal: false }}
|
||||||
|
value={selected}
|
||||||
|
onChange={(values) => onChange(values)}
|
||||||
|
w={160}
|
||||||
|
styles={{
|
||||||
|
pillsList: {
|
||||||
|
maxHeight: 70,
|
||||||
|
overflowY: "auto",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
maxDropdownHeight={220}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
size="xs"
|
size="xs"
|
||||||
@@ -199,11 +233,18 @@ export function ViewFilterConfigPopover({
|
|||||||
label: p.name,
|
label: p.name,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const [unSaved, setUnSaved] = useState(false)
|
||||||
const [draft, setDraft] = useState<FilterCondition | null>(null);
|
const [draft, setDraft] = useState<FilterCondition | null>(null);
|
||||||
|
const [draftConditions, setDraftConditions] =
|
||||||
|
useState<FilterCondition[]>(conditions);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!opened) setDraft(null);
|
if (opened) {
|
||||||
}, [opened]);
|
setDraftConditions(conditions);
|
||||||
|
setDraft(null);
|
||||||
|
setUnSaved(false)
|
||||||
|
}
|
||||||
|
}, [opened, conditions]);
|
||||||
|
|
||||||
const handleStartDraft = useCallback(() => {
|
const handleStartDraft = useCallback(() => {
|
||||||
const firstProperty = properties[0];
|
const firstProperty = properties[0];
|
||||||
@@ -216,14 +257,21 @@ export function ViewFilterConfigPopover({
|
|||||||
}, [properties]);
|
}, [properties]);
|
||||||
|
|
||||||
const handleSaveDraft = useCallback(() => {
|
const handleSaveDraft = useCallback(() => {
|
||||||
if (!draft) return;
|
const nextConditions = draft
|
||||||
onChange([...conditions, draft]);
|
? [...draftConditions, draft]
|
||||||
|
: draftConditions;
|
||||||
|
|
||||||
|
onChange(nextConditions);
|
||||||
setDraft(null);
|
setDraft(null);
|
||||||
}, [draft, conditions, onChange]);
|
setUnSaved(false)
|
||||||
|
|
||||||
|
}, [draft, draftConditions, onChange]);
|
||||||
|
|
||||||
const handleCancelDraft = useCallback(() => {
|
const handleCancelDraft = useCallback(() => {
|
||||||
|
setDraftConditions(conditions)
|
||||||
setDraft(null);
|
setDraft(null);
|
||||||
}, []);
|
setUnSaved(false)
|
||||||
|
}, [conditions]);
|
||||||
|
|
||||||
const handleDraftPropertyChange = useCallback(
|
const handleDraftPropertyChange = useCallback(
|
||||||
(propertyId: string | null) => {
|
(propertyId: string | null) => {
|
||||||
@@ -272,17 +320,19 @@ export function ViewFilterConfigPopover({
|
|||||||
|
|
||||||
const handleRemove = useCallback(
|
const handleRemove = useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
onChange(conditions.filter((_, i) => i !== index));
|
setUnSaved(true);
|
||||||
|
setDraftConditions((current) => current.filter((_, i) => i !== index));
|
||||||
},
|
},
|
||||||
[conditions, onChange],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handlePropertyChange = useCallback(
|
const handlePropertyChange = useCallback(
|
||||||
(index: number, propertyId: string | null) => {
|
(index: number, propertyId: string | null) => {
|
||||||
if (!propertyId) return;
|
if (!propertyId) return;
|
||||||
const newProperty = properties.find((p) => p.id === propertyId);
|
const newProperty = properties.find((p) => p.id === propertyId);
|
||||||
onChange(
|
setUnSaved(true)
|
||||||
conditions.map((f, i) => {
|
setDraftConditions((current) =>
|
||||||
|
current.map((f, i) => {
|
||||||
if (i !== index) return f;
|
if (i !== index) return f;
|
||||||
if (newProperty) {
|
if (newProperty) {
|
||||||
const validOperators = getOperatorsForType(newProperty.type);
|
const validOperators = getOperatorsForType(newProperty.type);
|
||||||
@@ -302,15 +352,16 @@ export function ViewFilterConfigPopover({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[conditions, properties, onChange],
|
[properties],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleOperatorChange = useCallback(
|
const handleOperatorChange = useCallback(
|
||||||
(index: number, operator: string | null) => {
|
(index: number, operator: string | null) => {
|
||||||
if (!operator) return;
|
if (!operator) return;
|
||||||
const op = operator as FilterOperator;
|
const op = operator as FilterOperator;
|
||||||
onChange(
|
setUnSaved(true)
|
||||||
conditions.map((f, i) => {
|
setDraftConditions((current) =>
|
||||||
|
current.map((f, i) => {
|
||||||
if (i !== index) return f;
|
if (i !== index) return f;
|
||||||
const kind = inputKindForProperty(
|
const kind = inputKindForProperty(
|
||||||
properties.find((p) => p.id === f.propertyId),
|
properties.find((p) => p.id === f.propertyId),
|
||||||
@@ -320,16 +371,17 @@ export function ViewFilterConfigPopover({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[conditions, properties, onChange],
|
[properties],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleValueChange = useCallback(
|
const handleValueChange = useCallback(
|
||||||
(index: number, value: unknown) => {
|
(index: number, value: unknown) => {
|
||||||
onChange(
|
setUnSaved(true)
|
||||||
conditions.map((f, i) => (i === index ? { ...f, value } : f)),
|
setDraftConditions((current) =>
|
||||||
|
current.map((f, i) => (i === index ? { ...f, value } : f)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[conditions, onChange],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -362,13 +414,13 @@ export function ViewFilterConfigPopover({
|
|||||||
{t("Filter by")}
|
{t("Filter by")}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{conditions.length === 0 && !draft && (
|
{draftConditions.length === 0 && !draft && (
|
||||||
<Text size="xs" c="dimmed">
|
<Text size="xs" c="dimmed">
|
||||||
{t("No filters applied")}
|
{t("No filters applied")}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{conditions.map((condition, index) => {
|
{draftConditions.map((condition, index) => {
|
||||||
const needsValue = !NO_VALUE_OPERATORS.includes(condition.op);
|
const needsValue = !NO_VALUE_OPERATORS.includes(condition.op);
|
||||||
const property = properties.find(
|
const property = properties.find(
|
||||||
(p) => p.id === condition.propertyId,
|
(p) => p.id === condition.propertyId,
|
||||||
@@ -471,14 +523,6 @@ export function ViewFilterConfigPopover({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
<Group justify="flex-end" gap="xs">
|
|
||||||
<Button variant="default" size="xs" onClick={handleCancelDraft}>
|
|
||||||
{t("Cancel")}
|
|
||||||
</Button>
|
|
||||||
<Button size="xs" onClick={handleSaveDraft}>
|
|
||||||
{t("Save")}
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
})()}
|
})()}
|
||||||
@@ -492,6 +536,20 @@ export function ViewFilterConfigPopover({
|
|||||||
{t("Add filter")}
|
{t("Add filter")}
|
||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
)}
|
)}
|
||||||
|
<Group justify="flex-end" gap="xs">
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
size="xs"
|
||||||
|
onClick={handleCancelDraft}
|
||||||
|
disabled={!draft && !unSaved}
|
||||||
|
>
|
||||||
|
{t("Cancel")}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button size="xs" onClick={handleSaveDraft} disabled={!draft && !unSaved}>
|
||||||
|
{t("Save")}
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Popover.Dropdown>
|
</Popover.Dropdown>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -250,6 +250,17 @@ function CollabPageEditor({
|
|||||||
return [...mainExtensions, ...collabExtensions(provider, currentUser.user)];
|
return [...mainExtensions, ...collabExtensions(provider, currentUser.user)];
|
||||||
}, [provider, currentUser?.user]);
|
}, [provider, currentUser?.user]);
|
||||||
|
|
||||||
|
const debouncedUpdateContent = useDebouncedCallback((newContent: any) => {
|
||||||
|
const pageData = queryClient.getQueryData<IPage>(["pages", slugId]);
|
||||||
|
|
||||||
|
if (pageData) {
|
||||||
|
queryClient.setQueryData(["pages", slugId], {
|
||||||
|
...pageData,
|
||||||
|
content: newContent,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
const editor = useEditor(
|
const editor = useEditor(
|
||||||
{
|
{
|
||||||
extensions,
|
extensions,
|
||||||
@@ -364,17 +375,6 @@ function CollabPageEditor({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const debouncedUpdateContent = useDebouncedCallback((newContent: any) => {
|
|
||||||
const pageData = queryClient.getQueryData<IPage>(["pages", slugId]);
|
|
||||||
|
|
||||||
if (pageData) {
|
|
||||||
queryClient.setQueryData(["pages", slugId], {
|
|
||||||
...pageData,
|
|
||||||
content: newContent,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
const handleActiveCommentEvent = (event) => {
|
const handleActiveCommentEvent = (event) => {
|
||||||
const { commentId, resolved } = event.detail;
|
const { commentId, resolved } = event.detail;
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ import {
|
|||||||
import { mobileSidebarAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
import { mobileSidebarAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
||||||
import { useToggleSidebar } from "@/components/layouts/global/hooks/hooks/use-toggle-sidebar.ts";
|
import { useToggleSidebar } from "@/components/layouts/global/hooks/hooks/use-toggle-sidebar.ts";
|
||||||
import { searchSpotlight } from "@/features/search/constants";
|
import { searchSpotlight } from "@/features/search/constants";
|
||||||
import TemplatePickerModal from "@/ee/template/components/template-picker-modal";
|
const TemplatePickerModal = React.lazy(
|
||||||
|
() => import("@/ee/template/components/template-picker-modal"),
|
||||||
|
);
|
||||||
import { useHasFeature } from "@/ee/hooks/use-feature";
|
import { useHasFeature } from "@/ee/hooks/use-feature";
|
||||||
import { useUpgradeLabel } from "@/ee/hooks/use-upgrade-label";
|
import { useUpgradeLabel } from "@/ee/hooks/use-upgrade-label";
|
||||||
import { Feature } from "@/ee/features";
|
import { Feature } from "@/ee/features";
|
||||||
@@ -406,11 +408,13 @@ function SpaceMenu({
|
|||||||
|
|
||||||
{hasTemplates && templatePickerOpened && (
|
{hasTemplates && templatePickerOpened && (
|
||||||
<ErrorBoundary fallbackRender={() => null}>
|
<ErrorBoundary fallbackRender={() => null}>
|
||||||
<TemplatePickerModal
|
<React.Suspense fallback={null}>
|
||||||
opened={templatePickerOpened}
|
<TemplatePickerModal
|
||||||
onClose={closeTemplatePicker}
|
opened={templatePickerOpened}
|
||||||
initialSpaceId={spaceId}
|
onClose={closeTemplatePicker}
|
||||||
/>
|
initialSpaceId={spaceId}
|
||||||
|
/>
|
||||||
|
</React.Suspense>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export class SearchService {
|
|||||||
const rankColumn = browseByFilters
|
const rankColumn = browseByFilters
|
||||||
? sql<number>`0`.as('rank')
|
? sql<number>`0`.as('rank')
|
||||||
: titleOnly
|
: titleOnly
|
||||||
? sql<number>`word_similarity(lower(f_unaccent(${titleQuery})), lower(f_unaccent(pages.title)))`.as(
|
? sql<number>`word_similarity(lower(${titleQuery}), lower(pages.title))`.as(
|
||||||
'rank',
|
'rank',
|
||||||
)
|
)
|
||||||
: sql<number>`ts_rank(tsv, to_tsquery('english', f_unaccent(${searchQuery})))`.as(
|
: sql<number>`ts_rank(tsv, to_tsquery('english', f_unaccent(${searchQuery})))`.as(
|
||||||
@@ -84,9 +84,9 @@ export class SearchService {
|
|||||||
.$if(!browseByFilters && titleOnly, (qb) =>
|
.$if(!browseByFilters && titleOnly, (qb) =>
|
||||||
qb.where((eb) =>
|
qb.where((eb) =>
|
||||||
eb(
|
eb(
|
||||||
sql`lower(f_unaccent(pages.title))`,
|
sql`lower(pages.title)`,
|
||||||
'like',
|
'like',
|
||||||
sql`lower(f_unaccent(${`%${titleLikeQuery}%`}))`,
|
sql`lower(${`%${titleLikeQuery}%`})`,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { type Kysely, sql } from 'kysely';
|
import { type Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await sql`CREATE INDEX IF NOT EXISTS pages_title_trgm_idx ON pages USING gin (lower(f_unaccent(title)) gin_trgm_ops)`.execute(
|
await sql`CREATE INDEX IF NOT EXISTS pages_title_trgm_idx ON pages USING gin (lower(title) gin_trgm_ops)`.execute(
|
||||||
db,
|
db,
|
||||||
);
|
);
|
||||||
|
|
||||||
// separators normalized to spaces so space-typed queries match How_to_export.pdf
|
// separators normalized to spaces so space-typed queries match How_to_export.pdf
|
||||||
await sql`CREATE INDEX IF NOT EXISTS attachments_file_name_trgm_idx ON attachments USING gin (lower(f_unaccent(translate(file_name, '_.-', ' '))) gin_trgm_ops)`.execute(
|
await sql`CREATE INDEX IF NOT EXISTS attachments_file_name_trgm_idx ON attachments USING gin (lower(translate(file_name, '_.-', ' ')) gin_trgm_ops)`.execute(
|
||||||
db,
|
db,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: 10f6cff199...4c837b7635
@@ -71,6 +71,15 @@ export class StaticModule implements OnModuleInit {
|
|||||||
await app.register(fastifyStatic, {
|
await app.register(fastifyStatic, {
|
||||||
root: clientDistPath,
|
root: clientDistPath,
|
||||||
wildcard: false,
|
wildcard: false,
|
||||||
|
setHeaders: (reply: any, pathName: string) => {
|
||||||
|
// Vite content-hashes everything under /assets, so they can be cached forever
|
||||||
|
if (/[\\/]assets[\\/]/.test(pathName)) {
|
||||||
|
reply.header(
|
||||||
|
'Cache-Control',
|
||||||
|
'public, max-age=31536000, immutable',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get(RENDER_PATH, (req: any, res: any) => {
|
app.get(RENDER_PATH, (req: any, res: any) => {
|
||||||
|
|||||||
+1
-1
@@ -95,5 +95,5 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@11.15.1"
|
"packageManager": "pnpm@11.23.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user