1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

JS-6345: Publishing filter

This commit is contained in:
Andrew Simachev 2025-01-30 12:02:24 +01:00
parent 8d8e51a7fe
commit 61d18cfc3a
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF
4 changed files with 10 additions and 16 deletions

View file

@ -1,6 +1,6 @@
import * as React from 'react';
import { Title, Label, IconObject, Button } from 'Component';
import { I, C, S, U, translate, Renderer, analytics, Action } from 'Lib';
import { I, C, S, U, translate, analytics, Action } from 'Lib';
import { observer } from 'mobx-react';
interface State {
@ -90,7 +90,7 @@ const PopupSettingsPageDataIndex = observer(class PopupSettingsPageDataIndex ext
};
componentDidMount(): void {
C.PublishingList(S.Common.space, (message: any) => {
C.PublishingList('', (message: any) => {
if (!message.error.code) {
this.setState({ list: message.list });
};

View file

@ -21,7 +21,7 @@ const PopupSettingsPageDataPublish = observer(class PopupSettingsPageDataPublish
const { list } = this.state;
const Row = (item: any) => {
const object = S.Detail.get(SUB_ID, item.objectId);
const object = S.Detail.mapper(item.details);
return (
<div className="row">
@ -65,18 +65,9 @@ const PopupSettingsPageDataPublish = observer(class PopupSettingsPageDataPublish
};
load () {
C.PublishingList(S.Common.space, (message: any) => {
C.PublishingList('', (message: any) => {
if (!message.error.code) {
const list = message.list;
const ids = list.map(item => item.objectId);
U.Data.subscribeIds({
subId: SUB_ID,
ids,
noDeps: true,
}, () => {
this.setState({ list });
});
this.setState({ list: message.list });
};
});
};
@ -88,6 +79,7 @@ const PopupSettingsPageDataPublish = observer(class PopupSettingsPageDataPublish
onMore (item: any) {
const { getId } = this.props;
const element = $(`#${getId()} #icon-more-${item.objectId}`);
const object = S.Detail.mapper(item.details);
const options: any[] = [
{ id: 'open', name: translate('menuPublishButtonOpen') },
{ isDiv: true },
@ -108,7 +100,7 @@ const PopupSettingsPageDataPublish = observer(class PopupSettingsPageDataPublish
onSelect: (e: any, element: any) => {
switch (element.id) {
case 'open': {
U.Object.openAuto(S.Detail.get(SUB_ID, item.objectId));
U.Object.openAuto(object);
break;
};
@ -133,7 +125,7 @@ const PopupSettingsPageDataPublish = observer(class PopupSettingsPageDataPublish
};
onUnpublish (item: any) {
const object = S.Detail.get(SUB_ID, item.objectId);
const object = S.Detail.mapper(item.details);
C.PublishingRemove(S.Common.space, item.objectId, (message: any) => {
if (!message.error.code) {

View file

@ -11,4 +11,5 @@ export interface PublishState {
version: string;
timestamp: number;
size: number;
details: any;
};

View file

@ -691,6 +691,7 @@ export const Mapper = {
version: obj.getVersion(),
timestamp: obj.getTimestamp(),
size: obj.getSize(),
details: Decode.struct(obj.getDetails()),
};
},