mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-14 00:40:30 +00:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
parent
fa50bbad9c
commit
19c25713c4
387 changed files with 4785 additions and 4109 deletions
|
@ -1,5 +1,5 @@
|
|||
import { useTranslation } from "next-i18next";
|
||||
import { useCallback } from 'react';
|
||||
import { useCallback } from "react";
|
||||
|
||||
import QueueEntry from "../../components/widgets/queue/queueEntry";
|
||||
|
||||
|
@ -8,7 +8,7 @@ import Block from "components/services/widget/block";
|
|||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
function getProgress(sizeLeft, size) {
|
||||
return sizeLeft === 0 ? 100 : (1 - sizeLeft / size) * 100
|
||||
return sizeLeft === 0 ? 100 : (1 - sizeLeft / size) * 100;
|
||||
}
|
||||
|
||||
export default function Component({ service }) {
|
||||
|
@ -65,8 +65,7 @@ export default function Component({ service }) {
|
|||
activity={formatDownloadState(queueEntry.trackedDownloadState)}
|
||||
key={`${queueEntry.movieId}-${queueEntry.sizeLeft}`}
|
||||
/>
|
||||
))
|
||||
}
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,40 +17,41 @@ const widget = {
|
|||
},
|
||||
"queue/status": {
|
||||
endpoint: "queue/status",
|
||||
validate: [
|
||||
"totalCount"
|
||||
]
|
||||
validate: ["totalCount"],
|
||||
},
|
||||
"queue/details": {
|
||||
endpoint: "queue/details",
|
||||
map: (data) => asJson(data).map((entry) => ({
|
||||
trackedDownloadState: entry.trackedDownloadState,
|
||||
trackedDownloadStatus: entry.trackedDownloadStatus,
|
||||
timeLeft: entry.timeleft,
|
||||
size: entry.size,
|
||||
sizeLeft: entry.sizeleft,
|
||||
movieId: entry.movieId ?? entry.id,
|
||||
status: entry.status
|
||||
})).sort((a, b) => {
|
||||
const downloadingA = a.trackedDownloadState === "downloading"
|
||||
const downloadingB = b.trackedDownloadState === "downloading"
|
||||
if (downloadingA && !downloadingB) {
|
||||
return -1;
|
||||
}
|
||||
if (downloadingB && !downloadingA) {
|
||||
return 1;
|
||||
}
|
||||
map: (data) =>
|
||||
asJson(data)
|
||||
.map((entry) => ({
|
||||
trackedDownloadState: entry.trackedDownloadState,
|
||||
trackedDownloadStatus: entry.trackedDownloadStatus,
|
||||
timeLeft: entry.timeleft,
|
||||
size: entry.size,
|
||||
sizeLeft: entry.sizeleft,
|
||||
movieId: entry.movieId ?? entry.id,
|
||||
status: entry.status,
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
const downloadingA = a.trackedDownloadState === "downloading";
|
||||
const downloadingB = b.trackedDownloadState === "downloading";
|
||||
if (downloadingA && !downloadingB) {
|
||||
return -1;
|
||||
}
|
||||
if (downloadingB && !downloadingA) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const percentA = a.sizeLeft / a.size;
|
||||
const percentB = b.sizeLeft / b.size;
|
||||
if (percentA < percentB) {
|
||||
return -1;
|
||||
}
|
||||
if (percentA > percentB) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
const percentA = a.sizeLeft / a.size;
|
||||
const percentB = b.sizeLeft / b.size;
|
||||
if (percentA < percentB) {
|
||||
return -1;
|
||||
}
|
||||
if (percentA > percentB) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}),
|
||||
},
|
||||
calendar: {
|
||||
endpoint: "calendar",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue