refactor(views): move full height detection to rendererer

This commit is contained in:
Elian Doran
2025-07-14 12:56:17 +03:00
parent b29c3eff6e
commit 8c56315313
5 changed files with 7 additions and 18 deletions

View File

@@ -47,7 +47,13 @@ export default class NoteListRenderer {
}
get isFullHeight() {
return this.viewMode?.isFullHeight;
switch (this.viewType) {
case "list":
case "grid":
return false;
default:
return true;
}
}
async renderList() {

View File

@@ -129,10 +129,6 @@ export default class CalendarView extends ViewMode<{}> {
args.$parent.append(this.$root);
}
get isFullHeight(): boolean {
return true;
}
async renderList(): Promise<JQuery<HTMLElement> | undefined> {
this.isCalendarRoot = this.parentNote.hasLabel("calendarRoot") || this.parentNote.hasLabel("workspaceCalendarRoot");
const isEditable = !this.isCalendarRoot;

View File

@@ -243,10 +243,6 @@ export default class GeoView extends ViewMode<MapData> {
}
}
get isFullHeight(): boolean {
return true;
}
#changeState(newState: State) {
this._state = newState;
this.$container.toggleClass("placing-note", newState === State.NewNote);

View File

@@ -120,10 +120,6 @@ export default class TableView extends ViewMode<StateInfo> {
args.$parent.append(this.$root);
}
get isFullHeight(): boolean {
return true;
}
async renderList() {
this.$container.empty();
this.renderTable(this.$container[0]);

View File

@@ -39,11 +39,6 @@ export default abstract class ViewMode<T extends object> extends Component {
// Do nothing by default.
}
get isFullHeight() {
// Override to change its value.
return false;
}
get isReadOnly() {
return this.parentNote.hasLabel("readOnly");
}