2019-06-13 01:27:13 +05:30
|
|
|
import UpdateAction from "../UpdateAction.js";
|
|
|
|
|
2019-03-09 00:34:56 +05:30
|
|
|
export default class SimpleTile {
|
2019-03-09 05:10:03 +05:30
|
|
|
constructor({entry, emitUpdate}) {
|
2019-03-09 00:34:56 +05:30
|
|
|
this._entry = entry;
|
2019-03-09 05:10:03 +05:30
|
|
|
this._emitUpdate = emitUpdate;
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|
|
|
|
// view model props for all subclasses
|
|
|
|
// hmmm, could also do instanceof ... ?
|
|
|
|
get shape() {
|
2019-06-13 01:27:13 +05:30
|
|
|
return null;
|
2019-03-09 00:34:56 +05:30
|
|
|
// "gap" | "message" | "image" | ... ?
|
|
|
|
}
|
|
|
|
|
|
|
|
// don't show display name / avatar
|
|
|
|
// probably only for MessageTiles of some sort?
|
|
|
|
get isContinuation() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
get hasDateSeparator() {
|
|
|
|
return false;
|
|
|
|
}
|
2019-06-01 21:59:02 +05:30
|
|
|
// TilesCollection contract? unused atm
|
|
|
|
get upperEntry() {
|
|
|
|
return this._entry;
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|
|
|
|
|
2019-06-01 21:59:02 +05:30
|
|
|
// TilesCollection contract? unused atm
|
|
|
|
get lowerEntry() {
|
|
|
|
return this._entry;
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|
|
|
|
|
2019-06-13 01:27:13 +05:30
|
|
|
emitUpdate(paramName) {
|
|
|
|
this._emitUpdate(this, paramName);
|
|
|
|
}
|
|
|
|
|
2019-03-09 00:34:56 +05:30
|
|
|
// TilesCollection contract
|
2019-06-01 21:59:02 +05:30
|
|
|
compareEntry(entry) {
|
|
|
|
return this._entry.compare(entry);
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// update received for already included (falls within sort keys) entry
|
2019-06-16 20:17:56 +05:30
|
|
|
updateEntry(entry) {
|
|
|
|
this._entry = entry;
|
2019-06-13 01:27:13 +05:30
|
|
|
return UpdateAction.Nothing();
|
2019-03-09 05:10:03 +05:30
|
|
|
}
|
2019-03-09 00:34:56 +05:30
|
|
|
|
2019-03-09 05:10:03 +05:30
|
|
|
// return whether the tile should be removed
|
|
|
|
// as SimpleTile only has one entry, the tile should be removed
|
|
|
|
removeEntry(entry) {
|
|
|
|
return true;
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|
|
|
|
|
2019-03-09 05:10:03 +05:30
|
|
|
// SimpleTile can only contain 1 entry
|
2019-03-09 00:34:56 +05:30
|
|
|
tryIncludeEntry() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// let item know it has a new sibling
|
|
|
|
updatePreviousSibling(prev) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// let item know it has a new sibling
|
|
|
|
updateNextSibling(next) {
|
|
|
|
|
|
|
|
}
|
2019-06-02 21:45:24 +05:30
|
|
|
|
|
|
|
get internalId() {
|
|
|
|
return this._entry.asEventKey().toString();
|
|
|
|
}
|
2019-07-29 23:23:58 +05:30
|
|
|
|
|
|
|
get isPending() {
|
|
|
|
return this._entry.isPending;
|
|
|
|
}
|
2019-03-09 00:34:56 +05:30
|
|
|
}
|