mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-24 05:29:51 +03:00
fix cmdk project switching
This commit is contained in:
parent
22365668e0
commit
e0fb1c93ba
@ -12,32 +12,27 @@
|
||||
import { Button, Tooltip } from '$lib/components';
|
||||
|
||||
export let data: PageData;
|
||||
const { activity, project, statuses, sessions, head } = data;
|
||||
$: activity = derived(data.activity, (activity) => activity);
|
||||
$: project = derived(data.project, (project) => project);
|
||||
$: statuses = derived(data.statuses, (statuses) => statuses);
|
||||
$: sessions = derived(data.sessions, (sessions) => sessions);
|
||||
$: head = derived(data.head, (head) => head);
|
||||
|
||||
const recentSessions = derived(
|
||||
sessions,
|
||||
(sessions) => {
|
||||
$: recentSessions = derived(sessions, (sessions) => {
|
||||
const lastFourDaysOfSessions = sessions.filter(
|
||||
(session) => session.meta.startTimestampMs >= getTime(subDays(new Date(), 4))
|
||||
);
|
||||
if (lastFourDaysOfSessions.length >= 4) return lastFourDaysOfSessions;
|
||||
return sessions.slice(0, 4);
|
||||
},
|
||||
[]
|
||||
);
|
||||
});
|
||||
|
||||
const recentActivity = derived(
|
||||
[activity, recentSessions],
|
||||
([activity, recentSessions]) =>
|
||||
activity
|
||||
$: recentActivity = derived([activity, recentSessions], ([activity, recentSessions]) => {
|
||||
return activity
|
||||
.filter((a) => a.timestampMs >= (recentSessions.at(-1)?.meta.startTimestampMs ?? 0))
|
||||
.sort((a, b) => b.timestampMs - a.timestampMs),
|
||||
[]
|
||||
);
|
||||
.sort((a, b) => b.timestampMs - a.timestampMs);
|
||||
});
|
||||
|
||||
const sessionByDates = derived(
|
||||
recentSessions,
|
||||
(sessions) =>
|
||||
$: sessionByDates = derived(recentSessions, (sessions) =>
|
||||
sessions.reduce((list: [Session[], Date][], session) => {
|
||||
const date = startOfDay(new Date(session.meta.startTimestampMs));
|
||||
if (list.length === 0) {
|
||||
@ -51,11 +46,10 @@
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}, []),
|
||||
[]
|
||||
}, [])
|
||||
);
|
||||
|
||||
const filesActivityByDate = asyncDerived(
|
||||
$: filesActivityByDate = asyncDerived(
|
||||
[project, sessionByDates],
|
||||
async ([project, sessionByDates]) =>
|
||||
await Promise.all(
|
||||
|
Loading…
Reference in New Issue
Block a user