mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-15 09:11:21 +10:00
* feat: move game import to new task system * fix: sizing issue with new task UI * fix: lint * feat: add pcgamingwiki task
This commit is contained in:
@ -332,6 +332,22 @@ export type TaskRunContext = {
|
||||
log: (message: string) => void;
|
||||
};
|
||||
|
||||
export function wrapTaskContext(
|
||||
context: TaskRunContext,
|
||||
options: { min: number; max: number; prefix: string },
|
||||
): TaskRunContext {
|
||||
return {
|
||||
progress(progress) {
|
||||
const scalar = 100 / (options.max - options.min);
|
||||
const adjustedProgress = progress * scalar + options.min;
|
||||
return context.progress(adjustedProgress);
|
||||
},
|
||||
log(message) {
|
||||
return context.log(options.prefix + message);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
id: string;
|
||||
taskGroup: TaskGroup;
|
||||
|
||||
Reference in New Issue
Block a user