diff --git a/packages/web-app-activities/src/components/ActivityItem.vue b/packages/web-app-activities/src/components/ActivityItem.vue
index 3c25c6871ce..d0a076fdb9c 100644
--- a/packages/web-app-activities/src/components/ActivityItem.vue
+++ b/packages/web-app-activities/src/components/ActivityItem.vue
@@ -7,12 +7,16 @@
activity unknown
@@ -20,7 +24,12 @@
import { computed, defineComponent, onMounted, PropType, ref, unref } from 'vue'
import { Activity } from '@ownclouders/web-client/src/graph/generated'
import { DateTime } from 'luxon'
-import { formatDateFromDateTime, ResourceListItem, useClientService } from '@ownclouders/web-pkg'
+import {
+ formatDateFromDateTime,
+ formatRelativeDateFromDateTime,
+ ResourceListItem,
+ useClientService
+} from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'
import { Resource } from '@ownclouders/web-client'
@@ -37,10 +46,16 @@ export default defineComponent({
const clientService = useClientService()
const { current: currentLanguage } = useGettext()
const resource = ref()
- const resourceDeleted = ref(false)
+ const resourceNotAccessible = ref(false)
- const modifiedDateTime = computed(() => {
+ const recordedDateTime = computed(() => {
const dateTime = DateTime.fromISO(props.activity.times.recordedTime)
+
+ const isWithinLastHour = dateTime > DateTime.now().minus({ hour: 1 })
+ if (isWithinLastHour) {
+ return formatRelativeDateFromDateTime(dateTime, currentLanguage)
+ }
+
return formatDateFromDateTime(dateTime, currentLanguage)
})
@@ -51,14 +66,14 @@ export default defineComponent({
{ fileId: props.activity.template.variables.resource.id }
)
} catch (e) {
- resourceDeleted.value = true
+ resourceNotAccessible.value = true
}
})
return {
- modifiedDateTime,
+ recordedDateTime,
resource,
- resourceDeleted
+ resourceNotAccessible
}
}
})
diff --git a/packages/web-app-activities/src/index.ts b/packages/web-app-activities/src/index.ts
index 98b9cd7df8b..eaec50a8655 100644
--- a/packages/web-app-activities/src/index.ts
+++ b/packages/web-app-activities/src/index.ts
@@ -14,7 +14,7 @@ export default defineWebApplication({
name: $gettext('Activities'),
id: APPID,
icon: 'pulse',
- color: '#ff6961'
+ color: '#887ef1'
}
const routes: RouteRecordRaw[] = [
diff --git a/packages/web-app-activities/src/views/ActivityList.vue b/packages/web-app-activities/src/views/ActivityList.vue
index e7c04ee887a..e7970f2e0f8 100644
--- a/packages/web-app-activities/src/views/ActivityList.vue
+++ b/packages/web-app-activities/src/views/ActivityList.vue
@@ -40,19 +40,6 @@ export default defineComponent({
}
acc[date].push(activity)
- // TODO: Remove mock data
- const date2 = DateTime.fromISO(activity.times.recordedTime).minus({ day: 1 }).toISODate()
- if (!acc[date2]) {
- acc[date2] = []
- }
- acc[date2].push(activity)
-
- const date3 = DateTime.fromISO(activity.times.recordedTime).minus({ day: 2 }).toISODate()
- if (!acc[date3]) {
- acc[date3] = []
- }
- acc[date3].push(activity)
-
return acc
}, {})
})
diff --git a/packages/web-app-activities/src/views/App.vue b/packages/web-app-activities/src/views/App.vue
index b58377a4b9d..ab8298d0ef7 100644
--- a/packages/web-app-activities/src/views/App.vue
+++ b/packages/web-app-activities/src/views/App.vue
@@ -80,14 +80,14 @@ export default defineComponent({
})
const loadActivitiesTask = useTask(function* (signal) {
- const filters = []
+ const filters = ['sort:desc']
if (unref(locationQuery)) {
filters.push(`itemid:${unref(locationQuery)}`)
}
activities.value = yield* call(
- clientService.graphAuthenticated.activities.listActivities(filters.join(' AND '), {
+ clientService.graphAuthenticated.activities.listActivities(`${filters.join(' AND ')}`, {
signal
})
)