this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor this out for no particular reason

+15 -16
+1 -1
src/components/media.jsx
··· 9 9 } from 'preact/hooks'; 10 10 import QuickPinchZoom, { make3dTransformValue } from 'react-quick-pinch-zoom'; 11 11 12 + import formatDuration from '../utils/format-duration'; 12 13 import mem from '../utils/mem'; 13 14 import states from '../utils/states'; 14 15 15 16 import Icon from './icon'; 16 17 import Link from './link'; 17 - import { formatDuration } from './status'; 18 18 19 19 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755 20 20
-15
src/components/status.jsx
··· 2872 2872 ); 2873 2873 } 2874 2874 2875 - export function formatDuration(time) { 2876 - if (!time) return; 2877 - let hours = Math.floor(time / 3600); 2878 - let minutes = Math.floor((time % 3600) / 60); 2879 - let seconds = Math.round(time % 60); 2880 - 2881 - if (hours === 0) { 2882 - return `${minutes}:${seconds.toString().padStart(2, '0')}`; 2883 - } else { 2884 - return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds 2885 - .toString() 2886 - .padStart(2, '0')}`; 2887 - } 2888 - } 2889 - 2890 2875 function nicePostURL(url) { 2891 2876 if (!url) return; 2892 2877 const urlObj = new URL(url);
+14
src/utils/format-duration.jsx
··· 1 + export default function formatDuration(time) { 2 + if (!time) return; 3 + let hours = Math.floor(time / 3600); 4 + let minutes = Math.floor((time % 3600) / 60); 5 + let seconds = Math.round(time % 60); 6 + 7 + if (hours === 0) { 8 + return `${minutes}:${seconds.toString().padStart(2, '0')}`; 9 + } else { 10 + return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds 11 + .toString() 12 + .padStart(2, '0')}`; 13 + } 14 + }