diff --git a/src/core/components/SortableBox.tsx b/src/core/components/SortableBox.tsx index 56ced33e..512c4f51 100644 --- a/src/core/components/SortableBox.tsx +++ b/src/core/components/SortableBox.tsx @@ -1,5 +1,4 @@ -// @ts-nocheck -// dont need size in the second one will fix later +// dont need size in the second one will fix later: set to null to avoid the warning import { SortableContext, @@ -36,6 +35,7 @@ export const SortableProjectBox = ({ boxes }) => { {boxes.map((boxes) => ( { + const Themes = [ + "dark", + "dracula", + "halloween", + "forest", + "luxury", + "business", + "night", + "coffee", + "dim", + "sunset", + ] + + return Themes.includes(theme) ? ( + Staple Logo + ) : ( + Staple Logo + ) +} + // MainNavbar // Always present on the top of the page // Includes non-project specific functionalities @@ -57,33 +81,12 @@ const Navbar = () => { } }, [theme]) - var logo = "" - - if ( - [ - "dark", - "dracula", - "halloween", - "forest", - "luxury", - "business", - "night", - "coffee", - "dim", - "sunset", - ].includes(theme) - ) { - logo = Staple Logo - } else { - logo = Staple Logo - } - // return pages return (
{/* Tabs */} {/* On the left */} -
{logo}
+
{StapleLogo({ theme })}
{/* On the right */}
{/* Templated tabs tab */} diff --git a/src/elements/components/ElementDashboard.tsx b/src/elements/components/ElementDashboard.tsx index 606c92a9..ed97b705 100644 --- a/src/elements/components/ElementDashboard.tsx +++ b/src/elements/components/ElementDashboard.tsx @@ -1,4 +1,3 @@ -// @ts-nocheck // element dashboard assignees issue import { useRouter } from "next/router" @@ -130,7 +129,7 @@ export const PMElement = () => { return task.schema !== null }) if (allAssignments.length > 0) { - const allForms = allAssignments.flatMap((assignment) => assignment.assignees) + const allForms = allAssignments.flatMap((assignment) => assignment["assignees"]) const completedAssignments = allForms.filter( (assignment) => assignment.statusLogs[0].status === "COMPLETED" ) @@ -140,7 +139,8 @@ export const PMElement = () => { } const completedLabels = tasks.filter((task) => { - return task.labels.length > 0 + const l = task.hasOwnProperty("labels") ? task["labels"].length : 0 + return l > 0 }) labelPercent = completedLabels.length / tasks.length } else { @@ -171,7 +171,7 @@ export const PMElement = () => { text={`${Math.round(taskPercent * 100)}%`} styles={buildStyles({ textSize: "16px", - pathTransitionDuration: "none", + pathTransitionDuration: 0, pathColor: "oklch(var(--p))", textColor: "oklch(var(--s))", trailColor: "oklch(var(--pc))", @@ -196,7 +196,7 @@ export const PMElement = () => { text={`${Math.round(formPercent * 100)}%`} styles={buildStyles({ textSize: "16px", - pathTransitionDuration: "none", + pathTransitionDuration: 0, pathColor: "oklch(var(--p))", textColor: "oklch(var(--s))", trailColor: "oklch(var(--pc))", @@ -221,7 +221,7 @@ export const PMElement = () => { text={`${Math.round(labelPercent * 100)}%`} styles={buildStyles({ textSize: "16px", - pathTransitionDuration: "none", + pathTransitionDuration: 0, pathColor: "oklch(var(--p))", textColor: "oklch(var(--s))", trailColor: "oklch(var(--pc))", diff --git a/src/forms/components/FormsTable.tsx b/src/forms/components/FormsTable.tsx index c70aac78..c2ca0ffe 100644 --- a/src/forms/components/FormsTable.tsx +++ b/src/forms/components/FormsTable.tsx @@ -1,13 +1,10 @@ -// @ts-nocheck -// issue with !.title - import React from "react" import { Forms } from "db" - import { createColumnHelper } from "@tanstack/react-table" import Link from "next/link" import { Routes } from "@blitzjs/next" import { JsonFormModal } from "src/core/components/JsonFormModal" +import { getSchemaTitle } from "src/services/getSchemaTitle" // TODO: Is it better to call the database for column name every time or just one time and pass the value to child components? // Column helper @@ -16,7 +13,7 @@ const columnHelper = createColumnHelper() // ColumnDefs export const formsTableColumns = [ columnHelper.accessor("schema", { - cell: (info) => {info.getValue()!.title}, + cell: (info) => {getSchemaTitle(info.getValue())}, header: "Name", }), columnHelper.accessor("updatedAt", { diff --git a/src/forms/components/ProjectFormsTable.tsx b/src/forms/components/ProjectFormsTable.tsx index fb320747..1cef000a 100644 --- a/src/forms/components/ProjectFormsTable.tsx +++ b/src/forms/components/ProjectFormsTable.tsx @@ -1,9 +1,8 @@ -// @ts-nocheck // issue with !.title import Link from "next/link" import { Routes } from "@blitzjs/next" -import { Prisma } from "@prisma/client" +import { Prisma, Task } from "@prisma/client" import Table from "src/core/components/Table" import getTasks from "src/tasks/queries/getTasks" import { createColumnHelper } from "@tanstack/react-table" @@ -11,15 +10,16 @@ import { useRouter } from "next/router" import { usePaginatedQuery } from "@blitzjs/rpc" import { useParam } from "@blitzjs/next" import { useState, useEffect } from "react" +import { getSchemaTitle } from "src/services/getSchemaTitle" -const columnHelper = createColumnHelper() +const columnHelper = createColumnHelper() export const projectFormTableColumns = [ columnHelper.accessor("name", { cell: (info) => {info.getValue()}, header: "Task", }), columnHelper.accessor("schema", { - cell: (info) => {info.getValue() ? info.getValue()!.title : ""}, + cell: (info) => {info.getValue() ? getSchemaTitle(info.getValue()) : ""}, header: "Form Required", }), columnHelper.accessor("id", { @@ -31,9 +31,7 @@ export const projectFormTableColumns = [ className="btn btn-primary" href={Routes.ShowFormPage({ taskId: info.getValue(), - // eslint-disable-next-line react-hooks/exhaustive-deps - // eslint-disable-next-line react-hooks/rules-of-hooks - projectId: useParam("projectId", "number"), + projectId: info.row.original.projectId, })} > View diff --git a/src/forms/mutations/createForm.ts b/src/forms/mutations/createForm.ts index 4586367a..3afd6603 100644 --- a/src/forms/mutations/createForm.ts +++ b/src/forms/mutations/createForm.ts @@ -1,16 +1,15 @@ -// @ts-nocheck -// issue with schema line? import { resolver } from "@blitzjs/rpc" import { CreateFormSchema } from "../schemas" -import db from "db" +import db, { Prisma } from "db" export default resolver.pipe( resolver.zod(CreateFormSchema), resolver.authorize(), async ({ userId, schema, uiSchema }) => { + const newSchema = schema != null ? schema : Prisma.JsonNull const form = await db.forms.create({ data: { - schema, + schema: newSchema, uiSchema, user: { connect: { id: userId }, diff --git a/src/forms/mutations/updateForm.ts b/src/forms/mutations/updateForm.ts index 94aecc27..2dc35f1f 100644 --- a/src/forms/mutations/updateForm.ts +++ b/src/forms/mutations/updateForm.ts @@ -1,15 +1,19 @@ -// @ts-nocheck -// null not assignable to json null - import { resolver } from "@blitzjs/rpc" -import db from "db" +import db, { Prisma } from "db" import { EditFormSchema } from "../schemas" export default resolver.pipe( resolver.zod(EditFormSchema), resolver.authorize(), async ({ id, ...data }) => { - const forms = await db.forms.update({ where: { id }, data }) + const newSchema = data.schema != null ? data.schema : Prisma.JsonNull + const forms = await db.forms.update({ + where: { id }, + data: { + uiSchema: data.uiSchema, + schema: newSchema, + }, + }) return forms } diff --git a/src/labels/components/ContributorsLabelsList.tsx b/src/labels/components/ContributorsLabelsList.tsx index 41ecab0d..28c4dfb9 100644 --- a/src/labels/components/ContributorsLabelsList.tsx +++ b/src/labels/components/ContributorsLabelsList.tsx @@ -1,10 +1,7 @@ -// @ts-nocheck -// issue with label.user - import { useQuery } from "@blitzjs/rpc" import { useRouter } from "next/router" import getLabels from "../queries/getLabels" -import { LabelInformation, labelTableColumnsSimple } from "./LabelTable" +import { LabelInformation } from "./LabelTable" import Table from "src/core/components/Table" export const ContributorLabelsList = ({ usersId, projectId, columns }) => { @@ -26,9 +23,10 @@ export const ContributorLabelsList = ({ usersId, projectId, columns }) => { const description = label.description || "" const taxonomy = label.taxonomy || "" - const userName = label.user.firstName - ? `${label.user.firstName} ${label.user.lastName}` - : label.user.username + const user = label["user"] + const userName = user["firstName"] + ? `${user["firstName"]} ${user["lastName"]}` + : user["username"] let t: LabelInformation = { name: name, @@ -43,12 +41,9 @@ export const ContributorLabelsList = ({ usersId, projectId, columns }) => { return t }) - //console.log(labels) - return (
- {/*

All Contributors

*/} diff --git a/src/labels/components/LabelTable.tsx b/src/labels/components/LabelTable.tsx index 0584dd2a..4a0affa4 100644 --- a/src/labels/components/LabelTable.tsx +++ b/src/labels/components/LabelTable.tsx @@ -1,4 +1,3 @@ -// @ts-nocheck import React, { useState } from "react" import { createColumnHelper } from "@tanstack/react-table" import Modal from "src/core/components/Modal" @@ -19,6 +18,7 @@ export type LabelInformation = { userId: number onChangeCallback?: () => void taxonomyList: string[] + userName?: string } const EditColumn = ({ row }) => { diff --git a/src/messages/hooks/useNotificationTable.tsx b/src/messages/hooks/useNotificationTable.tsx index c24e4c43..ed5c28b4 100644 --- a/src/messages/hooks/useNotificationTable.tsx +++ b/src/messages/hooks/useNotificationTable.tsx @@ -1,11 +1,14 @@ -// @ts-nocheck -import { Notification } from "db" import { createColumnHelper } from "@tanstack/react-table" import ReadToggle from "../components/ReadToggle" -import { useNotification } from "../components/NotificationContext" +import { useNotification, ExtendedNotification } from "../components/NotificationContext" +import { Project } from "db" // Column helper -const columnHelper = createColumnHelper() +const columnHelper = createColumnHelper() + +const getProjectName = (project: Project) => { + return project ? project.name.substring(0, 20) : "N/A" +} // ColumnDefs export const useNotificationTableColumns = () => { @@ -28,7 +31,6 @@ export const useNotificationTableColumns = () => { ), header: "Date", }), - // TODO: Define Notification with extended project because of include columnHelper.accessor("projectId", { id: "projectTitle", header: "Project", diff --git a/src/pages/notifications/index.tsx b/src/pages/notifications/index.tsx index c274b312..26d1e03c 100644 --- a/src/pages/notifications/index.tsx +++ b/src/pages/notifications/index.tsx @@ -8,7 +8,7 @@ import { useNotificationTableColumns } from "src/messages/hooks/useNotificationT const NotificationContent = () => { // Get notifications const { notifications, page, hasMore, goToPreviousPage, goToNextPage } = useNotification() - console.log(notifications) + // console.log(notifications) // Get columns and pass refetch const columns = useNotificationTableColumns() @@ -19,7 +19,7 @@ const NotificationContent = () => {

All Notifications

-
+
+