diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-03-17 14:26:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-17 14:26:07 +0300 |
| commit | db62a07fb89e08e974210ccb0f62cc648d799e94 (patch) | |
| tree | 50af3c5e77ae27c3e5b360eb32b9e95fe795aa25 /web/html/xui/component | |
| parent | e3120c402882e3fccc0112b1c0197126fb613329 (diff) | |
Code refactoring (#2785)
* chore: pretty theme menu in sidebar
* refactor: renaming component templates
* refactor: create custom `a-statistic` component
* fix: display button text only on large screens
* chore: remove loading background in overview page
* fix: show `Version` text when xray version is unknown
Diffstat (limited to 'web/html/xui/component')
| -rw-r--r-- | web/html/xui/component/aCustomStatistic.html | 55 | ||||
| -rw-r--r-- | web/html/xui/component/aPasswordInput.html (renamed from web/html/xui/component/password.html) | 2 | ||||
| -rw-r--r-- | web/html/xui/component/aPersianDatepicker.html (renamed from web/html/xui/component/persianDatepicker.html) | 2 | ||||
| -rw-r--r-- | web/html/xui/component/aSettingListItem.html (renamed from web/html/xui/component/setting.html) | 10 | ||||
| -rw-r--r-- | web/html/xui/component/aTableSortable.html (renamed from web/html/xui/component/sortableTable.html) | 2 | ||||
| -rw-r--r-- | web/html/xui/component/aThemeSwitch.html (renamed from web/html/xui/component/themeSwitch.html) | 16 |
6 files changed, 67 insertions, 20 deletions
diff --git a/web/html/xui/component/aCustomStatistic.html b/web/html/xui/component/aCustomStatistic.html new file mode 100644 index 00000000..41695e90 --- /dev/null +++ b/web/html/xui/component/aCustomStatistic.html @@ -0,0 +1,55 @@ +{{define "component/customStatistic"}} +<template> + <a-statistic :title="title" :value="value"> + <template #prefix> + <slot name="prefix"></slot> + </template> + <template #suffix> + <slot name="suffix"></slot> + </template> + </a-statistic> +</template> +{{end}} + +{{define "component/aCustomStatistic"}} +<style> + .dark .ant-statistic-title, + .dark .ant-statistic-content { + color: var(--dark-color-text-primary) !important + } + + .dark .ant-statistic-title { + user-select: none; + opacity: 0.55; + } + + .ant-statistic-title { + margin-bottom: 0 !important; + } + + .ant-statistic-content-prefix { + margin-right: 6px !important; + } + + .ant-statistic-content-prefix, + .ant-statistic-content-value { + font-size: 1.05rem; + } +</style> + +<script> + Vue.component('a-custom-statistic', { + props: { + 'title': { + type: String, + required: false, + }, + 'value': { + type: String, + required: false + } + }, + template: `{{template "component/customStatistic"}}`, + }); +</script> +{{end}}
\ No newline at end of file diff --git a/web/html/xui/component/password.html b/web/html/xui/component/aPasswordInput.html index 0fea1430..460e7e76 100644 --- a/web/html/xui/component/password.html +++ b/web/html/xui/component/aPasswordInput.html @@ -12,7 +12,7 @@ </template> {{end}} -{{define "component/password"}} +{{define "component/aPasswordInput"}} <script> Vue.component('a-password-input', { props: { diff --git a/web/html/xui/component/persianDatepicker.html b/web/html/xui/component/aPersianDatepicker.html index 2df79a06..58132ddd 100644 --- a/web/html/xui/component/persianDatepicker.html +++ b/web/html/xui/component/aPersianDatepicker.html @@ -12,7 +12,7 @@ </template> {{end}} -{{define "component/persianDatepicker"}} +{{define "component/aPersianDatepicker"}} <link rel="stylesheet" href="{{ .base_path }}assets/persian-datepicker/persian-datepicker.min.css?{{ .cur_ver }}" /> <script src="{{ .base_path }}assets/moment/moment-jalali.min.js?{{ .cur_ver }}"></script> <script src="{{ .base_path }}assets/persian-datepicker/persian-datepicker.min.js?{{ .cur_ver }}"></script> diff --git a/web/html/xui/component/setting.html b/web/html/xui/component/aSettingListItem.html index 85220d25..6a7d31d0 100644 --- a/web/html/xui/component/setting.html +++ b/web/html/xui/component/aSettingListItem.html @@ -18,18 +18,10 @@ </a-list-item> {{end}} -{{define "component/setting"}} +{{define "component/aSettingListItem"}} <script> Vue.component('a-setting-list-item', { props: { - 'title': { - type: String, - required: true, - }, - 'description': { - type: String, - required: false, - }, 'paddings': { type: String, required: false, diff --git a/web/html/xui/component/sortableTable.html b/web/html/xui/component/aTableSortable.html index 67bbcee2..7dbc3d0a 100644 --- a/web/html/xui/component/sortableTable.html +++ b/web/html/xui/component/aTableSortable.html @@ -3,7 +3,7 @@ @click="clickHandler" /> {{end}} -{{define "component/sortableTable"}} +{{define "component/aTableSortable"}} <script> const DRAGGABLE_ROW_CLASS = 'draggable-row'; const findParentRowElement = (el) => { diff --git a/web/html/xui/component/themeSwitch.html b/web/html/xui/component/aThemeSwitch.html index 28cb79b1..9a213ca6 100644 --- a/web/html/xui/component/themeSwitch.html +++ b/web/html/xui/component/aThemeSwitch.html @@ -4,15 +4,15 @@ <a-sub-menu> <span slot="title"> <a-icon type="bulb" :theme="themeSwitcher.isDarkTheme ? 'filled' : 'outlined'"></a-icon> - <span>Theme</span> + <span>{{ i18n "menu.theme" }}</span> </span> - <a-menu-item id="change-theme" class="ant-menu-theme-switch" @mousedown="themeSwitcher.animationsOff()"> Dark - <a-switch style="margin-left: 2px;" size="small" :default-checked="themeSwitcher.isDarkTheme" - @change="themeSwitcher.toggleTheme()"></a-switch> + <a-menu-item id="change-theme" class="ant-menu-theme-switch" @mousedown="themeSwitcher.animationsOff()"> + <span>{{ i18n "menu.dark" }}</span> + <a-switch style="margin-left: 2px;" size="small" :default-checked="themeSwitcher.isDarkTheme" @change="themeSwitcher.toggleTheme()"></a-switch> </a-menu-item> - <a-menu-item id="change-theme-ultra" v-if="themeSwitcher.isDarkTheme" class="ant-menu-theme-switch" - @mousedown="themeSwitcher.animationsOffUltra()"> Ultra <a-checkbox style="margin-left: 2px;" - :checked="themeSwitcher.isUltra" @click="themeSwitcher.toggleUltra()"></a-checkbox> + <a-menu-item id="change-theme-ultra" v-if="themeSwitcher.isDarkTheme" class="ant-menu-theme-switch" @mousedown="themeSwitcher.animationsOffUltra()"> + <span>{{ i18n "menu.ultraDark" }}</span> + <a-checkbox style="margin-left: 2px;" :checked="themeSwitcher.isUltra" @click="themeSwitcher.toggleUltra()"></a-checkbox> </a-menu-item> </a-sub-menu> </a-menu> @@ -36,7 +36,7 @@ </template> {{end}} -{{define "component/themeSwitcher"}} +{{define "component/aThemeSwitch"}} <script> function createThemeSwitcher() { const isDarkTheme = localStorage.getItem('dark-mode') === 'true'; |
