MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / constructor

Method constructor

apps/client/src/code/pages/page/page.ts:162–274  ·  view source on GitHub ↗
(input: { factories: Factories; app: Pages; id: string })

Source from the content-addressed store, hash-verified

160 }
161
162 constructor(input: { factories: Factories; app: Pages; id: string }) {
163 this.app = input.app;
164 this.id = input.id;
165
166 this.realtimeCtx = new (RealtimeContext())();
167
168 this.react = reactive({
169 // Region
170
171 collab: computed(() => this.collab.store.page),
172
173 _nextZIndex: 0,
174 nextZIndex: computed({
175 get: () =>
176 Math.max(this.react.collab.nextZIndex, this.react._nextZIndex),
177 set: (value) => {
178 value ||= 0;
179
180 this.react.collab.nextZIndex = value;
181 this.react._nextZIndex = value;
182 },
183 }),
184
185 notes: computed(() => this.notes.fromIds(this.react.collab.noteIds)),
186 arrows: computed(() => this.arrows.fromIds(this.react.collab.arrowIds)),
187
188 elems: computed(() =>
189 (this.react.notes as PageElem[]).concat(this.react.arrows),
190 ),
191
192 islandRoot: computed(() => getIslandRoot(this)),
193 islandRegions: computed(() => getIslandRegions(this)),
194
195 // Page
196
197 active: computed(() => this.app.react.page === this),
198
199 groupId: computed(() => pageGroupIds()(this.id).get()!),
200
201 readOnly: computed(() => {
202 if (
203 !!this.realtimeCtx.hget('page', this.id, 'permanent-deletion-date') ||
204 !!this.realtimeCtx.hget(
205 'group',
206 this.react.groupId,
207 'permanent-deletion-date',
208 )
209 ) {
210 return true;
211 }
212
213 if (authStore().userId == null) {
214 return true;
215 }
216
217 const userPlan = this.realtimeCtx.hget(
218 'user',
219 authStore().userId,

Callers

nothing calls this directly

Calls 5

getIslandRootFunction · 0.90
getIslandRegionsFunction · 0.90
getMethod · 0.65
fromIdsMethod · 0.45
hgetMethod · 0.45

Tested by

no test coverage detected