2025-12-10 12:10:32 +02:00
|
|
|
import { type ComponentChild } from "preact";
|
|
|
|
|
|
2025-12-09 22:22:28 +02:00
|
|
|
import { formatDateTime } from "../utils/formatters";
|
2025-12-10 12:25:38 +02:00
|
|
|
import { useNoteContext, useStaticTooltip } from "./react/hooks";
|
2025-12-09 22:22:28 +02:00
|
|
|
import { joinElements } from "./react/react_utils";
|
|
|
|
|
import { useNoteMetadata } from "./ribbon/NoteInfoTab";
|
2025-12-10 12:25:38 +02:00
|
|
|
import { Trans } from "react-i18next";
|
|
|
|
|
import { useRef } from "preact/hooks";
|
2025-12-09 22:22:28 +02:00
|
|
|
|
|
|
|
|
export default function NoteTitleDetails() {
|
2025-12-10 12:52:03 +02:00
|
|
|
const { note, noteContext } = useNoteContext();
|
2025-12-10 12:10:32 +02:00
|
|
|
const isHiddenNote = note?.noteId.startsWith("_");
|
2025-12-10 12:52:03 +02:00
|
|
|
const isDefaultView = noteContext?.viewScope?.viewMode === "default";
|
2025-12-10 12:10:32 +02:00
|
|
|
|
2025-12-11 00:23:32 +02:00
|
|
|
const items: ComponentChild[] = [].filter(item => !!item);
|
2025-12-09 22:22:28 +02:00
|
|
|
|
2025-12-11 00:23:32 +02:00
|
|
|
return items.length && (
|
2025-12-09 22:22:28 +02:00
|
|
|
<div className="title-details">
|
2025-12-10 12:10:32 +02:00
|
|
|
{joinElements(items, " • ")}
|
2025-12-09 22:22:28 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-12-10 12:25:38 +02:00
|
|
|
|
|
|
|
|
function TextWithValue({ i18nKey, value, valueTooltip }: {
|
|
|
|
|
i18nKey: string;
|
|
|
|
|
value: string;
|
|
|
|
|
valueTooltip: string;
|
|
|
|
|
}) {
|
|
|
|
|
const listItemRef = useRef<HTMLLIElement>(null);
|
|
|
|
|
useStaticTooltip(listItemRef, {
|
|
|
|
|
selector: "span.value",
|
|
|
|
|
title: valueTooltip,
|
|
|
|
|
popperConfig: { placement: "bottom" }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<li ref={listItemRef}>
|
|
|
|
|
<Trans
|
|
|
|
|
i18nKey={i18nKey}
|
|
|
|
|
components={{
|
|
|
|
|
Value: <span className="value">{value}</span> as React.ReactElement
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</li>
|
|
|
|
|
);
|
|
|
|
|
}
|