Skip to content

Commit

Permalink
Linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Diegogtz03 committed Jun 1, 2024
1 parent 2dd3045 commit 7dd5468
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 258 deletions.
11 changes: 3 additions & 8 deletions knowx/src/app/actions/compare.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"use server"
import { cookies } from "next/headers"
import { getCompares, setCookie } from "../helper/cookies"
import { COMPARES_KEY, COMPARE_DATA_KEY } from "../const/cookies"
import { setCookie } from "../helper/cookies"
import { COMPARES_KEY } from "../const/cookies"
import { Results } from "../interfaces/Phase3"

export async function toggleCompares(keys: Set<string>, results: Results) {
// const compares = getCompares();
console.log("going")
export async function toggleCompares(keys: Set<string>) {
let newCompares = ""
keys.forEach((key) => (newCompares += key + ","))
// console.log(newCompares);
setCookie(COMPARES_KEY, newCompares)
// setCookie(COMPARE_DATA_KEY, JSON.parse(results));
}

// export async function getCompareData
Expand Down
1 change: 0 additions & 1 deletion knowx/src/app/actions/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
getCurrentQuery,
} from "../helper/cookies"
import { getServerSession } from "next-auth"
import { example } from "../dashboard/phase3/ejemplo"
import { Results } from "../interfaces/Phase3"

