forked from Berry-Dash/launcher
Move to NextJS + other changes
This commit is contained in:
10
src/app/types/DownloadProgress.ts
Normal file
10
src/app/types/DownloadProgress.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { LauncherVersion } from './LauncherVersion'
|
||||
|
||||
export class DownloadProgress {
|
||||
constructor (
|
||||
public version: LauncherVersion,
|
||||
public progress: number,
|
||||
public failed: boolean,
|
||||
public queued: boolean
|
||||
) {}
|
||||
}
|
||||
12
src/app/types/DownloadedVersion.ts
Normal file
12
src/app/types/DownloadedVersion.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { LauncherVersion } from './LauncherVersion'
|
||||
|
||||
export class DownloadedVersion {
|
||||
constructor (
|
||||
public version: LauncherVersion,
|
||||
public installDate: number = Date.now()
|
||||
) {}
|
||||
|
||||
static import (data: LauncherVersion) {
|
||||
return new DownloadedVersion(data)
|
||||
}
|
||||
}
|
||||
18
src/app/types/InstallsProps.ts
Normal file
18
src/app/types/InstallsProps.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { DownloadedVersion } from './DownloadedVersion'
|
||||
import { DownloadProgress } from './DownloadProgress'
|
||||
import { LauncherVersion } from './LauncherVersion'
|
||||
import { NormalConfig } from './NormalConfig'
|
||||
import { VersionsConfig } from './VersionsConfig'
|
||||
|
||||
export type InstallsProps = {
|
||||
downloadProgress: DownloadProgress[]
|
||||
showPopup: boolean
|
||||
setShowPopup: (v: boolean) => void
|
||||
setPopupMode: (v: null | number) => void
|
||||
setFadeOut: (v: boolean) => void
|
||||
setSelectedVersionList: (v: LauncherVersion[]) => void
|
||||
setVersionList: (v: null | LauncherVersion[]) => void
|
||||
downloadedVersionsConfig: VersionsConfig | null
|
||||
normalConfig: NormalConfig | null
|
||||
setManagingVersion: (v: DownloadedVersion | null) => void
|
||||
}
|
||||
8
src/app/types/LauncherVersion.ts
Normal file
8
src/app/types/LauncherVersion.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface LauncherVersion {
|
||||
version: string
|
||||
displayName: string
|
||||
platforms: string[]
|
||||
downloadUrls: string[]
|
||||
executables: string[]
|
||||
id: number
|
||||
}
|
||||
9
src/app/types/LeaderboardEntry.ts
Normal file
9
src/app/types/LeaderboardEntry.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface LeaderboardEntry {
|
||||
username: string
|
||||
userid: bigint
|
||||
value: bigint
|
||||
icon: number
|
||||
overlay: number
|
||||
birdColor: number[]
|
||||
overlayColor: number[]
|
||||
}
|
||||
21
src/app/types/NormalConfig.ts
Normal file
21
src/app/types/NormalConfig.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { SettingsType } from './SettingsType'
|
||||
|
||||
type NormalConfigData = {
|
||||
version: string
|
||||
settings?: Partial<SettingsType>
|
||||
}
|
||||
|
||||
export class NormalConfig {
|
||||
constructor (
|
||||
public version: string,
|
||||
public settings: SettingsType = new SettingsType()
|
||||
) {}
|
||||
|
||||
static import (data: NormalConfigData) {
|
||||
const cfg = new NormalConfig(data.version)
|
||||
if (data.settings) {
|
||||
cfg.settings = { ...cfg.settings, ...data.settings }
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
}
|
||||
6
src/app/types/SettingProps.ts
Normal file
6
src/app/types/SettingProps.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export type SettingProps = {
|
||||
label: string
|
||||
value: boolean
|
||||
onChange: (val: boolean) => void
|
||||
className?: string
|
||||
}
|
||||
5
src/app/types/SettingsProps.ts
Normal file
5
src/app/types/SettingsProps.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { NormalConfig } from './NormalConfig'
|
||||
|
||||
export type SettingsProps = {
|
||||
normalConfig: NormalConfig | null
|
||||
}
|
||||
8
src/app/types/SettingsType.ts
Normal file
8
src/app/types/SettingsType.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export class SettingsType {
|
||||
constructor (
|
||||
public checkForNewVersionOnLoad: boolean = true,
|
||||
public allowNotifications: boolean = true,
|
||||
public useWineOnUnixWhenNeeded: boolean = false,
|
||||
public useWindowsRoundedCorners: boolean = false
|
||||
) {}
|
||||
}
|
||||
8
src/app/types/SidebarProps.ts
Normal file
8
src/app/types/SidebarProps.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { DownloadProgress } from './DownloadProgress'
|
||||
|
||||
export type SidebarProps = {
|
||||
setShowPopup: (v: boolean) => void
|
||||
setPopupMode: (v: null | number) => void
|
||||
setFadeOut: (v: boolean) => void
|
||||
downloadProgress: DownloadProgress[]
|
||||
}
|
||||
16
src/app/types/VersionsConfig.ts
Normal file
16
src/app/types/VersionsConfig.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { DownloadedVersion } from './DownloadedVersion'
|
||||
|
||||
type VersionsConfigData = {
|
||||
version: string
|
||||
list: DownloadedVersion[]
|
||||
}
|
||||
|
||||
export class VersionsConfig {
|
||||
constructor (public version: string, public list: DownloadedVersion[] = []) {}
|
||||
|
||||
static import (data: VersionsConfigData) {
|
||||
const cfg = new VersionsConfig(data.version)
|
||||
cfg.list = [...data.list]
|
||||
return cfg
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user