Skip to content

Commit cab171c

Browse files
committed
Рефакторинг стилей и структуры компонента MikuMonday для улучшения компоновки и читабельности.
- Введен новый стиль компоновки компонента MikuMonday для улучшения общей структуры и выравнивания. - Удалены устаревшие разделы с информацией о пользователе и интегрировано отображение доступных треков непосредственно в область основного контента. - Обновлён RouletteGroupList для использования более оптимизированной структуры классов для элементов обратной рулетки. - Добавлены атрибуты данных для улучшения доступности и функциональности в компоненте PrizeItem. - Очищен неиспользуемый код и улучшена согласованность стилей в модуле MikuMonday.
1 parent 9196e6a commit cab171c

File tree

6 files changed

+47
-126
lines changed

6 files changed

+47
-126
lines changed

src/components/OBS_Components/MikuMonday/MikuMonday.module.scss

Lines changed: 30 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1+
.layout {
2+
min-height: 100vh;
3+
width: 100%;
4+
display: flex;
5+
flex-direction: column;
6+
justify-content: flex-end;
7+
align-items: center;
8+
gap: 16px;
9+
padding: 24px 20px 0;
10+
box-sizing: border-box;
11+
}
12+
113
.roulette-container {
214
background: linear-gradient(135deg, rgba( var(--bs-primary-rgb), 0.1 ) 0%, rgba( var(--bs-primary-rgb), 0.25 ) 100%);
315
border-radius: 20px;
416
border: 2px solid var(--site-border-accent);
517
box-shadow: var(--site-shadow-medium);
618
overflow: hidden;
19+
width: min(70vw, 1100px);
20+
max-width: 100%;
21+
position: relative;
22+
display: flex;
23+
flex-direction: column;
24+
justify-content: flex-end;
25+
align-items: stretch;
26+
gap: 20px;
27+
padding: 24px;
28+
margin: 0 auto;
29+
justify-self: flex-end;
730
}
831

932
.roulette-pointer {
@@ -23,77 +46,6 @@
2346
}
2447
}
2548

