Skip to content

Commit ffaa572

Browse files
Merge pull request #32 from wdyy20041223/main
fix:拼图编辑器可预览三角形,优化页面显示、分享代码的生成,优化异形拼图页面,增加提示功能
2 parents 953963f + a7d5875 commit ffaa572

17 files changed

+1308
-215
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@types/react-router-dom": "^5.3.3",
1616
"axios": "^1.11.0",
1717
"interactjs": "^1.10.27",
18+
"lz-string": "^1.5.0",
1819
"react": "^19.1.0",
1920
"react-dom": "^19.1.0",
2021
"react-router-dom": "^7.8.2"

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import './App.css';
2424

2525

2626

27-
type AppView = 'menu' | 'game' | 'editor' | 'irregular-game' | 'tetris-game' | 'achievements' | 'dailyChallenge' | 'multiplayer' | 'shop' | 'profile' | 'leaderboard' | 'dailyChallengeHistory' | 'settings';
27+
type AppView = 'menu' | 'game' | 'editor' | 'irregular-game' | 'tetris-game' | 'achievements' | 'dailyChallenge' | 'multiplayer' | 'shop' | 'profile' | 'leaderboard' | 'settings' | 'home' | 'singlePlayer' | 'multiplayer-game' | 'dailyChallengeHistory';
2828

2929

3030