export async function toggleSearchObject(obj: string) {
Expand Down
2 changes: 1 addition & 1 deletion knowx/src/app/components/AnimatedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const AnimatedText = ({ text }: { text: string }) => {

useEffect(() => {
const handleMouseMove = (e: MouseEvent) => {
lettersRef.current.forEach((letter, index) => {
lettersRef.current.forEach((letter) => {
if (letter) {
const rect = letter.getBoundingClientRect()
const dx = e.clientX - (rect.left + rect.width / 2)
Expand Down
10 changes: 5 additions & 5 deletions knowx/src/app/components/Compare/Compare_Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { ChevronDownIcon } from "@heroicons/react/20/solid"
import { useState } from "react"
import { Results, ServiceCategories } from "@/app/interfaces/Phase3"

interface CardData {
title: string
description: string
[key: string]: string
}
// interface CardData {
// title: string
// description: string
// [key: string]: string
// }

interface CardProps {
initialTitle: string
Expand Down
1 change: 0 additions & 1 deletion knowx/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image"
import UserMenu from "./UserMenu"
import KnowXLogo from "./KnowXLogo"

Expand Down
1 change: 0 additions & 1 deletion knowx/src/app/components/Phase1/P1_ResultsWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client"
import React from "react"
import Image from "next/image"
import { navigateToPhase2 } from "@/app/actions/redirect"
import { Button } from "@nextui-org/react"
import { useState } from "react"
Expand Down
186 changes: 0 additions & 186 deletions knowx/src/app/components/Phase3/P3_ResultsTable copy.tsx

This file was deleted.

73 changes: 25 additions & 48 deletions knowx/src/app/components/Phase3/P3_ResultsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import {
ScrollShadow,
} from "@nextui-org/react"

import {
ChevronDownIcon,
EllipsisVerticalIcon,
} from "@heroicons/react/20/solid"
import { useAsyncList } from "@react-stately/data"
import { ChevronDownIcon } from "@heroicons/react/20/solid"

import { useState, useEffect } from "react"

Expand Down Expand Up @@ -65,10 +61,8 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {

useEffect(() => {
const handleRowUpdate = () => {
toggleCompares(currentRows, results)
console.log("Doing")
toggleCompares(currentRows)
}
// console.log(currentRows);
handleRowUpdate()
}, [currentRows])

Expand All @@ -82,8 +76,6 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {
className="my-5 flex w-[200px] items-center justify-between p-5"
variant="flat"
color="default"
className="flex w-full items-center justify-start "
variant="light"
>
{"Columns"}
<ChevronDownIcon className="h-5 w-5" />
Expand All @@ -97,7 +89,7 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {
onSelectionChange={(keys) => setCurrentColumns(keys as Set<string>)}
>
{checkCategories() != undefined ? (
checkCategories().map((category, index) => {
checkCategories().map((category) => {
return (
<DropdownItem key={category} onClick={() => {}}>
{category}
Expand All @@ -109,9 +101,6 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {
{"No Columns"}
</DropdownItem>
)}
{/* <DropdownItem>
<div className="flex flex-row items-center gap-3"></div>
</DropdownItem> */}
</DropdownMenu>
</Dropdown>
<ScrollShadow hideScrollBar size={5}>
Expand All @@ -120,22 +109,16 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {
selectionMode="multiple"
className="dark:pretty-scrollbar h-full w-[90vw] min-w-[90vw] table-auto overflow-auto rounded-lg dark:dark"
aria-label="search history table"
onSelectionChange={(keys) => {
// setCurrentRows(key);
onSelectionChange={(keys: Set<string>) => {
setCurrentRows(keys as Set<string>)
// console.log("HUH", currentRows);
// console.log(key);
}}
// sortDescriptor={list.sortDescriptor}
// onSortChange={list.sort}
onRowAction={(key) => console.log("HUH?")}
>
<TableHeader key={"Header"} className="h-10">
{checkCategories()
.filter((category, index) => {
.filter((category) => {
return Array.from(currentColumns).includes(category)
})
.map((column, index) => {
.map((column) => {
return <TableColumn key={column}>{column}</TableColumn>
})}
</TableHeader>
Expand All @@ -147,31 +130,25 @@ export const P3_ResultsTable = ({ results }: ResultsTableProps) => {
>
{(item: Service) => (
<TableRow key={item.Name} className="cursor-pointer select-none">
{
// <TableCell className="text-md">{item.Name}</TableCell>
// item.Categories = [...item.Categories, {Name: "Name", Value: item.Name}]
checkItemCategories(item)
.filter((category) => {
console.log(
"FILTERING -> ",
category.Name,
category.Value,
" RESULT ",
Array.from(currentColumns).includes(category.Name),
)
return Array.from(currentColumns).includes(category.Name)
})
.map((category, index) => {
console.log("MAPPING -> ", category.Name, category.Value)
return (
<TableCell key={`${category.Name}-${index} `}>
{category.Value}
</TableCell>
)
})
}
{/* <TableCell>{item.Categories[0].Value}</TableCell>
<TableCell>{item.Categories[1].Value}</TableCell> */}
{checkItemCategories(item)
.filter((category) => {
console.log(
"FILTERING -> ",
category.Name,
category.Value,
" RESULT ",
Array.from(currentColumns).includes(category.Name),
)
return Array.from(currentColumns).includes(category.Name)
})
.map((category, index) => {
console.log("MAPPING -> ", category.Name, category.Value)
return (
<TableCell key={`${category.Name}-${index} `}>
{category.Value}
</TableCell>
)
})}
</TableRow>
)}
</TableBody>
Expand Down
2 changes: 0 additions & 2 deletions knowx/src/app/dashboard/phase3/ejemplo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Name } from "drizzle-orm"

export const example = {
categories: [
"Name",
Expand Down
2 changes: 0 additions & 2 deletions knowx/src/app/dashboard/phase3/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import Header from "../../components/Header"
import P3_ResultsTable from "@/app/components/Phase3/P3_ResultsTable"
import P3_CompareButton from "@/app/components/Phase3/P3_CompareButton"
import { Results } from "@/app/interfaces/Phase3"
import { getFullSearch } from "@/app/actions/search"
import { getAllData } from "@/app/helper/cookies"
// import { example } from "./ejemplo";

export default async function Phase3() {
const allData = getAllData()
Expand Down
Loading

0 comments on commit 7dd5468

Please sign in to comment.