From 9da2517617adf97686f5a3731408b17f65d4e17d Mon Sep 17 00:00:00 2001 From: Mike Mhlv Date: Thu, 24 Oct 2024 16:43:55 +0100 Subject: [PATCH 1/9] JS-5077: page main tag --- src/ts/component/editor/page.tsx | 2 +- src/ts/component/page/index.tsx | 2 + src/ts/component/page/main/object.tsx | 2 +- src/ts/component/page/main/tag.tsx | 60 +++++++++++++++++++++++++++ src/ts/component/page/main/type.tsx | 3 +- src/ts/interface/object.ts | 3 +- src/ts/lib/util/object.ts | 9 +++- src/ts/store/block.ts | 2 +- 8 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 src/ts/component/page/main/tag.tsx diff --git a/src/ts/component/editor/page.tsx b/src/ts/component/editor/page.tsx index 1ec5132d70..b1d8436873 100644 --- a/src/ts/component/editor/page.tsx +++ b/src/ts/component/editor/page.tsx @@ -2363,4 +2363,4 @@ const EditorPage = observer(class EditorPage extends React.Component { diff --git a/src/ts/component/page/main/object.tsx b/src/ts/component/page/main/object.tsx index cfefda4725..4eb93032a9 100644 --- a/src/ts/component/page/main/object.tsx +++ b/src/ts/component/page/main/object.tsx @@ -31,4 +31,4 @@ class PageMainObject extends React.Component { }; -export default PageMainObject; \ No newline at end of file +export default PageMainObject; diff --git a/src/ts/component/page/main/tag.tsx b/src/ts/component/page/main/tag.tsx new file mode 100644 index 0000000000..45b71701c2 --- /dev/null +++ b/src/ts/component/page/main/tag.tsx @@ -0,0 +1,60 @@ +import * as React from 'react'; +import { observer } from 'mobx-react'; +import { I } from 'Lib'; +import { Header, Footer } from 'Component'; + +interface State { + isLoading: boolean; + isDeleted: boolean; +}; + +const PageMainTag = observer(class PageMainTag extends React.Component { + + _isMounted = false; + node: any = null; + refHeader: any = null; + + state = { + isLoading: false, + isDeleted: false, + }; + + constructor (props: I.PageComponent) { + super(props); + }; + + render () { + const rootId = this.getRootId(); + + return ( +
this.node = node}> +
this.refHeader = ref} + rootId={rootId} + /> + +
+
+ TAG + +
+
+ +
+
+ ); + }; + + componentDidMount () { + this._isMounted = true; + }; + + getRootId () { + const { rootId, match } = this.props; + return rootId ? rootId : match.params.id; + }; +}); + +export default PageMainTag; diff --git a/src/ts/component/page/main/type.tsx b/src/ts/component/page/main/type.tsx index 883782a21d..fb003aec73 100644 --- a/src/ts/component/page/main/type.tsx +++ b/src/ts/component/page/main/type.tsx @@ -348,7 +348,8 @@ const PageMainType = observer(class PageMainType extends React.Component Date: Tue, 29 Oct 2024 11:33:22 +0000 Subject: [PATCH 2/9] JS-5077: wip --- src/json/text.json | 1 + src/ts/component/page/main/tag.tsx | 75 +++++++++++++++++++++++++++--- src/ts/lib/relation.ts | 2 +- 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/src/json/text.json b/src/json/text.json index 7fec3a98e5..129ca845a3 100644 --- a/src/json/text.json +++ b/src/json/text.json @@ -1697,6 +1697,7 @@ "defaultNameRelation": "New Relation", "defaultNameBookmark": "Paste Link", "defaultNameView": "New View", + "defaultNameTag": "New Tag", "placeholderBlock": "Type text or \/ for commands", "placeholderBlockDescription": "Add a description", diff --git a/src/ts/component/page/main/tag.tsx b/src/ts/component/page/main/tag.tsx index 45b71701c2..bf1d0cb37a 100644 --- a/src/ts/component/page/main/tag.tsx +++ b/src/ts/component/page/main/tag.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; import { observer } from 'mobx-react'; -import { I } from 'Lib'; +import { Action, C, I, S, translate, U } from 'Lib'; import { Header, Footer } from 'Component'; +import HeadSimple from 'ts/component/page/elements/head/simple'; interface State { isLoading: boolean; @@ -12,7 +13,9 @@ const PageMainTag = observer(class PageMainTag extends React.Component this.node = node}> @@ -35,11 +41,13 @@ const PageMainTag = observer(class PageMainTag extends React.Component -
-
- TAG - -
+
+ this.refHead = ref} + placeholder={translate('defaultNameTag')} + rootId={rootId} + />