chore: clean up type errors and warnings
This commit is contained in:
120
package-lock.json
generated
120
package-lock.json
generated
@@ -10124,6 +10124,126 @@
|
||||
"@react-email/components": "0.0.12",
|
||||
"react-email": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-x64": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.4.tgz",
|
||||
"integrity": "sha512-b0Xo1ELj3u7IkZWAKcJPJEhBop117U78l70nfoQGo4xUSvv0PJSTaV4U9xQBLvZlnjsYkc8RwQN1HoH/oQmLlQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.4.tgz",
|
||||
"integrity": "sha512-457G0hcLrdYA/u1O2XkRMsDKId5VKe3uKPvrKVOyuARa6nXrdhJOOYU9hkKKyQTMru1B8qEP78IAhf/1XnVqKA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-musl": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.4.tgz",
|
||||
"integrity": "sha512-l/kMG+z6MB+fKA9KdtyprkTQ1ihlJcBh66cf0HvqGP+rXBbOXX0dpJatjZbHeunvEHoBBS69GYQG5ry78JMy3g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-gnu": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.4.tgz",
|
||||
"integrity": "sha512-BapIFZ3ZRnvQ1uWbmqEGJuPT9cgLwvKtxhK/L2t4QYO7l+/DxXuIGjvp1x8rvfa/x1FFSsipERZK70pewbtJtw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-musl": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.4.tgz",
|
||||
"integrity": "sha512-mqVxTwk4XuBl49qn2A5UmzFImoL1iLm0KQQwtdRJRKl21ylQwwGCxJtIYo2rbfkZHoSKlh/YgztY0qH3wG1xIg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.4.tgz",
|
||||
"integrity": "sha512-xzxF4ErcumXjO2Pvg/wVGrtr9QQJLk3IyQX1ddAC/fi6/5jZCZ9xpuL9Tzc4KPWMFq8GGWFVDMshZOdHGdkvag==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-ia32-msvc": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.4.tgz",
|
||||
"integrity": "sha512-WZiz8OdbkpRw6/IU/lredZWKKZopUMhcI2F+XiMAcPja0uZYdMTZQRoQ0WZcvinn9xZAidimE7tN9W5v9Yyfyw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-x64-msvc": {
|
||||
"version": "14.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.4.tgz",
|
||||
"integrity": "sha512-4Rto21sPfw555sZ/XNLqfxDUNeLhNYGO2dlPqsnuCg8N8a2a9u1ltqBOPQ4vj1Gf7eJC0W2hHG2eYUHuiXgY2w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import React, {
|
||||
import { api } from "~/utils/api";
|
||||
|
||||
import {
|
||||
GetBoardByIdOutput,
|
||||
ReorderCardInput,
|
||||
ReorderListInput,
|
||||
type GetBoardByIdOutput,
|
||||
type ReorderCardInput,
|
||||
type ReorderListInput,
|
||||
} from "~/types/router.types";
|
||||
|
||||
interface BoardContextProps {
|
||||
@@ -40,29 +40,22 @@ export const BoardProvider: React.FC<{ children: ReactNode }> = ({
|
||||
const [boardData, setBoardData] =
|
||||
useState<GetBoardByIdOutput>(initialBoardData);
|
||||
|
||||
const refetchBoard = () => {
|
||||
if (boardData?.publicId)
|
||||
utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
const refetchBoard = async () => {
|
||||
if (boardData?.publicId) {
|
||||
try {
|
||||
await utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const updateCardMutation = api.card.reorder.useMutation({
|
||||
onSuccess: async () => {
|
||||
try {
|
||||
await refetchBoard();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
onSuccess: () => refetchBoard(),
|
||||
});
|
||||
|
||||
const updateListMutation = api.list.reorder.useMutation({
|
||||
onSuccess: async () => {
|
||||
try {
|
||||
await refetchBoard();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
onSuccess: () => refetchBoard(),
|
||||
});
|
||||
|
||||
const updateList = ({
|
||||
|
||||
@@ -195,7 +195,7 @@ export const cardRouter = createTRPCRouter({
|
||||
input.cardPublicId,
|
||||
);
|
||||
|
||||
if (!card || !card?.list?.id) return;
|
||||
if (!card ?? !card?.list?.id) return;
|
||||
|
||||
const deletedAt = new Date().toISOString();
|
||||
|
||||
|
||||
@@ -105,5 +105,7 @@ export const listRouter = createTRPCRouter({
|
||||
{ name: input.name },
|
||||
{ listPublicId: input.listPublicId },
|
||||
);
|
||||
|
||||
return result;
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { z } from "zod";
|
||||
import { generateUID } from "~/utils/generateUID";
|
||||
|
||||
import { createTRPCRouter, protectedProcedure } from "~/server/api/trpc";
|
||||
import * as workspaceRepo from "~/server/db/repository/workspace.repo";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RouterInputs, type RouterOutputs } from "~/utils/api";
|
||||
import { type RouterInputs, type RouterOutputs } from "~/utils/api";
|
||||
|
||||
export type GetBoardByIdOutput = RouterOutputs["board"]["byId"];
|
||||
export type ReorderListInput = RouterInputs["list"]["reorder"];
|
||||
|
||||
@@ -13,15 +13,20 @@ export function DeleteListConfirmation({
|
||||
const { boardData } = useBoard();
|
||||
const { closeModal } = useModal();
|
||||
|
||||
const refetchBoard = () => {
|
||||
if (boardData?.publicId)
|
||||
utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
const refetchBoard = async () => {
|
||||
if (boardData?.publicId) {
|
||||
try {
|
||||
await utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const deleteList = api.list.delete.useMutation({
|
||||
onSuccess: async () => {
|
||||
onSuccess: () => {
|
||||
closeModal();
|
||||
await refetchBoard();
|
||||
return refetchBoard();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import CheckboxDropdown from "~/components/CheckboxDropdown";
|
||||
import { useBoard } from "~/providers/board";
|
||||
import { useModal } from "~/providers/modal";
|
||||
|
||||
import { NewCardInput } from "~/types/router.types";
|
||||
import { type NewCardInput } from "~/types/router.types";
|
||||
|
||||
type NewCardFormInput = NewCardInput & {
|
||||
isCreateAnotherEnabled: boolean;
|
||||
@@ -43,9 +43,14 @@ export function NewCardForm({ listPublicId }: NewCardFormProps) {
|
||||
const memberPublicIds = watch("memberPublicIds") || [];
|
||||
const isCreateAnotherEnabled = watch("isCreateAnotherEnabled");
|
||||
|
||||
const refetchBoard = () => {
|
||||
if (boardData?.publicId)
|
||||
utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
const refetchBoard = async () => {
|
||||
if (boardData?.publicId) {
|
||||
try {
|
||||
await utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const createCard = api.card.create.useMutation({
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Switch } from "@headlessui/react";
|
||||
import { useBoard } from "~/providers/board";
|
||||
import { useModal } from "~/providers/modal";
|
||||
|
||||
import { NewListInput } from "~/types/router.types";
|
||||
import { type NewListInput } from "~/types/router.types";
|
||||
|
||||
import { Formik, Form, Field } from "formik";
|
||||
|
||||
@@ -21,16 +21,21 @@ export function NewListForm({ boardPublicId }: { boardPublicId: string }) {
|
||||
const { closeModal } = useModal();
|
||||
const [isCreateAnotherEnabled, setIsCreateAnotherEnabled] = useState(false);
|
||||
|
||||
const refetchBoard = () => {
|
||||
if (boardData?.publicId)
|
||||
utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
const refetchBoard = async () => {
|
||||
if (boardData?.publicId) {
|
||||
try {
|
||||
await utils.board.byId.refetch({ boardPublicId: boardData.publicId });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const createList = api.list.create.useMutation({
|
||||
onSuccess: async () => {
|
||||
onSuccess: () => {
|
||||
try {
|
||||
await refetchBoard();
|
||||
if (!isCreateAnotherEnabled) closeModal();
|
||||
return refetchBoard();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import { NewWorkspaceForm } from "~/components/NewWorkspaceForm";
|
||||
import { NewCardForm } from "./components/NewCardForm";
|
||||
import { NewListForm } from "./components/NewListForm";
|
||||
|
||||
import { UpdateBoardInput } from "~/types/router.types";
|
||||
import { type UpdateBoardInput } from "~/types/router.types";
|
||||
|
||||
type PublicListId = string;
|
||||
|
||||
@@ -228,7 +228,7 @@ export default function BoardPage() {
|
||||
>
|
||||
<svg
|
||||
fill={
|
||||
label.colourCode || undefined
|
||||
label.colourCode ?? undefined
|
||||
}
|
||||
className="h-2 w-2"
|
||||
viewBox="0 0 6 6"
|
||||
@@ -246,15 +246,14 @@ export default function BoardPage() {
|
||||
className="inline-flex h-6 w-6 items-center justify-center rounded-full bg-light-900 ring-2 ring-light-50 dark:bg-gray-500 dark:ring-dark-500"
|
||||
>
|
||||
<span className="text-[10px] font-medium leading-none text-white">
|
||||
{member?.user?.name &&
|
||||
member.user.name
|
||||
.split(" ")
|
||||
.map((namePart) =>
|
||||
namePart
|
||||
.charAt(0)
|
||||
.toUpperCase(),
|
||||
)
|
||||
.join("")}
|
||||
{member?.user?.name
|
||||
?.split(" ")
|
||||
.map((namePart) =>
|
||||
namePart
|
||||
.charAt(0)
|
||||
.toUpperCase(),
|
||||
)
|
||||
.join("")}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useWorkspace } from "~/providers/workspace";
|
||||
|
||||
import { Formik, Form, Field } from "formik";
|
||||
|
||||
import { NewBoardInput } from "~/types/router.types";
|
||||
import { type NewBoardInput } from "~/types/router.types";
|
||||
|
||||
export function NewBoardForm() {
|
||||
const utils = api.useUtils();
|
||||
|
||||
Reference in New Issue
Block a user