Skip to content

Commit 782e802

Browse files
committed
yooooooo
1 parent a3616ae commit 782e802

File tree

20 files changed

+585
-357
lines changed

20 files changed

+585
-357
lines changed

app/fake-data.ts

-42
This file was deleted.

app/http/bad-response.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export function notFound() {
2+
return new Response("Not Found", { status: 404, statusText: "Not Found" });
3+
}
4+
5+
export function badRequest(body: string) {
6+
return new Response(body, {
7+
status: 400,
8+
statusText: "Bad Request",
9+
});
10+
}

app/root.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ export default function App() {
1515
<meta charSet="utf-8" />
1616
<meta name="viewport" content="width=device-width, initial-scale=1" />
1717

18+
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
1819
<link rel="stylesheet" href={stylesHref} />
1920
<Meta />
2021
<Links />
2122
</head>
2223
<body className="h-screen overflow-hidden">
23-
<div className="h-full flex flex-col">
24-
<div className="bg-gray-800">
24+
<div className="h-full flex flex-col min-h-0">
25+
<div className="bg-stone-800">
2526
<img
2627
2728
alt="Remix Logo: Colorful letters glowing on a dark background"
28-
className="h-16 p-2"
29+
className="h-16 py-2 px-8"
2930
/>
3031
</div>
3132

32-
<div className="flex-grow min-h-0">
33+
<div className="flex-grow min-h-0 h-full">
3334
<Outlet />
3435
</div>
3536
</div>

app/routes/board/icons.svg renamed to app/routes/board.$id/icons.svg

+28-1
Loading

app/routes/board.$id/icons.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import iconsHref from "./icons.svg";
2+
3+
export function Icon({
4+
name,
5+
size = "md",
6+
spin = false,
7+
}: {
8+
name: string;
9+
size?: "md" | "xl";
10+
spin?: boolean;
11+
}) {
12+
let classNames = {
13+
md: "w-4 h-4",
14+
xl: "w-8 h-8",
15+
};
16+
return (
17+
<svg
18+
className={`${classNames[size]} inline self-center ${
19+
spin ? "animate-spin" : ""
20+
}`}
21+
>
22+
<use href={`${iconsHref}#${name}`} />
23+
</svg>
24+
);
25+
}

app/routes/board.$id/query.ts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { prisma } from "../../db/prisma";
2+
3+
export async function createItem(columnId: number, title: string) {
4+
let itemCountForColumn = await prisma.item.count({ where: { columnId } });
5+
return prisma.item.create({
6+
data: {
7+
title,
8+
columnId,
9+
order: itemCountForColumn + 1,
10+
},
11+
});
12+
}
13+
14+
export async function updateColumnName(id: number, name: string) {
15+
return prisma.column.update({
16+
where: { id },
17+
data: { name },
18+
});
19+
}
20+
21+
export async function createEmptyColumn(boardId: number) {
22+
let columnCount = await prisma.column.count({ where: { boardId } });
23+
return prisma.column.create({
24+
data: {
25+
name: "",
26+
boardId,
27+
order: columnCount + 1,
28+
},
29+
});
30+
}
31+
32+
export async function getBoardData(boardId: number) {
33+
return prisma.board.findUnique({
34+
where: {
35+
id: boardId,
36+
},
37+
include: {
38+
columns: {
39+
include: {
40+
items: {
41+
orderBy: {
42+
order: "asc",
43+
},
44+
},
45+
},
46+
orderBy: {
47+
order: "asc",
48+
},
49+
},
50+
},
51+
});
52+
}

0 commit comments

Comments
 (0)