Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/client/src/layouts/desktop_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import ScrollPadding from "../widgets/scroll_padding.js";
import SearchResult from "../widgets/search_result.jsx";
import SharedInfo from "../widgets/shared_info.jsx";
import OriginInfo from "../widgets/note_origin.jsx";
import SpacerWidget from "../widgets/spacer.js";
import SplitNoteContainer from "../widgets/containers/split_note_container.js";
import SqlResults from "../widgets/sql_result.js";
Expand Down Expand Up @@ -138,6 +139,7 @@ export default class DesktopLayout {
.filling()
.child(new ContentHeader()
.child(<ReadOnlyNoteInfoBar />)
.child(<OriginInfo />)
.child(<SharedInfo />)
)
.child(new PromotedAttributesWidget())
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
"title": "الملاحظات المعدلة"
},
"note_properties": {
"info": "معلومات"
"this_note_was_originally_taken_from": ""
},
"backend_log": {
"refresh": "تحديث"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/cn/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,7 @@
"search": "搜索"
},
"note_properties": {
"this_note_was_originally_taken_from": "笔记来源:",
"info": "信息"
"this_note_was_originally_taken_from": "笔记来源:"
},
"owned_attribute_list": {
"owned_attributes": "拥有的属性"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,7 @@
"search": "Suchen"
},
"note_properties": {
"this_note_was_originally_taken_from": "Diese Notiz stammt ursprünglich aus:",
"info": "Info"
"this_note_was_originally_taken_from": "Diese Notiz stammt ursprünglich aus:"
},
"owned_attribute_list": {
"owned_attributes": "Eigene Attribute"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,7 @@
"search": "Search"
},
"note_properties": {
"this_note_was_originally_taken_from": "This note was originally taken from:",
"info": "Info"
"this_note_was_originally_taken_from": "This note was originally taken from:"
},
"owned_attribute_list": {
"owned_attributes": "Owned Attributes"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,7 @@
"search": "Buscar"
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota fue tomada originalmente de:",
"info": "Información"
"this_note_was_originally_taken_from": "Esta nota fue tomada originalmente de:"
},
"owned_attribute_list": {
"owned_attributes": "Atributos propios"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,7 @@
"search": "Recherche"
},
"note_properties": {
"this_note_was_originally_taken_from": "Cette note est initialement extraite de :",
"info": "Infos"
"this_note_was_originally_taken_from": "Cette note est initialement extraite de :"
},
"owned_attribute_list": {
"owned_attributes": "Attributs propres"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1408,8 +1408,7 @@
"search": "Ricerca"
},
"note_properties": {
"this_note_was_originally_taken_from": "Questa nota è stata originariamente tratta da:",
"info": "Informazioni"
"this_note_was_originally_taken_from": "Questa nota è stata originariamente tratta da:"
},
"owned_attribute_list": {
"owned_attributes": "Attributi posseduti"
Expand Down
1 change: 0 additions & 1 deletion apps/client/src/translations/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@
"outside_hoisted": "このパスはホイストされたノートの外側にあるため、ホイストを解除する必要があります。"
},
"note_properties": {
"info": "情報",
"this_note_was_originally_taken_from": "このノートは元々以下から引用したものです:"
},
"similar_notes": {
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/pl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,7 @@
"search": "Szukaj"
},
"note_properties": {
"this_note_was_originally_taken_from": "Ta notatka oryginalnie została wzięta z:",
"info": "Info"
"this_note_was_originally_taken_from": "Ta notatka oryginalnie została wzięta z:"
},
"owned_attribute_list": {
"owned_attributes": "Posiadane atrybuty"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,7 @@
"search": "Pesquisar"
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:",
"info": "Informações"
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:"
},
"owned_attribute_list": {
"owned_attributes": "Atributos próprios"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/pt_br/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,7 @@
"outside_hoisted": "Este caminho está fora de uma nota fixada e você teria que desafixar."
},
"note_properties": {
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:",
"info": "Informações"
"this_note_was_originally_taken_from": "Esta nota foi originalmente obtida de:"
},
"promoted_attributes": {
"promoted_attributes": "Atributos Promovidos",
Expand Down
1 change: 0 additions & 1 deletion apps/client/src/translations/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@
"title": "Căile notiței"
},
"note_properties": {
"info": "Informații",
"this_note_was_originally_taken_from": "Această notiță a fost preluată original de la:"
},
"note_type_chooser": {
Expand Down
1 change: 0 additions & 1 deletion apps/client/src/translations/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,6 @@
"archived": "Архивировано"
},
"note_properties": {
"info": "Информация",
"this_note_was_originally_taken_from": "Эта заметка была первоначально взята из:"
},
"promoted_attributes": {
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/tw/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,7 @@
"search": "搜尋"
},
"note_properties": {
"this_note_was_originally_taken_from": "筆記來源:",
"info": "資訊"
"this_note_was_originally_taken_from": "筆記來源:"
},
"owned_attribute_list": {
"owned_attributes": "自有屬性"
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/translations/uk/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,7 @@
"outside_hoisted": "Цей шлях знаходиться поза межами закріпленої нотатки і вам доведеться відкріпити."
},
"note_properties": {
"this_note_was_originally_taken_from": "Цю нотатку було спочатку взято з:",
"info": "Інформація"
"this_note_was_originally_taken_from": "Цю нотатку було спочатку взято з:"
},
"owned_attribute_list": {
"owned_attributes": "Власні Атрибути"
Expand Down
43 changes: 43 additions & 0 deletions apps/client/src/widgets/note_origin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { t } from "../services/i18n";
import { useNoteContext, useTriliumEvent, useTriliumOption } from "./react/hooks";
import { useEffect, useState } from "preact/hooks";
import attributes from "../services/attributes";
import InfoBar from "./react/InfoBar";
import RawHtml from "./react/RawHtml";
import FNote from "../entities/fnote";

export default function OriginInfo() {
const { note } = useNoteContext();
const [link, setLink] = useState<string>();

function refresh() {
if (!note) return;
const pageUrl = getPageUrl(note);
if (!pageUrl) {
setLink(undefined);
return;
}
setLink(`<a href="${pageUrl}" class="external tn-link">${pageUrl}</a>`);
}

useEffect(refresh, [note]);
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
if (loadResults.getAttributeRows().find((attr) => attr.type === "label" && attr.name?.toString() === "pageUrl" && attributes.isAffecting(attr, note))) {
refresh();
}
});

