mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-09 09:35:02 +09:00
fix bin logic
This commit is contained in:
parent
eaacad838b
commit
d83c3fa1bc
1 changed files with 18 additions and 51 deletions
|
@ -9,8 +9,6 @@ type State = {
|
|||
previewId: string;
|
||||
};
|
||||
|
||||
const SUB_ID = 'widgetArchive';
|
||||
|
||||
const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, State> {
|
||||
|
||||
state: State = {
|
||||
|
@ -47,7 +45,6 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
|
|||
const bodyCn = [ 'body' ];
|
||||
const space = U.Space.getSpaceview();
|
||||
const canWrite = U.Space.canMyParticipantWrite();
|
||||
const archived = S.Record.getRecordIds(SUB_ID, '');
|
||||
|
||||
let content = null;
|
||||
|
||||
|
@ -173,26 +170,24 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
|
|||
/>
|
||||
))}
|
||||
|
||||
{archived.length ? (
|
||||
<DropTarget
|
||||
{...this.props}
|
||||
isTargetBottom={true}
|
||||
rootId={S.Block.widgets}
|
||||
id={last?.id}
|
||||
dropType={I.DropType.Widget}
|
||||
canDropMiddle={false}
|
||||
className="lastTarget"
|
||||
cacheKey="lastTarget"
|
||||
>
|
||||
<Button
|
||||
text={translate('commonBin')}
|
||||
color=""
|
||||
className="widget"
|
||||
icon="bin"
|
||||
onClick={this.onArchive}
|
||||
/>
|
||||
</DropTarget>
|
||||
) : ''}
|
||||
<DropTarget
|
||||
{...this.props}
|
||||
isTargetBottom={true}
|
||||
rootId={S.Block.widgets}
|
||||
id={last?.id}
|
||||
dropType={I.DropType.Widget}
|
||||
canDropMiddle={false}
|
||||
className="lastTarget"
|
||||
cacheKey="lastTarget"
|
||||
>
|
||||
<Button
|
||||
text={translate('commonBin')}
|
||||
color=""
|
||||
className="widget"
|
||||
icon="bin"
|
||||
onClick={this.onArchive}
|
||||
/>
|
||||
</DropTarget>
|
||||
|
||||
<div className="buttons">
|
||||
{buttons.map(button => (
|
||||
|
@ -231,14 +226,6 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
|
|||
);
|
||||
};
|
||||
|
||||
componentDidMount (): void {
|
||||
this.subscribeArchive();
|
||||
};
|
||||
|
||||
componentDidUpdate (): void {
|
||||
this.subscribeArchive();
|
||||
};
|
||||
|
||||
onEdit (e: any): void {
|
||||
e.stopPropagation();
|
||||
|
||||
|
@ -534,26 +521,6 @@ const SidebarWidget = observer(class SidebarWidget extends React.Component<{}, S
|
|||
}, S.Menu.getTimeout());
|
||||
};
|
||||
|
||||
subscribeArchive () {
|
||||
const { space } = S.Common
|
||||
|
||||
if (this.isSubcribed == space) {
|
||||
return;
|
||||
};
|
||||
|
||||
U.Data.searchSubscribe({
|
||||
subId: SUB_ID,
|
||||
spaceId: space,
|
||||
ignoreArchived: false,
|
||||
filters: [
|
||||
{ relationKey: 'isArchived', condition: I.FilterCondition.Equal, value: true },
|
||||
],
|
||||
limit: 1,
|
||||
}, () => {
|
||||
this.isSubcribed = space;
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
export default SidebarWidget;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue