feat: replace inline formatDuration function with imported utility for better code reuse
This commit is contained in:
@@ -6,6 +6,7 @@ import { toast } from 'sonner';
|
|||||||
import { apiService } from '@/services/api';
|
import { apiService } from '@/services/api';
|
||||||
import { AddUrlDialog } from '@/components/AddUrlDialog';
|
import { AddUrlDialog } from '@/components/AddUrlDialog';
|
||||||
import { useAddUrlShortcut } from '@/hooks/use-keyboard-shortcuts';
|
import { useAddUrlShortcut } from '@/hooks/use-keyboard-shortcuts';
|
||||||
|
import { formatDuration } from '@/lib/format-duration';
|
||||||
|
|
||||||
interface Sound {
|
interface Sound {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -29,12 +30,6 @@ const SoundCard: React.FC<SoundCardProps> = ({ sound, onPlay, isPlaying }) => {
|
|||||||
onPlay(sound.id);
|
onPlay(sound.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDuration = (seconds: number) => {
|
|
||||||
const mins = Math.floor(seconds / 60);
|
|
||||||
const secs = seconds % 60;
|
|
||||||
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="transition-all duration-200 hover:shadow-lg cursor-pointer group">
|
<Card className="transition-all duration-200 hover:shadow-lg cursor-pointer group">
|
||||||
<CardHeader className="pb-3">
|
<CardHeader className="pb-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user