@@ -216,7 +216,7 @@ const AppContent: React.FC = () => {
216216

217217
case 'editor':
218218
return (
219-
<PuzzleEditor onBackToMenu={handleBackToMenu} />
219+
<PuzzleEditor onBackToMenu={handleBackToMenu} onStartGame={handleStartGame} onStartIrregularGame={handleStartIrregularGame} />
220220
);
221221

222222
case 'irregular-game':

src/components/editor/DifficultySettings.css

Lines changed: 136 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,63 @@
1+
/* 让上传和导入按钮大小一致 */
2+
.same-size-btn {
3+
min-width: 160px;
4+
height: 44px;
5+
box-sizing: border-box;
6+
font-size: 16px;
7+
padding: 0 20px;
8+
display: flex;
9+
align-items: center;
10+
justify-content: center;
11+
line-height: 1;
12+
vertical-align: middle;
13+
}
14+
15+
.upload-step .upload-btn,
16+
.upload-step .import-btn {
17+
margin: 0;
18+
}
19+
20+
.upload-step {
21+
/* 保证按钮容器本身是flex且垂直居中 */
22+
/* 只影响上传区域的按钮,不影响其它地方 */
23+
}
124
.difficulty-settings {
225
display: flex;
326
flex-direction: column;
427
gap: 32px;
28+
max-height: 100vh;
29+
overflow-y: auto;
30+
padding-top: 24px;
31+
box-sizing: border-box;
32+
width: 1100px;
33+
min-height: 800px;
34+
margin: 0 auto;
535
}
636

737
.settings-section {
838
background: white;
939
border-radius: 12px;
10-
padding: 24px;
40+
padding: 8px 24px 24px 24px;
1141
border: 1px solid #e5e7eb;
1242
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
1343
}
1444

45+
/* 单独放大“选择拼块形状”大框 */
46+
.settings-section:nth-of-type(2) {
47+
padding: 32px 48px 36px 48px;
48+
margin-bottom: 44px;
49+
}
50+
1551
.settings-section h3 {
1652
margin: 0 0 12px 0;
1753
font-size: 24px;
1854
color: #1f2937;
1955
font-weight: 600;
20-
padding-top: 8px;
56+
padding-top: 0;
2157
}
2258

2359
.settings-section:first-of-type h3 {
24-
padding-top: 40px;
60+
padding-top: 0;
2561
}
2662

2763
.section-description {
@@ -34,7 +70,7 @@
3470
/* Difficulty Grid */
3571
.difficulty-grid {
3672
display: grid;
37-
grid-template-columns: repeat(4, 1fr);
73+
grid-template-columns: repeat(5, 1fr);
3874
gap: 16px;
3975
}
4076

@@ -66,6 +102,26 @@
66102
box-shadow: 0 8px 24px color-mix(in srgb, var(--accent-color, #3b82f6) 20%, transparent);
67103
}
68104

105+
/* 自定义选项的特殊样式 */
106+
.difficulty-card[style*="--accent-color: #8b5cf6"] {
107+
border: 2px solid #e5e7eb;
108+
}
109+
110+
.difficulty-card[style*="--accent-color: #8b5cf6"].selected {
111+
border: 2px solid #8b5cf6;
112+
background: linear-gradient(135deg,
113+
color-mix(in srgb, #8b5cf6 15%, white),
114+
white
115+
);
116+
box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
117+
}
118+
119+
.difficulty-card[style*="--accent-color: #8b5cf6"]:hover {
120+
border-color: #7c3aed;
121+
transform: translateY(-2px);
122+
box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
123+
}
124+
69125
.card-header {
70126
display: flex;
71127
flex-direction: column;
@@ -142,6 +198,9 @@
142198
font-weight: 500;
143199
text-align: center;
144200
transition: all 0.2s ease;
201+
margin-top: 8px;
202+
min-height: 24px;
203+
overflow: visible;
145204
}
146205

147206
.selection-indicator:not(.active) {
@@ -157,20 +216,37 @@
157216
/* Shape Grid */
158217
.shape-grid {
159218
display: grid;
160-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
219+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
220+
gap: 20px;
221+
margin-top: 16px;
222+
}
223+
224+
.shape-grid-horizontal {
225+
display: flex;
226+
flex-direction: row;
227+
justify-content: space-between;
161228
gap: 16px;
162229
}
163230

231+
.shape-grid-horizontal .shape-card {
232+
flex: 1 1 0;
233+
min-width: 0;
234+
max-width: 220px;
235+
}
164236
.shape-card {
165237
display: flex;
166238
flex-direction: column;
167-
padding: 20px;
239+
padding: 20px 12px 20px 12px;
168240
border: 2px solid #e5e7eb;
169241
border-radius: 12px;
170242
background: white;
171243
cursor: pointer;
172244
transition: all 0.3s ease;
173245
text-align: center;
246+
min-width: 0;
247+
min-height: 220px;
248+
box-sizing: border-box;
249+
overflow: visible;
174250
}
175251

176252
.shape-card:hover:not(.coming-soon) {
@@ -257,7 +333,10 @@
257333
flex: 1;
258334
display: flex;
259335
flex-direction: column;
260-
gap: 12px;
336+
gap: 8px;
337+
margin-bottom: 16px;
338+
align-items: center;
339+
overflow: visible;
261340
}
262341

263342
.shape-description {
@@ -270,6 +349,8 @@
270349
.shape-meta {
271350
display: flex;
272351
justify-content: center;
352+
margin-top: 4px;
353+
margin-bottom: 0;
273354
}
274355

275356
.difficulty-badge {
@@ -312,15 +393,16 @@
312393

313394
.summary-content {
314395
display: grid;
315-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
396+
grid-template-columns: repeat(3, 1fr);
316397
gap: 12px;
317398
}
318399

319400
.summary-item {
320401
display: flex;
321-
justify-content: space-between;
402+
justify-content: flex-start;
322403
align-items: center;
323404
padding: 8px 0;
405+
gap: 12px;
324406
}
325407

326408
.summary-label {
@@ -379,7 +461,7 @@
379461
background: #f0f9ff;
380462
border: 1px solid #bfdbfe;
381463
border-radius: 12px;
382-
padding: 20px;
464+
padding: 8px 20px 20px 20px;
383465
}
384466

385467
.settings-tips h4 {
@@ -409,7 +491,7 @@
409491
/* Responsive Design */
410492
@media (max-width: 1024px) {
411493
.difficulty-grid {
412-
grid-template-columns: repeat(2, 1fr);
494+
grid-template-columns: repeat(3, 1fr);
413495
}
414496

415497
.shape-grid {
@@ -451,6 +533,31 @@
451533

452534
.stat-item {
453535
flex-direction: row;
536+
.difficulty-grid {
537+
display: flex;
538+
flex-direction: row;
539+
justify-content: center;
540+
align-items: stretch;
541+
gap: 16px;
542+
margin: 0 auto 12px auto;
543+
width: 80%;
544+
max-width: 100px;
545+
}
546+
.difficulty-card {
547+
display: flex;
548+
flex-direction: column;
549+
padding: 12px 6px;
550+
border: 2px solid #e5e7eb;
551+
border-radius: 12px;
552+
background: white;
553+
cursor: pointer;
554+
transition: all 0.3s ease;
555+
text-align: center;
556+
min-height: 120px;
557+
width: 50px;
558+
max-width: 10vw;
559+
box-sizing: border-box;
560+
}
454561
justify-content: space-between;
455562
align-items: center;
456563
}
@@ -507,3 +614,21 @@
507614
.shape-card:nth-child(1) { animation-delay: 0.1s; }
508615
.shape-card:nth-child(2) { animation-delay: 0.2s; }
509616
.shape-card:nth-child(3) { animation-delay: 0.3s; }
617+
618+
/* Custom shape section animations */
619+
@keyframes fadeIn {
620+
from {
621+
opacity: 0;
622+
transform: translateY(10px);
623+
}
624+
to {
625+
opacity: 1;
626+
transform: translateY(0);
627+
}
628+
}
629+
630+
.custom-shape-section {
631+
animation: fadeIn 0.3s ease-in-out;
632+
margin-top: 6px !important;
633+
padding: 6px !important;
634+
}

0 commit comments

Comments
 (0)