Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile history graph date fix #2647

Merged
merged 5 commits into from
Mar 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Transformers/UserMonthlyPlaycountTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserMonthlyPlaycountTransformer extends Fractal\TransformerAbstract
public function transform(UserMonthlyPlaycount $playcount)
{
return [
'start_date' => json_time($playcount->startDate()),
'start_date' => json_date($playcount->startDate()),
'count' => $playcount->playcount,
];
}
Expand Down
2 changes: 1 addition & 1 deletion app/Transformers/UserReplaysWatchedCountTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserReplaysWatchedCountTransformer extends Fractal\TransformerAbstract
public function transform(UserReplaysWatchedCount $count)
{
return [
'start_date' => json_time($count->startDate()),
'start_date' => json_date($count->startDate()),
'count' => $count->count,
];
}
Expand Down
10 changes: 4 additions & 6 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,14 @@ function html_excerpt($body, $limit = 300)
return e($body);
}

function json_date($date)
function json_date(?DateTime $date) : ?string
{
return json_time($date->startOfDay());
return $date === null ? null : $date->format('Y-m-d');
}

function json_time($time)
function json_time(?DateTime $time) : ?string
{
if ($time !== null) {
return $time->toIso8601String();
}
return $time === null ? null : $time->format(DateTime::ATOM);
}

function locale_flag($locale)
Expand Down
8 changes: 7 additions & 1 deletion resources/assets/coffee/_classes/line-chart.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ class @LineChart
.attr 'data-visibility', 'hidden'

@tooltipContent = @tooltip.append 'div'
.classed 'chart__tooltip-content', true
.classed 'chart__tooltip-component chart__tooltip-component--content', true

@tooltip.append 'div'
.classed 'chart__tooltip-component chart__tooltip-component--arrow', true

@tooltip.append 'div'
.classed 'chart__tooltip-component chart__tooltip-component--circle', true

@tooltipY = @tooltipContent.append 'div'
.classed 'chart__tooltip-text chart__tooltip-text--y', true
Expand Down
32 changes: 16 additions & 16 deletions resources/assets/less/bem/chart.less
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,29 @@
flex-direction: column;
align-items: center;
width: 0;
}

&::before {
.circle(@_marker-radius * 2);
content: '';
order: 1;
background-color: #fff;
border: 3px solid @pink-darker;
}
&__tooltip-component {
flex: none;

&::after {
content: '';
&--arrow {
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 10px solid @pink-darker;
}
}

&__tooltip-content {
.default-border-radius();
flex: none;
padding: 10px 20px;
background-color: @pink-darker;
color: #fff;
&--circle {
.circle(@_marker-radius * 2);
background-color: #fff;
border: 3px solid @pink-darker;
}

&--content {
.default-border-radius();
padding: 10px 20px;
background-color: @pink-darker;
color: #fff;
}
}

&__tooltip-text {
Expand Down