diff --git a/AquaNet/src/libs/i18n/en_ref.ts b/AquaNet/src/libs/i18n/en_ref.ts index 957425d7..c34fbda8 100644 --- a/AquaNet/src/libs/i18n/en_ref.ts +++ b/AquaNet/src/libs/i18n/en_ref.ts @@ -82,6 +82,8 @@ export const EN_REF_HOME = { 'home.join-discord-description': 'Join our Discord server to chat with other players and get help.', 'home.setup': 'Setup Connection', 'home.setup-description': 'If you own a cab or arcade setup, begin setting up the connection.', + 'home.import': 'Import Player Data', + 'home.import-description': 'If you are from another server, you can import your data here.', 'home.linkcard.cards': 'Your Cards', 'home.linkcard.description': 'Here are the cards you have linked to your account', 'home.linkcard.account-card': 'Account Card', @@ -109,6 +111,9 @@ export const EN_REF_HOME = { 'home.setup.ask': 'If you have any questions, please ask in our', 'home.setup.support': 'server', 'home.setup.keychip-tips': 'This is your unique keychip, do not share it with anyone', + 'home.import.unknown-game': 'Unknown game type', + 'home.import.new-data': 'Data to import', + 'home.import.data-conflict': 'Proceed will override your current data', } export const EN_REF_SETTINGS = { diff --git a/AquaNet/src/libs/i18n/zh.ts b/AquaNet/src/libs/i18n/zh.ts index ea0dccd0..a33ef8fd 100644 --- a/AquaNet/src/libs/i18n/zh.ts +++ b/AquaNet/src/libs/i18n/zh.ts @@ -91,6 +91,8 @@ const zhHome: typeof EN_REF_HOME = { 'home.join-discord-description': '加入我们的 Discord 群,与其他玩家聊天、获取帮助', 'home.setup': '连接到 AquaDX', 'home.setup-description': '如果您有街机框体或者手台,点击这里设置服务器的连接', + 'home.import': '导入玩家数据', + 'home.import-description': '如果你来自其他在线服,可以点击这里导入从其他服务器导出的数据', 'home.linkcard.cards': "已绑卡片", 'home.linkcard.description': "这些是您绑定到帐户的卡", 'home.linkcard.account-card': "账户卡", @@ -118,6 +120,9 @@ const zhHome: typeof EN_REF_HOME = { 'home.setup.ask': "如果您有任何问题, 请加入我们的", 'home.setup.support': "以获取支持", 'home.setup.keychip-tips': "这是你的狗号, 不要与任何人分享", + 'home.import.unknown-game': '未知游戏类型', + 'home.import.new-data': '要导入的数据', + 'home.import.data-conflict': '继续导入将覆盖现有数据', } const zhSettings: typeof EN_REF_SETTINGS = { diff --git a/AquaNet/src/libs/sdk.ts b/AquaNet/src/libs/sdk.ts index 041e7ed0..8c11293b 100644 --- a/AquaNet/src/libs/sdk.ts +++ b/AquaNet/src/libs/sdk.ts @@ -303,6 +303,8 @@ export const GAME = { post(`/api/v2/game/${game}/change-name`, { newName }), export: (game: GameName): Promise> => post(`/api/v2/game/${game}/export`), + import: (game: GameName, data: any): Promise> => + post(`/api/v2/game/${game}/import`, {}, { body: JSON.stringify(data) }), } export const DATA = { diff --git a/AquaNet/src/pages/Home.svelte b/AquaNet/src/pages/Home.svelte index dafa6b62..7f17e94b 100644 --- a/AquaNet/src/pages/Home.svelte +++ b/AquaNet/src/pages/Home.svelte @@ -8,6 +8,7 @@ import StatusOverlays from "../components/StatusOverlays.svelte"; import ActionCard from "../components/ActionCard.svelte"; import { t } from "../libs/i18n"; + import ImportDataAction from "./Home/ImportDataAction.svelte"; USER.ensureLoggedIn(); @@ -54,6 +55,8 @@

{t('home.setup')}

{t('home.setup-description')} + + {:else if tab === 1}
diff --git a/AquaNet/src/pages/Home/ImportDataAction.svelte b/AquaNet/src/pages/Home/ImportDataAction.svelte new file mode 100644 index 00000000..88073561 --- /dev/null +++ b/AquaNet/src/pages/Home/ImportDataAction.svelte @@ -0,0 +1,162 @@ + + + +

{t('home.import')}

+ {t('home.import-description')} +
+ + + +{#if conflict} +
+
+

{t('home.import.data-conflict')}

+

+
+
+ {t('home.linkcard.account-card')} + {t('home.linkcard.name')}: {conflict.oldName} + {t('home.linkcard.rating')}: {conflict.oldRating} +
+ +
+
+
+ +
+
+ {t('home.import.new-data')} + {t('home.linkcard.name')}: {conflict.newName} + {t('home.linkcard.rating')}: {conflict.newRating} +
+
+

+
+ + +
+
+
+{/if} + +