From eae19bb1b047b3568e7a9a624b50e80886e56331 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:50 +0300 Subject: feat/frontend: optimizing imports, file extensions (#230) Co-authored-by: FifthWit --- frontend/src/types/Chapters.ts | 19 +++++++ frontend/src/types/Chapters.tsx | 19 ------- frontend/src/types/Content.ts | 24 +++++++++ frontend/src/types/Content.tsx | 24 --------- frontend/src/types/Game.ts | 37 +++++++++++++ frontend/src/types/Game.tsx | 37 ------------- frontend/src/types/Map.ts | 108 ++++++++++++++++++++++++++++++++++++++ frontend/src/types/Map.tsx | 108 -------------------------------------- frontend/src/types/Pagination.ts | 6 +++ frontend/src/types/Pagination.tsx | 6 --- frontend/src/types/Profile.ts | 63 ++++++++++++++++++++++ frontend/src/types/Profile.tsx | 63 ---------------------- frontend/src/types/Ranking.ts | 31 +++++++++++ frontend/src/types/Ranking.tsx | 31 ----------- frontend/src/types/Search.ts | 13 +++++ frontend/src/types/Search.tsx | 13 ----- 16 files changed, 301 insertions(+), 301 deletions(-) create mode 100644 frontend/src/types/Chapters.ts delete mode 100644 frontend/src/types/Chapters.tsx create mode 100644 frontend/src/types/Content.ts delete mode 100644 frontend/src/types/Content.tsx create mode 100644 frontend/src/types/Game.ts delete mode 100644 frontend/src/types/Game.tsx create mode 100644 frontend/src/types/Map.ts delete mode 100644 frontend/src/types/Map.tsx create mode 100644 frontend/src/types/Pagination.ts delete mode 100644 frontend/src/types/Pagination.tsx create mode 100644 frontend/src/types/Profile.ts delete mode 100644 frontend/src/types/Profile.tsx create mode 100644 frontend/src/types/Ranking.ts delete mode 100644 frontend/src/types/Ranking.tsx create mode 100644 frontend/src/types/Search.ts delete mode 100644 frontend/src/types/Search.tsx (limited to 'frontend/src/types') diff --git a/frontend/src/types/Chapters.ts b/frontend/src/types/Chapters.ts new file mode 100644 index 0000000..1d48306 --- /dev/null +++ b/frontend/src/types/Chapters.ts @@ -0,0 +1,19 @@ +import type { Game } from "@customTypes/Game"; +import type { Map } from "@customTypes/Map"; + +interface Chapter { + id: number; + name: string; + image: string; + is_disabled: boolean; +} + +export interface GameChapter { + chapter: Chapter; + maps: Map[]; +} + +export interface GamesChapters { + game: Game; + chapters: Chapter[]; +} \ No newline at end of file diff --git a/frontend/src/types/Chapters.tsx b/frontend/src/types/Chapters.tsx deleted file mode 100644 index 2c0afdd..0000000 --- a/frontend/src/types/Chapters.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Game } from "./Game"; -import { Map } from "./Map"; - -interface Chapter { - id: number; - name: string; - image: string; - is_disabled: boolean; -} - -export interface GameChapter { - chapter: Chapter; - maps: Map[]; -} - -export interface GamesChapters { - game: Game; - chapters: Chapter[]; -} \ No newline at end of file diff --git a/frontend/src/types/Content.ts b/frontend/src/types/Content.ts new file mode 100644 index 0000000..42a6917 --- /dev/null +++ b/frontend/src/types/Content.ts @@ -0,0 +1,24 @@ +export interface ModMenuContent { + id: number; + name: string; + score: number; + date: string; + showcase: string; + description: string; + category_id: number; +}; + +export interface MapDiscussionContent { + title: string; + content: string; +}; + +export interface MapDiscussionCommentContent { + comment: string; +}; + +export interface UploadRunContent { + map_id: number; + host_demo: File | null; + partner_demo: File | null; +}; diff --git a/frontend/src/types/Content.tsx b/frontend/src/types/Content.tsx deleted file mode 100644 index 42a6917..0000000 --- a/frontend/src/types/Content.tsx +++ /dev/null @@ -1,24 +0,0 @@ -export interface ModMenuContent { - id: number; - name: string; - score: number; - date: string; - showcase: string; - description: string; - category_id: number; -}; - -export interface MapDiscussionContent { - title: string; - content: string; -}; - -export interface MapDiscussionCommentContent { - comment: string; -}; - -export interface UploadRunContent { - map_id: number; - host_demo: File | null; - partner_demo: File | null; -}; diff --git a/frontend/src/types/Game.ts b/frontend/src/types/Game.ts new file mode 100644 index 0000000..1a80341 --- /dev/null +++ b/frontend/src/types/Game.ts @@ -0,0 +1,37 @@ +import type { Map } from '@customTypes/Map'; + + +export interface Game { + id: number; + name: string; + image: string; + is_coop: boolean; + category_portals: GameCategoryPortals[]; +}; + +export interface GameChapters { + game: Game; + chapters: Chapter[]; +}; + +export interface GameMaps { + game: Game; + maps: Map[]; +}; + +export interface Category { + id: number; + name: string; +}; + +interface Chapter { + id: number; + name: string; + image: string; + is_disabled: boolean; +}; + +export interface GameCategoryPortals { + category: Category; + portal_count: number; +}; diff --git a/frontend/src/types/Game.tsx b/frontend/src/types/Game.tsx deleted file mode 100644 index eb435f6..0000000 --- a/frontend/src/types/Game.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { Map } from './Map'; - - -export interface Game { - id: number; - name: string; - image: string; - is_coop: boolean; - category_portals: GameCategoryPortals[]; -}; - -export interface GameChapters { - game: Game; - chapters: Chapter[]; -}; - -export interface GameMaps { - game: Game; - maps: Map[]; -}; - -export interface Category { - id: number; - name: string; -}; - -interface Chapter { - id: number; - name: string; - image: string; - is_disabled: boolean; -}; - -export interface GameCategoryPortals { - category: Category; - portal_count: number; -}; diff --git a/frontend/src/types/Map.ts b/frontend/src/types/Map.ts new file mode 100644 index 0000000..89c66d5 --- /dev/null +++ b/frontend/src/types/Map.ts @@ -0,0 +1,108 @@ +import type { Category, GameCategoryPortals } from '@customTypes/Game'; +import type { Pagination } from '@customTypes/Pagination'; +import type { UserShort } from '@customTypes/Profile'; + +export interface Map { + id: number; + name: string; + image: string; + is_disabled: boolean; + difficulty: number; + category_portals: GameCategoryPortals[]; +}; + +export interface MapDiscussion { + discussion: MapDiscussionsDetail; +}; + +export interface MapDiscussions { + discussions: MapDiscussionsDetail[]; +}; + +export interface MapDiscussionsDetail { + id: number; + title: string; + content: string; + creator: UserShort; + comments: MapDiscussionDetailComment[]; + created_at: string; + updated_at: string; +}; + +interface MapDiscussionDetailComment { + comment: string; + date: string; + user: UserShort; +}; + +export interface MapLeaderboard { + map: MapSummaryMap; + records: MapLeaderboardRecordSingleplayer[] | MapLeaderboardRecordMultiplayer[]; + pagination: Pagination; +}; + +export interface MapLeaderboardRecordSingleplayer { + kind: "singleplayer"; + placement: number; + record_id: number; + score_count: number; + score_time: number; + user: UserShort; + demo_id: string; + record_date: string; +}; + +export interface MapLeaderboardRecordMultiplayer { + kind: "multiplayer"; + placement: number; + record_id: number; + score_count: number; + score_time: number; + host: UserShort; + partner: UserShort; + host_demo_id: string; + partner_demo_id: string; + record_date: string; +}; + + +export interface MapSummary { + map: MapSummaryMap; + summary: MapSummaryDetails; +}; + +interface MapSummaryMap { + id: number; + image: string; + chapter_name: string; + game_name: string; + map_name: string; + is_coop: boolean; + is_disabled: boolean; +}; + +interface MapSummaryDetails { + routes: MapSummaryDetailsRoute[]; +}; + +interface MapSummaryDetailsRoute { + route_id: number; + category: Category; + history: MapSummaryDetailsRouteHistory; + rating: number; + completion_count: number; + description: string; + showcase: string; +}; + +interface MapSummaryDetailsRouteHistory { + runner_name: string; + score_count: number; + date: string; +}; + +export interface MapDeleteEndpoint { + map_id: number; + record_id: number; +} + diff --git a/frontend/src/types/Map.tsx b/frontend/src/types/Map.tsx deleted file mode 100644 index 4669e8b..0000000 --- a/frontend/src/types/Map.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import { Category, GameCategoryPortals } from './Game'; -import { Pagination } from './Pagination'; -import { UserShort } from './Profile'; - -export interface Map { - id: number; - name: string; - image: string; - is_disabled: boolean; - difficulty: number; - category_portals: GameCategoryPortals[]; -}; - -export interface MapDiscussion { - discussion: MapDiscussionsDetail; -}; - -export interface MapDiscussions { - discussions: MapDiscussionsDetail[]; -}; - -export interface MapDiscussionsDetail { - id: number; - title: string; - content: string; - creator: UserShort; - comments: MapDiscussionDetailComment[]; - created_at: string; - updated_at: string; -}; - -interface MapDiscussionDetailComment { - comment: string; - date: string; - user: UserShort; -}; - -export interface MapLeaderboard { - map: MapSummaryMap; - records: MapLeaderboardRecordSingleplayer[] | MapLeaderboardRecordMultiplayer[]; - pagination: Pagination; -}; - -export interface MapLeaderboardRecordSingleplayer { - kind: "singleplayer"; - placement: number; - record_id: number; - score_count: number; - score_time: number; - user: UserShort; - demo_id: string; - record_date: string; -}; - -export interface MapLeaderboardRecordMultiplayer { - kind: "multiplayer"; - placement: number; - record_id: number; - score_count: number; - score_time: number; - host: UserShort; - partner: UserShort; - host_demo_id: string; - partner_demo_id: string; - record_date: string; -}; - - -export interface MapSummary { - map: MapSummaryMap; - summary: MapSummaryDetails; -}; - -interface MapSummaryMap { - id: number; - image: string; - chapter_name: string; - game_name: string; - map_name: string; - is_coop: boolean; - is_disabled: boolean; -}; - -interface MapSummaryDetails { - routes: MapSummaryDetailsRoute[]; -}; - -interface MapSummaryDetailsRoute { - route_id: number; - category: Category; - history: MapSummaryDetailsRouteHistory; - rating: number; - completion_count: number; - description: string; - showcase: string; -}; - -interface MapSummaryDetailsRouteHistory { - runner_name: string; - score_count: number; - date: string; -}; - -export interface MapDeleteEndpoint { - map_id: number; - record_id: number; -} - diff --git a/frontend/src/types/Pagination.ts b/frontend/src/types/Pagination.ts new file mode 100644 index 0000000..ccff04b --- /dev/null +++ b/frontend/src/types/Pagination.ts @@ -0,0 +1,6 @@ +export interface Pagination { + total_records: number; + total_pages: number; + current_page: number; + page_size: number; +}; diff --git a/frontend/src/types/Pagination.tsx b/frontend/src/types/Pagination.tsx deleted file mode 100644 index ccff04b..0000000 --- a/frontend/src/types/Pagination.tsx +++ /dev/null @@ -1,6 +0,0 @@ -export interface Pagination { - total_records: number; - total_pages: number; - current_page: number; - page_size: number; -}; diff --git a/frontend/src/types/Profile.ts b/frontend/src/types/Profile.ts new file mode 100644 index 0000000..42e5c3e --- /dev/null +++ b/frontend/src/types/Profile.ts @@ -0,0 +1,63 @@ +import type { Pagination } from "@customTypes/Pagination"; + +export interface UserShort { + steam_id: string; + user_name: string; + avatar_link: string; +}; + +export interface UserProfile { + profile: boolean; + steam_id: string; + user_name: string; + avatar_link: string; + country_code: string; + titles: UserProfileTitles[]; + links: UserProfileLinks; + rankings: UserProfileRankings; + records: UserProfileRecords[]; + pagination: Pagination; +}; + +interface UserProfileTitles { + name: string; + color: string; +}; + +interface UserProfileLinks { + p2sr: string; + steam: string; + youtube: string; + twitch: string; +}; + +interface UserProfileRankings { + overall: UserProfileRankingsDetail; + singleplayer: UserProfileRankingsDetail; + cooperative: UserProfileRankingsDetail; +}; + +interface UserProfileRecords { + game_id: number; + category_id: number; + map_id: number; + map_name: string; + map_wr_count: number; + placement: number; + scores: UserProfileRecordsScores[] +}; + +interface UserProfileRecordsScores { + record_id: number; + demo_id: string; + score_count: number; + score_time: number; + date: string; +}; + +interface UserProfileRankingsDetail { + rank: number; + completion_count: number; + completion_total: number; +}; + diff --git a/frontend/src/types/Profile.tsx b/frontend/src/types/Profile.tsx deleted file mode 100644 index 2bb037c..0000000 --- a/frontend/src/types/Profile.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Pagination } from "./Pagination"; - -export interface UserShort { - steam_id: string; - user_name: string; - avatar_link: string; -}; - -export interface UserProfile { - profile: boolean; - steam_id: string; - user_name: string; - avatar_link: string; - country_code: string; - titles: UserProfileTitles[]; - links: UserProfileLinks; - rankings: UserProfileRankings; - records: UserProfileRecords[]; - pagination: Pagination; -}; - -interface UserProfileTitles { - name: string; - color: string; -}; - -interface UserProfileLinks { - p2sr: string; - steam: string; - youtube: string; - twitch: string; -}; - -interface UserProfileRankings { - overall: UserProfileRankingsDetail; - singleplayer: UserProfileRankingsDetail; - cooperative: UserProfileRankingsDetail; -}; - -interface UserProfileRecords { - game_id: number; - category_id: number; - map_id: number; - map_name: string; - map_wr_count: number; - placement: number; - scores: UserProfileRecordsScores[] -}; - -interface UserProfileRecordsScores { - record_id: number; - demo_id: string; - score_count: number; - score_time: number; - date: string; -}; - -interface UserProfileRankingsDetail { - rank: number; - completion_count: number; - completion_total: number; -}; - diff --git a/frontend/src/types/Ranking.ts b/frontend/src/types/Ranking.ts new file mode 100644 index 0000000..a143355 --- /dev/null +++ b/frontend/src/types/Ranking.ts @@ -0,0 +1,31 @@ +import type { UserShort } from "@customTypes/Profile"; + +export interface RankingType { + placement: number; + user: UserShort; + total_score: number; +} + +export interface SteamRankingType { + user_name: string; + avatar_link: string; + steam_id: string; + sp_score: number; + mp_score: number; + overall_score: number; + sp_rank: number; + mp_rank: number; + overall_rank: number; +} + +export interface Ranking { + rankings_overall: RankingType[]; + rankings_singleplayer: RankingType[]; + rankings_multiplayer: RankingType[]; +} + +export interface SteamRanking { + rankings_overall: SteamRankingType[]; + rankings_singleplayer: SteamRankingType[]; + rankings_multiplayer: SteamRankingType[]; +} \ No newline at end of file diff --git a/frontend/src/types/Ranking.tsx b/frontend/src/types/Ranking.tsx deleted file mode 100644 index b3b26c6..0000000 --- a/frontend/src/types/Ranking.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { UserShort } from "./Profile"; - -export interface RankingType { - placement: number; - user: UserShort; - total_score: number; -} - -export interface SteamRankingType { - user_name: string; - avatar_link: string; - steam_id: string; - sp_score: number; - mp_score: number; - overall_score: number; - sp_rank: number; - mp_rank: number; - overall_rank: number; -} - -export interface Ranking { - rankings_overall: RankingType[]; - rankings_singleplayer: RankingType[]; - rankings_multiplayer: RankingType[]; -} - -export interface SteamRanking { - rankings_overall: SteamRankingType[]; - rankings_singleplayer: SteamRankingType[]; - rankings_multiplayer: SteamRankingType[]; -} \ No newline at end of file diff --git a/frontend/src/types/Search.ts b/frontend/src/types/Search.ts new file mode 100644 index 0000000..d218806 --- /dev/null +++ b/frontend/src/types/Search.ts @@ -0,0 +1,13 @@ +import type { UserShort } from "@customTypes/Profile"; + +export interface Search { + players: UserShort[]; + maps: SearchMap[]; +}; + +interface SearchMap { + id: number; + game: string; + chapter: string; + map: string; +}; diff --git a/frontend/src/types/Search.tsx b/frontend/src/types/Search.tsx deleted file mode 100644 index 766311a..0000000 --- a/frontend/src/types/Search.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { UserShort } from "./Profile"; - -export interface Search { - players: UserShort[]; - maps: SearchMap[]; -}; - -interface SearchMap { - id: number; - game: string; - chapter: string; - map: string; -}; -- cgit v1.2.3