Room details: Message history UX improvement

This commit is contained in:
10G Meow 2024-02-25 13:19:43 +02:00
parent 75ba6a15c4
commit d3c4423b17
4 changed files with 91 additions and 146 deletions

View file

@ -14,6 +14,36 @@ export default {
editedRoomTopic: "",
isRoomTopicEditMode: false,
roomTopicErrorMessage: null,
retentionPeriods: [
{
text: this.$t("room_info.message_retention_none"),
value: 0
},
{
text: this.$t("room_info.message_retention_4_week"),
value: 3600 * 24 * 28 * 1000
},
{
text: this.$t("room_info.message_retention_2_week"),
value: 3600 * 24 * 14 * 1000
},
{
text: this.$t("room_info.message_retention_1_week"),
value: 3600 * 24 * 7 * 1000
},
{
text: this.$t("room_info.message_retention_1_day"),
value: 3600 * 24 * 1000
},
{
text: this.$t("room_info.message_retention_8_hours"),
value: 3600 * 8 * 1000
},
{
text: this.$t("room_info.message_retention_1_hour"),
value: 3600 * 1000
}
]
};
},
mounted() {
@ -135,20 +165,10 @@ export default {
*/
roomMessageRetentionDisplay(maybeEvent) {
const retention = this.roomMessageRetention(maybeEvent);
if (retention == 0) {
return this.$t("room_info.message_retention_none");
} else if (retention == 60 * 60 * 1000) {
return this.$t("room_info.message_retention_1_hour");
} else if (retention == 24 * 60 * 60 * 1000) {
return this.$t("room_info.message_retention_1_day");
} else if (retention == 7 * 24 * 60 * 60 * 1000) {
return this.$t("room_info.message_retention_1_week");
} else if (retention == 30 * 24 * 60 * 60 * 1000) {
return this.$t("room_info.message_retention_30_days");
} else if (retention == 365 * 24 * 60 * 60 * 1000) {
return this.$t("room_info.message_retention_365_days");
const retentionPeriodsFound = this.retentionPeriods.find(rp=>rp.value===retention)
if(retentionPeriodsFound) {
return retentionPeriodsFound.text
}
return this.$t("room_info.message_retention_other_seconds", { count: retention / 1000 });
},
roomMessageRetention(maybeEvent) {