Skip to content

Commit 5f1517e

Browse files
authored
Merge pull request #121 from STAPLE-verse/remove-tsnocheck-warnings
Remove tsnocheck warnings
2 parents 5a0c8ac + 729fdb1 commit 5f1517e

28 files changed

Lines changed: 121 additions & 128 deletions

File tree

src/core/components/SortableBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// @ts-nocheck
2-
// dont need size in the second one will fix later
1+
// dont need size in the second one will fix later: set to null to avoid the warning
32

43
import {
54
SortableContext,
@@ -36,6 +35,7 @@ export const SortableProjectBox = ({ boxes }) => {
3635
<SortableContext items={boxes} strategy={rectSwappingStrategy}>
3736
{boxes.map((boxes) => (
3837
<Boxes
38+
size={null}
3939
key={boxes.id}
4040
id={boxes.id}
4141
title={boxes.title}

src/core/components/navbar/MainNavbar.tsx

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-nocheck
1+
//
22
// issue with element versus string
33

44
import Link from "next/link"
@@ -13,6 +13,30 @@ import { HomeIcon } from "@heroicons/react/24/outline"
1313
import NotificationsMenu from "src/core/components/NotificationMenu"
1414
import Image from "next/image"
1515

16+
type LogoProps = {
17+
theme: string
18+
}
19+
const StapleLogo = ({ theme }: LogoProps) => {
20+
const Themes = [
21+
"dark",
22+
"dracula",
23+
"halloween",
24+
"forest",
25+
"luxury",
26+
"business",
27+
"night",
28+
"coffee",
29+
"dim",
30+
"sunset",
31+
]
32+
33+
return Themes.includes(theme) ? (
34+
<Image src="/stapler_white.png" width={25} height={25} alt="Staple Logo" />
35+
) : (
36+
<Image src="/stapler_black.png" width={25} height={25} alt="Staple Logo" />
37+
)
38+
}
39+
1640
// MainNavbar
1741
// Always present on the top of the page
1842
// Includes non-project specific functionalities
@@ -57,33 +81,12 @@ const Navbar = () => {
5781
}
5882
}, [theme])
5983

60-
var logo = ""
61-
62-
if (
63-
[
64-
"dark",
65-
"dracula",
66-
"halloween",
67-
"forest",
68-
"luxury",
69-
"business",
70-
"night",
71-
"coffee",
72-
"dim",
73-
"sunset",
74-
].includes(theme)
75-
) {
76-
logo = <Image src="/stapler_white.png" width={25} height={25} alt="Staple Logo" />
77-
} else {
78-
logo = <Image src="/stapler_black.png" width={25} height={25} alt="Staple Logo" />
79-
}
80-
8184
// return pages
8285
return (
8386
<div className="flex-0 navbar bg-base-100 sticky z-[1099] top-0 border-b border-gray-300 sm:px-4 md:px-6 lg:px-8 xl:px-10">
8487
{/* Tabs */}
8588
{/* On the left */}
86-
<div className="flex-1">{logo}</div>
89+
<div className="flex-1">{StapleLogo({ theme })}</div>
8790
{/* On the right */}
8891
<div className="flex space-x-5">
8992
{/* Templated tabs tab */}

src/elements/components/ElementDashboard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-nocheck
21
// element dashboard assignees issue
32

43
import { useRouter } from "next/router"
@@ -130,7 +129,7 @@ export const PMElement = () => {
130129
return task.schema !== null
131130
})
132131
if (allAssignments.length > 0) {
133-
const allForms = allAssignments.flatMap((assignment) => assignment.assignees)
132+
const allForms = allAssignments.flatMap((assignment) => assignment["assignees"])
134133
const completedAssignments = allForms.filter(
135134
(assignment) => assignment.statusLogs[0].status === "COMPLETED"
136135
)
@@ -140,7 +139,8 @@ export const PMElement = () => {
140139
}
141140

142141
const completedLabels = tasks.filter((task) => {
143-
return task.labels.length > 0
142+
const l = task.hasOwnProperty("labels") ? task["labels"].length : 0
143+
return l > 0
144144
})
145145
labelPercent = completedLabels.length / tasks.length
146146
} else {
@@ -171,7 +171,7 @@ export const PMElement = () => {
171171
text={`${Math.round(taskPercent * 100)}%`}
172172
styles={buildStyles({
173173
textSize: "16px",
174-
pathTransitionDuration: "none",
174+
pathTransitionDuration: 0,
175175
pathColor: "oklch(var(--p))",
176176
textColor: "oklch(var(--s))",
177177
trailColor: "oklch(var(--pc))",
@@ -196,7 +196,7 @@ export const PMElement = () => {
196196
text={`${Math.round(formPercent * 100)}%`}
197197
styles={buildStyles({
198198
textSize: "16px",
199-
pathTransitionDuration: "none",
199+
pathTransitionDuration: 0,
200200
pathColor: "oklch(var(--p))",
201201
textColor: "oklch(var(--s))",
202202
trailColor: "oklch(var(--pc))",
@@ -221,7 +221,7 @@ export const PMElement = () => {
221221
text={`${Math.round(labelPercent * 100)}%`}
222222
styles={buildStyles({
223223
textSize: "16px",
224-
pathTransitionDuration: "none",
224+
pathTransitionDuration: 0,
225225
pathColor: "oklch(var(--p))",
226226
textColor: "oklch(var(--s))",
227227
trailColor: "oklch(var(--pc))",

src/forms/components/FormsTable.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// @ts-nocheck
2-
// issue with !.title
3-
41
import React from "react"
52
import { Forms } from "db"
6-
73
import { createColumnHelper } from "@tanstack/react-table"
84
import Link from "next/link"
95
import { Routes } from "@blitzjs/next"
106
import { JsonFormModal } from "src/core/components/JsonFormModal"
7+
import { getSchemaTitle } from "src/services/getSchemaTitle"
118

129
// TODO: Is it better to call the database for column name every time or just one time and pass the value to child components?
1310
// Column helper
@@ -16,7 +13,7 @@ const columnHelper = createColumnHelper<Forms>()
1613
// ColumnDefs
1714
export const formsTableColumns = [
1815
columnHelper.accessor("schema", {
19-
cell: (info) => <span>{info.getValue()!.title}</span>,
16+
cell: (info) => <span>{getSchemaTitle(info.getValue())}</span>,
2017
header: "Name",
2118
}),
2219
columnHelper.accessor("updatedAt", {

src/forms/components/ProjectFormsTable.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
// @ts-nocheck
21
// issue with !.title
32

43
import Link from "next/link"
54
import { Routes } from "@blitzjs/next"
6-
import { Prisma } from "@prisma/client"
5+
import { Prisma, Task } from "@prisma/client"
76
import Table from "src/core/components/Table"
87
import getTasks from "src/tasks/queries/getTasks"
98
import { createColumnHelper } from "@tanstack/react-table"
109
import { useRouter } from "next/router"
1110
import { usePaginatedQuery } from "@blitzjs/rpc"
1211
import { useParam } from "@blitzjs/next"
1312
import { useState, useEffect } from "react"
13+
import { getSchemaTitle } from "src/services/getSchemaTitle"
1414

15-
const columnHelper = createColumnHelper<Forms>()
15+
const columnHelper = createColumnHelper<Task>()
1616
export const projectFormTableColumns = [
1717
columnHelper.accessor("name", {
1818
cell: (info) => <span>{info.getValue()}</span>,
1919
header: "Task",
2020
}),
2121
columnHelper.accessor("schema", {
22-
cell: (info) => <span> {info.getValue() ? info.getValue()!.title : ""}</span>,
22+
cell: (info) => <span> {info.getValue() ? getSchemaTitle(info.getValue()) : ""}</span>,
2323
header: "Form Required",
2424
}),
2525
columnHelper.accessor("id", {
@@ -31,9 +31,7 @@ export const projectFormTableColumns = [
3131
className="btn btn-primary"
3232
href={Routes.ShowFormPage({
3333
taskId: info.getValue(),
34-
// eslint-disable-next-line react-hooks/exhaustive-deps
35-
// eslint-disable-next-line react-hooks/rules-of-hooks
36-
projectId: useParam("projectId", "number"),
34+
projectId: info.row.original.projectId,
3735
})}
3836
>
3937
View

src/forms/mutations/createForm.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
// @ts-nocheck
2-
// issue with schema line?
31
import { resolver } from "@blitzjs/rpc"
42
import { CreateFormSchema } from "../schemas"
5-
import db from "db"
3+
import db, { Prisma } from "db"
64

75
export default resolver.pipe(
86
resolver.zod(CreateFormSchema),
97
resolver.authorize(),
108
async ({ userId, schema, uiSchema }) => {
9+
const newSchema = schema != null ? schema : Prisma.JsonNull
1110
const form = await db.forms.create({
1211
data: {
13-
schema,
12+
schema: newSchema,
1413
uiSchema,
1514
user: {
1615
connect: { id: userId },

src/forms/mutations/updateForm.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
// @ts-nocheck
2-
// null not assignable to json null
3-
41
import { resolver } from "@blitzjs/rpc"
5-
import db from "db"
2+
import db, { Prisma } from "db"
63
import { EditFormSchema } from "../schemas"
74

85
export default resolver.pipe(
96
resolver.zod(EditFormSchema),
107
resolver.authorize(),
118
async ({ id, ...data }) => {
12-
const forms = await db.forms.update({ where: { id }, data })
9+
const newSchema = data.schema != null ? data.schema : Prisma.JsonNull
10+
const forms = await db.forms.update({
11+
where: { id },
12+
data: {
13+
uiSchema: data.uiSchema,
14+
schema: newSchema,
15+
},
16+
})
1317

1418
return forms
1519
}

src/labels/components/ContributorsLabelsList.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
// @ts-nocheck
2-
// issue with label.user
3-
41
import { useQuery } from "@blitzjs/rpc"
52
import { useRouter } from "next/router"
63
import getLabels from "../queries/getLabels"
7-
import { LabelInformation, labelTableColumnsSimple } from "./LabelTable"
4+
import { LabelInformation } from "./LabelTable"
85
import Table from "src/core/components/Table"
96

107
export const ContributorLabelsList = ({ usersId, projectId, columns }) => {
@@ -26,9 +23,10 @@ export const ContributorLabelsList = ({ usersId, projectId, columns }) => {
2623
const description = label.description || ""
2724
const taxonomy = label.taxonomy || ""
2825

29-
const userName = label.user.firstName
30-
? `${label.user.firstName} ${label.user.lastName}`
31-
: label.user.username
26+
const user = label["user"]
27+
const userName = user["firstName"]
28+
? `${user["firstName"]} ${user["lastName"]}`
29+
: user["username"]
3230

3331
let t: LabelInformation = {
3432
name: name,
@@ -43,12 +41,9 @@ export const ContributorLabelsList = ({ usersId, projectId, columns }) => {
4341
return t
4442
})
4543

46-
//console.log(labels)
47-
4844
return (
4945
<div>
5046
<main className="flex flex-col mt-2 mx-auto w-full max-w-7xl">
51-
{/* <h1 className="flex justify-center mb-2">All Contributors</h1> */}
5247
<Table columns={columns} data={contributorLabelInformation} />
5348
</main>
5449
</div>

src/labels/components/LabelTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-nocheck
21
import React, { useState } from "react"
32
import { createColumnHelper } from "@tanstack/react-table"
43
import Modal from "src/core/components/Modal"
@@ -19,6 +18,7 @@ export type LabelInformation = {
1918
userId: number
2019
onChangeCallback?: () => void
2120
taxonomyList: string[]
21+
userName?: string
2222
}
2323

2424
const EditColumn = ({ row }) => {

src/messages/hooks/useNotificationTable.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
// @ts-nocheck
2-
import { Notification } from "db"
31
import { createColumnHelper } from "@tanstack/react-table"
42
import ReadToggle from "../components/ReadToggle"
5-
import { useNotification } from "../components/NotificationContext"
3+
import { useNotification, ExtendedNotification } from "../components/NotificationContext"
4+
import { Project } from "db"
65

76
// Column helper
8-
const columnHelper = createColumnHelper<Notification>()
7+
const columnHelper = createColumnHelper<ExtendedNotification>()
8+
9+
const getProjectName = (project: Project) => {
10+
return project ? project.name.substring(0, 20) : "N/A"
11+
}
912

1013
// ColumnDefs
1114
export const useNotificationTableColumns = () => {
@@ -28,7 +31,6 @@ export const useNotificationTableColumns = () => {
2831
),
2932
header: "Date",
3033
}),
31-
// TODO: Define Notification with extended project because of include
3234
columnHelper.accessor("projectId", {
3335
id: "projectTitle",
3436
header: "Project",

0 commit comments

Comments
 (0)