Skip to content

Build your personal knowledge base with Trilium Notes

style(share): fill the page with a shared collection view

Elian Doran4eee709db7a1
diff --git a/packages/share-theme/src/content/calendar_view.css b/packages/share-theme/src/content/calendar_view.css
deleted file mode 100644
index ef4d09ecad..0000000000
--- a/packages/share-theme/src/content/calendar_view.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.share-calendar {
- margin-block: 1em;
-}
diff --git a/packages/share-theme/src/content/calendar_view.tsx b/packages/share-theme/src/content/calendar_view.tsx
index 4fef7d3de2..20dfc6f37e 100644
--- a/packages/share-theme/src/content/calendar_view.tsx
+++ b/packages/share-theme/src/content/calendar_view.tsx
@@ -1,7 +1,6 @@
import "fullcalendar/skeleton.css";
import "fullcalendar/themes/forma/theme.css";
import "@triliumnext/client/src/widgets/collections/calendar/palette.css";
-import "./calendar_view.css";
import froca from "@triliumnext/client/src/services/froca.js";
import Calendar from "@triliumnext/client/src/widgets/collections/calendar/calendar.js";
@@ -51,7 +50,7 @@ function ShareCalendar({ events, plugins, links }: ShareCalendarProps) {
plugins={plugins}
initialView="dayGridMonth"
headerToolbar={{ start: "title", end: "today prev,next" }}
- height="auto"
+ height="100%"
editable={false}
eventClick={onEventClick}
/>
diff --git a/packages/share-theme/src/content/collection_view.css b/packages/share-theme/src/content/collection_view.css
new file mode 100644
index 0000000000..7f80ec2e66
--- /dev/null
+++ b/packages/share-theme/src/content/collection_view.css
@@ -0,0 +1,31 @@
+body:has(#content.collection-view) {
+ #right-pane {
+ height: 100vh;
+ }
+
+ #main {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ padding: 0;
+ }
+
+ #content {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ }
+
+ #content > .share-calendar,
+ #content > .share-geomap {
+ flex: 1;
+ min-height: 0;
+ }
+
+ @media (max-width: 48em) {
+ #right-pane {
+ height: calc(100dvh - var(--header-height));
+ }
+ }
+}
diff --git a/packages/share-theme/src/content/geomap_view.css b/packages/share-theme/src/content/geomap_view.css
index 0258619e0c..2850334986 100644
--- a/packages/share-theme/src/content/geomap_view.css
+++ b/packages/share-theme/src/content/geomap_view.css
@@ -1,5 +1,3 @@
.share-geomap {
position: relative;
- height: 70vh;
- margin-block: 1em;
}
diff --git a/packages/share-theme/src/index.ts b/packages/share-theme/src/index.ts
index e65383eab3..e2e8d7b350 100644
--- a/packages/share-theme/src/index.ts
+++ b/packages/share-theme/src/index.ts
@@ -16,6 +16,7 @@ import "./content/external_links.css";
import "./content/task_states.css";
import "./content/adaptive_colors.css";
import "./content/link_embed.css";
+import "./content/collection_view.css";
import setupMath from "./content/math.js";
import setupCalendar from "./content/calendar.js";
import setupGeoMap from "./content/geomap.js";
diff --git a/packages/share-theme/src/model/page.spec.ts b/packages/share-theme/src/model/page.spec.ts
index e152705e90..fb785de592 100644
--- a/packages/share-theme/src/model/page.spec.ts
+++ b/packages/share-theme/src/model/page.spec.ts
@@ -436,6 +436,11 @@ describe("getContentClasses", () => {
expect(classes("file", "application/zip", false, { fullContentWidth: "" }))
.toBe("type-file full-content-width");
});
+
+ it("gives a collection view the full width", () => {
+ expect(getContentClasses(fakeNote({ noteId: "map", type: "book" }), false, true))
+ .toBe("type-book full-content-width collection-view");
+ });
});
describe("getChildLinks", () => {
diff --git a/packages/share-theme/src/model/page.ts b/packages/share-theme/src/model/page.ts
index b0a5a66261..b5d4f34fa4 100644
--- a/packages/share-theme/src/model/page.ts
+++ b/packages/share-theme/src/model/page.ts
@@ -343,15 +343,16 @@ export function getShareLink(note: ShareNote, sanitizeUrl: (url: string) => stri
* with `#fullContentWidth` or of a type the app always shows at full width, and `no-content` when
* empty. A Markdown note reads as text, so its type does not make it full width.
*/
-export function getContentClasses(note: ShareNote, isEmpty = false) {
+export function getContentClasses(note: ShareNote, isEmpty = false, isCollectionView = false) {
const isEditorContent = note.type === "text"
|| (note.type === "code" && note.mime === "text/x-markdown");
const isFullWidth = (!isEditorContent && isFullWidthNoteType(note.type, note.mime))
- || note.isLabelTruthy("fullContentWidth");
+ || note.isLabelTruthy("fullContentWidth") || isCollectionView;
return [
`type-${note.type}`,
isEditorContent && "ck-content",
isFullWidth && "full-content-width",
+ isCollectionView && "collection-view",
isEmpty && "no-content"
].filter(Boolean).join(" ");
}
diff --git a/packages/trilium-core/src/share/content_renderer.ts b/packages/trilium-core/src/share/content_renderer.ts
index efa6c51306..f2d57e9240 100644
--- a/packages/trilium-core/src/share/content_renderer.ts
+++ b/packages/trilium-core/src/share/content_renderer.ts
@@ -284,7 +284,7 @@ function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs)
navigation,
childLinks,
childLinksLayout: getChildLinksLayout(note),
- contentClasses: getContentClasses(note, isEmpty),
+ contentClasses: getContentClasses(note, isEmpty, isCollectionView),
language: getPageLanguages(note, {
displayLanguage,
defaultContentLanguage: options.getOptionOrNull("defaultContentLanguage")