Skip to content

Commit 2583b66

Browse files
committed
ロード時のpreviewの修正
1 parent 0bf5977 commit 2583b66

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `isColorful` to the `Board` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "Board" ADD COLUMN "isColorful" BOOLEAN NOT NULL;

src/lib/api/board.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type BoardListItem = {
3737
name: string;
3838
createdAt: string;
3939
preview: number[][];
40+
isColorful: boolean;
4041
};
4142

4243
export async function fetchBoardList(isJapanese: boolean): Promise<BoardListItem[] | undefined> {

src/lib/components/BoardModals.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
selectedBoardId = null;
3030
}
3131
32-
function getCellColor(cell: number): string {
32+
function getCellColor(cell: number, isColorful: boolean): string {
3333
const WHITE = 0xffffff;
3434
3535
if (isColorful) {
@@ -71,7 +71,10 @@
7171
{#each manager.saveState.preview as row, i (i)}
7272
<div class="preview-row">
7373
{#each row as cell, j (j)}
74-
<div class="preview-cell" style="background-color: {getCellColor(cell)}"></div>
74+
<div
75+
class="preview-cell"
76+
style="background-color: {getCellColor(cell, isColorful)}"
77+
></div>
7578
{/each}
7679
</div>
7780
{/each}
@@ -129,7 +132,7 @@
129132
{#each row as cell, j (j)}
130133
<div
131134
class="preview-cell"
132-
style="background-color: {getCellColor(cell)}"
135+
style="background-color: {getCellColor(cell, item.isColorful)}"
133136
></div>
134137
{/each}
135138
</div>

src/routes/api/board/+server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export async function GET({ url }) {
7272
name: true,
7373
createdAt: true,
7474
preview: true,
75+
isColorful: true,
7576
},
7677
});
7778

0 commit comments

Comments
 (0)