history and track info

This commit is contained in:
Mateusz Pstrucha committed 2021-09-05 14:36:15 +02:00
1 parent 6620a9f3e5
commit 4e620850ed
19 files changed
+714 -3

No files matched your search

+96
View File
@@ -7184,6 +7184,19 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
},
"history": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
"integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
"requires": {
"@babel/runtime": "^7.1.2",
"loose-envify": "^1.2.0",
"resolve-pathname": "^3.0.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0",
"value-equal": "^1.0.1"
}
},
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -7194,6 +7207,14 @@
"minimalistic-crypto-utils": "^1.0.1"
}
},
"hoist-non-react-statics": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
"requires": {
"react-is": "^16.7.0"
}
},
"hoopy": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz",
@@ -10050,6 +10071,15 @@
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="
},
"mini-create-react-context": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz",
"integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==",
"requires": {
"@babel/runtime": "^7.12.1",
"tiny-warning": "^1.0.3"
}
},
"mini-css-extract-plugin": {
"version": "0.11.3",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz",
@@ -12484,6 +12514,52 @@
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
"integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg=="
},
"react-router": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.1.tgz",
"integrity": "sha512-lIboRiOtDLFdg1VTemMwud9vRVuOCZmUIT/7lUoZiSpPODiiH1UQlfXy+vPLC/7IWdFYnhRwAyNqA/+I7wnvKQ==",
"requires": {
"@babel/runtime": "^7.12.13",
"history": "^4.9.0",
"hoist-non-react-statics": "^3.1.0",
"loose-envify": "^1.3.1",
"mini-create-react-context": "^0.4.0",
"path-to-regexp": "^1.7.0",
"prop-types": "^15.6.2",
"react-is": "^16.6.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"requires": {
"isarray": "0.0.1"
}
}
}
},
"react-router-dom": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.1.tgz",
"integrity": "sha512-xhFFkBGVcIVPbWM2KEYzED+nuHQPmulVa7sqIs3ESxzYd1pYg8N8rxPnQ4T2o1zu/2QeDUWcaqST131SO1LR3w==",
"requires": {
"@babel/runtime": "^7.12.13",
"history": "^4.9.0",
"loose-envify": "^1.3.1",
"prop-types": "^15.6.2",
"react-router": "5.2.1",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
}
},
"react-scripts": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
@@ -12902,6 +12978,11 @@
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
},
"resolve-pathname": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
"integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
},
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@@ -14460,6 +14541,16 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
},
"tiny-invariant": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
"integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
},
"tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
},
"tmpl": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
@@ -14920,6 +15011,11 @@
"spdx-expression-parse": "^3.0.0"
}
},
"value-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
"integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+2 -1
View File
@@ -9,6 +9,7 @@
"@testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
},
@@ -37,4 +38,4 @@
"last 1 safari version"
]
}
}
}
+2
View File
@@ -15,6 +15,8 @@
<meta name="author" content="Mathias">
<title>radio-rolnik</title>
<link rel="stylesheet" href="/fontello.css">
<!-- Social embed properties -->
<!-- <meta property="og:type" content="website" />
<meta property="og:url" content="https://radio-rolnik.mtps.pl/" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+44
View File
@@ -0,0 +1,44 @@
var tracks = {
'8034thrgnu0380': {
id: '8034thrgnu0380',
title: 'Fiołkowe Pole',
artists: ['Sobel'],
album: {
name: 'Jakiś',
art: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBISEhgVEhISEhgYEhgYEhgYERgY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eXKujnfiRPvcI2W5hvpwjTq6ba8WG/1XxNPFvaMrHubaIzHTjhbh4xUjL0uaDe0FwGx4Vo+Sm/kUl4zqon1Ad0jUEm3Mkq/Dktc0tMODnQQY2JK+boeNgul4LbHJa2bf5QPVdbA+JUy6m1x1GZ8RIkaedz7LVzhJaZWGOUHtHz9Wt+DUczL0B1hrDdlPF4VtRudhEAfKJWbxqsypiHvpjKxzyWAuzEMkwC7cwsuFrljxqWm0TYyVxfkcdHoRrplH4ZGqqK+kq4JlUGxYSDB/u79lwcVhnU3FrtRpwRyFzxyxk2kWlGiNF8HsbFeVWQfvVVwrmkEQdfuFf3ZX9FMrf4TVLagANjr98rGW+6uwZyvaT/AFCbKJq4tEx7PosTRD2EWkQWndp2IWnA/hUWgNqU3h0Ew8BzSdi0lc/HhrCDAktygz+W5MDfVZmlhEOAcFTxvGWXG7lX0Rly/jktHT8cwjajc7LuGvOXy5WHAv6Yt2291dRkCGPkRdrjNuJ1j3WXIGOkCJsRrY6wdCrfgyY1T2vTRfF5MOSknv6ZuRHtLYmINpkTPdFDTXZ62PLHIrTCIig1CIiAIiIDl+KLine truncated
year: '2020',
},
duration: 23451,
explicit: false,
banned: false,
votes: {
up: 124,
down: 12,
rank: 2,
},
},
'2340q8ghedsnawg1': {
id: '2340q8ghedsnawg1',
title: 'Bandyta',
artists: ['Sobel'],
album: {
name: 'Jakiś Inny',
art: '/media/default.png',
year: '2020',
},
duration: 23231,
explicit: true,
banned: false,
votes: {
up: 356,
down: 62,
rank: 1,
},
},
}
var get = (id) => {
return tracks[id]
}
export { tracks, get }
+15
View File
@@ -0,0 +1,15 @@
.history {
overflow-y: auto;
padding-bottom: 2.5em;
margin-bottom: 1em;
font-family: 'Poppins';
width: min(100%, 800px);
margin: auto;
}
.history > span {
border-bottom: 1px solid #eeec;
display: block;
margin: 0 0.5em;
color: #3a3a3a;
}
+20
View File
@@ -0,0 +1,20 @@
import Track from '../Track/Track'
import './History.css'
function History(props) {
return (
<div className="wrapper history">
<span>Następny:</span>
<Track {...props.next} />
<span>Gra teraz:</span>
<Track {...props.playing} />
<span>Poprzednie:</span>
{props.tracks.map((track) => {
return <Track key={track.id} {...track} />
})}
</div>
)
}
export default History
+73
View File
@@ -0,0 +1,73 @@
.info {
text-align: center;
padding: 1em;
max-width: 600px;
margin: auto;
display: flex;
flex-direction: column;
align-items: stretch;
height: 100%;
box-sizing: border-box;
}
.info-image {
height: min(20vh, 60vw);
margin: auto;
margin-bottom: 1em;
box-shadow: 0px 4px 16px 0px #000000b8;
}
.info-wrapper {
border-radius: 1em;
background: linear-gradient(180deg, white, transparent);
height: 100%;
padding: 1em;
padding-bottom: 6em;
box-shadow: 0 -1px 11px 2px #6b6b6b52;
}
.info-wrapper > .title {
font-size: 2em;
display: block;
}
.info-balance {
width: 100%;
font-size: 0.75em;
background-color: #f3d9da;
margin: 1em 0;
}
.info-balance > div {
display: inline-block;
}
.info-balance > .up {
background-color: #57191d;
color: white;
}
.info-list > div {
padding: 0.7em;
display: flex;
justify-content: space-around;
}
.info-list > div:not(:last-child) {
border-bottom: 1px solid #cccc;
}
.info-list > div:nth-child(-n + 2) {
padding: 0;
}
.info-list > div > i {
cursor: pointer;
width: 100%;
font-size: 1.5em;
padding: 0.25em;
}
.info-list > div > i:hover {
background-color: #cccc;
}
+49
View File
@@ -0,0 +1,49 @@
import { useParams } from 'react-router-dom'
import { get } from '../../Cache'
import './Info.css'
function Info() {
let { id } = useParams(),
track = get(id)
let percent = (track.votes.up / (track.votes.up + track.votes.down)) * 100
return (
<div className="wrapper info">
<img src={track.album.art} className="info-image" alt="album cover" />
<div className="info-wrapper">
<span className="title">{track.title}</span>
<span className="artist">{track.artists[0]}</span>
<div className="info-balance">
<div className="up" style={{ width: `${percent}%` }}>
{track.votes.up}&nbsp;
</div>
<div className="down" style={{ width: `${100 - percent}%` }}>
{track.votes.down}
</div>
</div>
<div className="info-list">
<div>
<i className="icon-thumbs-up"></i>
<i className="icon-thumbs-down"></i>
</div>
<div>
<i className="icon-export"></i>
<i className="icon-music"></i>
<i className="icon-flag"></i>
</div>
<div>{`${track.title} - ${track.artists.join(', ')} - ${
track.album.name
} (${track.album.year})`}</div>
<div>Liczba głosów: {track.votes.up + track.votes.down}</div>
<div>Miejsce: {track.votes.rank}</div>
<div>Zablokowane: {track.banned ? 'Tak' : 'Nie'}</div>
</div>
</div>
</div>
)
}
export default Info
+9
View File
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css2?family=Quicksand&family=Poppins');
.main {
height: 100vh;
justify-content: flex-end;
background-color: hsl(356deg 50% 92%);
font-family: 'Quicksand';
overflow: hidden auto;
}
+45 -2
View File
@@ -1,11 +1,54 @@
import Home from '../Home/Home'
import {
BrowserRouter as Router,
Switch,
Route,
Redirect,
} from 'react-router-dom'
import Nav from '../Nav/Nav'
import History from '../History/History'
import Status from '../Status/Status'
import { get } from '../../Cache'
import './Main.css'
import Info from '../Info/Info'
var playing = get('2340q8ghedsnawg1')
function Main() {
return (
<div className="main">
<Home />
<Router>
<Switch>
<Route exact path="/">
<History
next={get('8034thrgnu0380')}
playing={playing}
tracks={[get('2340q8ghedsnawg1'), get('8034thrgnu0380')]}
/>
</Route>
<Route path="/utwor/:id">
<Info playing={playing} />
</Route>
<Route render={() => <Redirect to="/" />} />
</Switch>
<Nav
buttons={[
{ label: 'Historia', to: '/', icon: 'align-left' },
{ label: 'Wyszukaj', to: '/wyszukaj', icon: 'search' },
{ label: 'Top', to: '/top', icon: 'list-numbered' },
{
label: 'Utwór',
path: '/utwor',
to: `/utwor/${playing.id}`,
icon: 'info',
},
{ label: 'Ustawienia', to: '/ustawienia', icon: 'cog-alt' },
]}
/>
<Status track={playing} progress=".75" />
</Router>
</div>
)
}
+51
View File
@@ -0,0 +1,51 @@
nav {
width: 100%;
display: flex;
background-color: #fefefe;
border-radius: 1em 1em 0 0;
padding: 0.5em;
box-sizing: border-box;
user-select: none;
box-shadow: 0 0 12px 1px #0000002b, 0 -10px 20px 20px #f5e0e2;
z-index: 5;
position: fixed;
bottom: 0;
}
.nav-button {
width: 100%;
padding: 0.2em;
text-align: center;
cursor: pointer;
color: #666;
text-shadow: 0px 5px 5px #0003;
transition: 0.1s;
text-decoration: none;
}
.nav-button:not(:last-child) {
border-right: 1px solid #cccc;
}
.nav-button.active {
color: #ca3e47;
font-weight: bold;
padding-top: 0;
position: relative;
}
.nav-button.active:before {
content: '';
width: 80%;
left: 10%;
bottom: 0;
position: absolute;
border-bottom: 4px solid #ca3e4730;
border-radius: 3px;
}
@media only screen and (max-width: 600px) {
.nav-button > span {
display: none;
}
}
+53
View File
@@ -0,0 +1,53 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { useLocation } from 'react-router-dom'
import './Nav.css'
function Button(props) {
return (
<Link
to={props.to}
onClick={props.onClick}
className={`nav-button ${props.active ? 'active' : ''}`}
>
<i className={`icon-${props.icon}`}></i>
<span>{props.label}</span>
</Link>
)
}
function Nav(props) {
function getTab() {
return props.buttons
.slice()
.reverse()
.find((button) =>
document.location.pathname.startsWith(button.path ?? button.to)
).to
}
let [current, setCurrent] = useState(getTab()),
location = useLocation()
useEffect(() => {
setCurrent(getTab())
}, [location]) // eslint-disable-line
return (
<nav className="nav">
{props.buttons.map((button) => (
<Button
key={button.label}
label={button.label}
icon={button.icon}
active={button.to === current}
to={button.to}
onClick={() => setCurrent(button.to)}
/>
))}
</nav>
)
}
export default Nav
View File
Whitespace-only changes.
+11
View File
@@ -0,0 +1,11 @@
import './Search.css'
function Search(props) {
return (
<div className="search">
<input className="search-input" type="text" />
</div>
)
}
export default Search
+60
View File
@@ -0,0 +1,60 @@
.status {
position: fixed;
bottom: 3.5rem;
left: 2.5%;
width: 95%;
background: hsl(356deg 55% 22%);
color: #fefefe;
padding: 0.5em;
border-radius: 1em;
box-sizing: border-box;
box-shadow: 0 2px 8px 1px #00000063;
z-index: 10;
text-decoration: none;
}
.status-image {
height: 3em;
float: left;
margin-left: 0.2em;
margin-right: 0.5em;
}
.status-track {
font-size: 1.1em;
display: block;
font-weight: bold;
}
.status-artist {
font-size: 0.9em;
font-style: italic;
}
.status i {
position: absolute;
right: 0.7em;
top: 0.7em;
font-size: 1.5em;
}
.status-progress {
content: '';
--max: calc(100% - 2em);
position: absolute;
left: 1em;
bottom: 0;
border-bottom: 2px solid white;
transition: 0.4s;
}
.status-progress:after {
content: '';
width: 8px;
height: 8px;
position: absolute;
right: 0px;
bottom: -5px;
background-color: white;
border-radius: 100%;
}
+23
View File
@@ -0,0 +1,23 @@
import { Link } from 'react-router-dom'
import './Status.css'
function Status(props) {
return (
<Link className="status" to={`/utwor/${props.track.id}`}>
<img
className="status-image"
alt="album cover"
src={props.track.album.art}
/>
<span className="status-track">{props.track.title}</span>
<span className="status-artist">{props.track.artists.join(', ')}</span>
<i className="icon-info"></i>
<div
className="status-progress"
style={{ width: `calc(var(--max) * ${props.progress})` }}
></div>
</Link>
)
}
export default Status
+102
View File
@@ -0,0 +1,102 @@
.track {
height: 2em;
margin: 0.3em 0.4em;
padding: 0.4em;
background-color: #fefefe;
display: flex;
align-content: center;
line-height: 1.9em;
border-radius: 6px;
position: relative;
overflow: hidden;
}
.track-section-a {
width: 5em;
flex-shrink: 0;
text-align: right;
}
.track-section-b {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: flex;
flex-direction: row;
/* justify-content: space-around; */
}
.track-timestamp {
color: #666;
margin: 0 0.5em 0 0.2em;
font-size: 0.75em;
float: left;
width: 2.5em;
text-align: center;
user-select: none;
}
.track-image {
height: 100%;
margin-right: 0.5em;
border-radius: 3px;
}
.track-title {
padding: 0px 10px;
font-weight: bold;
text-decoration: none;
color: inherit;
}
.track-artist {
padding: 0px 10px;
color: #333;
}
.track-icons {
float: right;
padding: 0 0.5em;
}
.track-icons > i {
cursor: pointer;
}
.track-more {
width: 100%;
height: 100%;
position: absolute;
left: 100%;
top: 0;
border-radius: inherit;
background: hsl(12deg, 4%, 20%);
transition: 0.3s ease-in-out;
display: flex;
flex-direction: row;
color: #fff;
padding: 0.5em;
box-sizing: border-box;
justify-content: space-around;
}
.track.open > .track-more {
left: 0;
}
.track-more-button {
width: 100%;
text-align: center;
cursor: pointer;
color: inherit;
}
.track-more-button:hover {
background-color: #fff2;
}
.track-more-button:not(:last-child) {
border-right: 1px solid #fff5;
}
+59
View File
@@ -0,0 +1,59 @@
import { useState } from 'react'
import { Link } from 'react-router-dom'
import './Track.css'
function Track(props) {
let [open, setOpen] = useState(false)
return (
<div className={['track', open ? 'open' : ''].join(' ')}>
<div className="track-section-a">
{props.timestamp && (
<span className="track-timestamp">{props.timestamp}</span>
)}
<img
className="track-image"
src={props.album.art ?? '/media/default.png'}
alt="album cover"
/>
</div>
<div className="track-section-b">
<Link to={`/utwor/${props.id}`} className="track-title">
{props.title}
</Link>
<span className="track-artist">{props.artists.join(', ')}</span>
</div>
<div className="track-icons">
<i
className="icon-ellipsis-vert"
onClick={() => {
setOpen(true)
}}
></i>
</div>
<div className="track-more">
<div className="track-more-button">
<i className="icon-thumbs-up"></i>
</div>
<div className="track-more-button">
<i className="icon-thumbs-down"></i>
</div>
<Link to={`/utwor/${props.id}`} className="track-more-button">
<i className="icon-info"></i>
</Link>
<div
className="track-more-button"
onClick={() => {
setOpen(false)
}}
>
<i className="icon-cancel-circled"></i>
</div>
</div>
</div>
)
}
export default Track