Skip to content

Commit cbf70dc

Browse files
committed
feat: remove start / stop buttons
1 parent 91e65eb commit cbf70dc

4 files changed

Lines changed: 14 additions & 104 deletions

File tree

src/index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ <h1>🍣 Sushi mit RxJS</h1>
1010

1111
<p>Lass uns Sushi essen! Du kannst den Flattening-Operator in der <code>index.ts</code> ändern, um verschiedene Strategien auszuprobieren!</p>
1212

13-
<div class="button-container">
14-
<button id="startBtn" type="button">Starten</button>
15-
<button id="stopBtn" type="button">Stoppen</button>
16-
</div>
17-
1813
<!-- UI Container wird von initUI() in ui.ts erstellt und hier eingefügt -->
1914
<div id="sushi-ui-placeholder"></div>
2015

src/index.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import './style.css';
2-
import { Observable, Subject } from 'rxjs';
3-
import { filter, concatMap, mergeMap, switchMap, exhaustMap, withLatestFrom, takeUntil, tap } from 'rxjs/operators';
2+
import { Observable } from 'rxjs';
3+
import { filter, concatMap, mergeMap, switchMap, exhaustMap, withLatestFrom, tap } from 'rxjs/operators';
44

55
import { SushiWithSoja, sushiBelt$, soja$, iWantThis, getSushiFromPlate } from './helpers'
6-
import { initUI, onPlateAppear, onPlateSelected, onSushiConsumed, onStart, onStop } from './ui'
6+
import { initUI, onPlateAppear, onPlateSelected, onSushiConsumed, onStart } from './ui'
77

88
// Initialize UI on load
99
initUI();
@@ -18,22 +18,11 @@ const sushi$: Observable<SushiWithSoja> = sushiBelt$.pipe(
1818
))
1919
);
2020

21-
// Subject to signal stream termination
22-
const stop$ = new Subject<void>();
21+
// Auto-start on page load
22+
onStart();
2323

24-
document.getElementById('stopBtn')?.addEventListener('click', () => {
25-
stop$.next();
26-
onStop();
27-
});
24+
// Log all plates from the belt
25+
sushiBelt$.subscribe(plate => onPlateAppear(plate));
2826

29-
document.getElementById('startBtn')?.addEventListener('click', () => {
30-
onStart();
31-
32-
// Log all plates from the belt
33-
sushiBelt$.pipe(takeUntil(stop$))
34-
.subscribe(plate => onPlateAppear(plate))
35-
36-
// Log consumed sushi with soy sauce
37-
sushi$.pipe(takeUntil(stop$))
38-
.subscribe(sushi => onSushiConsumed(sushi));
39-
});
27+
// Log consumed sushi with soy sauce
28+
sushi$.subscribe(sushi => onSushiConsumed(sushi));

src/style.css

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -59,76 +59,6 @@ p code {
5959
color: #ffd93d;
6060
}
6161

62-
/* Button container */
63-
.button-container {
64-
display: flex;
65-
flex-direction: row;
66-
gap: 1rem;
67-
justify-content: center;
68-
margin-bottom: 1.5rem;
69-
}
70-
71-
button {
72-
padding: 1rem 2.5rem;
73-
font-size: 1.1rem;
74-
font-weight: 600;
75-
border: none;
76-
border-radius: 50px;
77-
cursor: pointer;
78-
margin: 0.5rem;
79-
transition: all 0.3s ease;
80-
position: relative;
81-
overflow: hidden;
82-
}
83-
84-
button::before {
85-
content: '';
86-
position: absolute;
87-
top: 50%;
88-
left: 50%;
89-
width: 0;
90-
height: 0;
91-
background: rgba(255, 255, 255, 0.2);
92-
border-radius: 50%;
93-
transform: translate(-50%, -50%);
94-
transition: width 0.6s, height 0.6s;
95-
}
96-
97-
button:hover::before {
98-
width: 300px;
99-
height: 300px;
100-
}
101-
102-
#startBtn {
103-
background: linear-gradient(135deg, #6bcf7f 0%, #4ecdc4 100%);
104-
color: #1a1a2e;
105-
box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
106-
}
107-
108-
#startBtn:hover {
109-
transform: translateY(-3px) scale(1.05);
110-
box-shadow: 0 8px 25px rgba(78, 205, 196, 0.6);
111-
}
112-
113-
#startBtn:active {
114-
transform: translateY(0) scale(0.98);
115-
}
116-
117-
#stopBtn {
118-
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
119-
color: #fff;
120-
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
121-
}
122-
123-
#stopBtn:hover {
124-
transform: translateY(-3px) scale(1.05);
125-
box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
126-
}
127-
128-
#stopBtn:active {
129-
transform: translateY(0) scale(0.98);
130-
}
131-
13262
/* Plate animation on the side */
13363
@keyframes plateSlide {
13464
0% { transform: translateX(-100vw) rotate(0deg); }
@@ -145,11 +75,6 @@ button:hover::before {
14575
font-size: 0.9rem;
14676
padding: 0 1rem;
14777
}
148-
149-
button {
150-
padding: 0.8rem 1.5rem;
151-
font-size: 1rem;
152-
}
15378
}
15479

15580
/* ============================================

src/ui.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ export function initUI(): void {
143143
sushiApp.appendChild(tableArea); // Table Area zwischen Belt und Bottom Section
144144
sushiApp.appendChild(bottomSection);
145145

146-
// In das bestehende HTML einfügen (nach dem Button-Container)
147-
const buttonContainer = document.querySelector('.button-container');
148-
if (buttonContainer && buttonContainer.parentNode) {
149-
buttonContainer.parentNode.insertBefore(sushiApp, buttonContainer.nextSibling);
146+
// In das bestehende HTML einfügen (nach dem Placeholder oder Paragraph)
147+
const placeholder = document.getElementById('sushi-ui-placeholder');
148+
if (placeholder && placeholder.parentNode) {
149+
placeholder.parentNode.insertBefore(sushiApp, placeholder);
150+
placeholder.remove();
150151
} else {
151152
// Fallback: Am Ende des Body einfügen
152153
document.body.appendChild(sushiApp);

0 commit comments

Comments
 (0)