Skip to content

Commit 28bfe59

Browse files
authored
Merge pull request #11129 from notbakaneko/feature/ts-store-supporter-tag
Convert StoreSupporterTag to typescript
2 parents 6bbe641 + f636546 commit 28bfe59

File tree

12 files changed

+351
-330
lines changed

12 files changed

+351
-330
lines changed

resources/css/bem/store-slider.less

+13-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
// inset slider to prevent overflows making the page wider.
1313
// the 2px is to add a gap between the callout and the page edge.
14-
padding: 0 ((@callout-extension / 2) - (@callout-padding * 2) + 2px);
1514
padding: 0 (@slider-callout--width / 2 - @gutter-v2 + 2px);
1615

1716
@media @desktop {
@@ -76,18 +75,15 @@
7675
text-align: center;
7776
border-radius: 10px;
7877

79-
.js-store--disabled & {
78+
&--active {
79+
background-color: @osu-colour-pink-1;
80+
}
81+
82+
&--disabled {
8083
background-color: @osu-colour-b1;
8184
pointer-events: none;
8285
cursor: default;
8386
}
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-
}
9187
}
9288

9389
&__presets {
@@ -108,16 +104,19 @@
108104

109105
.ui-slider {
110106
background-color: @osu-colour-b3;
111-
.js-store--disabled & {
112-
.ui-slider-handle, .ui-slider-range {
113-
background-color: @osu-colour-b1;
114-
}
115-
}
107+
116108
.ui-slider-handle {
117109
background-color: @osu-colour-pink-1;
118110
}
111+
119112
.ui-slider-range {
120113
background-color: @osu-colour-pink-1;
121114
}
115+
116+
&--disabled {
117+
.ui-slider-handle, .ui-slider-range {
118+
background-color: @osu-colour-b1;
119+
}
120+
}
122121
}
123122
}

resources/js/_classes/store-supporter-tag-price.coffee

-62
This file was deleted.

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

-37
This file was deleted.

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

-155
This file was deleted.

resources/js/entrypoints/app.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'app-deps';
55

66
import 'jquery-pubsub.coffee';
77

8-
import '_classes/store-supporter-tag-price.coffee';
98
import '_classes/timeout.coffee';
109

1110
import 'spoilerbox.coffee';

resources/js/main.coffee

-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,6 @@ $(document).on 'submit', 'form', (e) ->
6059

6160
$(document).on 'turbolinks:load', ->
6261
BeatmapPack.initialize()
63-
StoreSupporterTag.initialize()
6462
StoreCheckout.initialize()
6563

6664
# 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 maxMessageLength = getInt(container.dataset.maxMessageLength);
112+
if (maxMessageLength == null) {
113+
throw new Error('missing maxMessageLength');
114+
}
115+
116+
return <StoreSupporterTag maxMessageLength={maxMessageLength} />;
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)