diff --git a/resources/js/helpers/api.types.ts b/resources/js/helpers/api.types.ts index 90b7ed3..7173348 100644 --- a/resources/js/helpers/api.types.ts +++ b/resources/js/helpers/api.types.ts @@ -1,5 +1,35 @@ export type Booleanish = boolean | "true" | "false"; +export type EmptyObject = { [key: string]: never }; + +export interface SessionRequest { + id: number; + session_id: number; + type: string; + path: string; + created_at: string; + updated_at: string; +} + +export interface Session { + id: number; + ip: string; + useragent: string; + created_at: string; + updated_at: string; + ended_at: string; + requests?: SessionRequest[]; +} + +export interface SessionCollection { + sessions: Session[]; + total: number; +} + +export interface SessionRequestCollection { + session: Session; +} + export interface Event { id: string; title: string; diff --git a/resources/js/router/index.js b/resources/js/router/index.js index d37286a..05ee913 100644 --- a/resources/js/router/index.js +++ b/resources/js/router/index.js @@ -198,6 +198,31 @@ export const routes = [ /* webpackPrefetch: true */ "@/views/dashboard/Dashboard.vue" ), }, + { + path: "analytics", + children: [ + { + path: "", + name: "dashboard-analytics-list", + meta: { + title: "Analytics", + middleware: "authenticated", + }, + component: () => + import("@/views/dashboard/AnalyticsList.vue"), + }, + { + path: ":id", + name: "dashboard-analytics-item", + meta: { + title: "Analytics Session", + middleware: "authenticated", + }, + component: () => + import("@/views/dashboard/AnalyticsItem.vue"), + }, + ], + }, { path: "articles", children: [ @@ -471,7 +496,7 @@ router.beforeEach(async (to, from, next) => { url: "/analytics", body: { type: "pageview", - attribute: to.fullPath, + path: to.fullPath, }, }).catch(() => { /* empty */ diff --git a/resources/js/views/dashboard/AnalyticsItem.vue b/resources/js/views/dashboard/AnalyticsItem.vue new file mode 100644 index 0000000..48fbe70 --- /dev/null +++ b/resources/js/views/dashboard/AnalyticsItem.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/resources/js/views/dashboard/AnalyticsList.vue b/resources/js/views/dashboard/AnalyticsList.vue new file mode 100644 index 0000000..5cb8685 --- /dev/null +++ b/resources/js/views/dashboard/AnalyticsList.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/resources/js/views/dashboard/Dashboard.vue b/resources/js/views/dashboard/Dashboard.vue index c241f89..d558421 100644 --- a/resources/js/views/dashboard/Dashboard.vue +++ b/resources/js/views/dashboard/Dashboard.vue @@ -43,8 +43,8 @@ + :to="{ name: 'dashboard-analytics-list' }" + class="admin-card analytics">

Analytics