Skip to content

Commit 7c89731

Browse files
committed
Optimized code style and updated multiple components and language files. Fixed styling issues in the search bar and account panel, adjusted the default wallpaper path in state management, and updated translations for some languages. Ensured code consistency and readability.
1 parent 0ca25c9 commit 7c89731

File tree

9 files changed

+1283
-1285
lines changed

9 files changed

+1283
-1285
lines changed

src/assets/lang/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const files = require.context("./", false, /\.json$/);
2-
const langs = {};
1+
const files = require.context('./', false, /\.json$/)
2+
const langs = {}
33
files.keys().forEach((key) => {
4-
langs[key.replace(/(\.\/|\.json$)/g, "").toLowerCase()] = files(key);
5-
});
4+
langs[key.replace(/(\.\/|\.json$)/g, '').toLowerCase()] = files(key)
5+
})
66

7-
export default langs;
7+
export default langs

src/assets/lang/pt_BR.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"lang_name": "Português(brasileiro)",
33
"OK": "OK",
44
"Cancel": "Cancelar",
5-
"Submit": "Salvar",
5+
"Submit": "Enviar",
66
"Back": "Voltar",
77
"Edit": "Editar",
88
"Update": "Atualizar",
@@ -74,18 +74,18 @@
7474
"Widgets Settings": "Configurações de Widgets",
7575
"Time": "Hora",
7676
"System Status": "Status do Sistema",
77-
"Storage Status": "Status de armazenamento",
77+
"Storage Status": "Status do armazenamento",
7878
"Network Status": "Status de rede",
7979
"Search...": "Localizar...",
8080
"Sync your data": "Sincronizar seus dados",
81-
"Use Syncthing to sync your files between multiple devices.": "Use Syncthing para sincronizar seus arquivos entre vários dispositivos",
81+
"Use Syncthing to sync your files between multiple devices.": "Use a sincronização para sincronizar seus arquivos entre vários dispositivos",
8282
"Install": "Instalar",
8383
"Config": "Configurações",
8484
"Total": "Total",
85-
"Failed to start, please try again.": "Falha ao iniciar Syncthing. Tente novamente.",
85+
"Failed to start, please try again.": "Falha ao iniciar a Sincronização. Tente novamente.",
8686
"Syncthing is not running, start it?": "Syncthing não está em execução. Deseja iniciar?",
87-
"Starting Syncthing...": "Iniciando Syncthing...",
88-
"Have an idea? Shoot it on Discord!": "Tem uma ideia? Manda no Discord!",
87+
"Starting Syncthing...": "Iniciando Sincronização...",
88+
"Have an idea? Shoot it on Discord!": "Tem uma ideia? Mande-nos no Discord!",
8989
"Smarten up your home": "Tornando sua casa inteligente",
9090
"We want to give you a smart home experience with privacy, high speed, and localized storage.": "Nós queremos te dar uma experiência de casa inteligente com privacidade, alta velocidade e armazenamento local.",
9191
"In development": "Atenção",

src/assets/lang/zh_CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"Uninstall": "卸载",
9797
"Attention": "注意",
9898
"Data cannot be recovered after deletion! <br>Continue on to uninstall this application?": "删除后无法恢复数据! <br>继续卸载此应用?",
99-
"Featured Apps": "精选App",
99+
"Featured Apps": "精选 App",
100100
"Custom Install": "自定义安装",
101101
"Continue in background": "在后台继续",
102102
"Install a new App manually": "手动安装新应用",

