diff --git a/src-electron/electron-preload.ts b/src-electron/electron-preload.ts index 5917991..4a060d3 100644 --- a/src-electron/electron-preload.ts +++ b/src-electron/electron-preload.ts @@ -71,7 +71,7 @@ const modulesAPI = { contextBridge.exposeInMainWorld('modulesAPI', modulesAPI) import { State as ExecutionEngineState, ExecutionLogEntry } from './handlers/engine' -import { WeeklyTopData } from './handlers/top' +import { TopData } from './handlers/top' declare global { interface Window { @@ -135,7 +135,7 @@ declare global { } const topAPI = { - async getWeeklyTop (): Promise { + async getWeeklyTop (): Promise { return await ipcRenderer.invoke('top:getWeeklyTop') }, } diff --git a/src-electron/handlers/top.ts b/src-electron/handlers/top.ts index 30e453f..dd31c3a 100644 --- a/src-electron/handlers/top.ts +++ b/src-electron/handlers/top.ts @@ -1,28 +1,33 @@ import { ipcMain } from "electron"; import fetch from "electron-fetch"; -export interface WeeklyTopData { +export interface PeriodTopData { + items: Array<{ + traffic: number, + user_name: string, + systems: Array, + servers_count: number, + }> + start_date: string + end_data: string +} + +export interface TopData { success: boolean; error: string data: { - items: Array<{ - traffic: number, - user_name: string, - systems: Array, - servers_count: number, - }> - start_date: string - end_data: string + week_stats: PeriodTopData + month_stats: PeriodTopData } } -async function getWeeklyTopData(): Promise { +async function getTopData(): Promise { const response = await fetch("https://itarmy.com.ua/leaderboard/json/leaderboard.json") - return await response.json() as WeeklyTopData + return await response.json() as TopData } export function handleTop () { ipcMain.handle('top:getWeeklyTop', async () => { - return await getWeeklyTopData() + return await getTopData() }) } \ No newline at end of file diff --git a/src/pages/SettingsPage.vue b/src/pages/SettingsPage.vue index dd8bba2..c047f31 100644 --- a/src/pages/SettingsPage.vue +++ b/src/pages/SettingsPage.vue @@ -1,3 +1,135 @@ + + diff --git a/src/pages/top/TopPage.vue b/src/pages/top/TopPage.vue index fd8de93..f9f6bd3 100644 --- a/src/pages/top/TopPage.vue +++ b/src/pages/top/TopPage.vue @@ -1,21 +1,52 @@