mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
refactoring
This commit is contained in:
parent
7226a5cbfc
commit
4a1bd3859e
4 changed files with 34 additions and 29 deletions
|
@ -30,27 +30,30 @@ export default {
|
|||
},
|
||||
|
||||
limit: {
|
||||
menuRecords: 100,
|
||||
widgets: 20,
|
||||
notification: 20,
|
||||
space: 50,
|
||||
graphDepth: 5,
|
||||
cellEntry: 320,
|
||||
listObject: 50,
|
||||
spaceName: 50,
|
||||
spaceDescription: 200,
|
||||
spaceNameThreshold: 10,
|
||||
spaceDescriptionThreshold: 50,
|
||||
menuRecords: 100,
|
||||
widgets: 20,
|
||||
notification: 20,
|
||||
graphDepth: 5,
|
||||
cellEntry: 320,
|
||||
listObject: 50,
|
||||
|
||||
space: {
|
||||
count: 50,
|
||||
name: 50,
|
||||
description: 200,
|
||||
nameThreshold: 10,
|
||||
descriptionThreshold: 50,
|
||||
},
|
||||
|
||||
chat: {
|
||||
messages: 50,
|
||||
attachments: 10,
|
||||
files: 10,
|
||||
mentions: 10,
|
||||
text: 2000,
|
||||
reactions: {
|
||||
self: 3,
|
||||
all: 12,
|
||||
messages: 50,
|
||||
attachments: 10,
|
||||
files: 10,
|
||||
mentions: 10,
|
||||
text: 2000,
|
||||
reactions: {
|
||||
self: 3,
|
||||
all: 12,
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ const PageMainSettingsSpaceIndex = observer(class PageMainSettingsSpaceIndex ext
|
|||
placeholder={translate('defaultNamePage')}
|
||||
readonly={!canWrite || !isEditing}
|
||||
onKeyUp={() => this.onKeyUp('name')}
|
||||
maxLength={J.Constant.limit.spaceName}
|
||||
maxLength={J.Constant.limit.space.name}
|
||||
/>
|
||||
<div className="counter" />
|
||||
</div>
|
||||
|
@ -147,7 +147,7 @@ const PageMainSettingsSpaceIndex = observer(class PageMainSettingsSpaceIndex ext
|
|||
placeholder={translate('popupSettingsSpaceIndexDescriptionPlaceholder')}
|
||||
readonly={!canWrite || !isEditing}
|
||||
onKeyUp={() => this.onKeyUp('description')}
|
||||
maxLength={J.Constant.limit.spaceDescription}
|
||||
maxLength={J.Constant.limit.space.description}
|
||||
/>
|
||||
<div className="counter" />
|
||||
</div>
|
||||
|
@ -502,6 +502,7 @@ const PageMainSettingsSpaceIndex = observer(class PageMainSettingsSpaceIndex ext
|
|||
|
||||
updateCounters () {
|
||||
const node = $(this.node);
|
||||
const { name, nameThreshold, description, descriptionThreshold } = J.Constant.limit.space;
|
||||
|
||||
let canSave = true;
|
||||
|
||||
|
@ -514,13 +515,13 @@ const PageMainSettingsSpaceIndex = observer(class PageMainSettingsSpaceIndex ext
|
|||
if (input == 'name') {
|
||||
ref = this.refName;
|
||||
el = node.find('.spaceNameWrapper .counter');
|
||||
limit = J.Constant.limit.spaceName;
|
||||
threshold = J.Constant.limit.spaceNameThreshold;
|
||||
limit = name;
|
||||
threshold = nameThreshold;
|
||||
} else {
|
||||
ref = this.refDescription;
|
||||
el = node.find('.spaceDescriptionWrapper .counter');
|
||||
limit = J.Constant.limit.spaceDescription;
|
||||
threshold = J.Constant.limit.spaceDescriptionThreshold;
|
||||
limit = description;
|
||||
threshold = descriptionThreshold;
|
||||
};
|
||||
|
||||
const counter = limit - ref?.getTextValue().length;
|
||||
|
|
|
@ -14,6 +14,7 @@ const PopupSpaceCreate = observer(forwardRef<{}, I.Popup>(({ param = {}, close }
|
|||
const [ iconOption, setIconOption ] = useState(U.Common.rand(1, J.Constant.count.icon));
|
||||
const { data } = param;
|
||||
const { uxType } = data;
|
||||
const { name: limit, nameThreshold: threshold } = J.Constant.limit.space;
|
||||
|
||||
const onKeyDown = (e: any) => {
|
||||
keyboard.shortcut('enter', e, () => {
|
||||
|
@ -166,8 +167,8 @@ const PopupSpaceCreate = observer(forwardRef<{}, I.Popup>(({ param = {}, close }
|
|||
|
||||
const updateCounter = () => {
|
||||
const el = $('.popupSpaceCreate .nameWrapper .counter');
|
||||
const counter = J.Constant.limit.spaceName - nameRef.current?.getTextValue().length;
|
||||
const show = counter <= J.Constant.limit.spaceNameThreshold;
|
||||
const counter = limit - nameRef.current?.getTextValue().length;
|
||||
const show = counter <= threshold;
|
||||
const isRed = counter < 0;
|
||||
|
||||
el.toggleClass('show', show);
|
||||
|
@ -212,7 +213,7 @@ const PopupSpaceCreate = observer(forwardRef<{}, I.Popup>(({ param = {}, close }
|
|||
onKeyDown={onKeyDown}
|
||||
onKeyUp={onKeyUp}
|
||||
placeholder={translate('defaultNamePage')}
|
||||
maxLength={J.Constant.limit.spaceName}
|
||||
maxLength={limit}
|
||||
/>
|
||||
<div className="counter" />
|
||||
</div>
|
||||
|
|
|
@ -367,7 +367,7 @@ class UtilSpace {
|
|||
const items = U.Common.objectCopy(this.getList().filter(it => it.creator == this.getParticipantId(it.targetSpaceId, account.id)));
|
||||
const length = items.length;
|
||||
|
||||
return length < J.Constant.limit.space;
|
||||
return length < J.Constant.limit.space.count;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue