diff --git a/.gitignore b/.gitignore index fa6b93a5..13bfdbdd 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ # Built Visual Studio Code Extensions *.vsix + +node_modules \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e5a5b7de..2af99d39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", + "swiper": "^11.1.10", "typescript": "^4.9.5", "use-sound": "^4.0.3", "web-vitals": "^2.1.4" @@ -18871,6 +18872,25 @@ "boolbase": "~1.0.0" } }, + "node_modules/swiper": { + "version": "11.1.10", + "resolved": "https://registry.npmjs.org/swiper/-/swiper-11.1.10.tgz", + "integrity": "sha512-pAVM6vCb6bumj2B9aSh67l3wP1j5YR8dPQM1YhQKMpnBc33vs+RpyVz6NZYZl/ZopCBSYbbWK5nvESwbmU0QXQ==", + "funding": [ + { + "type": "patreon", + "url": "https://www.patreon.com/swiperjs" + }, + { + "type": "open_collective", + "url": "http://opencollective.com/swiper" + } + ], + "license": "MIT", + "engines": { + "node": ">= 4.7.0" + } + }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", diff --git a/package.json b/package.json index a9f4ebf9..2772b44e 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", + "swiper": "^11.1.10", "typescript": "^4.9.5", "use-sound": "^4.0.3", "web-vitals": "^2.1.4" diff --git a/src/App.css b/src/App.css index 6ba48812..d10c0b97 100644 --- a/src/App.css +++ b/src/App.css @@ -24,6 +24,7 @@ color: white; bottom: 0; width: 100%; + position: absolute; } /* Добавление градиента к блоку прокрутки */ diff --git a/src/App.tsx b/src/App.tsx index 41786762..c8bf3b47 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,15 +22,15 @@ function App() { async function fetchData() { const responseSongs = await axios.get('http://localhost:3000/songs'); - const responseAlbums = await axios.get('http://localhost:3000/albums'); - const responseGenres = await axios.get('http://localhost:3000/genres'); - const responseBands = await axios.get('http://localhost:3000/bands'); + // const responseAlbums = await axios.get('http://localhost:3000/albums'); + // const responseGenres = await axios.get('http://localhost:3000/genres'); + // const responseBands = await axios.get('http://localhost:3000/bands'); const responsePlaylists = await axios.get('http://localhost:3000/playlists'); setSongs(responseSongs.data); - setAlbums(responseAlbums.data); - setGenres(responseGenres.data); - setBands(responseBands.data); + // setAlbums(responseAlbums.data); + // setGenres(responseGenres.data); + // setBands(responseBands.data); setPlaylist(responsePlaylists.data); } diff --git a/src/components/CurrentTrack.tsx b/src/components/CurrentTrack.tsx index 4c9ddd00..917b508c 100644 --- a/src/components/CurrentTrack.tsx +++ b/src/components/CurrentTrack.tsx @@ -1,23 +1,44 @@ import React from 'react'; -import { Button } from 'antd'; -import { Grid, Row, Col } from 'antd'; -import PlayCircleOutlined from '@ant-design/icons/PlayCircleOutlined'; +import { Button, Table } from 'antd'; +import { PlayCircleOutlined } from '@ant-design/icons'; import { ISong, SongProps } from '../models/IModels'; -export function CurrentTrack({song}: SongProps) { +export function CurrentTrack({song}: {song: ISong}) { + + const columns = [ + { + title: 'Play', + dataIndex: 'play', + key: 'play', + width: 50, + render: (text: string, song: ISong) => ( + {song.song_name} + ), + }, + { + title: '', + dataIndex: 'song_name', + key: 'song_name', + }, + { + title: '', + dataIndex: 'band_name', + key: 'band_name', + } + ]; + return ( - - - - - - -

Current Track

- - -

Current Group

- -
-
+ ); } + + diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 13b6f1ef..4bad51ad 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,16 +1,13 @@ import React from 'react'; import { Button } from 'antd'; import { CurrentTrack } from './CurrentTrack'; -import { ISong, SongProps } from '../models/IModels'; +import { ISong } from '../models/IModels'; -export function Footer({song}: SongProps) { +export function Footer({song}: {song: ISong}) { return (
- - -

2022 Music Service

  • diff --git a/src/components/PlaylistsBlock.tsx b/src/components/PlaylistsBlock.tsx index 13acba5b..92f27270 100644 --- a/src/components/PlaylistsBlock.tsx +++ b/src/components/PlaylistsBlock.tsx @@ -1,16 +1,42 @@ import { IPlaylist } from "../models/IModels"; +import { Navigation, Pagination, Scrollbar, A11y } from 'swiper/modules'; + +import { Swiper, SwiperSlide } from 'swiper/react'; + +// Import Swiper styles +import 'swiper/css'; +import 'swiper/css/navigation'; +import 'swiper/css/pagination'; +import 'swiper/css/scrollbar'; + export function PlaylistsBlock({playlists}: {playlists: IPlaylist[]}) { return ( -
    - {playlists.map((p: IPlaylist) => ( -
    - {p.name} -

    {p.name}

    -
    - ))} +
    + console.log('slide change')}> + {playlists.map((p: IPlaylist) => ( + +
    + {p.name} +

    {p.name}

    +
    +
    + ))} +
    + +
    + ) } +