Skip to content

Commit

Permalink
JS-5845: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3orblade committed Nov 25, 2024
1 parent c966841 commit 747699c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/scss/component/headSimple.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

.editableWrap { flex-grow: 1; }
.editableWrap {
.editable { z-index: 1; position: relative; word-break: break-word; cursor: text; }
.editable { z-index: 1; position: relative; word-break: break-word; cursor: text; min-height: 32px; }
}

> .descr { @include text-paragraph; }
Expand Down
1 change: 1 addition & 0 deletions src/scss/page/main/date.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.pageMainDate {
.wrapper { width: 704px; margin: 0px auto; padding: 40px 0px 80px 0px; user-select: none; }

.headSimple { align-items: center; height: 32px; }
.headSimple {
.side.right { gap: 0px; }
.side.right {
Expand Down
41 changes: 15 additions & 26 deletions src/ts/component/page/main/date.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import { Header, Footer, Loader, Deleted, ListObject, Button } from 'Component';
import { Header, Footer, Deleted, ListObject, Button } from 'Component';
import { I, C, S, U, Action, translate } from 'Lib';
import HeadSimple from 'Component/page/elements/head/simple';

interface State {
isLoading: boolean;
isDeleted: boolean;
relations: any[];
selectedRelation: string;
Expand All @@ -27,15 +26,14 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC
timeout = 0;

state = {
isLoading: false,
isDeleted: false,
relations: [],
selectedRelation: RELATION_KEY_MENTION,
};

render () {
const { space } = S.Common;
const { isLoading, isDeleted, relations, selectedRelation } = this.state;
const { isDeleted, relations, selectedRelation } = this.state;
const rootId = this.getRootId();
const object = S.Detail.get(rootId, rootId, [ 'timestamp' ]);

Expand All @@ -56,12 +54,15 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC
filters.push({ relationKey: selectedRelation, condition: I.FilterCondition.Equal, value: object.timestamp, format: I.RelationType.Date });
};

let content = null;
return (
<div ref={node => this.node = node}>
<Header
{...this.props}
component="mainObject"
ref={ref => this.refHeader = ref}
rootId={object.rootId}
/>

if (isLoading) {
content = <Loader id="loader" />;
} else {
content = (
<div className="blocks wrapper">
<HeadSimple
{...this.props}
Expand Down Expand Up @@ -110,19 +111,6 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC
/>
</div>
</div>
);
};

return (
<div ref={node => this.node = node}>
<Header
{...this.props}
component="mainObject"
ref={ref => this.refHeader = ref}
rootId={object.rootId}
/>

{content}

<Footer component="mainObject" {...this.props} />
</div>
Expand Down Expand Up @@ -167,7 +155,7 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC

this.close();
this.id = rootId;
this.setState({ isDeleted: false, isLoading: true });
this.setState({ isDeleted: false });

C.ObjectOpen(rootId, '', U.Router.getRouteSpaceId(), (message: any) => {
if (!U.Common.checkErrorOnOpen(rootId, message.error.code, this)) {
Expand All @@ -176,14 +164,13 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC

const object = S.Detail.get(rootId, rootId, []);
if (object.isDeleted) {
this.setState({ isDeleted: true, isLoading: false });
this.setState({ isDeleted: true });
return;
};

this.refHeader?.forceUpdate();
this.refHead?.forceUpdate();

this.setState({ isLoading: false });
this.loadCategory();
});
};
Expand Down Expand Up @@ -230,7 +217,9 @@ const PageMainDate = observer(class PageMainDate extends React.Component<I.PageC
return 0;
});

this.setState({ relations });
if (relations.length) {
this.setState({ relations, selectedRelation: relations[0].relationKey });
};
});
};

Expand Down

0 comments on commit 747699c

Please sign in to comment.