return (
<InfoBar className="origin-info-widget" type="subtle" style={{ display: (!link) ? "none" : undefined }}>
{link && (
<RawHtml
html={`${t("note_properties.this_note_was_originally_taken_from")} ${link}`}
/>
)}
</InfoBar>
)
}

function getPageUrl(note: FNote) {
return note.getOwnedLabelValue("pageUrl");
}
20 changes: 0 additions & 20 deletions apps/client/src/widgets/ribbon/NotePropertiesTab.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions apps/client/src/widgets/ribbon/RibbonDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ScriptTab from "./ScriptTab";
import EditedNotesTab from "./EditedNotesTab";
import NotePropertiesTab from "./NotePropertiesTab";
import NoteInfoTab from "./NoteInfoTab";
import SimilarNotesTab from "./SimilarNotesTab";
import FilePropertiesTab from "./FilePropertiesTab";
Expand Down Expand Up @@ -59,13 +58,6 @@ export const RIBBON_TAB_DEFINITIONS: TabConfiguration[] = [
show: ({ note }) => note?.type === "book" || note?.type === "search",
toggleCommand: "toggleRibbonTabBookProperties"
},
{
title: t("note_properties.info"),
icon: "bx bx-info-square",
content: NotePropertiesTab,
show: ({ note }) => !!note?.getLabelValue("pageUrl"),
activate: true
},
{
title: t("file_properties.title"),
icon: "bx bx-file",
Expand Down
Loading