2022-09-20 15:02:09 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { SimpleTile } = require('hydrogen-view-sdk');
|
|
|
|
|
|
|
|
const MatrixPublicArchiveURLCreator = require('matrix-public-archive-shared/lib/url-creator');
|
|
|
|
const assert = require('../lib/assert');
|
|
|
|
|
2022-11-02 03:27:30 -06:00
|
|
|
class JumpToNextActivitySummaryTileViewModel extends SimpleTile {
|
2022-09-20 15:02:09 -06:00
|
|
|
constructor(entry, options) {
|
|
|
|
super(entry, options);
|
|
|
|
this._entry = entry;
|
|
|
|
|
|
|
|
const basePath = this._entry?.content?.['basePath'];
|
|
|
|
assert(basePath);
|
|
|
|
this._matrixPublicArchiveURLCreator = new MatrixPublicArchiveURLCreator(basePath);
|
|
|
|
}
|
|
|
|
|
|
|
|
get shape() {
|
2022-11-02 03:27:30 -06:00
|
|
|
return 'org.matrix.archive.jump_to_next_activity_summary:shape';
|
2022-09-20 15:02:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
get daySummaryKind() {
|
|
|
|
return this._entry?.content?.['daySummaryKind'];
|
|
|
|
}
|
|
|
|
|
|
|
|
get dayTimestamp() {
|
|
|
|
return this._entry?.content?.['dayTimestamp'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// The end of the range to use as a jumping off point to the next activity
|
|
|
|
get rangeEndTimestamp() {
|
|
|
|
return this._entry?.content?.['rangeEndTimestamp'];
|
|
|
|
}
|
|
|
|
|
|
|
|
get jumpToNextActivityUrl() {
|
2022-10-27 00:09:13 -06:00
|
|
|
return this._matrixPublicArchiveURLCreator.archiveJumpUrlForRoom(
|
|
|
|
this._entry?.content?.['canonicalAlias'] || this._entry.roomId,
|
|
|
|
{
|
|
|
|
ts: this.rangeEndTimestamp,
|
|
|
|
dir: 'f',
|
|
|
|
}
|
|
|
|
);
|
2022-09-20 15:02:09 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-02 03:27:30 -06:00
|
|
|
module.exports = JumpToNextActivitySummaryTileViewModel;
|