-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f589f19
commit a683118
Showing
17 changed files
with
565 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { | ||
type NextComponentType, | ||
type NextPageContext, | ||
type GetServerSidePropsContext, | ||
type NextPage, | ||
} from "next"; | ||
import { type AppProps as NextAppProps } from "next/app"; | ||
import { | ||
type NullableProfile, | ||
type NullablePSNProfile, | ||
type NullableSession, | ||
} from "./AuthModel"; | ||
import { type CSSProperties } from "react"; | ||
|
||
export type ExtendedPageProps = object; | ||
|
||
export interface ExtendedInitialProps { | ||
initialSession: NullableSession; | ||
initialProfile: NullableProfile; | ||
initialPSNProfile: NullablePSNProfile; | ||
isInitialFailed: boolean; | ||
} | ||
|
||
export interface AppProps<P = object> | ||
extends NextAppProps<P>, | ||
ExtendedInitialProps { | ||
Component: NextComponentType< | ||
NextPageContext, | ||
ExtendedInitialProps, | ||
ExtendedPageProps | ||
>; | ||
} | ||
|
||
export interface InitialProps { | ||
ctx: GetServerSidePropsContext; | ||
} | ||
|
||
export type Page<P = object, IP = P> = NextPage<P & ExtendedPageProps, IP>; | ||
|
||
export interface CustomPosition { | ||
top?: string | number; | ||
left?: string | number; | ||
bottom?: string | number; | ||
right?: string | number; | ||
transform: CSSProperties["transform"]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { type Session, type User as SupabaseUser } from "@supabase/supabase-js"; | ||
import { | ||
type AuthTokensResponse, | ||
type ProfileFromUserNameResponse, | ||
} from "psn-api"; | ||
|
||
type PSNProfileResponse = ProfileFromUserNameResponse["profile"]; | ||
type PersonalDetail = PSNProfileResponse["personalDetail"]; | ||
|
||
export interface PSNProfile extends Omit<PSNProfileResponse, "personalDetail"> { | ||
personalDetail: PersonalDetail & { middleName: string | undefined }; | ||
} | ||
|
||
export type NullableSession = Session | null; | ||
export type NullableUser = SupabaseUser | null; | ||
export type NullableProfile = Profile | null; | ||
export type NullablePSNProfile = PSNProfile | null; | ||
export type NullableAuthResponse = AuthTokensResponse | null; | ||
|
||
export type ProfileType = "public" | "private"; | ||
export type Presence = PSNProfile["presences"][0]; | ||
|
||
export interface SignUpBody extends Record<string, string> { | ||
email: string; | ||
password: string; | ||
npsso: string; | ||
language: string; | ||
username: string; | ||
type: ProfileType; | ||
} | ||
|
||
interface UserData { | ||
language: string; | ||
username: string; | ||
onlineId: string; | ||
type: ProfileType; | ||
} | ||
|
||
export interface User extends SupabaseUser { | ||
user_metadata: SupabaseUser["user_metadata"] & UserData; | ||
} | ||
|
||
export interface Profile { | ||
id: string; | ||
created_at: string; | ||
language: string; | ||
username: string; | ||
online_id: string; | ||
type: ProfileType; | ||
} | ||
|
||
export type ProfileEditBody = Pick<Profile, "language" | "type">; | ||
|
||
export interface SessionResponse { | ||
session: NullableSession; | ||
profile: NullableProfile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { type MantineColor } from "@mantine/core"; | ||
import { type Game } from "./GameModel"; | ||
import { type Range } from "./UtilsModel"; | ||
|
||
export interface ColumnColor { | ||
color: MantineColor; | ||
shade: Range<0, 10>; | ||
} | ||
|
||
export enum BOARD_COLUMNS { | ||
Backlog = "backlog", | ||
InProgress = "progress", | ||
Platinum = "platinum", | ||
Complete = "complete", | ||
} | ||
|
||
export type BoardColumns = Record<BOARD_COLUMNS | string, Game[]>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { type BOARD_COLUMNS } from "./BoardModel"; | ||
import { type Platform } from "./PlatformModel"; | ||
import { type ProgressItem } from "./ProgressModel"; | ||
|
||
export interface Game { | ||
id: number; | ||
created_at: string; | ||
updated_at: string; | ||
title: string; | ||
image_url: string; | ||
platform: Platform; | ||
status: BOARD_COLUMNS; | ||
progress: ProgressItem[] | null; | ||
user_id: string; | ||
username: string; | ||
code: string; | ||
position: number; | ||
} | ||
|
||
export type NewGamePayload = Omit< | ||
Game, | ||
"id" | "created_at" | "updated_at" | "progress" | "position" | ||
>; | ||
|
||
export interface AddGamePayload { | ||
game_id: string; | ||
status: BOARD_COLUMNS; | ||
} | ||
|
||
export interface AddGameState { | ||
status: BOARD_COLUMNS | null; | ||
opened: boolean; | ||
} | ||
|
||
export interface ReorderItem { | ||
id: number; | ||
position: number; | ||
status: BOARD_COLUMNS; | ||
} | ||
|
||
export interface ReorderPayload { | ||
items: ReorderItem[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface HeaderLink { | ||
id: number; | ||
label: string; | ||
href: string; | ||
disabled: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface Locale { | ||
id: number; | ||
value: string; | ||
label: string; | ||
icon_url: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { type Dispatch, type SetStateAction } from "react"; | ||
|
||
interface DefaultModalProps { | ||
opened: boolean; | ||
setOpened: Dispatch<SetStateAction<boolean>>; | ||
} | ||
|
||
export type ModalProps<T = object> = T & DefaultModalProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { type Dispatch, type SetStateAction } from "react"; | ||
|
||
export interface Note { | ||
id: number; | ||
created_at: string; | ||
updated_at: string; | ||
user_id: string; | ||
username: string; | ||
game_id: number; | ||
trophy_id: number; | ||
content: string; | ||
} | ||
|
||
export interface AddNotePayload { | ||
game_id: number; | ||
trophy_id: number; | ||
content: string; | ||
} | ||
|
||
export interface NewNotePayload | ||
extends Omit<Note, "id" | "created_at" | "updated_at" | "content"> { | ||
content: string | null; | ||
} | ||
|
||
export interface NoteModalState { | ||
opened: boolean; | ||
game_id: number | null; | ||
trophy_id: number | null; | ||
} | ||
|
||
export interface NoteModalHandler extends NoteModalState { | ||
setState: Dispatch<SetStateAction<NoteModalState>>; | ||
open: (params?: Partial<NoteModalState>) => void; | ||
close: () => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export type Platform = "ps3" | "ps4" | "ps5" | "vita" | string; | ||
|
||
export interface PlatformLabel { | ||
short: string; | ||
full: string; | ||
} | ||
|
||
export interface PlatformColor { | ||
bg: string; | ||
fg: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export interface ProgressItem { | ||
id: number; | ||
earned: boolean; | ||
group: string; | ||
dlc: boolean; | ||
} | ||
|
||
export interface ProgressPayload { | ||
payload: ProgressItem[]; | ||
} | ||
|
||
export type ProgressType = "platinum" | "complete"; | ||
|
||
export interface ProgressStats { | ||
base: number; | ||
baseCompleted: number; | ||
baseProgress: number; | ||
total: number; | ||
totalCompleted: number; | ||
totalProgress: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export interface SearchQueries { | ||
[key: string]: string | string[]; | ||
query: string; | ||
} | ||
|
||
export interface SearchItem { | ||
id: string; | ||
title: string; | ||
platform_title: string; | ||
count_tlist: number; | ||
count_article: number; | ||
release_date: string; | ||
} | ||
|
||
export interface SearchResult { | ||
id: number; | ||
name: string; | ||
platform: string; | ||
url: string; | ||
} | ||
|
||
export interface SearchResponse { | ||
query: string; | ||
results: SearchResult[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { type MantineTheme } from "@mantine/core"; | ||
|
||
export type DefaultProps<P> = | ||
| Partial<P> | ||
| ((theme: MantineTheme) => Partial<P>); |
Oops, something went wrong.