Skip to content

Commit ce21aab

Browse files
Merge pull request #1022 from smalruby/feature/lesson-support-1017
feat(classroom): 課題詳細刷新 — 説明タブ+プレビュー・限定ポーリング (E-4)
2 parents dcac11c + 5d6ae78 commit ce21aab

12 files changed

Lines changed: 274 additions & 256 deletions

File tree

docs/classroom/testing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ Playwright MCP および Selenium integration tests で使用する `data-testid
244244
| `classroom-board-reuse-view` | div | 再利用ビュー(全課題を日付降順) |
245245
| `classroom-board-reuse-filter` | select | 再利用ビューのクラスフィルタ |
246246
| `classroom-board-reuse-copy-{classroomId}` | button | このクラスに複製 |
247+
| `classroom-tab-description` | button | 課題詳細の「説明」タブ(デフォルトアクティブ) |
248+
| `classroom-description-editor` | div | 説明タブの課題編集フォーム(埋め込み) |
249+
| `classroom-description-preview` | div | 右ペインの生徒視点プレビュー |
250+
| `classroom-description-preview-body` | div | プレビュー本文(テキスト+画像) |
251+
| `classroom-description-preview-prev` / `-next` | button | プレビューのページ送り |
247252
| `classroom-phase-teacher-group-manage` | div | 組管理フェーズのルート |
248253
| `classroom-group-create-name` / `classroom-group-create-year` | input | 新規組の名前 / 年度 |
249254
| `classroom-group-create-submit` | button | 組をつくる |

packages/scratch-gui/src/components/classroom-modal/classroom-modal.css

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,8 @@
13471347
}
13481348

13491349
.detail-right-pane {
1350-
width: 300px;
1350+
/* Wider now that the sidebar is gone (teacher review round 2) */
1351+
width: 380px;
13511352
flex-shrink: 0;
13521353
border-left: 1px solid #e0e0e0;
13531354
padding-left: 1rem;
@@ -2633,3 +2634,57 @@
26332634
opacity: 0.5;
26342635
cursor: default;
26352636
}
2637+
2638+
/* --- Description tab preview (student view) --- */
2639+
2640+
.assignment-preview {
2641+
display: flex;
2642+
flex-direction: column;
2643+
gap: 0.5rem;
2644+
height: 100%;
2645+
}
2646+
2647+
.assignment-preview-title {
2648+
font-weight: bold;
2649+
font-size: 0.9rem;
2650+
color: hsla(225, 15%, 40%, 1);
2651+
}
2652+
2653+
.assignment-preview-body {
2654+
flex: 1;
2655+
border: 1px solid hsla(0, 0%, 0%, 0.12);
2656+
border-radius: 0.5rem;
2657+
background: white;
2658+
padding: 1rem;
2659+
overflow-y: auto;
2660+
}
2661+
2662+
.assignment-preview-text {
2663+
white-space: pre-wrap;
2664+
margin: 0 0 0.75rem;
2665+
}
2666+
2667+
.assignment-preview-image {
2668+
max-width: 100%;
2669+
border-radius: 0.25rem;
2670+
}
2671+
2672+
.assignment-preview-pager {
2673+
display: flex;
2674+
align-items: center;
2675+
justify-content: center;
2676+
gap: 0.75rem;
2677+
}
2678+
2679+
.assignment-preview-pager button {
2680+
border: 1px solid hsla(0, 0%, 0%, 0.2);
2681+
background: white;
2682+
border-radius: 0.3rem;
2683+
padding: 0.25rem 0.7rem;
2684+
cursor: pointer;
2685+
}
2686+
2687+
.assignment-preview-pager button:disabled {
2688+
opacity: 0.4;
2689+
cursor: default;
2690+
}

packages/scratch-gui/src/components/classroom-modal/teacher-assignment-editor.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ const TeacherAssignmentEditor = ({
185185
starterSource,
186186
onAddPage,
187187
onAttachPageImage,
188+
embedded,
188189
onCancel,
189190
onChangePageText,
190191
onMovePage,
@@ -255,7 +256,11 @@ const TeacherAssignmentEditor = ({
255256
};
256257

257258
return (
258-
<div className={styles.assignmentEditor} data-testid="classroom-phase-teacher-assignment-edit">
259+
<div
260+
className={styles.assignmentEditor}
261+
data-testid={embedded ? 'classroom-description-editor' : 'classroom-phase-teacher-assignment-edit'}
262+
>
263+
{!embedded && (
259264
<h2 className={styles.phaseTitle}>
260265
<FormattedMessage
261266
defaultMessage="Edit Assignment"
@@ -264,6 +269,7 @@ const TeacherAssignmentEditor = ({
264269
/>
265270
{selectedClassroom ? ` — ${selectedClassroom.className}` : ''}
266271
</h2>
272+
)}
267273
<p className={styles.assignmentEditorHint}>
268274
<FormattedMessage
269275
defaultMessage="Students see these pages and the starter project opens automatically when they join with the class code."
@@ -392,6 +398,7 @@ const TeacherAssignmentEditor = ({
392398
</div>
393399

394400
<div className={styles.buttonRow}>
401+
{!embedded && (
395402
<button
396403
className={styles.secondaryButton}
397404
data-testid="classroom-assignment-cancel"
@@ -404,6 +411,7 @@ const TeacherAssignmentEditor = ({
404411
id="gui.classroom.assignmentEditor.cancel"
405412
/>
406413
</button>
414+
)}
407415
<button
408416
className={styles.primaryButton}
409417
data-testid="classroom-assignment-save"
@@ -443,7 +451,8 @@ TeacherAssignmentEditor.propTypes = {
443451
starterSource: PropTypes.object,
444452
onAddPage: PropTypes.func.isRequired,
445453
onAttachPageImage: PropTypes.func.isRequired,
446-
onCancel: PropTypes.func.isRequired,
454+
embedded: PropTypes.bool,
455+
onCancel: PropTypes.func,
447456
onChangePageText: PropTypes.func.isRequired,
448457
onMovePage: PropTypes.func.isRequired,
449458
onRemovePage: PropTypes.func.isRequired,

0 commit comments

Comments
 (0)