Ignore:
Timestamp:
02/10/26 21:58:39 (5 months ago)
Author:
Filip Gavrilovski <filipgavrilovski28@…>
Branches:
main
Children:
92db381
Parents:
0808ef2
Message:

refactor artist, collection, listener components to have similar style as other components; refactor some dto-s

File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/pages/LandingPage.tsx

    r0808ef2 r1579b4f  
    1212        Song,
    1313} from "../utils/types";
    14 
    15 // Convert a regular YouTube URL to an embeddable URL
    16 const toEmbedUrl = (url: string): string => {
    17         try {
    18                 const parsed = new URL(url);
    19                 if (
    20                         (parsed.hostname === "www.youtube.com" ||
    21                                 parsed.hostname === "youtube.com") &&
    22                         parsed.searchParams.has("v")
    23                 ) {
    24                         return `https://www.youtube.com/embed/${parsed.searchParams.get("v")}`;
    25                 }
    26                 if (parsed.hostname === "youtu.be") {
    27                         return `https://www.youtube.com/embed${parsed.pathname}`;
    28                 }
    29                 return url;
    30         } catch {
    31                 return url;
    32         }
    33 };
     14import { toEmbedUrl } from "../utils/utils";
    3415
    3516const CATEGORIES: { value: SearchCategory; label: string }[] = [
Note: See TracChangeset for help on using the changeset viewer.