feat: Add reordering to starred documents (#2953)
* draft * reordering * JIT Index stars on first load * test * Remove unused code on client * small unrefactor
This commit is contained in:
28
app/models/Star.ts
Normal file
28
app/models/Star.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { observable } from "mobx";
|
||||
import BaseModel from "./BaseModel";
|
||||
import Field from "./decorators/Field";
|
||||
|
||||
class Star extends BaseModel {
|
||||
id: string;
|
||||
|
||||
@Field
|
||||
@observable
|
||||
index: string;
|
||||
|
||||
documentId: string;
|
||||
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
next(): Star | undefined {
|
||||
const index = this.store.orderedData.indexOf(this);
|
||||
return this.store.orderedData[index + 1];
|
||||
}
|
||||
|
||||
previous(): Star | undefined {
|
||||
const index = this.store.orderedData.indexOf(this);
|
||||
return this.store.orderedData[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
export default Star;
|
||||
Reference in New Issue
Block a user