mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-10 10:00:48 +09:00
spaces fixes and refactoring
This commit is contained in:
parent
4b6d7e8621
commit
73826eca3f
4 changed files with 17 additions and 25 deletions
|
@ -86,7 +86,7 @@ const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList e
|
|||
|
||||
onClick (space: any) {
|
||||
if (space.spaceAccountStatus != I.SpaceStatus.Joining) {
|
||||
UtilRouter.switchSpace(space.targetSpaceId, 'ScreenSettings');
|
||||
UtilRouter.switchSpace(space.targetSpaceId);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { Title, Label, IconObject, ObjectName } from 'Component';
|
||||
import { I, UtilObject, translate } from 'Lib';
|
||||
import { I, UtilObject, UtilData, translate } from 'Lib';
|
||||
import { observer } from 'mobx-react';
|
||||
import { dbStore, detailStore } from 'Store';
|
||||
import { AutoSizer, WindowScroller, CellMeasurer, CellMeasurerCache, List } from 'react-virtualized';
|
||||
|
@ -131,17 +131,7 @@ const PopupSettingsSpaceMembers = observer(class PopupSettingsSpaceMembers exten
|
|||
const subId = Constant.subId.participant;
|
||||
const records = dbStore.getRecords(subId, '').map(id => detailStore.get(subId, id)).filter(it => statuses.includes(it.status));
|
||||
|
||||
records.sort((c1, c2) => {
|
||||
const isOwner1 = c1.permissions == I.ParticipantPermissions.Owner;
|
||||
const isOwner2 = c2.permissions == I.ParticipantPermissions.Owner;
|
||||
|
||||
if (isOwner1 && !isOwner2) return -1;
|
||||
if (!isOwner1 && isOwner2) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
return records;
|
||||
return records.sort(UtilData.sortByOwner);
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { Title, Label, Icon, Input, Button, IconObject, ObjectName, Select, Tag, Error } from 'Component';
|
||||
import { I, C, translate, UtilCommon } from 'Lib';
|
||||
import { I, C, translate, UtilCommon, UtilData } from 'Lib';
|
||||
import { observer } from 'mobx-react';
|
||||
import { dbStore, detailStore, popupStore, commonStore } from 'Store';
|
||||
import { AutoSizer, WindowScroller, CellMeasurer, CellMeasurerCache, List } from 'react-virtualized';
|
||||
|
@ -236,17 +236,7 @@ const PopupSettingsSpaceShare = observer(class PopupSettingsSpaceShare extends R
|
|||
const subId = Constant.subId.participant;
|
||||
const records = dbStore.getRecords(subId, '').map(id => detailStore.get(subId, id)).filter(it => statuses.includes(it.status));
|
||||
|
||||
records.sort((c1, c2) => {
|
||||
const isOwner1 = c1.permissions == I.ParticipantPermissions.Owner;
|
||||
const isOwner2 = c2.permissions == I.ParticipantPermissions.Owner;
|
||||
|
||||
if (isOwner1 && !isOwner2) return -1;
|
||||
if (!isOwner1 && isOwner2) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
return records;
|
||||
return records.sort(UtilData.sortByOwner);
|
||||
};
|
||||
|
||||
getLink () {
|
||||
|
|
|
@ -375,6 +375,7 @@ class UtilData {
|
|||
{ relationKey: 'name', type: I.SortType.Asc },
|
||||
],
|
||||
ignoreDeleted: true,
|
||||
noDeps: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -388,6 +389,7 @@ class UtilData {
|
|||
],
|
||||
ignoreWorkspace: true,
|
||||
ignoreDeleted: true,
|
||||
noDeps: true,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -626,6 +628,16 @@ class UtilData {
|
|||
return this.sortByName(c1, c2);
|
||||
};
|
||||
|
||||
sortByOwner (c1: any, c2: any) {
|
||||
const isOwner1 = c1.permissions == I.ParticipantPermissions.Owner;
|
||||
const isOwner2 = c2.permissions == I.ParticipantPermissions.Owner;
|
||||
|
||||
if (isOwner1 && !isOwner2) return -1;
|
||||
if (!isOwner1 && isOwner2) return 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
checkObjectWithRelationCnt (relationKey: string, type: string, ids: string[], limit: number, callBack?: (message: any) => void) {
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.Equal, value: type },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue