Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Speed cards as pills with icon in first column and speed on top…
… of the unit in second column (#169) Co-authored-by: Ievgen Sobko <ievgensobko@cloud.upwork.com>
- Loading branch information
Showing
7 changed files
with
94 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { setDocumentTitle } from './setDocumentTitle' | ||
|
||
export { | ||
setDocumentTitle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { formatBytes } from '@/helpers' | ||
|
||
export class setDocumentTitle { | ||
static setDefault() { | ||
this.set('VueTorrent') | ||
} | ||
|
||
static setGlobalSpeed(speeds) { | ||
if (!speeds || speeds.length !== 2) return | ||
this.set(`[D: ${formatBytes(speeds[0])}/s, U: ${formatBytes(speeds[1])}/s] VueTorrent`) | ||
} | ||
|
||
static setFirstTorrentStatus(torrent) { | ||
if (!torrent) return | ||
this.set(`${torrent.state.toLowerCase()} - ${torrent.progress}% - ${torrent.name}`) | ||
} | ||
|
||
static updateTitle(mode, speeds, torrent) { | ||
if (!mode || !speeds.length || !torrent) return | ||
switch (mode) { | ||
case 'Default': | ||
return this.setDefault() | ||
case 'Global Speed': | ||
return this.setGlobalSpeed(speeds) | ||
case 'First Torrent Status': | ||
return this.setFirstTorrentStatus(torrent) | ||
default: | ||
return this.setDefault() | ||
} | ||
} | ||
|
||
static set(title) { | ||
document.title = title | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ export function setup(component, propsData) { | |
vuetify, | ||
propsData | ||
}) | ||
} | ||
} |