src/components/CoreService.vue

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script>
22
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
33
import sortBy from 'lodash/sortBy'
4-
import last from 'lodash/last'
54
import noticeBlock from '@/components/noticBlock/noticeBlock'
65
import { mixin } from '@/mixins/mixin'
76
import SyncBlock from '@/components/syncthing/SyncBlock.vue'
@@ -48,31 +47,7 @@ export default {
4847
},
4948
},
5049
},
51-
noticesData: {
52-
// example data:
53-
/* 'local-storage': {
54-
prelude: {
55-
title: 'local-storage',
56-
icon: 'mdi-usb',
57-
},
58-
content: {
59-
a: {
60-
title: 'Found a new drive',
61-
icon: '/storage/disk.png',
62-
color: 'is-primary',
63-
path: '/storage',
64-
uuid: '456',
65-
value: '100G/500G'
66-
},},
67-
contentType: 'list',
68-
operate: {
69-
type: 'button',
70-
title: 'More',
71-
path: '/storage',
72-
icon: 'mdi-arrow-right',
73-
},
74-
}, */
75-
},
50+
noticesData: {},
7651
dockerProgress: {},
7752
totalPercentage: 0,
7853
}
@@ -125,25 +100,33 @@ export default {
125100
_isValidDiskEvent(evt) {
126101
let p = {}
127102
if (typeof evt?.properties === 'string') {
128-
try { p = JSON.parse(evt.properties) } catch (_) { p = {} }
129-
} else if (typeof evt?.properties === 'object' && evt.properties !== null) {
103+
try {
104+
p = JSON.parse(evt.properties)
105+
}
106+
catch {
107+
p = {}
108+
}
109+
}
110+
else if (typeof evt?.properties === 'object' && evt.properties !== null) {
130111
p = evt.properties
131112
}
132113
133114
const asNum = (v) => {
134-
const n = typeof v === 'number' ? v : parseFloat(v)
135-
return Number.isFinite(n) ? n : NaN
115+
const n = typeof v === 'number' ? v : Number.parseFloat(v)
116+
return Number.isFinite(n) ? n : Number.NaN
136117
}
137118
138119
const size = asNum(p.size)
139-
if (!size || !Number.isFinite(size) || size <= 0) return false
120+
if (!size || !Number.isFinite(size) || size <= 0)
121+
return false
140122
141123
const path = p['local-storage:path'] || p.path || ''
142-
const mnt = p.mount_point || ''
143-
if (typeof path === 'string' && path.startsWith('/dev/loop') && !mnt) return false
124+
const mnt = p.mount_point || ''
125+
if (typeof path === 'string' && path.startsWith('/dev/loop') && !mnt)
126+
return false
144127
145128
return true
146-
}
129+
},
147130
createWS(domain) {
148131
let socket
149132
// reference:

src/components/SearchBar.vue

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
1-
<template>
2-
<b-field class="search-bar has-text-white mb-4" position="is-centered ">
3-
<b-input v-model="keyText" :class="['ovh', isFocus ? 'fo' : '']" :placeholder="$t('Search...')" expanded
4-
icon="search-outline" icon-pack="casa" icon-right="search-outline" icon-right-clickable size="is-medium"
5-
@blur="onBlur" @focus="onFocus" @icon-right-click="gotoSearch" @keyup.enter.native="gotoSearch">
6-
</b-input>
7-
</b-field>
8-
</template>
9-
101
<script>
112
export default {
12-
name: "search-bar",
13-
data() {
14-
return {
15-
isFocus: false,
16-
keyText: "",
17-
// searchEngine:this.$store.state.searchEngine
18-
}
19-
},
20-
computed: {
21-
searchEngine() {
22-
return this.$store.state.searchEngine === "" ? "https://duckduckgo.com/?q=" : this.$store.state.searchEngine
23-
}
24-
},
25-
methods: {
26-
/**
27-
* @description: Handle Focus event
28-
* @return {*} void
29-
*/
30-
onFocus() {
31-
this.isFocus = true;
32-
},
3+
name: 'SearchBar',
4+
data() {
5+
return {
6+
isFocus: false,
7+
keyText: '',
8+
// searchEngine:this.$store.state.searchEngine
9+
}
10+
},
11+
computed: {
12+
searchEngine() {
13+
return this.$store.state.searchEngine === '' ? 'https://duckduckgo.com/?q=' : this.$store.state.searchEngine
14+
},
15+
},
16+
methods: {
17+
/**
18+
* @description: Handle Focus event
19+
* @return {*} void
20+
*/
21+
onFocus() {
22+
this.isFocus = true
23+
},
3324
34-
/**
35-
* @description: Handle Blur event
36-
* @return {*} void
37-
*/
38-
onBlur() {
39-
if (this.keyText === "")
40-
this.isFocus = false;
41-
},
25+
/**
26+
* @description: Handle Blur event
27+
* @return {*} void
28+
*/
29+
onBlur() {
30+
if (this.keyText === '')
31+
this.isFocus = false
32+
},
4233
43-
/**
44-
* @description: Pop up a new window and jump to google search
45-
* @return {*} void
46-
*/
47-
gotoSearch() {
48-
window.open(this.searchEngine + this.keyText, '_blank')
49-
}
50-
},
34+
/**
35+
* @description: Pop up a new window and jump to google search
36+
* @return {*} void
37+
*/
38+
gotoSearch() {
39+
window.open(this.searchEngine + this.keyText, '_blank')
40+
},
41+
},
5142
}
5243
</script>
5344

45+
<template>
46+
<b-field class="search-bar has-text-white mb-4" position="is-centered ">
47+
<b-input
48+
v-model="keyText" class="ovh" :class="[isFocus ? 'fo' : '']" :placeholder="$t('Search...')" expanded
49+
icon="search-outline" icon-pack="casa" icon-right="search-outline" icon-right-clickable size="is-medium"
50+
@blur="onBlur" @focus="onFocus" @icon-right-click="gotoSearch" @keyup.enter.native="gotoSearch"
51+
/>
52+
</b-field>
53+
</template>
54+
5455
<style lang="scss">
5556
.search-bar {
5657
input {
@@ -117,4 +118,4 @@ export default {
117118
}
118119
}
119120
}
120-
</style>
121+
</style>

0 commit comments

Comments
 (0)