diff --git a/app/helpers.php b/app/helpers.php
index 8fa5e3b164c..0de9773bd25 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -76,9 +76,9 @@ function beatmap_timestamp_format($ms)
/**
* Allows using both html-safe and non-safe text inside `{{ }}` directive.
*/
-function blade_safe($html)
+function blade_safe($html): HtmlString
{
- return new Illuminate\Support\HtmlString($html);
+ return new HtmlString($html);
}
/**
@@ -270,16 +270,16 @@ function css_group_colour($group)
return '--group-colour: '.(optional($group)->colour ?? 'initial');
}
-function css_var_2x(string $key, string $url)
+function css_var_2x(string $key, ?string $url): ?HtmlString
{
if (!present($url)) {
- return;
+ return null;
}
$url = e($url);
$url2x = retinaify($url);
- return blade_safe("{$key}: url('{$url}'); {$key}-2x: url('{$url2x}')");
+ return blade_safe("{$key}: url('{$url}'); {$key}-2x: url('{$url2x}');");
}
function current_locale_meta(): LocaleMeta
diff --git a/resources/css/bem/artist.less b/resources/css/bem/artist.less
index f5fe0afa488..4d1d3a9fb9c 100644
--- a/resources/css/bem/artist.less
+++ b/resources/css/bem/artist.less
@@ -95,7 +95,7 @@
}
&__portrait {
- .at2x-simple("~@images/layout/artist-noavatar.jpg");
+ .at2x-fallback(--artist-portrait, "~@images/layout/artist-noavatar.jpg");
width: 250px;
height: 250px;
.default-box-shadow();
@@ -133,6 +133,7 @@
right: 0;
position: absolute;
border-radius: 4px 0 3px 0;
+ .at2x-simple-var(--artist-label-overlay);
}
&__links-area {
diff --git a/resources/css/bem/tournament.less b/resources/css/bem/tournament.less
index 581563e7f01..b295f576f1a 100644
--- a/resources/css/bem/tournament.less
+++ b/resources/css/bem/tournament.less
@@ -9,6 +9,10 @@
margin-bottom: 10px;
}
+ &__banner {
+ .at2x-simple-var(--tournament-header-banner);
+ }
+
&__body {
.center-content();
.default-gutter-v2();
diff --git a/resources/css/functions.less b/resources/css/functions.less
index 447855e33ea..bf9f264bc01 100644
--- a/resources/css/functions.less
+++ b/resources/css/functions.less
@@ -249,6 +249,14 @@
}
}
+.at2x-simple-var(@var) {
+ background-image: var(@var);
+
+ @media @highdpi {
+ background-image: var(~"@{var}-2x");
+ }
+}
+
.at2x-fallback(@var, @fallback) {
@fallback2x: replace(@fallback, "(\.[^.]+)$", "@2x$1");
background-image: var(@var, url(@fallback));
diff --git a/resources/views/admin/contests/show.blade.php b/resources/views/admin/contests/show.blade.php
index 6bc0befa5c0..0c7990e2781 100644
--- a/resources/views/admin/contests/show.blade.php
+++ b/resources/views/admin/contests/show.blade.php
@@ -5,9 +5,9 @@
@extends('master', ['titlePrepend' => osu_trans('layout.header.admin.contest').' / '.$contest->name])
@section('content')
- @include('objects.css-override', ['mapping' => [
- '.header-v4__bg' => $contest->header_url,
- ]])
+
@include('admin/_header')
diff --git a/resources/views/artists/show.blade.php b/resources/views/artists/show.blade.php
index 2571fea7ca6..2da9ce799df 100644
--- a/resources/views/artists/show.blade.php
+++ b/resources/views/artists/show.blade.php
@@ -29,11 +29,13 @@
])
@section('content')
- @include('objects.css-override', ['mapping' => [
- '.header-v4__bg' => $images['header_url'],
- '.artist__portrait' => $images['cover_url'],
- '.artist__label-overlay' => $artist->label ? $artist->label->icon_url : '',
- ]])
+
@include('layout._page_header_v4', ['params' => [
'links' => $headerLinks,
diff --git a/resources/views/objects/css-override.blade.php b/resources/views/objects/css-override.blade.php
deleted file mode 100644
index af22dcf576f..00000000000
--- a/resources/views/objects/css-override.blade.php
+++ /dev/null
@@ -1,22 +0,0 @@
-{{--
- Copyright (c) ppy Pty Ltd . Licensed under the GNU Affero General Public License v3.0.
- See the LICENCE file in the repository root for full licence text.
---}}
-
-{{-- below check skips this whole thing if there are no images given --}}
-@if (collect($mapping)->first(function ($val) { return present($val); }) !== null)
-
-@endif
diff --git a/resources/views/tournaments/show.blade.php b/resources/views/tournaments/show.blade.php
index f0e6820792a..2e3d5c6af38 100644
--- a/resources/views/tournaments/show.blade.php
+++ b/resources/views/tournaments/show.blade.php
@@ -18,13 +18,14 @@
@extends('master', ['titlePrepend' => $tournament->name])
@section('content')
- @include('objects.css-override', ['mapping' => ['.tournament__banner' => $tournament->header_banner]])
-
@include('layout._page_header_v4', ['params' => [
'links' => $links,
'linksBreadcrumb' => true,
'theme' => 'tournaments',
]])
+