26-
.user-info {
27-
display: flex;
28-
flex-direction: column;
29-
align-items: center;
30-
gap: 20px;
31-
margin-top: 30px;
32-
padding: 20px;
33-
}
34-
35-
.user-name-container {
36-
display: flex;
37-
flex-direction: column;
38-
align-items: center;
39-
gap: 10px;
40-
}
41-
42-
.label {
43-
font-size: 2rem;
44-
font-weight: 600;
45-
color: var(--site-text-light);
46-
text-shadow:
47-
0 0 10px rgba( var(--bs-primary-rgb), 0.8 ),
48-
0 0 20px rgba( var(--bs-primary-rgb), 0.6 ),
49-
var(--text-shadow-heavy);
50-
}
51-
52-
.user-name {
53-
font-size: 3rem;
54-
font-weight: 800;
55-
color: var(--bs-primary);
56-
text-shadow:
57-
0 0 15px var(--bs-primary),
58-
0 0 30px rgba( var(--bs-primary-rgb), 0.8 ),
59-
var(--text-shadow-heavy);
60-
animation: glow 2s ease-in-out infinite;
61-
}
62-
63-
.track-info {
64-
display: flex;
65-
flex-direction: column;
66-
align-items: center;
67-
gap: 10px;
68-
}
69-
70-
.track-title {
71-
font-size: 2.5rem;
72-
font-weight: 700;
73-
color: var(--site-text-light);
74-
text-shadow:
75-
0 0 10px rgba(255, 255, 255, 0.8),
76-
0 0 20px rgba( var(--bs-primary-rgb), 0.6 ),
77-
var(--text-shadow-heavy);
78-
}
79-
80-
@keyframes glow {
81-
0%,
82-
100% {
83-
text-shadow:
84-
0 0 15px var(--bs-primary),
85-
0 0 30px rgba( var(--bs-primary-rgb), 0.8 ),
86-
var(--text-shadow-heavy);
87-
}
88-
50% {
89-
text-shadow:
90-
0 0 25px var(--bs-primary),
91-
0 0 40px var(--bs-primary),
92-
0 0 50px rgba( var(--bs-primary-rgb), 0.8 ),
93-
var(--text-shadow-heavy);
94-
}
95-
}
96-
9749
// Кастомизация стилей рулетки
9850
:global {
9951
.react-roulette-pro-default-design {
@@ -125,7 +77,8 @@
12577
.available-tracks {
12678
display: flex;
12779
justify-content: center;
128-
margin-top: 10px;
80+
margin-bottom: 12px;
81+
padding: 0 20px;
12982
}
13083

13184
.available-tracks-text {
@@ -146,17 +99,13 @@
14699
.single-roulette {
147100
width: 100%;
148101
position: relative;
102+
}
149103

150-
// Развернутая рулетка - крутится справа налево
151-
&.reversed {
152-
transform: scaleX(-1);
104+
.single-roulette-reversed {
105+
transform: scaleX(-1);
153106

154-
// Возвращаем содержимое в нормальное состояние
155-
:global {
156-
.react-roulette-pro-prize-item {
157-
transform: scaleX(-1);
158-
}
159-
}
107+
[data-roulette-card="true"] {
108+
transform: scaleX(-1);
160109
}
161110
}
162111

src/components/OBS_Components/MikuMonday/MikuMonday.stories.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,3 @@ export const WithMockData: Story = {
9898
}, 1000);
9999
},
100100
};
101-
102-
103-
104-

src/components/OBS_Components/MikuMonday/MikuMonday.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ function MikuMondayContent() {
6060
return (
6161
<div
6262
ref={containerRef}
63-
className={" " + animate.animated + " " + animate.fadeIn}
63+
className={`${styles.layout} ${animate.animated} ${animate.fadeIn}`}
6464
onAnimationEnd={handleContainerAnimationEnd}
6565
style={baseStyle}
6666
>
67+
{availableTracksCount > 0 && (
68+
<div className={styles["available-tracks"]}>
69+
<span className={styles["available-tracks-text"]}>
70+
Осталось свободных треков: {availableTracksCount}
71+
</span>
72+
</div>
73+
)}
6774
<RouletteGroupList
6875
ref={groupsRef}
6976
groups={rouletteGroups}
@@ -75,26 +82,6 @@ function MikuMondayContent() {
7582
<RoulettePointer visible={visible} pointerHeight={pointerHeight} />
7683
}
7784
/>
78-
<div className={styles["user-info"]}>
79-
<div className={styles["user-name-container"]}>
80-
<span className={styles["label"]}>Мику заметила:</span>
81-
<span className={styles["user-name"]}>
82-
{currentAlert.displayName}
83-
</span>
84-
</div>
85-
<div className={styles["track-info"]}>
86-
<span className={styles["track-title"]}>
87-
И дарит трек #{currentAlert.selectedTrack.number}
88-
</span>
89-
</div>
90-
{availableTracksCount > 0 && (
91-
<div className={styles["available-tracks"]}>
92-
<span className={styles["available-tracks-text"]}>
93-
Осталось свободных треков: {availableTracksCount}
94-
</span>
95-
</div>
96-
)}
97-
</div>
9885
</div>
9986
);
10087
}

src/components/OBS_Components/MikuMonday/PrizeItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function PrizeItemComponent({ prize }: PrizeItemProps) {
1919
: "Мику улыбается этому треку";
2020

2121
return (
22-
<article className={containerClass}>
22+
<article className={containerClass} data-roulette-card="true">
2323
<div className={mediaClass}>
2424
{hasCover && (
2525
<img

src/components/OBS_Components/MikuMonday/components/RouletteGroupList.tsx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,14 @@ const RouletteGroupList = forwardRef<HTMLDivElement, RouletteGroupListProps>(
2626
},
2727
ref
2828
) => (
29-
<div
30-
ref={ref}
31-
className={styles["roulette-container"]}
32-
style={{
33-
width: "100%",
34-
margin: "0 auto",
35-
height: "80vh",
36-
alignSelf: "center",
37-
position: "relative",
38-
display: "flex",
39-
flexDirection: "column",
40-
gap: "20px",
41-
justifyContent: "center",
42-
}}
43-
>
29+
<div ref={ref} className={styles["roulette-container"]}>
4430
{pointer}
4531
{groups.map((group, index) => (
4632
<div
4733
key={index}
48-
className={`${styles["single-roulette"]} ${group.isReversed ? styles["reversed"] : ""}`}
34+
className={`${styles["single-roulette"]} ${
35+
group.isReversed ? styles["single-roulette-reversed"] : ""
36+
}`}
4937
style={{
5038
opacity: rouletteOpacities[index] ?? 1,
5139
transition: "opacity 2s ease-out",
@@ -60,7 +48,7 @@ const RouletteGroupList = forwardRef<HTMLDivElement, RouletteGroupListProps>(
6048
prizeItemRenderFunction={renderPrizeItem}
6149
spinningTime={20}
6250
type="horizontal"
63-
options={{ withoutAnimation: false, stopInCenter: true }}
51+
options={{ withoutAnimation: false, stopInCenter: false }}
6452
defaultDesignOptions={{
6553
prizesWithText: true,
6654
hideCenterDelimiter: true,

src/components/OBS_Components/MikuMonday/hooks/useRouletteAnimation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import animate from "@/shared/styles/animate.module.scss";
1111
import type { OperationResult } from "@/shared/types/OperationResult";
1212
import { createErrorResult } from "@/shared/types/OperationResult";
1313

14+
import styles from "../MikuMonday.module.scss";
1415
import type { RouletteGroup } from "../types";
1516

1617
type ShowToast = (result: OperationResult<unknown>) => void;
@@ -39,7 +40,7 @@ export function useRouletteAnimation({
3940
display: "flex",
4041
flexDirection: "column",
4142
alignItems: "center",
42-
justifyContent: "center",
43+
justifyContent: "flex-end",
4344
animationDuration: "2.2s",
4445
});
4546
const [rouletteStart, setRouletteStart] = useState(false);
@@ -111,7 +112,7 @@ export function useRouletteAnimation({
111112
...prevStyle,
112113
animationDuration: "1.5s",
113114
}));
114-
div.className = " " + animate.animated + " " + animate.fadeOut;
115+
div.className = `${styles.layout} ${animate.animated} ${animate.fadeOut}`;
115116
}
116117
}, 100);
117118
}

0 commit comments

Comments
 (0)