mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-27 20:07:37 +03:00
chore: fix peers tab in vite
This commit is contained in:
parent
8a59d10483
commit
ab6ec174cb
12 changed files with 38 additions and 36 deletions
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: Build nightly
|
||||
name: Build nightly
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
||||
<meta name="description" content="VueTorrent" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
|
|
|
@ -17,8 +17,8 @@ export class Torrents {
|
|||
// update torrents
|
||||
store.state.torrents = data.map(t => new Torrent(t))
|
||||
|
||||
// load fake torrents if enabled
|
||||
if(isProduction() && !import.meta.env.VITE_USE_FAKE_TORRENTS) return
|
||||
// load fake torrents if enabled
|
||||
if (isProduction() && !import.meta.env.VITE_USE_FAKE_TORRENTS) return
|
||||
const count = import.meta.env.VITE_FAKE_TORRENT_COUNT
|
||||
store.state.torrents.push(...generateMultiple(count))
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td :class="commonStyle">
|
||||
{{ $t("torrent.timeActive") | titleCase }}
|
||||
{{ $t('torrent.timeActive') | titleCase }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.time_active }}
|
||||
<span v-if="torrent.seeding_time">{{ `(${$t("torrent.seededFor")} ${torrent.seeding_time})` }}</span>
|
||||
<span v-if="torrent.seeding_time">{{ `(${$t('torrent.seededFor')} ${torrent.seeding_time})` }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Content from './Content.vue'
|
||||
import Info from './Info.vue'
|
||||
import Peers from './DetailPeers.vue'
|
||||
import DetailPeers from './DetailPeers.vue'
|
||||
import Trackers from './Trackers.vue'
|
||||
import TagsAndCategories from './TorrentTagsAndCategories.vue'
|
||||
|
||||
export { Content, Info, Peers, Trackers, TagsAndCategories }
|
||||
export { Content, Info, DetailPeers, Trackers, TagsAndCategories }
|
||||
|
|
|
@ -7,6 +7,6 @@ Object.entries(components).forEach(([path, definition]) => {
|
|||
?.split('/')
|
||||
?.pop()
|
||||
?.replace(/\.\w+$/, '')
|
||||
|
||||
if(componentName) Vue.component(componentName, definition)
|
||||
|
||||
if (componentName) Vue.component(componentName, definition)
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||
import axios from 'axios'
|
||||
import VueI18n from 'vue-i18n'
|
||||
|
||||
import { messages} from '../lang'
|
||||
import { messages } from '../lang'
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@ import { describe, it, expect } from 'vitest'
|
|||
import { generateMultiple, generateTorrent } from './faker'
|
||||
|
||||
describe('faker to generate fake torrents', () => {
|
||||
it('can generate a fake torrent', () => {
|
||||
const t = generateTorrent({ name: 'Test' })
|
||||
expect(t.name).toBe('Test')
|
||||
})
|
||||
it('can generate a fake torrent', () => {
|
||||
const t = generateTorrent({ name: 'Test' })
|
||||
expect(t.name).toBe('Test')
|
||||
})
|
||||
|
||||
it('can generate multile', () => {
|
||||
const ts = generateMultiple(3)
|
||||
expect(ts.length).toBe(3)
|
||||
expect(ts[0]?.name).toBe('Torrent - 0')
|
||||
})
|
||||
})
|
||||
it('can generate multile', () => {
|
||||
const ts = generateMultiple(3)
|
||||
expect(ts.length).toBe(3)
|
||||
expect(ts[0]?.name).toBe('Torrent - 0')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -16,6 +16,7 @@ export function generateMultiple(count: number = 1): Torrent[] {
|
|||
export function generateTorrent(data: any): Torrent {
|
||||
return new Torrent({
|
||||
name: data.name,
|
||||
hash: faker.datatype.uuid(),
|
||||
size: faker.datatype.number({ min: 1000000, max: 50000000000 }),
|
||||
tags: [],
|
||||
progress: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
|
@ -24,9 +25,10 @@ export function generateTorrent(data: any): Torrent {
|
|||
availability: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
added_on: faker.date.recent(),
|
||||
ratio: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
num_leechs: faker.datatype.number({ min: 0, max: 500 }),
|
||||
available_seeds: faker.datatype.number({ min: 0, max: 500 }),
|
||||
num_seeds: faker.datatype.number({ min: 0, max: 500 }),
|
||||
available_peers: faker.datatype.number({ min: 0, max: 500 }),
|
||||
num_leechs: faker.datatype.number({ min: 1, max: 20 }),
|
||||
num_complete: faker.datatype.number({ min: 1, max: 500 }),
|
||||
num_seeds: faker.datatype.number({ min: 1, max: 25 }),
|
||||
num_incomplete: faker.datatype.number({ min: 1, max: 500 }),
|
||||
save_path: faker.system.filePath()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export function isProduction(): boolean {
|
||||
return process.env.NODE_ENV === 'production'
|
||||
return process.env.NODE_ENV === 'production'
|
||||
}
|
||||
|
||||
export function isDevelopment(): boolean {
|
||||
return process.env.NODE_ENV === 'development'
|
||||
}
|
||||
return process.env.NODE_ENV === 'development'
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="px-1 px-sm-5 pt-4 background noselect" @click.self="resetSelected">
|
||||
<v-row class="ma-0 pa-0" @click.self="resetSelected">
|
||||
<v-col v-if="topPagination && isMobile" cols="12" class="align-center justify-center pa-0">
|
||||
<div class="text-center">
|
||||
<v-pagination v-if="pageCount > 1 && !hasSearchFilter" v-model="pageNumber" :length="pageCount" :total-visible="7" @input="toTop" />
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col v-if="topPagination && isMobile" cols="12" class="align-center justify-center pa-0">
|
||||
<div class="text-center">
|
||||
<v-pagination v-if="pageCount > 1 && !hasSearchFilter" v-model="pageNumber" :length="pageCount" :total-visible="7" @input="toTop" />
|
||||
</div>
|
||||
</v-col>
|
||||
<v-expand-x-transition>
|
||||
<v-card v-show="searchFilterEnabled" id="searchFilter" flat xs7 md3 class="ma-0 pa-0 mt-1 transparent">
|
||||
<v-text-field
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<Trackers :is-active="tab === 'trackers'" :hash="hash" />
|
||||
</v-tab-item>
|
||||
<v-tab-item eager value="peers">
|
||||
<Peers :is-active="tab === 'peers'" :hash="hash" />
|
||||
<DetailPeers :is-active="tab === 'peers'" :hash="hash" />
|
||||
</v-tab-item>
|
||||
<v-tab-item eager value="content">
|
||||
<Content :is-active="tab === 'content'" :hash="hash" />
|
||||
|
@ -60,12 +60,12 @@
|
|||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { Content, Info, Peers, Trackers, TagsAndCategories } from '../components/TorrentDetail/Tabs'
|
||||
import { Content, Info, DetailPeers, Trackers, TagsAndCategories } from '../components/TorrentDetail/Tabs'
|
||||
import { mdiClose } from '@mdi/js'
|
||||
|
||||
export default {
|
||||
name: 'TorrentDetail',
|
||||
components: { Content, Info, Peers, Trackers, TagsAndCategories },
|
||||
components: { Content, Info, DetailPeers, Trackers, TagsAndCategories },
|
||||
data() {
|
||||
return {
|
||||
tab: null,
|
||||
|
|
Loading…
Reference in a new issue