Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
7c058306
Commit
7c058306
authored
5 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Updated client for new trackservice structure.
parent
a2d0c540
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/aura-player/src/TrackService.svelte
+43
-11
43 additions, 11 deletions
contrib/aura-player/src/TrackService.svelte
with
43 additions
and
11 deletions
contrib/aura-player/src/TrackService.svelte
+
43
−
11
View file @
7c058306
<style>
<style>
.card
{
.card
{
margin-bottom
:
38px
;
margin-bottom
:
38px
;
}
}
card
.active-track
{
border
:
3px
solid
greenyellow
;
}
</style>
</style>
<script>
<script>
...
@@ -9,9 +13,14 @@ import { fly } from 'svelte/transition';
...
@@ -9,9 +13,14 @@ import { fly } from 'svelte/transition';
export
let
data
;
export
let
data
;
let
currentDate
=
""
;
let
currentDate
=
""
;
function
getDate
(
track
)
{
function
getDate
(
item
)
{
if
(
currentDate
!=
track
.
track_start
)
{
let
track_date
=
""
;
currentDate
=
track
.
track_start
;
if
(
item
.
track_start
!=
null
)
track_date
=
item
.
track_start
.
split
(
'
T
'
)[
0
];
if
(
currentDate
!=
track_date
)
{
currentDate
=
track_date
;
let
date
=
new
Date
(
currentDate
);
let
date
=
new
Date
(
currentDate
);
let
options
=
{
let
options
=
{
weekday
:
"
long
"
,
year
:
"
numeric
"
,
month
:
"
short
"
,
weekday
:
"
long
"
,
year
:
"
numeric
"
,
month
:
"
short
"
,
...
@@ -23,8 +32,8 @@ function getDate(track) {
...
@@ -23,8 +32,8 @@ function getDate(track) {
}
}
}
}
function
getTime
(
track
)
{
function
getTime
(
item
)
{
let
date
=
new
Date
(
track
.
track_start
);
let
date
=
new
Date
(
item
.
track_start
);
let
options
=
{
let
options
=
{
hour
:
"
2-digit
"
,
minute
:
"
2-digit
"
hour
:
"
2-digit
"
,
minute
:
"
2-digit
"
...
@@ -32,15 +41,38 @@ function getTime(track) {
...
@@ -32,15 +41,38 @@ function getTime(track) {
return
date
.
toLocaleTimeString
(
"
de-at
"
,
options
);
return
date
.
toLocaleTimeString
(
"
de-at
"
,
options
);
}
}
</script>
function
isActive
(
item
)
{
if
(
item
.
track
.
duration
!=
null
&&
parseInt
(
item
.
track
.
duration
)
>
0
)
{
let
startDate
=
new
Date
(
item
.
track_start
);
let
endDate
=
new
Date
(
startDate
.
getTime
()
+
item
.
track
.
duration
*
1000
);
let
now
=
new
Date
();
if
(
startDate
<
now
<
endDate
)
{
return
"
active-track
"
;
}
else
{
return
""
;
}
}
else
{
return
""
;
}
}
function
printDuration
(
item
)
{
if
(
item
.
track
.
duration
!=
null
&&
parseInt
(
item
.
track
.
duration
)
>
0
)
{
return
"
(
"
+
item
.
track
.
duration
+
"
)
"
;
}
else
{
return
""
;
}
}
</script>
{
#each
data
as
track
}
{
#each
data
as
item
}
<h4>
{
getDate
(
track
)
}
</h4>
<h4>
{
getDate
(
item
)
}
</h4>
<div
class=
"card mt-5"
transition:fly=
"
{
{
y
:
150
,
duration
:
500
}
}
"
>
<div
class=
"card mt-5
{isActive(item)}
"
transition:fly=
"
{
{
y
:
150
,
duration
:
500
}
}
"
>
<div
class=
"card-body"
>
<div
class=
"card-body"
>
<h5
class=
"card-title"
><b>
{
getTime
(
track
)
}
</b>
|
{
track
.
artist
}
-
{
track
.
title
}
(
{
track
.
duration
}
)
</h5>
<h5
class=
"card-title"
><b>
{
getTime
(
item
)
}
</b>
|
{
item
.
track
.
artist
}
-
{
item
.
track
.
title
}
{
printDuration
(
item
)
}
</h5>
</div>
</div>
</div>
</div>
{
/each
}
{
/each
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment