+
{note && !isHiddenNote && noteType === "book" && }
);
diff --git a/apps/client/src/widgets/layout/StatusBar.tsx b/apps/client/src/widgets/layout/StatusBar.tsx
index d18269210..175aeeb53 100644
--- a/apps/client/src/widgets/layout/StatusBar.tsx
+++ b/apps/client/src/widgets/layout/StatusBar.tsx
@@ -12,6 +12,7 @@ import FNote from "../../entities/fnote";
import attributes from "../../services/attributes";
import { t } from "../../services/i18n";
import { ViewScope } from "../../services/link";
+import server from "../../services/server";
import { openInAppHelpFromUrl } from "../../services/utils";
import { formatDateTime } from "../../utils/formatters";
import { BacklinksList, useBacklinkCount } from "../FloatingButtonsDefinitions";
@@ -28,7 +29,6 @@ import { NotePathsWidget, useSortedNotePaths } from "../ribbon/NotePathsTab";
import { useAttachments } from "../type_widgets/Attachment";
import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector";
import Breadcrumb from "./Breadcrumb";
-import server from "../../services/server";
interface StatusBarContext {
note: FNote;
@@ -84,7 +84,6 @@ function StatusBarDropdown({ children, icon, text, buttonClassName, titleOptions
...titleOptions
}}
dropdownOptions={{
- autoClose: "outside",
popperConfig: {
strategy: "fixed",
placement: "top"
@@ -204,6 +203,7 @@ export function NoteInfoBadge({ note }: { note: FNote | null | undefined }) {
icon="bx bx-info-circle"
title={t("status_bar.note_info_title")}
dropdownContainerClassName="dropdown-note-info"
+ dropdownOptions={{ autoClose: "outside" }}
>
@@ -356,14 +356,13 @@ function CodeNoteSwitcher({ note }: StatusBarContext) {
mimeTypes.find(m => m.mime === currentNoteMime)
), [ mimeTypes, currentNoteMime ]);
- return (
+ return (note.type === "code" &&
<>
:is(.note-detail.full-height, .note-list-widget.full-height)),
- .note-split.type-book {
- .title-details {
- width: 100%;
- max-width: unset;
- padding-inline-start: 15px;
- padding-bottom: 0.2em;
- font-size: 0.8em;
- }
- }
-
- &.prefers-centered-content .title-details {
- margin-inline: auto;
- }
-}
-
-body.experimental-feature-floating-titlebar {
- .title-row {
- max-width: var(--max-content-width);
- padding: 0;
- padding-inline-start: 24px;
- }
-
- .note-icon-widget {
- padding: 0;
- width: 41px;
- }
-
- .note-split.type-code:not(.mime-text-x-sqlite) .title-row {
- background-color: var(--main-background-color);
- }
-
- .scrolling-container:has(> :is(.note-detail.full-height, .note-list-widget.full-height)),
- .note-split.type-book {
- .title-row {
- width: 100%;
- max-width: unset;
- padding-inline-start: 15px;
- padding-bottom: 0.2em;
- font-size: 0.8em;
- }
- }
-
- &.prefers-centered-content .title-row {
- margin-inline: auto;
}
}
diff --git a/apps/client/src/widgets/BreadcrumbBadges.css b/apps/client/src/widgets/react/Badge.css
similarity index 60%
rename from apps/client/src/widgets/BreadcrumbBadges.css
rename to apps/client/src/widgets/react/Badge.css
index 55737ae9b..83f3f05ef 100644
--- a/apps/client/src/widgets/BreadcrumbBadges.css
+++ b/apps/client/src/widgets/react/Badge.css
@@ -1,17 +1,4 @@
-.component.breadcrumb-badges {
- contain: none;
-}
-
-.breadcrumb-badges {
- display: flex;
- gap: 5px;
- min-width: 0;
- flex-shrink: 1;
- overflow: hidden;
- --badge-radius: 12px;
-}
-
-.breadcrumb-badge {
+.ext-badge {
display: flex;
align-items: center;
padding: 2px 6px;
@@ -30,12 +17,6 @@
}
}
- &.temporarily-editable-badge { --color: #4fa52b; }
- &.read-only-badge { --color: #e33f3b; }
- &.share-badge { --color: #3b82f6; }
- &.clipped-note-badge { --color: #57a2a5; }
- &.execute-badge { --color: #f59e0b; }
-
a {
color: inherit !important;
text-decoration: none;
@@ -49,18 +30,14 @@
}
}
-.breadcrumb-dropdown-badge {
+.dropdown-badge {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: var(--badge-radius);
- &.dropdown-backlinks-badge .dropdown-menu {
- min-width: 500px;
- }
-
- .breadcrumb-badge {
+ .ext-badge {
border-radius: 0;
}
diff --git a/apps/client/src/widgets/react/Badge.tsx b/apps/client/src/widgets/react/Badge.tsx
index 49d4b879d..e7844368c 100644
--- a/apps/client/src/widgets/react/Badge.tsx
+++ b/apps/client/src/widgets/react/Badge.tsx
@@ -1,8 +1,78 @@
-interface BadgeProps {
+import "./Badge.css";
+
+import clsx from "clsx";
+import { ComponentChildren, MouseEventHandler } from "preact";
+import { useRef } from "preact/hooks";
+
+import Dropdown, { DropdownProps } from "./Dropdown";
+import { useStaticTooltip } from "./hooks";
+import Icon from "./Icon";
+
+interface SimpleBadgeProps {
className?: string;
title: string;
}
-export default function Badge({ title, className }: BadgeProps) {
- return {title}
-}
\ No newline at end of file
+interface BadgeProps {
+ text?: string;
+ icon?: string;
+ className?: string;
+ tooltip?: string;
+ onClick?: MouseEventHandler;
+ href?: string;
+}
+
+export default function SimpleBadge({ title, className }: SimpleBadgeProps) {
+ return {title};
+}
+
+export function Badge({ icon, className, text, tooltip, onClick, href }: BadgeProps) {
+ const containerRef = useRef(null);
+ useStaticTooltip(containerRef, {
+ placement: "bottom",
+ fallbackPlacements: [ "bottom" ],
+ animation: false,
+ html: true,
+ title: tooltip
+ });
+
+ const content = <>
+ {icon && <> >}
+ {text}
+ >;
+
+ return (
+
+ );
+}
+
+export function BadgeWithDropdown({ children, tooltip, className, dropdownOptions, ...props }: BadgeProps & {
+ children: ComponentChildren,
+ dropdownOptions?: Partial
+}) {
+ return (
+ }
+ noDropdownListStyle
+ noSelectButtonStyle
+ hideToggleArrow
+ title={tooltip}
+ titlePosition="bottom"
+ {...dropdownOptions}
+ dropdownOptions={{
+ ...dropdownOptions?.dropdownOptions,
+ popperConfig: {
+ ...dropdownOptions?.dropdownOptions?.popperConfig,
+ placement: "bottom", strategy: "fixed"
+ }
+ }}
+ >{children}
+ );
+}
diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.css
index b314d74d1..bb0da9c4d 100644
--- a/apps/client/src/widgets/ribbon/style.css
+++ b/apps/client/src/widgets/ribbon/style.css
@@ -429,7 +429,7 @@ body.experimental-feature-new-layout {
.ribbon-container {
display: flex;
flex-direction: column-reverse;
- border-top: 1px solid var(--main-border-color);
+ border: 0;
.ribbon-tab-spacer,
.ribbon-tab-title,