Skip to content

Commit 4e24c00

Browse files
authored
Merge pull request #1298 from AtCoder-NoviSteps/#1293
💥 Remove grade from workbook list for solution (#1293)
2 parents 4879805 + b96d7cf commit 4e24c00

File tree

3 files changed

+65
-31
lines changed

3 files changed

+65
-31
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts">
2+
import { TableBodyCell } from 'flowbite-svelte';
3+
4+
import type { WorkbookList } from '$lib/types/workbook';
5+
import PublicationStatusLabel from '$lib/components/WorkBooks/PublicationStatusLabel.svelte';
6+
7+
export let paddingLeft: string = 'pl-2 xs:pl-4';
8+
export let workbook: WorkbookList;
9+
</script>
10+
11+
<TableBodyCell class="w-2/5 {paddingLeft} pr-4">
12+
<div
13+
class="flex items-center space-x-2 truncate min-w-[240px] max-w-[240px] lg:max-w-[300px] xl:max-w-[380px] 2xl:max-w-[480px]"
14+
>
15+
<PublicationStatusLabel isPublished={workbook.isPublished} />
16+
<a
17+
href="/workbooks/{workbook.id}"
18+
class="flex-1 font-medium xs:text-lg text-primary-600 hover:underline dark:text-primary-500 truncate"
19+
aria-labelledby="View details for workbook: {workbook.title}"
20+
>
21+
{workbook.title}
22+
</a>
23+
</div>
24+
</TableBodyCell>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script lang="ts">
2+
import { TableHeadCell } from 'flowbite-svelte';
3+
4+
export let paddingX: string = 'px-1 xs:px-3';
5+
</script>
6+
7+
<TableHeadCell
8+
class="text-left min-w-[240px] max-w-[240px] lg:max-w-[280px] xl:max-w-[360px] 2xl:max-w-[480px] {paddingX}"
9+
>
10+
タイトル
11+
</TableHeadCell>

src/lib/components/WorkBooks/WorkBookBaseTable.svelte

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
import { TaskGrade, type TaskResults } from '$lib/types/task';
1515
import type { Roles } from '$lib/types/user';
1616
17+
import TitleTableHeadCell from '$lib/components/WorkBooks/TitleTableHeadCell.svelte';
18+
import TitleTableBodyCell from '$lib/components/WorkBooks/TitleTableBodyCell.svelte';
1719
import GradeLabel from '$lib/components/GradeLabel.svelte';
18-
import PublicationStatusLabel from '$lib/components/WorkBooks/PublicationStatusLabel.svelte';
1920
import CompletedTasks from '$lib/components/Trophies/CompletedTasks.svelte';
2021
import ThermometerProgressBar from '$lib/components/ThermometerProgressBar.svelte';
2122
import AcceptedCounter from '$lib/components/SubmissionStatus/AcceptedCounter.svelte';
@@ -38,23 +39,22 @@
3839
}
3940
</script>
4041

41-
<!-- HACK: 2024年8月時点では「ユーザ作成」の問題集のみ大きく仕様が異なるので、暫定的に条件分岐で対処 -->
42-
<!-- HACK: 「解説別」と含めて仕様が大幅に変更される可能性が高いので、保留にしている -->
42+
<!-- HACK: (2024年9月時点) 問題集の仕様が大きく異なるので、暫定的に条件分岐で対処 -->
4343
<div class="overflow-auto rounded-md border">
4444
<Table shadow class="text-md">
4545
<TableHead class="text-sm bg-gray-100">
46-
{#if workbookType === WorkBookType.CREATED_BY_USER}
47-
<TableHeadCell>作者</TableHeadCell>
48-
{:else}
46+
{#if workbookType === WorkBookType.CURRICULUM}
4947
<TableHeadCell class="text-center px-0">
5048
<div>グレード</div>
5149
</TableHeadCell>
50+
<TitleTableHeadCell />
51+
{:else if workbookType === WorkBookType.SOLUTION}
52+
<TitleTableHeadCell paddingX="px-4" />
53+
{:else if workbookType === WorkBookType.CREATED_BY_USER}
54+
<TableHeadCell>作者</TableHeadCell>
55+
<TitleTableHeadCell />
5256
{/if}
53-
<TableHeadCell
54-
class="text-left min-w-[240px] max-w-[240px] lg:max-w-[280px] xl:max-w-[360px] 2xl:max-w-[480px] px-1 xs:px-3"
55-
>
56-
タイトル
57-
</TableHeadCell>
57+
5858
<TableHeadCell class="ext-left min-w-[240px] max-w-[1440px] px-0">回答状況</TableHeadCell>
5959
<TableHeadCell></TableHeadCell>
6060
<TableHeadCell class="text-center px-0">修了</TableHeadCell>
@@ -65,32 +65,31 @@
6565
{#each workbooks as workbook}
6666
{#if canRead(workbook.isPublished, userId, workbook.authorId)}
6767
<TableBodyRow>
68-
{#if workbookType === WorkBookType.CREATED_BY_USER}
68+
{#if workbookType === WorkBookType.CURRICULUM}
69+
<!-- グレード -->
70+
<TableBodyCell class="justify-center w-14 px-4">
71+
<div class="flex items-center justify-center min-w-[54px] max-w-[54px]">
72+
<GradeLabel taskGrade={getGradeMode(workbook.id)} />
73+
</div>
74+
</TableBodyCell>
75+
76+
<!-- タイトル -->
77+
<TitleTableBodyCell {workbook} />
78+
{:else if workbookType === WorkBookType.SOLUTION}
79+
<!-- タイトル -->
80+
<TitleTableBodyCell paddingLeft="pl-4" {workbook} />
81+
{:else if workbookType === WorkBookType.CREATED_BY_USER}
82+
<!-- 作者名 -->
6983
<TableBodyCell>
7084
<div class="truncate min-w-[96px] max-w-[120px]">
7185
{workbook.authorName}
7286
</div>
7387
</TableBodyCell>
74-
{:else}
75-
<TableBodyCell class="justify-center w-14 px-2">
76-
<div class="flex items-center justify-center min-w-[54px] max-w-[54px]">
77-
<GradeLabel taskGrade={getGradeMode(workbook.id)} />
78-
</div>
79-
</TableBodyCell>
88+
89+
<!-- タイトル -->
90+
<TitleTableBodyCell {workbook} />
8091
{/if}
81-
<TableBodyCell class="w-2/5 pl-2 xs:pl-4 pr-4">
82-
<div
83-
class="flex items-center space-x-2 truncate min-w-[240px] max-w-[240px] lg:max-w-[300px] xl:max-w-[380px] 2xl:max-w-[480px]"
84-
>
85-
<PublicationStatusLabel isPublished={workbook.isPublished} />
86-
<a
87-
href="/workbooks/{workbook.id}"
88-
class="flex-1 font-medium xs:text-lg text-primary-600 hover:underline dark:text-primary-500 truncate"
89-
>
90-
{workbook.title}
91-
</a>
92-
</div>
93-
</TableBodyCell>
92+
9493
<TableBodyCell class="min-w-[240px] max-w-[1440px] px-0">
9594
<ThermometerProgressBar
9695
workBookTasks={workbook.workBookTasks}

0 commit comments

Comments
 (0)