Skip to content

Commit

Permalink
Add condensed mode (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
6c65726f79 committed Feb 17, 2022
1 parent 792d79f commit 5e68441
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/services/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const defaultSettings: Record<string,any> = {
searchByName:true,
searchByDirectory:true,
selectedPreset:"",
rememberSelectedPreset:false
rememberSelectedPreset:false,
condensedMode: false
}

export const UserSettings = {
Expand Down
5 changes: 4 additions & 1 deletion src/views/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
v-on:retry="retry()">
</ConnectionStatus>

<VirtualScroll v-else id="torrentList" :fullscreen="true" :items="torrentOrderedList" :item-size="72" key-field="id">
<VirtualScroll v-else id="torrentList" :fullscreen="true" :items="torrentOrderedList" :item-size="itemSize" key-field="id">
<template v-slot:start>
<ion-list-header id="top">
<ion-label>
Expand Down Expand Up @@ -295,6 +295,9 @@ export default defineComponent({
},
downloadSpeed: function (): any {
return () => TransmissionRPC.sessionStats ? TransmissionRPC.sessionStats.downloadSpeed: 0;
},
itemSize() {
return UserSettings.state.condensedMode ? 46 : 72;
}
},
setup() {
Expand Down
5 changes: 5 additions & 0 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<ion-label>{{ Locale.speedUnit }}</ion-label>
<ion-toggle v-model="sharedState.useBits"></ion-toggle>
</ion-item>

<ion-item>
<ion-label>{{ Locale.condensedMode }}</ion-label>
<ion-toggle v-model="sharedState.condensedMode"></ion-toggle>
</ion-item>

<ion-item>
<ion-label>{{ Locale.expandSideMenu }}</ion-label>
Expand Down
51 changes: 46 additions & 5 deletions src/views/components/Torrent.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="torrent" tabindex="0">
<div :class="{ torrent:true, condensed }" tabindex="0">
<div v-if="orderByPosition" class="order">
<ion-icon :md="caretUpSharp" :ios="caretUpOutline" color="medium" @click="changeTorrentPosition($event,true)"></ion-icon>
<ion-icon :md="caretDownSharp" :ios="caretDownOutline" color="medium" @click="changeTorrentPosition($event,false)"></ion-icon>
Expand All @@ -11,7 +11,7 @@
{{ torrent.name }}
</div>

<div class="details">
<div :class="{details:true,error:torrent.errorString!=''}">
<div class="line">
<!-- Download -->
<span class="bloc fit">
Expand Down Expand Up @@ -134,6 +134,9 @@ export default defineComponent({
computed: {
orderByPosition() {
return UserSettings.state.orderBy=="queuePosition";
},
condensed() {
return UserSettings.state.condensedMode
}
},
methods: {
Expand Down Expand Up @@ -165,6 +168,10 @@ img.icon {
display: flex;
}
.torrent.condensed {
height:46px;
}
.torrent > div {
display: inline-block;
vertical-align: top;
Expand All @@ -180,6 +187,14 @@ img.icon {
cursor:pointer;
}
.torrent.condensed .control {
width: 24px;
height: 24px;
margin: 7px;
margin-right: 15px;
background-size: 48px;
}
.torrent .control.paused {
background-position:right center;
}
Expand Down Expand Up @@ -223,6 +238,10 @@ img.icon {
line-height: 18px;
}
.torrent.condensed .details {
bottom: -7px;
}
.torrent .details > * {
white-space: nowrap;
}
Expand Down Expand Up @@ -278,6 +297,15 @@ img.icon {
width:100%;
}
.torrent.condensed ion-progress-bar {
bottom: -4px;
left: -5px;
width: calc(100% + 10px);
height: calc(100% + 8px);
z-index: -1;
opacity: .2;
}
.torrent .details ion-icon {
vertical-align:-2px;
}
Expand All @@ -290,24 +318,37 @@ img.icon {
color: var(--ion-color-primary)
}
.torrent.condensed .title {
text-overflow: ellipsis;
white-space: nowrap;
}
@media (max-width: 800px) {
.torrent .title {
text-overflow: ellipsis;
white-space: nowrap;
}
.torrent .details {
.torrent:not(.condensed) .details {
height: 40px;
flex-direction: column;
}
.torrent .details .line {
.torrent:not(.condensed) .details .line {
width: 100%;
}
.torrent.condensed .details.error .bloc {
display:none;
}
.torrent.condensed .details.error .error {
display:block;
}
}
@media (min-width: 800px) {
.torrent .title {
.torrent:not(.condensed) .title {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
Expand Down

0 comments on commit 5e68441

Please sign in to comment.