Skip to content

Commit

Permalink
JS-4811: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3orblade committed Jul 2, 2024
1 parent ea5957b commit 4c99ce8
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 41 deletions.
6 changes: 2 additions & 4 deletions extension/iframe/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
};

componentDidMount (): void {
U.Data.createSubscriptions(() => {
this.init();
});
U.Data.createSpaceSubscriptions(() => this.init());
};

componentDidUpdate (): void {
Expand Down Expand Up @@ -177,7 +175,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St

onSpaceChange (id: string): void {
S.Common.spaceSet(id);
U.Data.createSubscriptions();
U.Data.createSpaceSubscriptions();
};

getWrapperWidth () {
Expand Down
4 changes: 2 additions & 2 deletions extension/popup/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
};

componentDidMount(): void {
U.Data.createSubscriptions(() => {
U.Data.createSpaceSubscriptions(() => {
this.initSpace();
this.initName();
this.initType();
Expand Down Expand Up @@ -264,7 +264,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St

onSpaceChange (id: string): void {
S.Common.spaceSet(id);
U.Data.createSubscriptions(() => this.forceUpdate());
U.Data.createSpaceSubscriptions(() => this.forceUpdate());

Storage.set('lastSpaceId', id);
};
Expand Down
9 changes: 6 additions & 3 deletions src/scss/component/vault.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

.vault {
position: fixed; background-color: #000; z-index: 30; left: 0px; top: 0px; width: $vaultWidthCollapsed; height: 100%;
display: flex; flex-direction: column; transition: width 0.3s $easeInQuint; padding-top: 42px;
display: flex; flex-direction: column; transition: width 0.3s $easeInQuint;
}
.vault {
.head { height: 42px; display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 0px 8px; padding: 0px 14px; flex-shrink: 0; }
.head {
height: 42px; display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 0px 8px; padding: 0px 14px; flex-shrink: 0;
position: relative; z-index: 1; background: #000;
}
.head {
.icon { width: 24px; height: 24px; background-size: 20px; border-radius: 4px; -webkit-app-region: no-drag; opacity: 0; }
.icon.settings { background-image: url('~img/icon/vault/settings.svg'); }
Expand All @@ -28,7 +31,7 @@

.item {
position: relative; border-radius: 2px; transition-property: background, filter; transition-duration: 0.2s; transition-timing-function: $easeInQuint;
filter: grayscale(100%) contrast(70%);
filter: grayscale(100%) contrast(80%);
}
.item {
.iconWrap, .infoWrap { position: relative; z-index: 1; }
Expand Down
4 changes: 2 additions & 2 deletions src/ts/component/vault/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ const Vault = observer(class Vault extends React.Component {
id="vault"
className="vault"
>
{/*
<div className="head">
{/*
<Icon className="settings" />
<Icon className="close" onClick={this.onToggle} />
*/}
</div>
*/}
<div className="body">
<List
axis="y"
Expand Down
79 changes: 50 additions & 29 deletions src/ts/lib/util/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class UtilData {
return;
};

this.createSubscriptions(() => {
this.createSpaceSubscriptions(() => {
// Redirect
if (pin && !keyboard.isPinChecked) {
U.Router.go('/auth/pin-check', routeParam);
Expand Down Expand Up @@ -241,13 +241,57 @@ class UtilData {

this.getMembershipTiers(noTierCache);
this.getMembershipStatus();
this.createGlobalSubscriptions();

analytics.event('OpenAccount');
};

createSubscriptions (callBack?: () => void): void {
const { space } = S.Common;
createGlobalSubscriptions (callBack?: () => void) {
const { account } = S.Auth;
const list: any[] = [
{
subId: J.Constant.subId.profile,
filters: [
{ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.Equal, value: S.Block.profile },
],
noDeps: true,
ignoreWorkspace: true,
ignoreHidden: false,
},
{
subId: J.Constant.subId.space,
keys: this.spaceRelationKeys(),
filters: [
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.SpaceView },
],
sorts: [
{ relationKey: 'name', type: I.SortType.Asc },
],
ignoreWorkspace: true,
ignoreHidden: false,
},
];

if (account) {
list.push({
subId: J.Constant.subId.myParticipant,
keys: this.participantRelationKeys(),
filters: [
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Participant },
{ operator: I.FilterOperator.And, relationKey: 'identity', condition: I.FilterCondition.Equal, value: account.id },
],
ignoreWorkspace: true,
ignoreDeleted: true,
ignoreHidden: false,
noDeps: true,
});
};

this.createSubscriptions(list, callBack);
};

createSpaceSubscriptions (callBack?: () => void): void {
const { space } = S.Common;
const list: any[] = [
{
subId: J.Constant.subId.profile,
Expand Down Expand Up @@ -314,18 +358,6 @@ class UtilData {
noDeps: true,
ignoreDeleted: true,
},
{
subId: J.Constant.subId.space,
keys: this.spaceRelationKeys(),
filters: [
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.SpaceView },
],
sorts: [
{ relationKey: 'name', type: I.SortType.Asc },
],
ignoreWorkspace: true,
ignoreHidden: false,
},
{
subId: J.Constant.subId.participant,
keys: this.participantRelationKeys(),
Expand All @@ -341,21 +373,10 @@ class UtilData {
},
];

if (account) {
list.push({
subId: J.Constant.subId.myParticipant,
keys: this.participantRelationKeys(),
filters: [
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Participant },
{ operator: I.FilterOperator.And, relationKey: 'identity', condition: I.FilterCondition.Equal, value: account.id },
],
ignoreWorkspace: true,
ignoreDeleted: true,
ignoreHidden: false,
noDeps: true,
});
};
this.createSubscriptions(list, callBack);
};

createSubscriptions (list: any[], callBack?: () => void) {
let cnt = 0;
const cb = (item: any) => {
if (item.onSubscribe) {
Expand Down
11 changes: 10 additions & 1 deletion src/ts/store/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,28 @@ class BlockStore {

constructor() {
makeObservable(this, {
rootId: observable,
profileId: observable,
spaceviewId: observable,
widgetsId: observable,

profile: computed,
root: computed,
spaceview: computed,
widgets: computed,

rootSet: action,
profileSet: action,
widgetsSet: action,
spaceviewSet: action,
set: action,
clear: action,
clearAll: action,
add: action,
update: action,
updateContent: action,
updateStructure: action,
delete: action
delete: action,
});
};

Expand Down

0 comments on commit 4c99ce8

Please sign in to comment.