Skip to content

Commit c6d27a4

Browse files
authored
chore: pretty backup and xray version modal (#2737)
* chore: pretty `backup & restore` modal * chore: pretty `xray version` modal * fix: new `xray version` modal style
1 parent 751f564 commit c6d27a4

13 files changed

+79
-59
lines changed

web/html/xui/index.html

+48-40
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
.ant-card-dark h2 {
2020
color: var(--dark-color-text-primary);
2121
}
22+
.ant-backup-list-item {
23+
text-align: left;
24+
user-select: none;
25+
cursor: pointer;
26+
}
27+
.dark .ant-backup-list-item svg {
28+
color: var(--dark-color-text-primary);
29+
}
30+
.dark .ant-backup-list,
31+
.dark .ant-xray-version-list {
32+
border-color: var(--dark-color-stroke);
33+
}
2234
</style>
2335

2436
<body>
@@ -262,12 +274,14 @@
262274
@ok="() => versionModal.visible = false" :class="themeSwitcher.currentTheme" footer="">
263275
<a-alert type="warning" style="margin-bottom: 12px; width: fit-content"
264276
message='{{ i18n "pages.index.xraySwitchClickDesk" }}' show-icon></a-alert>
265-
<template v-for="version, index in versionModal.versions">
266-
<a-tag :color="index % 2 == 0 ? 'purple' : 'green'" style="margin-right: 12px; margin-bottom: 12px"
267-
@click="switchV2rayVersion(version)">
268-
[[ version ]]
269-
</a-tag>
270-
</template>
277+
<a-list class="ant-xray-version-list" bordered style="width: 100%;">
278+
<a-list-item class="ant-xray-version-list-item" v-for="version in versionModal.versions">
279+
<a-list-item-meta>
280+
<template #title>[[ version ]]</template>
281+
</a-list-item-meta>
282+
<a-radio :checked="version === `v${status.xray.version}`" @click="switchV2rayVersion(version)"></a-radio>
283+
</a-list-item>
284+
</a-list>
271285
</a-modal>
272286
<a-modal id="log-modal" v-model="logModal.visible"
273287
:closable="true" @cancel="() => logModal.visible = false"
@@ -314,20 +328,32 @@
314328
</a-form>
315329
<div class="ant-input" style="height: auto; max-height: 500px; overflow: auto; margin-top: 0.5rem;" v-html="logModal.formattedLogs"></div>
316330
</a-modal>
317-
<a-modal id="backup-modal" v-model="backupModal.visible" :title="backupModal.title"
318-
:closable="true" footer=""
331+
<a-modal id="backup-modal"
332+
v-model="backupModal.visible"
333+
title='{{ i18n "pages.index.backupTitle" }}'
334+
:closable="true"
335+
footer=""
319336
:class="themeSwitcher.currentTheme">
320-
<a-alert type="warning" style="margin-bottom: 10px; width: fit-content"
321-
:message="backupModal.description"
322-
show-icon>
323-
</a-alert>
324337
<a-space direction="horizontal" style="text-align: center; margin-bottom: 10px;">
325-
<a-button type="primary" @click="exportDatabase()">
326-
[[ backupModal.exportText ]]
327-
</a-button>
328-
<a-button type="primary" @click="importDatabase()">
329-
[[ backupModal.importText ]]
330-
</a-button>
338+
<a-list class="ant-backup-list" bordered style="width: 100%;">
339+
<a-list-item class="ant-backup-list-item" @click="exportDatabase()">
340+
<a-list-item-meta>
341+
<template #title>{{ i18n "pages.index.exportDatabase" }}</template>
342+
<template #description>{{ i18n "pages.index.exportDatabaseDesc" }}</template>
343+
</a-list-item-meta>
344+
<a-icon type="right" />
345+
</a-list-item>
346+
<a-list-item class="ant-backup-list-item" @click="importDatabase()">
347+
<a-list-item-meta>
348+
<template #title>{{ i18n "pages.index.importDatabase" }}</template>
349+
<template #description>{{ i18n "pages.index.importDatabaseDesc" }}</template>
350+
<templaet #avatar>
351+
<a-icon type="import" />
352+
</templaet>
353+
</a-list-item-meta>
354+
<a-icon type="right" />
355+
</a-list-item>
356+
</a-list>
331357
</a-space>
332358
</a-modal>
333359
</a-layout>
@@ -491,24 +517,11 @@
491517

492518
const backupModal = {
493519
visible: false,
494-
title: '',
495-
description: '',
496-
exportText: '',
497-
importText: '',
498-
show({
499-
title = '{{ i18n "pages.index.backupTitle" }}',
500-
description = '{{ i18n "pages.index.backupDescription" }}',
501-
exportText = '{{ i18n "pages.index.exportDatabase" }}',
502-
importText = '{{ i18n "pages.index.importDatabase" }}',
503-
}) {
504-
this.title = title;
505-
this.description = description;
506-
this.exportText = exportText;
507-
this.importText = importText;
508-
this.visible = true;
520+
show() {
521+
this.visible = true;
509522
},
510523
hide() {
511-
this.visible = false;
524+
this.visible = false;
512525
},
513526
};
514527

@@ -604,12 +617,7 @@
604617
txtModal.show('config.json', JSON.stringify(msg.obj, null, 2), 'config.json');
605618
},
606619
openBackup() {
607-
backupModal.show({
608-
title: '{{ i18n "pages.index.backupTitle" }}',
609-
description: '{{ i18n "pages.index.backupDescription" }}',
610-
exportText: '{{ i18n "pages.index.exportDatabase" }}',
611-
importText: '{{ i18n "pages.index.importDatabase" }}',
612-
});
620+
backupModal.show();
613621
},
614622
exportDatabase() {
615623
window.location = basePath + 'server/getDb';

web/translation/translate.en_US.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Config"
114114
"backup" = "Backup & Restore"
115115
"backupTitle" = "Database Backup & Restore"
116-
"backupDescription" = "It is recommended to make a backup before restoring a database."
117116
"exportDatabase" = "Back Up"
117+
"exportDatabaseDesc" = "Click to download a .db file containing a backup of your current database to your device."
118118
"importDatabase" = "Restore"
119+
"importDatabaseDesc" = "Click to select and upload a .db file from your device to restore your database from a backup."
119120

120121
[pages.inbounds]
121122
"title" = "Inbounds"

web/translation/translate.es_ES.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Configuración"
114114
"backup" = "Copia de Seguridad y Restauración"
115115
"backupTitle" = "Copia de Seguridad y Restauración de la Base de Datos"
116-
"backupDescription" = "Recuerda hacer una copia de seguridad antes de importar una nueva base de datos."
117-
"exportDatabase" = "Descargar Base de Datos"
118-
"importDatabase" = "Cargar Base de Datos"
116+
"exportDatabase" = "Copia de seguridad"
117+
"exportDatabaseDesc" = "Haz clic para descargar un archivo .db que contiene una copia de seguridad de tu base de datos actual en tu dispositivo."
118+
"importDatabase" = "Restaurar"
119+
"importDatabaseDesc" = "Haz clic para seleccionar y cargar un archivo .db desde tu dispositivo para restaurar tu base de datos desde una copia de seguridad."
119120

120121
[pages.inbounds]
121122
"title" = "Entradas"

web/translation/translate.fa_IR.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "پیکربندی"
114114
"backup" = "پشتیبان‌گیری"
115115
"backupTitle" = "پشتیبان‌گیری دیتابیس"
116-
"backupDescription" = "توصیه‌می‌شود قبل‌از واردکردن یک دیتابیس جدید، نسخه پشتیبان تهیه ‌کنید"
117116
"exportDatabase" = "پشتیبان‌گیری"
118-
"importDatabase" = "بازگرداندن"
117+
"exportDatabaseDesc" = "برای دانلود یک فایل .db حاوی پشتیبان از پایگاه داده فعلی خود به دستگاهتان کلیک کنید."
118+
"importDatabase" = "بازیابی"
119+
"importDatabaseDesc" = "برای انتخاب و آپلود یک فایل .db از دستگاهتان و بازیابی پایگاه داده از یک پشتیبان کلیک کنید."
119120

120121
[pages.inbounds]
121122
"title" = "کاربران"

web/translation/translate.id_ID.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Konfigurasi"
114114
"backup" = "Cadangan & Pulihkan"
115115
"backupTitle" = "Cadangan & Pulihkan Database"
116-
"backupDescription" = "Disarankan untuk membuat cadangan sebelum memulihkan database."
117116
"exportDatabase" = "Cadangkan"
117+
"exportDatabaseDesc" = "Klik untuk mengunduh file .db yang berisi cadangan dari database Anda saat ini ke perangkat Anda."
118118
"importDatabase" = "Pulihkan"
119+
"importDatabaseDesc" = "Klik untuk memilih dan mengunggah file .db dari perangkat Anda untuk memulihkan database dari cadangan."
119120

120121
[pages.inbounds]
121122
"title" = "Masuk"

web/translation/translate.ja_JP.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "設定"
114114
"backup" = "バックアップと復元"
115115
"backupTitle" = "データベースのバックアップと復元"
116-
"backupDescription" = "データベースを復元する前にバックアップすることをお勧めします"
117116
"exportDatabase" = "バックアップ"
117+
"exportDatabaseDesc" = "クリックして、現在のデータベースのバックアップを含む .db ファイルをデバイスにダウンロードします。"
118118
"importDatabase" = "復元"
119+
"importDatabaseDesc" = "クリックして、デバイスから .db ファイルを選択し、アップロードしてバックアップからデータベースを復元します。"
119120

120121
[pages.inbounds]
121122
"title" = "インバウンド一覧"

web/translation/translate.pt_BR.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Configuração"
114114
"backup" = "Backup e Restauração"
115115
"backupTitle" = "Backup e Restauração do Banco de Dados"
116-
"backupDescription" = "É recomendado fazer um backup antes de restaurar o banco de dados."
117-
"exportDatabase" = "Fazer Backup"
116+
"exportDatabase" = "Backup"
117+
"exportDatabaseDesc" = "Clique para baixar um arquivo .db contendo um backup do seu banco de dados atual para o seu dispositivo."
118118
"importDatabase" = "Restaurar"
119+
"importDatabaseDesc" = "Clique para selecionar e enviar um arquivo .db do seu dispositivo para restaurar seu banco de dados a partir de um backup."
119120

120121
[pages.inbounds]
121122
"title" = "Inbounds"

web/translation/translate.ru_RU.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Конфигурация"
114114
"backup" = "Резервное копирование и восстановление"
115115
"backupTitle" = "База данных резервных копий"
116-
"backupDescription" = "Рекомендуется сделать резервную копию перед восстановлением базы данных."
117116
"exportDatabase" = "Экспорт базы данных"
117+
"exportDatabaseDesc" = "Нажмите, чтобы скачать файл .db, содержащий резервную копию вашей текущей базы данных на ваше устройство."
118118
"importDatabase" = "Импорт базы данных"
119+
"importDatabaseDesc" = "Нажмите, чтобы выбрать и загрузить файл .db с вашего устройства для восстановления базы данных из резервной копии."
119120

120121
[pages.inbounds]
121122
"title" = "Подключения"

web/translation/translate.tr_TR.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Yapılandırma"
114114
"backup" = "Yedekle & Geri Yükle"
115115
"backupTitle" = "Veritabanı Yedekleme & Geri Yükleme"
116-
"backupDescription" = "Veritabanını geri yüklemeden önce yedek almanız önerilir."
117116
"exportDatabase" = "Yedekle"
117+
"exportDatabaseDesc" = "Mevcut veritabanınızın yedeğini içeren bir .db dosyasını cihazınıza indirmek için tıklayın."
118118
"importDatabase" = "Geri Yükle"
119+
"importDatabaseDesc" = "Cihazınızdan bir .db dosyası seçip yükleyerek veritabanınızı yedekten geri yüklemek için tıklayın."
119120

120121
[pages.inbounds]
121122
"title" = "Gelenler"

web/translation/translate.uk_UA.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Конфігурація"
114114
"backup" = "Резервне копіювання та відновлення"
115115
"backupTitle" = "Резервне копіювання та відновлення бази даних"
116-
"backupDescription" = "Рекомендується зробити резервну копію перед відновленням бази даних."
117-
"exportDatabase" = "Резервне копіювання"
116+
"exportDatabase" = "Резервна копія"
117+
"exportDatabaseDesc" = "Натисніть, щоб завантажити файл .db, що містить резервну копію вашої поточної бази даних на ваш пристрій."
118118
"importDatabase" = "Відновити"
119+
"importDatabaseDesc" = "Натисніть, щоб вибрати та завантажити файл .db з вашого пристрою для відновлення бази даних з резервної копії."
119120

120121
[pages.inbounds]
121122
"title" = "Вхідні"

web/translation/translate.vi_VN.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "Cấu hình"
114114
"backup" = "Sao lưu & Khôi phục"
115115
"backupTitle" = "Sao lưu & Khôi phục Cơ sở dữ liệu"
116-
"backupDescription" = "Hãy nhớ sao lưu trước khi nhập cơ sở dữ liệu mới."
117-
"exportDatabase" = "Tải về Cơ sở dữ liệu"
118-
"importDatabase" = "Tải lên Cơ sở dữ liệu"
116+
"exportDatabase" = "Sao lưu"
117+
"exportDatabaseDesc" = "Nhấp để tải xuống tệp .db chứa bản sao lưu cơ sở dữ liệu hiện tại của bạn vào thiết bị."
118+
"importDatabase" = "Khôi phục"
119+
"importDatabaseDesc" = "Nhấp để chọn và tải lên tệp .db từ thiết bị của bạn để khôi phục cơ sở dữ liệu từ bản sao lưu."
119120

120121
[pages.inbounds]
121122
"title" = "Điểm vào (Inbounds)"

web/translation/translate.zh_CN.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "配置"
114114
"backup" = "备份和恢复"
115115
"backupTitle" = "备份和恢复数据库"
116-
"backupDescription" = "恢复数据库之前建议进行备份"
117116
"exportDatabase" = "备份"
117+
"exportDatabaseDesc" = "点击下载包含当前数据库备份的 .db 文件到您的设备。"
118118
"importDatabase" = "恢复"
119+
"importDatabaseDesc" = "点击选择并上传设备中的 .db 文件以从备份恢复数据库。"
119120

120121
[pages.inbounds]
121122
"title" = "入站列表"

web/translation/translate.zh_TW.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@
113113
"config" = "配置"
114114
"backup" = "備份和恢復"
115115
"backupTitle" = "備份和恢復資料庫"
116-
"backupDescription" = "恢復資料庫之前建議進行備份"
117116
"exportDatabase" = "備份"
117+
"exportDatabaseDesc" = "點擊下載包含當前資料庫備份的 .db 文件到您的設備。"
118118
"importDatabase" = "恢復"
119+
"importDatabaseDesc" = "點擊選擇並上傳設備中的 .db 文件以從備份恢復資料庫。"
119120

120121
[pages.inbounds]
121122
"title" = "入站列表"

0 commit comments

Comments
 (0)