Skip to content

Commit 224197f

Browse files
committed
v1.88
- Filtrando tarefas por qual começa primeiro; - Filtrando categorias por ordem alfabética
1 parent 7a30ff2 commit 224197f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/app/semana/dia/[dia]/components/Categorias/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default async function Categorias({ params }: { params: number }) {
1616
email: session?.user?.email,
1717
},
1818
},
19-
})) as CategoriaType[];
19+
})).sort((a,b) => a.title.localeCompare(b.title)) as CategoriaType[];
2020
}
2121

2222
let categories: CategoriaType[] = await getCategories();

src/app/semana/dia/[dia]/components/Tarefas/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { getServerSession } from "next-auth";
55
import Header from "./components/Header";
66
import TarefasGrid from "./components/TarefasGrid";
77
import { ModalTaskProvider } from "./providers/modalTaskProvider";
8+
import { hourToTime } from "@/utils/hourToTime";
89

910
export default async function Tarefas({ params }: { params: number }) {
1011
const session = await getServerSession(authOptions);
1112

1213
async function getTasks() {
13-
return await prisma.task.findMany({
14+
let tarefas = await prisma.task.findMany({
1415
where: {
1516
day: params,
1617
User: {
@@ -21,6 +22,8 @@ export default async function Tarefas({ params }: { params: number }) {
2122
Categorie: true
2223
}
2324
}) as TarefaType[]
25+
let newTarefas = tarefas.sort((a,b) => hourToTime({time: a.primeira_hora})-hourToTime({time: b.primeira_hora}))
26+
return newTarefas
2427
}
2528

2629
let tarefas: TarefaType[] = await getTasks();

0 commit comments

Comments
 (0)