diff --git a/Cargo.lock b/Cargo.lock index cc03481..73dcffe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,6 +280,21 @@ dependencies = [ "wasm-bindgen-test", ] +[[package]] +name = "rotate" +version = "0.1.0" +dependencies = [ + "console_error_panic_hook", + "glam", + "macros", + "serde", + "serde-wasm-bindgen", + "utils", + "wasm-bindgen", + "wasm-bindgen-test", + "web-sys", +] + [[package]] name = "ryu" version = "1.0.17" diff --git a/app/src/lib/helpers/index.ts b/app/src/lib/helpers/index.ts index 887d751..974ab54 100644 --- a/app/src/lib/helpers/index.ts +++ b/app/src/lib/helpers/index.ts @@ -127,3 +127,31 @@ export function humanizeNumber(number: number): string { return rounded + suffixes[baseIndex]; } +export function humanizeDuration(durationInMilliseconds: number) { + const millisecondsPerSecond = 1000; + const millisecondsPerMinute = 60000; + const millisecondsPerHour = 3600000; + const millisecondsPerDay = 86400000; + + let days = Math.floor(durationInMilliseconds / millisecondsPerDay); + let hours = Math.floor((durationInMilliseconds % millisecondsPerDay) / millisecondsPerHour); + let minutes = Math.floor((durationInMilliseconds % millisecondsPerHour) / millisecondsPerMinute); + let seconds = Math.floor((durationInMilliseconds % millisecondsPerMinute) / millisecondsPerSecond); + + let durationString = ''; + + if (days > 0) { + durationString += days + 'd '; + } + if (hours > 0) { + durationString += hours + 'h '; + } + if (minutes > 0) { + durationString += minutes + 'm '; + } + if (seconds > 0 || durationString === '') { + durationString += seconds + 's'; + } + + return durationString.trim(); +} diff --git a/app/src/lib/node-store/DraggableNode.svelte b/app/src/lib/node-store/DraggableNode.svelte index 3815c76..804f7d0 100644 --- a/app/src/lib/node-store/DraggableNode.svelte +++ b/app/src/lib/node-store/DraggableNode.svelte @@ -1,14 +1,16 @@ {#if input.type === 'float'} diff --git a/packages/ui/src/lib/elements/Float.svelte b/packages/ui/src/lib/elements/Float.svelte index b3dd594..628ddca 100644 --- a/packages/ui/src/lib/elements/Float.svelte +++ b/packages/ui/src/lib/elements/Float.svelte @@ -1,7 +1,7 @@ diff --git a/packages/ui/src/lib/elements/Vec3.svelte b/packages/ui/src/lib/elements/Vec3.svelte index a0bba47..b01c884 100644 --- a/packages/ui/src/lib/elements/Vec3.svelte +++ b/packages/ui/src/lib/elements/Vec3.svelte @@ -1,7 +1,7 @@