Skip to content

Commit

Permalink
Add:Nav button in side drawer and item more menu to go to web client #…
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Mar 22, 2024
1 parent f04eebe commit 3c6d4b5
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 7 deletions.
16 changes: 15 additions & 1 deletion components/app/SideDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export default {
return this.$store.state.serverSettings || {}
},
username() {
return this.user ? this.user.username : ''
return this.user?.username || ''
},
userIsAdminOrUp() {
return this.$store.getters['user/getIsAdminOrUp']
},
navItems() {
var items = [
Expand Down Expand Up @@ -132,6 +135,13 @@ export default {
})
if (this.serverConnectionConfig) {
if (this.userIsAdminOrUp) {
items.push({
icon: 'language',
text: this.$strings.ButtonGoToWebClient,
action: 'openWebClient'
})
}
items.push({
icon: 'login',
text: this.$strings.ButtonSwitchServerUser,
Expand All @@ -151,6 +161,10 @@ export default {
if (action === 'logout') {
await this.logout()
this.$router.push('/connect')
} else if (action === 'openWebClient') {
this.show = false
let path = `/library/${this.$store.state.libraries.currentLibraryId}`
await this.$store.dispatch('user/openWebClient', path)
}
},
clickBackground() {
Expand Down
10 changes: 10 additions & 0 deletions components/modals/ItemMoreMenuModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ export default {
}
}
if (this.isConnectedToServer && this.userIsAdminOrUp) {
items.push({
text: this.$strings.ButtonGoToWebClient,
value: 'openWebClient',
icon: 'language'
})
}
if (!this.episode) {
items.push({
text: this.$strings.LabelMoreInfo,
Expand Down Expand Up @@ -285,6 +293,8 @@ export default {
this.clickRSSFeed()
} else if (action === 'sendEbook') {
this.showSendEbookDevicesModal = true
} else if (action === 'openWebClient') {
this.$store.dispatch('user/openWebClient', `/item/${this.serverLibraryItemId}`)
}
},
async toggleFinished() {
Expand Down
17 changes: 17 additions & 0 deletions store/user.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Browser } from '@capacitor/browser'

export const state = () => ({
user: null,
serverConnectionConfig: null,
Expand Down Expand Up @@ -115,6 +117,21 @@ export const actions = {
commit('setSettings', userSettings)
this.$eventBus.$emit('user-settings', state.settings)
}
},
async openWebClient({ getters }, path = null) {
const serverAddress = getters.getServerAddress
if (!serverAddress) {
console.error('openWebClient: No server address')
return
}
try {
let url = serverAddress.replace(/\/$/, '') // Remove trailing slash
if (path?.startsWith('/')) url += path

await Browser.open({ url })
} catch (error) {
console.error('Error opening browser', error)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Smazat místní položku",
"ButtonDisableAutoTimer": "Zakázat automatický časovač",
"ButtonDisconnect": "Odpojit",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Historie",
"ButtonHome": "Domů",
"ButtonIssues": "Problémy",
Expand Down
3 changes: 2 additions & 1 deletion strings/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Hjem",
"ButtonIssues": "Problemer",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Podcast oprettet med succes",
"ToastRSSFeedCloseFailed": "Mislykkedes lukning af RSS-feed",
"ToastRSSFeedCloseSuccess": "RSS-feed lukket"
}
}
3 changes: 2 additions & 1 deletion strings/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Lösche lokales Element",
"ButtonDisableAutoTimer": "Deaktiviere automatischen Timer",
"ButtonDisconnect": "Trennen",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Historie",
"ButtonHome": "Startseite",
"ButtonIssues": "Probleme",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Podcast erstellt",
"ToastRSSFeedCloseFailed": "RSS-Feed konnte nicht geschlossen werden",
"ToastRSSFeedCloseSuccess": "RSS-Feed geschlossen"
}
}
3 changes: 2 additions & 1 deletion strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Home",
"ButtonIssues": "Issues",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Podcast created successfully",
"ToastRSSFeedCloseFailed": "Failed to close RSS feed",
"ToastRSSFeedCloseSuccess": "RSS feed closed"
}
}
1 change: 1 addition & 0 deletions strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Inicio",
"ButtonIssues": "Problemas",
Expand Down
1 change: 1 addition & 0 deletions strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Accueil",
"ButtonIssues": "Parutions",
Expand Down
1 change: 1 addition & 0 deletions strings/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "ઘર",
"ButtonIssues": "સમસ્યાઓ",
Expand Down
1 change: 1 addition & 0 deletions strings/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "घर",
"ButtonIssues": "समस्याएं",
Expand Down
1 change: 1 addition & 0 deletions strings/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Početna stranica",
"ButtonIssues": "Problemi",
Expand Down
1 change: 1 addition & 0 deletions strings/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Helyi elem törlése",
"ButtonDisableAutoTimer": "Automatikus időzítő letiltása",
"ButtonDisconnect": "Kapcsolat bontása",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Előzmények",
"ButtonHome": "Kezdőlap",
"ButtonIssues": "Problémák",
Expand Down
1 change: 1 addition & 0 deletions strings/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Elimina oggetto locale",
"ButtonDisableAutoTimer": "Disattiva Auto Timer",
"ButtonDisconnect": "Disconnetti",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Cronologia",
"ButtonHome": "Home",
"ButtonIssues": "Errori",
Expand Down
1 change: 1 addition & 0 deletions strings/lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Pradžia",
"ButtonIssues": "Problemos",
Expand Down
1 change: 1 addition & 0 deletions strings/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Home",
"ButtonIssues": "Issues",
Expand Down
1 change: 1 addition & 0 deletions strings/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Hjem",
"ButtonIssues": "Problemer",
Expand Down
1 change: 1 addition & 0 deletions strings/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Usuń lokalny element",
"ButtonDisableAutoTimer": "Wyłącz automatyczny wyłącznik",
"ButtonDisconnect": "Rozłącz",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Historia",
"ButtonHome": "Strona główna",
"ButtonIssues": "Błędy",
Expand Down
3 changes: 2 additions & 1 deletion strings/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Apagar item local",
"ButtonDisableAutoTimer": "Desativar Timer Automático",
"ButtonDisconnect": "Desconectar",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Histórico",
"ButtonHome": "Principal",
"ButtonIssues": "Problemas",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Podcast criado",
"ToastRSSFeedCloseFailed": "Falha ao fechar feed RSS",
"ToastRSSFeedCloseSuccess": "Feed RSS fechado"
}
}
1 change: 1 addition & 0 deletions strings/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Удалить локальный элемент",
"ButtonDisableAutoTimer": "Отключить автоматический таймер",
"ButtonDisconnect": "Отключиться",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "История",
"ButtonHome": "Домой",
"ButtonIssues": "Проблемы",
Expand Down
1 change: 1 addition & 0 deletions strings/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Delete local item",
"ButtonDisableAutoTimer": "Disable Auto Timer",
"ButtonDisconnect": "Disconnect",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "History",
"ButtonHome": "Hem",
"ButtonIssues": "Problem",
Expand Down
3 changes: 2 additions & 1 deletion strings/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Видалити локальний елемент",
"ButtonDisableAutoTimer": "Вимкнути автотаймер",
"ButtonDisconnect": "Відключитися",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Історія",
"ButtonHome": "Головна",
"ButtonIssues": "Проблеми",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Подкаст успішно створено",
"ToastRSSFeedCloseFailed": "Не вдалося закрити RSS-канал",
"ToastRSSFeedCloseSuccess": "RSS-канал закрито"
}
}
3 changes: 2 additions & 1 deletion strings/vi-vn.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "Xóa mục địa phương",
"ButtonDisableAutoTimer": "Tắt Bộ Đếm Tự Động",
"ButtonDisconnect": "Ngắt Kết Nối",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "Lịch Sử",
"ButtonHome": "Trang Chủ",
"ButtonIssues": "Vấn Đề",
Expand Down Expand Up @@ -291,4 +292,4 @@
"ToastPodcastCreateSuccess": "Tạo podcast thành công",
"ToastRSSFeedCloseFailed": "Không thể đóng RSS feed",
"ToastRSSFeedCloseSuccess": "Đóng RSS feed thành công"
}
}
1 change: 1 addition & 0 deletions strings/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ButtonDeleteLocalItem": "删除本地项目",
"ButtonDisableAutoTimer": "禁用自动定时器",
"ButtonDisconnect": "断开连接",
"ButtonGoToWebClient": "Go to Web Client",
"ButtonHistory": "历史",
"ButtonHome": "首页",
"ButtonIssues": "问题",
Expand Down

0 comments on commit 3c6d4b5

Please sign in to comment.