Skip to content

Commit 990b7f3

Browse files
committed
convert to react
1 parent 3f79742 commit 990b7f3

File tree

9 files changed

+326
-375
lines changed

9 files changed

+326
-375
lines changed

resources/css/bem/store-slider.less

+15-13
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,15 @@
7676
text-align: center;
7777
border-radius: 10px;
7878

79-
.js-store--disabled & {
79+
&--active {
80+
background-color: @osu-colour-pink-1;
81+
}
82+
83+
&--disabled {
8084
background-color: @osu-colour-b1;
8185
pointer-events: none;
8286
cursor: default;
8387
}
84-
85-
&.js-slider-preset--active {
86-
background-color: @osu-colour-pink-1;
87-
.js-store--disabled & {
88-
background-color: @osu-colour-b1;
89-
}
90-
}
9188
}
9289

9390
&__presets {
@@ -108,16 +105,21 @@
108105

109106
.ui-slider {
110107
background-color: @osu-colour-b3;
111-
.js-store--disabled & {
112-
.ui-slider-handle, .ui-slider-range {
113-
background-color: @osu-colour-b1;
114-
}
115-
}
108+
116109
.ui-slider-handle {
117110
background-color: @osu-colour-pink-1;
118111
}
112+
119113
.ui-slider-range {
120114
background-color: @osu-colour-pink-1;
121115
}
116+
117+
&--disabled {
118+
.ui-slider-handle, .ui-slider-range {
119+
background-color: @osu-colour-b1;
120+
}
121+
}
122+
123+
122124
}
123125
}

resources/js/components/user-card-store.tsx

-37
This file was deleted.

resources/js/core-legacy/store-supporter-tag.tsx

-189
This file was deleted.

resources/js/main.coffee

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import PostPreview from 'core-legacy/post-preview'
3232
import Search from 'core-legacy/search'
3333
import StickyFooter from 'core-legacy/sticky-footer'
3434
import { StoreCheckout } from 'core-legacy/store-checkout'
35-
import StoreSupporterTag from 'core-legacy/store-supporter-tag'
3635
import SyncHeight from 'core-legacy/sync-height'
3736
import TooltipDefault from 'core-legacy/tooltip-default'
3837
import { hideLoadingOverlay, showLoadingOverlay } from 'utils/loading-overlay'
@@ -60,7 +59,7 @@ $(document).on 'submit', 'form', (e) ->
6059

6160
$(document).on 'turbolinks:load', ->
6261
BeatmapPack.initialize()
63-
StoreSupporterTag.initialize()
62+
# StoreSupporterTag.initialize()
6463
StoreCheckout.initialize()
6564

6665
# ensure currentUser is updated early enough.

resources/js/register-components.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import RankingUserFilter from 'components/ranking-user-filter';
1515
import RankingVariantFilter from 'components/ranking-variant-filter';
1616
import SpotlightSelectOptions from 'components/spotlight-select-options';
1717
import { UserCard } from 'components/user-card';
18-
import { UserCardStore } from 'components/user-card-store';
1918
import { startListening, UserCardTooltip } from 'components/user-card-tooltip';
2019
import { UserCards } from 'components/user-cards';
2120
import { WikiSearch } from 'components/wiki-search';
@@ -25,8 +24,10 @@ import core from 'osu-core-singleton';
2524
import QuickSearch from 'quick-search/main';
2625
import QuickSearchWorker from 'quick-search/worker';
2726
import * as React from 'react';
27+
import StoreSupporterTag from 'store/store-supporter-tag';
2828
import { parseJson } from 'utils/json';
2929
import { mapBy } from 'utils/map';
30+
import { getInt } from 'utils/math';
3031

3132
function reqJson<T>(input: string|undefined): T {
3233
// This will throw when input is missing and thus parsing empty string.
@@ -106,17 +107,22 @@ core.reactTurbolinks.register('ranking-variant-filter', () => (
106107
<RankingVariantFilter {...parseJson('json-variant-filter')} />
107108
));
108109

110+
core.reactTurbolinks.register('store-supporter-tag', (container) => {
111+
const productId = getInt(container.dataset.productId);
112+
if (productId == null) {
113+
throw new Error('missing productId');
114+
}
115+
116+
return <StoreSupporterTag productId={productId} />;
117+
});
118+
109119
core.reactTurbolinks.register('user-card', (container) => (
110120
<UserCard
111121
modifiers={reqJson(container.dataset.modifiers ?? 'null')}
112122
user={container.dataset.isCurrentUser === '1' ? core.currentUser : reqJson(container.dataset.user ?? 'null')}
113123
/>
114124
));
115125

116-
core.reactTurbolinks.register('user-card-store', (container) => (
117-
<UserCardStore user={reqJson(container.dataset.user)} />
118-
));
119-
120126
core.reactTurbolinks.register('user-card-tooltip', (container) => (
121127
<UserCardTooltip
122128
container={container}

0 commit comments

Comments
 (0)