Skip to content

Commit

Permalink
Merge pull request #11482 from notbakaneko/feature/fix-spotlight-drop…
Browse files Browse the repository at this point in the history
…down

Fix spotlight dropdown height
  • Loading branch information
nanaya authored Sep 11, 2024
2 parents e154712 + 9d466fe commit ae9fd8e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 70 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/RankingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,9 @@ public function spotlight($mode)

$selectOptionTransformer = new SelectOptionTransformer();
$selectOptions = [
'selected' => json_item($spotlight, $selectOptionTransformer),
'options' => json_collection($spotlights, $selectOptionTransformer),
'currentItem' => json_item($spotlight, $selectOptionTransformer),
'items' => json_collection($spotlights, $selectOptionTransformer),
'type' => 'spotlight',
];

return ext_view(
Expand Down
11 changes: 3 additions & 8 deletions resources/css/bem/select-options.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,24 @@
--option-padding: 5px 10px;
--option-select-padding: 15px 10px;
--selector-display: none;
--selector-max-height: auto;
--selector-max-height: 400px; // arbitrary
--selector-overflow-y: auto;

&--basic {
--selector-max-height: 400px; // arbitrary
--selector-overflow-y: scroll;
}

&--beatmap-discussions-user-filter {
--decoration-colour: hsl(var(--hsl-c1));
--selector-max-height: auto;

@media @desktop {
width: 200px;
}
}

&--ranking {
--selector-max-height: 400px; // arbitrary
--selector-overflow-y: scroll;
--option-select-padding: 5px 10px;
}

&--report {
--selector-max-height: auto;
width: 100%;
}

Expand Down
6 changes: 4 additions & 2 deletions resources/js/components/basic-select-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import { route } from 'laroute';
import * as React from 'react';
import { fail } from 'utils/fail';
import { navigate } from 'utils/turbolinks';
import { updateQueryString } from 'utils/url';

interface Props {
currentItem: SelectOptionJson;
items: SelectOptionJson[];
type: 'daily_challenge' | 'judge_results' | 'multiplayer' | 'seasons';
type: 'daily_challenge' | 'judge_results' | 'multiplayer' | 'seasons' | 'spotlight';
}

export default class BasicSelectOptions extends React.PureComponent<Props> {
render() {
return (
<SelectOptions
modifiers='basic'
onChange={this.handleChange}
options={this.props.items}
renderOption={this.renderOption}
Expand All @@ -41,6 +41,8 @@ export default class BasicSelectOptions extends React.PureComponent<Props> {
return route('multiplayer.rooms.show', { room: id ?? 'latest' });
case 'seasons':
return route('seasons.show', { season: id ?? 'latest' });
case 'spotlight':
return updateQueryString(null, { spotlight: id?.toString() });
}
}

Expand Down
48 changes: 0 additions & 48 deletions resources/js/components/spotlight-select-options.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions resources/js/register-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import RankingCountryFilter from 'components/ranking-country-filter';
import RankingUserFilter from 'components/ranking-user-filter';
import RankingVariantFilter from 'components/ranking-variant-filter';
import ScoringModeToggle from 'components/scoring-mode-toggle';
import SpotlightSelectOptions from 'components/spotlight-select-options';
import { UserCard } from 'components/user-card';
import { startListening, UserCardTooltip } from 'components/user-card-tooltip';
import { UserCards } from 'components/user-cards';
Expand Down Expand Up @@ -71,10 +70,6 @@ core.reactTurbolinks.register('basic-select-options', () => (
<BasicSelectOptions {...parseJson('json-basic-select-options')} />
));

core.reactTurbolinks.register('spotlight-select-options', () => (
<SpotlightSelectOptions {...parseJson('json-spotlight-select-options')} />
));

core.reactTurbolinks.register('chat-icon', (container) => (
<ChatIcon type={container.dataset.type} />
));
Expand Down
2 changes: 1 addition & 1 deletion resources/views/multiplayer/rooms/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@section('ranking-header')
<div class="osu-page osu-page--ranking-info">
<div class="js-react--basic-select-options">
<div class="select-options select-options--spotlight">
<div class="select-options">
<div class="select-options__select">
<span class="select-options__option">
{{ $room->name }}
Expand Down
6 changes: 3 additions & 3 deletions resources/views/rankings/charts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

@section('ranking-header')
<div class="osu-page osu-page--ranking-info">
<div class="js-react--spotlight-select-options">
<div class="select-options select-options--spotlight">
<div class="js-react--basic-select-options">
<div class="select-options">
<div class="select-options__select">
<span class="select-options__option">
{{ $spotlight->name }}
Expand All @@ -16,7 +16,7 @@
</div>
</div>

<script id="json-spotlight-select-options" type="application/json">
<script id="json-basic-select-options" type="application/json">
{!! json_encode($selectOptions) !!}
</script>

Expand Down
2 changes: 1 addition & 1 deletion resources/views/rankings/daily_challenge.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@section('ranking-header')
<div class="osu-page osu-page--ranking-info">
<div class="js-react--basic-select-options">
<div class="select-options select-options--spotlight">
<div class="select-options">
<div class="select-options__select">
<span class="select-options__option">
{{ $currentRoomOption['text'] }}
Expand Down

0 comments on commit ae9fd8e

Please sign in to comment.