feat: FE calendar, context menu, dashboard
This commit is contained in:
parent
ca005ebb0b
commit
b389f37a1d
6 changed files with 123 additions and 84 deletions
|
@ -1,17 +1,17 @@
|
|||
import {ref, reactive} from "vue";
|
||||
import type {ShowInstance} from "@models/show/showInstance.ts";
|
||||
import type {calendarShowEvent} from "@models/misc/calendarShowEvent.ts";
|
||||
|
||||
export function archive_page() {
|
||||
const items = ref([])
|
||||
const selected = ref([])
|
||||
const loading = ref(false)
|
||||
const search = ref('')
|
||||
const listData = reactive({
|
||||
'itemsPerPage': 5,
|
||||
'first_page': null,
|
||||
'last_page': null,
|
||||
'total_items': 0,
|
||||
'page': 1,
|
||||
})
|
||||
|
||||
return { items, listData, selected, loading, search }
|
||||
export const setShowInstancesForCalendar = (showInstances: ShowInstance[]): calendarShowEvent[] => {
|
||||
return showInstances.flatMap((showInstance: ShowInstance, index: number) => {
|
||||
return {
|
||||
showInstanceIndex: index,
|
||||
showInstanceId: showInstance.id,
|
||||
title: showInstance.show.name,
|
||||
color: showInstance.show.color,
|
||||
start: new Date(showInstance.starts),
|
||||
end: new Date(showInstance.ends),
|
||||
timed: true
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type {ContextMenu} from "@models/misc/contextMenu"
|
||||
import type {ContextMenu, ExtractActionTriggers} from "@models/misc/contextMenu"
|
||||
|
||||
export interface calendarShowEvent {
|
||||
showInstanceIndex: Number,
|
||||
showInstanceId: Number,
|
||||
title: string,
|
||||
color: string,
|
||||
|
@ -9,6 +10,8 @@ export interface calendarShowEvent {
|
|||
timed: boolean,
|
||||
}
|
||||
|
||||
export type ShowEventActionTrigger = ExtractActionTriggers<typeof calendarShowEventMenu>;
|
||||
|
||||
export const calendarShowEventMenu: ContextMenu = {
|
||||
entries: [
|
||||
{
|
||||
|
|
|
@ -24,6 +24,12 @@ interface ContextMenuEntryWithChildren {
|
|||
|
||||
type ContextMenuEntry = ContextMenuEntryWithAction | ContextMenuEntryWithChildren;
|
||||
|
||||
export type ExtractActionTriggers<T> =
|
||||
T extends { actionTrigger: infer U } ? U :
|
||||
T extends { children: infer C } ? ExtractActionTriggers<C> :
|
||||
T extends (infer R)[] ? ExtractActionTriggers<R> :
|
||||
never;
|
||||
|
||||
export function menuEntryWithAction(entry: ContextMenuEntry): entry is ContextMenuEntryWithAction {
|
||||
return 'actionTrigger' in entry;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue