@@ -48,6 +61,16 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
.getAll()
.then((response) => organizeRaids(response.data.map((r: any) => r.raid)))
+ let jobs = await api.endpoints.jobs
+ .getAll({ params: headers })
+ .then((response) => {
+ return response.data
+ })
+
+ let jobSkills = await api.allSkills(headers).then((response) => {
+ return response.data
+ })
+
let party: Party | null = null
if (query.party) {
let response = await api.endpoints.parties.getOne({ id: query.party, params: headers })
@@ -59,6 +82,8 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
return {
props: {
party: party,
+ jobs: jobs,
+ jobSkills: jobSkills,
raids: raids,
sortedRaids: sortedRaids,
...(await serverSideTranslations(locale, ["common"])),
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index f43a79a0..63af7fdc 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -232,7 +232,8 @@
"placeholders": {
"weapon": "Search for a weapon...",
"summon": "Search for a summon...",
- "character": "Search for a character..."
+ "character": "Search for a character...",
+ "job_skill": "Search job skills..."
}
},
"teams": {
@@ -240,6 +241,19 @@
"loading": "Loading teams...",
"not_found": "No teams found"
},
+ "job_skills": {
+ "all": "All skills",
+ "buffing": "Buffing",
+ "debuffing": "Debuffing",
+ "damaging": "Damaging",
+ "healing": "Healing",
+ "emp": "Extended Mastery",
+ "base": "Base Skills",
+ "state": {
+ "selectable": "Select a skill",
+ "no_skill": "No skill"
+ }
+ },
"extra_weapons": "Additional Weapons",
"coming_soon": "Coming Soon",
"no_title": "Untitled",
diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json
index 21d147bc..d49f722c 100644
--- a/public/locales/ja/common.json
+++ b/public/locales/ja/common.json
@@ -233,7 +233,8 @@
"placeholders": {
"weapon": "武器を検索...",
"summon": "召喚石を検索...",
- "character": "キャラを検索..."
+ "character": "キャラを検索...",
+ "job_skill": "ジョブのスキルを検索..."
}
},
"teams": {
@@ -241,6 +242,19 @@
"loading": "ロード中...",
"not_found": "編成は見つかりませんでした"
},
+ "job_skills": {
+ "all": "全てのアビリティ",
+ "buffing": "強化アビリティ",
+ "debuffing": "弱体アビリティ",
+ "damaging": "ダメージアビリティ",
+ "healing": "回復アビリティ",
+ "emp": "リミットアビリティ",
+ "base": "ベースアビリティ",
+ "state": {
+ "selectable": "アビリティを選択",
+ "no_skill": "設定されていません"
+ }
+ },
"extra_weapons": "Additional
Weapons",
"coming_soon": "開発中",
"no_title": "無題",
diff --git a/types/Job.d.ts b/types/Job.d.ts
index bab89b90..7c1f5939 100644
--- a/types/Job.d.ts
+++ b/types/Job.d.ts
@@ -1,15 +1,16 @@
-interface Job {
- id: string
- row: string
- ml: boolean
- order: number
- name: {
- [key: string]: string
- en: string
- ja: string
- }
- proficiency: {
- proficiency1: number
- proficiency2: number
- }
-}
\ No newline at end of file
+interface Job {
+ id: string
+ row: string
+ ml: boolean
+ order: number
+ name: {
+ [key: string]: string
+ en: string
+ ja: string
+ }
+ proficiency: {
+ proficiency1: number
+ proficiency2: number
+ }
+ base_job?: Job
+}
diff --git a/types/JobSkill.d.ts b/types/JobSkill.d.ts
new file mode 100644
index 00000000..f1067964
--- /dev/null
+++ b/types/JobSkill.d.ts
@@ -0,0 +1,16 @@
+interface JobSkill {
+ id: string
+ job: Job
+ name: {
+ [key: string]: string
+ en: string
+ ja: string
+ }
+ slug: string
+ color: number
+ main: boolean
+ base: boolean
+ sub: boolean
+ emp: boolean
+ order: number
+}
diff --git a/types/Party.d.ts b/types/Party.d.ts
index 5a1dea6b..c43a4d17 100644
--- a/types/Party.d.ts
+++ b/types/Party.d.ts
@@ -1,8 +1,18 @@
+type JobSkillObject = {
+ [key: number]: JobSkill | undefined
+ 0: JobSkill | undefined
+ 1: JobSkill | undefined
+ 2: JobSkill | undefined
+ 3: JobSkill | undefined
+}
+
interface Party {
id: string
name: string
description: string
raid: Raid
+ job: Job
+ job_skills: JobSkillObject
shortcode: string
extra: boolean
favorited: boolean
diff --git a/types/index.d.ts b/types/index.d.ts
new file mode 100644
index 00000000..d37ca641
--- /dev/null
+++ b/types/index.d.ts
@@ -0,0 +1,9 @@
+export type SearchableObject = Character | Weapon | Summon | JobSkill
+export type SearchableObjectArray = (Character | Weapon | Summon | JobSkill)[]
+export type JobSkillObject = {
+ [key: number]: JobSkill | undefined
+ 0: JobSkill | undefined
+ 1: JobSkill | undefined
+ 2: JobSkill | undefined
+ 3: JobSkill | undefined
+}
diff --git a/utils/api.tsx b/utils/api.tsx
index 0fd196a7..b8a5987f 100644
--- a/utils/api.tsx
+++ b/utils/api.tsx
@@ -25,7 +25,7 @@ class Api {
url: string
endpoints: { [key: string]: EndpointMap }
- constructor({url}: {url: string}) {
+ constructor({ url }: { url: string }) {
this.url = url
this.endpoints = {}
}
@@ -56,13 +56,14 @@ class Api {
return axios.post(`${ oauthUrl }/token`, object)
}
- search({ object, query, filters, locale = "en", page = 0 }:
- { object: string, query: string, filters?: { [key: string]: number[] }, locale?: string, page?: number }) {
+ search({ object, query, job, filters, locale = "en", page = 0 }:
+ { object: string, query: string, job?: string, filters?: { [key: string]: number[] }, locale?: string, page?: number }) {
const resourceUrl = `${this.url}/${name}`
return axios.post(`${resourceUrl}search/${object}`, {
search: {
query: query,
filters: filters,
+ job: job,
locale: locale,
page: page
}
@@ -92,6 +93,22 @@ class Api {
const resourceUrl = `${this.url}/characters/resolve`
return axios.post(resourceUrl, body, { headers: params })
}
+
+ updateJob({ partyId, params }: { partyId: string, params?: {} }) {
+ const resourceUrl = `${this.url}/parties/${partyId}/jobs`
+ return axios.put(resourceUrl, params)
+ }
+
+ updateJobSkills({ partyId, params }: { partyId: string, params?: {} }) {
+ const resourceUrl = `${this.url}/parties/${partyId}/job_skills`
+ return axios.put(resourceUrl, params)
+ }
+
+ allSkills(params: {}) {
+ const resourceUrl = `${this.url}/jobs/skills`
+ return axios.get(resourceUrl, params)
+ }
+
savedTeams(params: {}) {
const resourceUrl = `${this.url}/parties/favorites`
return axios.get(resourceUrl, params)
@@ -127,15 +144,15 @@ class Api {
}
const api: Api = new Api({ url: process.env.NEXT_PUBLIC_SIERO_API_URL || 'https://localhost:3000/api/v1'})
-api.createEntity( { name: 'users' })
-api.createEntity( { name: 'parties' })
-api.createEntity( { name: 'grid_weapons' })
-api.createEntity( { name: 'characters' })
-api.createEntity( { name: 'weapons' })
-api.createEntity( { name: 'summons' })
-api.createEntity( { name: 'jobs' })
-api.createEntity( { name: 'raids' })
-api.createEntity( { name: 'weapon_keys' })
-api.createEntity( { name: 'favorites' })
+api.createEntity({ name: 'users' })
+api.createEntity({ name: 'parties' })
+api.createEntity({ name: 'grid_weapons' })
+api.createEntity({ name: 'characters' })
+api.createEntity({ name: 'weapons' })
+api.createEntity({ name: 'summons' })
+api.createEntity({ name: 'jobs' })
+api.createEntity({ name: 'raids' })
+api.createEntity({ name: 'weapon_keys' })
+api.createEntity({ name: 'favorites' })
export default api
diff --git a/utils/appState.tsx b/utils/appState.tsx
index 3a6725a6..42ef90ab 100644
--- a/utils/appState.tsx
+++ b/utils/appState.tsx
@@ -1,4 +1,5 @@
import { proxy } from "valtio"
+import { JobSkillObject } from "~types"
const emptyJob: Job = {
id: "-1",
@@ -25,6 +26,7 @@ interface AppState {
name: string | undefined
description: string | undefined
job: Job
+ jobSkills: JobSkillObject
raid: Raid | undefined
element: number
extra: boolean
@@ -53,6 +55,8 @@ interface AppState {
}
}
raids: Raid[]
+ jobs: Job[]
+ jobSkills: JobSkill[]
}
export const initialAppState: AppState = {
@@ -63,6 +67,12 @@ export const initialAppState: AppState = {
name: undefined,
description: undefined,
job: emptyJob,
+ jobSkills: {
+ 0: undefined,
+ 1: undefined,
+ 2: undefined,
+ 3: undefined,
+ },
raid: undefined,
element: 0,
extra: false,
@@ -91,6 +101,8 @@ export const initialAppState: AppState = {
},
},
raids: [],
+ jobs: [],
+ jobSkills: [],
}
export const appState = proxy(initialAppState)
diff --git a/utils/skillGroups.tsx b/utils/skillGroups.tsx
new file mode 100644
index 00000000..63d6ccd2
--- /dev/null
+++ b/utils/skillGroups.tsx
@@ -0,0 +1,91 @@
+export interface SkillGroup {
+ id: number
+ name: {
+ [key: string]: string
+ en: string
+ ja: string
+ }
+}
+
+export const skillClassification: SkillGroup[] = [
+ {
+ id: 0,
+ name: {
+ en: "Buffing",
+ ja: "強化アビリティ",
+ },
+ },
+ {
+ id: 1,
+ name: {
+ en: "Debuffing",
+ ja: "弱体アビリティ",
+ },
+ },
+ {
+ id: 2,
+ name: {
+ en: "Damaging",
+ ja: "ダメージアビリティ",
+ },
+ },
+ {
+ id: 3,
+ name: {
+ en: "Healing",
+ ja: "回復アビリティ",
+ },
+ },
+ {
+ id: 4,
+ name: {
+ en: "Field",
+ ja: "フィールドアビリティ",
+ },
+ },
+]
+
+export const skillGroups: SkillGroup[] = [
+ {
+ id: 0,
+ name: {
+ en: "Buffing",
+ ja: "強化アビリティ",
+ },
+ },
+ {
+ id: 1,
+ name: {
+ en: "Debuffing",
+ ja: "弱体アビリティ",
+ },
+ },
+ {
+ id: 2,
+ name: {
+ en: "Damaging",
+ ja: "ダメージアビリティ",
+ },
+ },
+ {
+ id: 3,
+ name: {
+ en: "Healing",
+ ja: "回復アビリティ",
+ },
+ },
+ {
+ id: 4,
+ name: {
+ en: "Extended Mastery",
+ ja: "リミットアビリティ",
+ },
+ },
+ {
+ id: 5,
+ name: {
+ en: "Base",
+ ja: "ベースアビリティ",
+ },
+ },
+]