Skip to content

Commit

Permalink
perf: add translations cron (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
WDaan authored Nov 29, 2023
1 parent 8f8caad commit 02d97f5
Show file tree
Hide file tree
Showing 89 changed files with 6,844 additions and 1,271 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ updates:
interval: 'weekly'
groups:
all:
patterns:
- "*"
patterns:
- '*'
32 changes: 32 additions & 0 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update Translations

on:
workflow_dispatch:
schedule:
# At 00:00 on Sunday.
- cron: '0 0 * * 0'

permissions:
contents: write
pull-requests: write

jobs:
update-translations:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Update locales
run: |
curl -H 'X-API-KEY: ${{ secrets.TOLGEE_TOKEN }}' 'https://app.tolgee.io/v2/projects/export' -o locales.zip
unzip -o -d ./src/locales locales.zip
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: update translations'
branch: 'update-tolgee-translations'
title: 'chore: update translations'
delete-branch: true
150 changes: 87 additions & 63 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<p>The sleekest looking WebUI for qBittorrent made with Vue.js!</p>

Join us on [Discord](https://discord.gg/KDQP7fR467)

</div>

![Vue](https://img.shields.io/badge/Vue-%5E3.3.4-brightgreen) ![qBittorrent](https://img.shields.io/badge/qBittorrent-4.4%2B-brightgreen)
Expand Down Expand Up @@ -117,5 +118,6 @@ but before you do that:
<a href="https://www.buymeacoffee.com/wdaan"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=wdaan&button_colour=FFDD00&font_colour=000000&font_family=Arial&outline_colour=000000&coffee_colour=ffffff"></a>

## Contributors

- [@m4ximuel](https://github.com/m4ximuel)
- [@Larsluph](https://github.com/Larsluph)
2 changes: 1 addition & 1 deletion __mocks__/torrents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
{
"name": "Second torrent"
}
]
]
Binary file added locales.zip
Binary file not shown.
25 changes: 7 additions & 18 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@ import DnDZone from '@/components/DnDZone.vue'
import Navbar from '@/components/Navbar/Navbar.vue'
import { TitleOptions } from '@/constants/vuetorrent'
import { formatPercent, formatSpeed } from '@/helpers'
import {
useAddTorrentStore,
useAppStore,
useAuthStore,
useDialogStore,
useLogStore,
useMaindataStore,
usePreferenceStore,
useTorrentStore,
useVueTorrentStore
} from '@/stores'
import { useAddTorrentStore, useAppStore, useAuthStore, useDialogStore, useLogStore, useMaindataStore, usePreferenceStore, useTorrentStore, useVueTorrentStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { onBeforeMount, watch, watchEffect } from 'vue'
Expand Down Expand Up @@ -88,18 +78,18 @@ watchEffect(() => {
case TitleOptions.GLOBAL_SPEED:
document.title =
'[' +
`D: ${ formatSpeed(serverState.value?.dl_info_speed ?? 0, useBitSpeed.value) }, ` +
`U: ${ formatSpeed(serverState.value?.up_info_speed ?? 0, useBitSpeed.value) }` +
`D: ${formatSpeed(serverState.value?.dl_info_speed ?? 0, useBitSpeed.value)}, ` +
`U: ${formatSpeed(serverState.value?.up_info_speed ?? 0, useBitSpeed.value)}` +
'] VueTorrent'
break
case TitleOptions.FIRST_TORRENT_STATUS:
const torrent = torrents.value.at(0)
if (torrent) {
document.title =
'[' +
`D: ${ formatSpeed(torrent.dlspeed, useBitSpeed.value) }, ` +
`U: ${ formatSpeed(torrent.upspeed, useBitSpeed.value) }, ` +
`${ formatPercent(torrent.progress) }` +
`D: ${formatSpeed(torrent.dlspeed, useBitSpeed.value)}, ` +
`U: ${formatSpeed(torrent.upspeed, useBitSpeed.value)}, ` +
`${formatPercent(torrent.progress)}` +
'] VueTorrent'
} else {
document.title = '[N/A] VueTorrent'
Expand All @@ -118,8 +108,7 @@ watchEffect(() => {

<template>
<v-app class="text-noselect">
<component v-for="dialog in dialogStore.dialogs" :is="dialog.component"
v-bind="{ guid: dialog.guid, ...dialog.props }" />
<component v-for="dialog in dialogStore.dialogs" :is="dialog.component" v-bind="{ guid: dialog.guid, ...dialog.props }" />
<Navbar v-if="authStore.isAuthenticated" />
<v-main>
<router-view />
Expand Down
3 changes: 1 addition & 2 deletions src/components/AddPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ function openAddTorrentDialog() {
</script>

<template>
<v-bottom-navigation :active="addTorrentStore.pendingTorrentsCount > 0" class="pointer"
v-touch="{ up: openAddTorrentDialog }" @click="openAddTorrentDialog">
<v-bottom-navigation :active="addTorrentStore.pendingTorrentsCount > 0" class="pointer" v-touch="{ up: openAddTorrentDialog }" @click="openAddTorrentDialog">
<v-list-item :title="$t('navbar.addPanel.torrentsPendingCount', addTorrentStore.pendingTorrentsCount)" />
<v-spacer />
<v-list-item>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Core/DataCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ const vueTorrentStore = useVueTorrentStore()
<v-row data-testid="card-wrapper" :class="[`text-${color}`]">
<v-col data-testid="card-title" cols="7" class="text-subtitle-1">{{ title }}</v-col>
<v-col cols="5" class="">
<span data-testid="card-value"
class="text-subtitle-1 roboto">{{ formatDataValue(value, vueTorrentStore.useBinarySize) }}</span>
<span data-testid="card-unit" class="font-weight-light text-caption ml-1 text-subtitle-1">{{
formatDataUnit(value, vueTorrentStore.useBinarySize)
}}</span>
<span data-testid="card-value" class="text-subtitle-1 roboto">{{ formatDataValue(value, vueTorrentStore.useBinarySize) }}</span>
<span data-testid="card-unit" class="font-weight-light text-caption ml-1 text-subtitle-1">{{ formatDataUnit(value, vueTorrentStore.useBinarySize) }}</span>
</v-col>
</v-row>
</v-sheet>
Expand Down
4 changes: 1 addition & 3 deletions src/components/Core/HistoryField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,4 @@ defineExpose({
<v-combobox v-model="_value" ref="field" :items="historyValue" />
</template>

<style scoped>
</style>
<style scoped></style>
9 changes: 3 additions & 6 deletions src/components/Core/SpeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ const vueTorrentStore = useVueTorrentStore()
<v-icon class="" :icon="icon" :color="color" />
</v-col>
<v-col cols="8" class="d-flex flex-column align-center justify-center">
<span class="text-subtitle-1 roboto"
:class="`text-${color}`">{{ formatSpeedValue(value, vueTorrentStore.useBitSpeed) }}</span>
<span class="text-caption" :class="`text-${color}`">{{
formatSpeedUnit(value, vueTorrentStore.useBitSpeed)
}}</span>
<span class="text-subtitle-1 roboto" :class="`text-${color}`">{{ formatSpeedValue(value, vueTorrentStore.useBitSpeed) }}</span>
<span class="text-caption" :class="`text-${color}`">{{ formatSpeedUnit(value, vueTorrentStore.useBitSpeed) }}</span>
</v-col>
</v-row>
</v-sheet>
Expand All @@ -44,4 +41,4 @@ const vueTorrentStore = useVueTorrentStore()
font-family: 'Roboto Mono', sans-serif !important;
font-weight: 500;
}
</style>
</style>
2 changes: 1 addition & 1 deletion src/components/Dashboard/DashboardItems/ItemData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const vuetorrentStore = useVueTorrentStore()
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${ title }`) }}
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
{{ formatDataValue(torrent[value], vuetorrentStore.useBinarySize) }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/DashboardItems/ItemDateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const vueTorrentStore = useVueTorrentStore()
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${ title }`) }}
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
<span v-if="torrent[value] > 0">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/DashboardItems/ItemSpeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const vuetorrentStore = useVueTorrentStore()
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${ title }`) }}
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
{{ formatSpeedValue(torrent[value], vuetorrentStore.useBitSpeed) }}
Expand Down
11 changes: 4 additions & 7 deletions src/components/Dashboard/TRC/RightClickMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function exportTorrents() {
const link = document.createElement('a')
link.href = url
link.style.opacity = '0'
link.setAttribute('download', `${ hash }.torrent`)
link.setAttribute('download', `${hash}.torrent`)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
Expand Down Expand Up @@ -280,8 +280,7 @@ const menuData = computed<TRCMenuEntry[]>(() => [
</script>

<template>
<v-menu v-if="trcVisible" v-model="trcVisible" activator="parent" :close-on-content-click="true"
transition="slide-y-transition" scroll-strategy="none">
<v-menu v-if="trcVisible" v-model="trcVisible" activator="parent" :close-on-content-click="true" transition="slide-y-transition" scroll-strategy="none">
<v-list>
<v-list-item>
<div class="d-flex justify-space-around">
Expand All @@ -294,8 +293,7 @@ const menuData = computed<TRCMenuEntry[]>(() => [

<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn density="compact" variant="plain" icon="mdi-fast-forward" v-bind="props"
@click="forceResumeTorrents" />
<v-btn density="compact" variant="plain" icon="mdi-fast-forward" v-bind="props" @click="forceResumeTorrents" />
</template>
<span>Force Resume</span>
</v-tooltip>
Expand All @@ -309,8 +307,7 @@ const menuData = computed<TRCMenuEntry[]>(() => [

<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn color="red" density="compact" variant="plain" icon="mdi-delete-forever" v-bind="props"
@click="deleteTorrents" />
<v-btn color="red" density="compact" variant="plain" icon="mdi-delete-forever" v-bind="props" @click="deleteTorrents" />
</template>
<span>Delete</span>
</v-tooltip>
Expand Down
6 changes: 2 additions & 4 deletions src/components/Dashboard/Torrent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ const isTorrentSelected = computed(() => dashboardStore.isTorrentInSelection(pro
</script>

<template>
<v-card :class="`sideborder ${torrent.state} pointer`"
:color="isTorrentSelected ? `torrent-${torrent.state}-darken-3` : undefined" width="100%" @click="onClick">
<v-card :class="`sideborder ${torrent.state} pointer`" :color="isTorrentSelected ? `torrent-${torrent.state}-darken-3` : undefined" width="100%" @click="onClick">
<v-card-title class="text-wrap text-subtitle-1 pt-1 pb-0">{{ torrent.name }}</v-card-title>
<v-card-text class="pa-2 pt-0">
<div class="d-flex gap flex-wrap">
<component :is="getComponent(ppt.type)" :torrent="torrent" v-bind="ppt.props"
v-for="ppt in torrentProperties" />
<component :is="getComponent(ppt.type)" :torrent="torrent" v-bind="ppt.props" v-for="ppt in torrentProperties" />
</div>
</v-card-text>
</v-card>
Expand Down
Loading

0 comments on commit 02d97f5

Please sign in to comment.