From c5ba3b9a00d3d4a82765760f0b79a9188e0197ee Mon Sep 17 00:00:00 2001 From: Takeshi Kimata <117462761+kimatata@users.noreply.github.com> Date: Sun, 19 May 2024 21:06:49 +0900 Subject: [PATCH] Introduce prettier --- frontend/components/counter.tsx | 6 +- frontend/components/icons.tsx | 90 ++----------- frontend/components/theme-switch.tsx | 70 ++++------ frontend/src/app/[locale]/DropdownAccount.tsx | 65 +++------ .../src/app/[locale]/DropdownLanguage.tsx | 37 ++---- frontend/src/app/[locale]/Header.tsx | 69 ++++------ frontend/src/app/[locale]/PaneDemoImages.tsx | 36 +++-- .../src/app/[locale]/PaneMainFeatures.tsx | 33 ++--- frontend/src/app/[locale]/PaneMainTitle.tsx | 43 +++--- frontend/src/app/[locale]/TokenProvider.tsx | 22 ++-- .../src/app/[locale]/account/AccountPage.tsx | 23 +--- .../src/app/[locale]/account/authPage.tsx | 76 +++++------ frontend/src/app/[locale]/account/layout.tsx | 6 +- frontend/src/app/[locale]/account/page.tsx | 8 +- .../src/app/[locale]/account/signin/page.tsx | 36 ++--- .../src/app/[locale]/account/signup/page.tsx | 36 ++--- frontend/src/app/[locale]/error.tsx | 12 +- frontend/src/app/[locale]/layout.tsx | 36 ++--- frontend/src/app/[locale]/page.tsx | 42 +++--- .../app/[locale]/projects/ProjectDialog.tsx | 55 +++----- .../app/[locale]/projects/ProjectsPage.tsx | 46 ++----- .../app/[locale]/projects/ProjectsTable.tsx | 87 +++++-------- .../[locale]/projects/[projectId]/Sidebar.tsx | 42 +++--- .../[projectId]/folders/FolderDialog.tsx | 55 +++----- .../[projectId]/folders/FolderEditMenu.tsx | 26 +--- .../[projectId]/folders/FoldersPane.tsx | 65 +++------ .../folders/[folderId]/cases/CasesPane.tsx | 19 +-- .../[folderId]/cases/TestCaseTable.tsx | 84 +++++------- .../cases/[caseId]/CaseAttachmentsEditor.tsx | 21 +-- .../[folderId]/cases/[caseId]/CaseEditor.tsx | 111 +++++----------- .../cases/[caseId]/CaseStepsEditor.tsx | 14 +- .../[folderId]/cases/[caseId]/page.tsx | 96 +++++++------- .../folders/[folderId]/cases/page.tsx | 47 +++---- .../projects/[projectId]/folders/layout.tsx | 32 ++--- .../projects/[projectId]/folders/page.tsx | 8 +- .../home/TestPriorityDonutChart.tsx | 36 ++--- .../home/TestProgressColumnChart.tsx | 40 ++---- .../[projectId]/home/TestTypesDonutChart.tsx | 36 ++--- .../projects/[projectId]/home/home.tsx | 99 +++++--------- .../projects/[projectId]/home/page.tsx | 64 ++++----- .../[locale]/projects/[projectId]/layout.tsx | 12 +- .../projects/[projectId]/runs/RunsPage.tsx | 35 ++--- .../projects/[projectId]/runs/RunsTable.tsx | 83 +++++------- .../[projectId]/runs/[runId]/RunEditor.tsx | 123 ++++++------------ .../runs/[runId]/RunPregressDonutChart.tsx | 34 ++--- .../runs/[runId]/TestCaseSelector.tsx | 92 ++++++------- .../[projectId]/runs/[runId]/page.tsx | 85 ++++++------ .../projects/[projectId]/runs/page.tsx | 36 ++--- frontend/src/app/[locale]/projects/layout.tsx | 6 +- frontend/src/app/[locale]/projects/page.tsx | 40 +++--- frontend/src/app/[locale]/providers.tsx | 16 +-- package.json | 2 +- 52 files changed, 884 insertions(+), 1509 deletions(-) diff --git a/frontend/components/counter.tsx b/frontend/components/counter.tsx index d16f862..b92ffdd 100644 --- a/frontend/components/counter.tsx +++ b/frontend/components/counter.tsx @@ -1,7 +1,7 @@ -"use client"; +'use client'; -import { useState } from "react"; -import { Button } from "@nextui-org/button"; +import { useState } from 'react'; +import { Button } from '@nextui-org/button'; export const Counter = () => { const [count, setCount] = useState(0); diff --git a/frontend/components/icons.tsx b/frontend/components/icons.tsx index 4813931..a854ccb 100644 --- a/frontend/components/icons.tsx +++ b/frontend/components/icons.tsx @@ -1,19 +1,8 @@ -import * as React from "react"; -import { IconSvgProps } from "@/types"; +import * as React from 'react'; +import { IconSvgProps } from '@/types'; -export const Logo: React.FC = ({ - size = 36, - width, - height, - ...props -}) => ( - +export const Logo: React.FC = ({ size = 36, width, height, ...props }) => ( + = ({ ); -export const DiscordIcon: React.FC = ({ - size = 24, - width, - height, - ...props -}) => { +export const DiscordIcon: React.FC = ({ size = 24, width, height, ...props }) => { return ( - + = ({ ); }; -export const TwitterIcon: React.FC = ({ - size = 24, - width, - height, - ...props -}) => { +export const TwitterIcon: React.FC = ({ size = 24, width, height, ...props }) => { return ( - + = ({ ); }; -export const GithubIcon: React.FC = ({ - size = 24, - width, - height, - ...props -}) => { +export const GithubIcon: React.FC = ({ size = 24, width, height, ...props }) => { return ( - + = ({ ); }; -export const MoonFilledIcon = ({ - size = 24, - width, - height, - ...props -}: IconSvgProps) => ( +export const MoonFilledIcon = ({ size = 24, width, height, ...props }: IconSvgProps) => (

TestPlat

@@ -82,7 +73,7 @@ export default function Header(params: { locale: string }) { showAnchorIcon anchorIcon={} > - {t("docs")} + {t('docs')} ) : ( @@ -100,11 +91,7 @@ export default function Header(params: { locale: string }) { - + @@ -126,12 +113,8 @@ export default function Header(params: { locale: string }) { {commonLinks.map((link) => link.isExternal ? ( - } - > - {t("docs")} + }> + {t('docs')} ) : ( diff --git a/frontend/src/app/[locale]/PaneDemoImages.tsx b/frontend/src/app/[locale]/PaneDemoImages.tsx index d200d88..baeef2e 100644 --- a/frontend/src/app/[locale]/PaneDemoImages.tsx +++ b/frontend/src/app/[locale]/PaneDemoImages.tsx @@ -1,7 +1,7 @@ -"use client"; -import { title } from "@/components/primitives"; -import { useState, useEffect } from "react"; -import { Tabs, Tab, Image } from "@nextui-org/react"; +'use client'; +import { title } from '@/components/primitives'; +import { useState, useEffect } from 'react'; +import { Tabs, Tab, Image } from '@nextui-org/react'; type PaneDemoImagesMessages = { title: string; @@ -14,28 +14,28 @@ type Props = { }; export default function DemoImages({ messages }: Props) { - const [currentTab, setcurrentTab] = useState("edit"); + const [currentTab, setcurrentTab] = useState('edit'); const [currentImage, setcurrentImage] = useState({ - src: "/top/caseEdit.png", + src: '/top/caseEdit.png', alt: messages.caseEdit, }); const tabs = [ { - key: "edit", + key: 'edit', title: messages.caseEdit, - src: "/top/caseEdit.png", + src: '/top/caseEdit.png', alt: messages.caseEdit, }, { - key: "home", + key: 'home', title: messages.caseHome, - src: "/top/caseHome.png", + src: '/top/caseHome.png', alt: messages.caseHome, }, { - key: "run", + key: 'run', title: messages.caseRun, - src: "/top/caseRun.png", + src: '/top/caseRun.png', alt: messages.caseRun, }, ]; @@ -50,11 +50,11 @@ export default function DemoImages({ messages }: Props) { <>
-

{messages.title}

+

{messages.title}


- {currentImage.alt} + {currentImage.alt}
diff --git a/frontend/src/app/[locale]/PaneMainFeatures.tsx b/frontend/src/app/[locale]/PaneMainFeatures.tsx index a489f3d..569dae4 100644 --- a/frontend/src/app/[locale]/PaneMainFeatures.tsx +++ b/frontend/src/app/[locale]/PaneMainFeatures.tsx @@ -1,30 +1,30 @@ -import { title, subtitle } from "@/components/primitives"; -import { Card, CardHeader, CardBody, Avatar } from "@nextui-org/react"; -import { Scale, Folder, Check, Globe } from "lucide-react"; -import { useTranslations } from "next-intl"; +import { title, subtitle } from '@/components/primitives'; +import { Card, CardHeader, CardBody, Avatar } from '@nextui-org/react'; +import { Scale, Folder, Check, Globe } from 'lucide-react'; +import { useTranslations } from 'next-intl'; export default function MainTitle() { - const t = useTranslations("Index"); + const t = useTranslations('Index'); const features = [ { - title: t("oss_title"), - detail: t("oss_detail"), + title: t('oss_title'), + detail: t('oss_detail'), icon: , }, { - title: t("organize_title"), - detail: t("organize_detail"), + title: t('organize_title'), + detail: t('organize_detail'), icon: , }, { - title: t("usability_title"), - detail: t("usability_detail"), + title: t('usability_title'), + detail: t('usability_detail'), icon: , }, { - title: t("universal_title"), - detail: t("universal_detail"), + title: t('universal_title'), + detail: t('universal_detail'), icon: , }, ]; @@ -36,12 +36,7 @@ export default function MainTitle() {
- +

{feature.title}

diff --git a/frontend/src/app/[locale]/PaneMainTitle.tsx b/frontend/src/app/[locale]/PaneMainTitle.tsx index d64e6d5..acde016 100644 --- a/frontend/src/app/[locale]/PaneMainTitle.tsx +++ b/frontend/src/app/[locale]/PaneMainTitle.tsx @@ -1,22 +1,22 @@ -import { title, subtitle } from "@/components/primitives"; -import { Button, Link as NextUiLink } from "@nextui-org/react"; -import { MoveUpRight } from "lucide-react"; -import { Link } from "@/src/navigation"; -import { useTranslations } from "next-intl"; +import { title, subtitle } from '@/components/primitives'; +import { Button, Link as NextUiLink } from '@nextui-org/react'; +import { MoveUpRight } from 'lucide-react'; +import { Link } from '@/src/navigation'; +import { useTranslations } from 'next-intl'; type Props = { locale: string; }; export default function MainTitle({ locale }: Props) { - const t = useTranslations("Index"); + const t = useTranslations('Index'); return (

TestPlat @@ -25,29 +25,23 @@ export default function MainTitle({ locale }: Props) {

- {t("oss_tcmt")} + {t('oss_tcmt')}
- {t("web_application")} + {t('web_application')}

-

- {t("integrate_and_manage")} -

+

{t('integrate_and_manage')}

- + - +
- {errorMessage && ( -
{errorMessage}
- )} + {errorMessage &&
{errorMessage}
} + } @@ -164,13 +150,9 @@ export default function AuthPage({ isSignup, messages, locale }: Props) { variant="bordered" autoComplete="new-password" className="mt-3" - type={isPasswordVisible ? "text" : "password"} + type={isPasswordVisible ? 'text' : 'password'} endContent={ - } diff --git a/frontend/src/app/[locale]/account/layout.tsx b/frontend/src/app/[locale]/account/layout.tsx index 2f82349..d36d148 100644 --- a/frontend/src/app/[locale]/account/layout.tsx +++ b/frontend/src/app/[locale]/account/layout.tsx @@ -1,8 +1,4 @@ -export default function AuthLayout({ - children, -}: { - children: React.ReactNode; -}) { +export default function AuthLayout({ children }: { children: React.ReactNode }) { return ( <>
{children}
diff --git a/frontend/src/app/[locale]/account/page.tsx b/frontend/src/app/[locale]/account/page.tsx index 5a0f2f7..cf7fad0 100644 --- a/frontend/src/app/[locale]/account/page.tsx +++ b/frontend/src/app/[locale]/account/page.tsx @@ -1,9 +1,9 @@ -import { useTranslations } from "next-intl"; -import AccountPage from "./AccountPage"; +import { useTranslations } from 'next-intl'; +import AccountPage from './AccountPage'; export default function Page(params: { locale: string }) { - const t = useTranslations("Auth"); + const t = useTranslations('Auth'); const messages = { - yourProjects: t("your_projects"), + yourProjects: t('your_projects'), }; return ; diff --git a/frontend/src/app/[locale]/account/signin/page.tsx b/frontend/src/app/[locale]/account/signin/page.tsx index 177be3e..a516d2e 100644 --- a/frontend/src/app/[locale]/account/signin/page.tsx +++ b/frontend/src/app/[locale]/account/signin/page.tsx @@ -1,24 +1,24 @@ -import AuthPage from "../authPage"; -import { useTranslations } from "next-intl"; +import AuthPage from '../authPage'; +import { useTranslations } from 'next-intl'; export default function Page(params: { locale: string }) { - const t = useTranslations("Auth"); + const t = useTranslations('Auth'); const messages = { - title: t("signin"), - linkTitle: t("or_signup"), - submitTitle: t("signin"), - email: t("email"), - username: t("username"), - password: t("password"), - confirmPassword: t("confirm_password"), - invalidEmail: t("invalid_email"), - invalidPassword: t("invalid_password"), - usernameEmpty: t("username_empty"), - passwordDoesNotMatch: t("password_not_match"), - EmailAlreadyExist: t("email_already_exist"), - emailNotExist: t("email_not_exist"), - signupError: t("signup_error"), - signinError: t("signin_error"), + title: t('signin'), + linkTitle: t('or_signup'), + submitTitle: t('signin'), + email: t('email'), + username: t('username'), + password: t('password'), + confirmPassword: t('confirm_password'), + invalidEmail: t('invalid_email'), + invalidPassword: t('invalid_password'), + usernameEmpty: t('username_empty'), + passwordDoesNotMatch: t('password_not_match'), + EmailAlreadyExist: t('email_already_exist'), + emailNotExist: t('email_not_exist'), + signupError: t('signup_error'), + signinError: t('signin_error'), }; return ( <> diff --git a/frontend/src/app/[locale]/account/signup/page.tsx b/frontend/src/app/[locale]/account/signup/page.tsx index f3c7c0f..75bf6cd 100644 --- a/frontend/src/app/[locale]/account/signup/page.tsx +++ b/frontend/src/app/[locale]/account/signup/page.tsx @@ -1,24 +1,24 @@ -import AuthPage from "../authPage"; -import { useTranslations } from "next-intl"; +import AuthPage from '../authPage'; +import { useTranslations } from 'next-intl'; export default function Page(params: { locale: string }) { - const t = useTranslations("Auth"); + const t = useTranslations('Auth'); const messages = { - title: t("signup"), - linkTitle: t("or_signin"), - submitTitle: t("signup"), - email: t("email"), - username: t("username"), - password: t("password"), - confirmPassword: t("confirm_password"), - invalidEmail: t("invalid_email"), - invalidPassword: t("invalid_password"), - usernameEmpty: t("username_empty"), - passwordDoesNotMatch: t("password_not_match"), - EmailAlreadyExist: t("email_already_exist"), - emailNotExist: t("email_not_exist"), - signupError: t("signup_error"), - signinError: t("signin_error"), + title: t('signup'), + linkTitle: t('or_signin'), + submitTitle: t('signup'), + email: t('email'), + username: t('username'), + password: t('password'), + confirmPassword: t('confirm_password'), + invalidEmail: t('invalid_email'), + invalidPassword: t('invalid_password'), + usernameEmpty: t('username_empty'), + passwordDoesNotMatch: t('password_not_match'), + EmailAlreadyExist: t('email_already_exist'), + emailNotExist: t('email_not_exist'), + signupError: t('signup_error'), + signinError: t('signin_error'), }; return ( <> diff --git a/frontend/src/app/[locale]/error.tsx b/frontend/src/app/[locale]/error.tsx index 337e394..7d3bae2 100644 --- a/frontend/src/app/[locale]/error.tsx +++ b/frontend/src/app/[locale]/error.tsx @@ -1,14 +1,8 @@ -"use client"; +'use client'; -import { useEffect } from "react"; +import { useEffect } from 'react'; -export default function Error({ - error, - reset, -}: { - error: Error; - reset: () => void; -}) { +export default function Error({ error, reset }: { error: Error; reset: () => void }) { useEffect(() => { // Log the error to an error reporting service console.error(error); diff --git a/frontend/src/app/[locale]/layout.tsx b/frontend/src/app/[locale]/layout.tsx index 7dfdd23..180375f 100644 --- a/frontend/src/app/[locale]/layout.tsx +++ b/frontend/src/app/[locale]/layout.tsx @@ -1,19 +1,19 @@ -import "@/styles/globals.css"; -import { fontSans } from "@/config/fonts"; -import { Providers } from "./providers"; -import Header from "./Header"; -import clsx from "clsx"; -import { getTranslations } from "next-intl/server"; +import '@/styles/globals.css'; +import { fontSans } from '@/config/fonts'; +import { Providers } from './providers'; +import Header from './Header'; +import clsx from 'clsx'; +import { getTranslations } from 'next-intl/server'; export async function generateMetadata({ params: { locale } }) { - const t = await getTranslations({ locale, namespace: "Header" }); + const t = await getTranslations({ locale, namespace: 'Header' }); return { - title: t("title"), - description: t("description"), + title: t('title'), + description: t('description'), icons: { - icon: "/favicon/favicon.ico", - shortcut: "/favicon/favicon-16x16.png", - apple: "/favicon/apple-touch-icon.png", + icon: '/favicon/favicon.ico', + shortcut: '/favicon/favicon-16x16.png', + apple: '/favicon/apple-touch-icon.png', }, }; } @@ -28,16 +28,8 @@ export default function RootLayout({ return ( - - + +
{children}
diff --git a/frontend/src/app/[locale]/page.tsx b/frontend/src/app/[locale]/page.tsx index ca61417..18778e9 100644 --- a/frontend/src/app/[locale]/page.tsx +++ b/frontend/src/app/[locale]/page.tsx @@ -1,17 +1,17 @@ -import { useTranslations } from "next-intl"; -import { Divider } from "@nextui-org/react"; -import PaneMainTitle from "./PaneMainTitle"; -import PaneMainFeatures from "./PaneMainFeatures"; -import PaneDemoImages from "./PaneDemoImages"; +import { useTranslations } from 'next-intl'; +import { Divider } from '@nextui-org/react'; +import PaneMainTitle from './PaneMainTitle'; +import PaneMainFeatures from './PaneMainFeatures'; +import PaneDemoImages from './PaneDemoImages'; export default function Home(params: { locale: string }) { - const t = useTranslations("Index"); + const t = useTranslations('Index'); const messages = { - title: t("organize_test_cases"), - caseEdit: t("case_edit"), - caseHome: t("case_home"), - caseRun: t("case_run"), + title: t('organize_test_cases'), + caseEdit: t('case_edit'), + caseHome: t('case_home'), + caseRun: t('case_run'), }; return ( @@ -24,30 +24,30 @@ export default function Home(params: { locale: string }) {
⚗️
@@ -57,7 +57,7 @@ export default function Home(params: { locale: string }) {
diff --git a/frontend/src/app/[locale]/projects/ProjectDialog.tsx b/frontend/src/app/[locale]/projects/ProjectDialog.tsx index 3ef7eb8..ad9054e 100644 --- a/frontend/src/app/[locale]/projects/ProjectDialog.tsx +++ b/frontend/src/app/[locale]/projects/ProjectDialog.tsx @@ -1,17 +1,8 @@ -"use client"; -import React from "react"; -import { useState, useEffect } from "react"; -import { - Button, - Input, - Textarea, - Modal, - ModalContent, - ModalHeader, - ModalBody, - ModalFooter, -} from "@nextui-org/react"; -import { ProjectType, ProjectsMessages } from "@/types/project"; +'use client'; +import React from 'react'; +import { useState, useEffect } from 'react'; +import { Button, Input, Textarea, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@nextui-org/react'; +import { ProjectType, ProjectsMessages } from '@/types/project'; type Props = { isOpen: boolean; @@ -21,23 +12,17 @@ type Props = { messages: ProjectsMessages; }; -export default function ProjectDialog({ - isOpen, - editingProject, - onCancel, - onSubmit, - messages, -}: Props) { +export default function ProjectDialog({ isOpen, editingProject, onCancel, onSubmit, messages }: Props) { const [projectName, setProjectName] = useState({ - text: editingProject ? editingProject.name : "", + text: editingProject ? editingProject.name : '', isValid: false, - errorMessage: "", + errorMessage: '', }); const [projectDetail, setProjectDetail] = useState({ - text: editingProject ? editingProject.detail : "", + text: editingProject ? editingProject.detail : '', isValid: false, - errorMessage: "", + errorMessage: '', }); useEffect(() => { @@ -49,17 +34,17 @@ export default function ProjectDialog({ setProjectDetail({ ...projectDetail, - text: editingProject.detail ? editingProject.detail : "", + text: editingProject.detail ? editingProject.detail : '', }); } else { setProjectName({ ...projectName, - text: "", + text: '', }); setProjectDetail({ ...projectDetail, - text: "", + text: '', }); } }, [editingProject]); @@ -67,20 +52,20 @@ export default function ProjectDialog({ const clear = () => { setProjectName({ isValid: false, - text: "", - errorMessage: "", + text: '', + errorMessage: '', }); setProjectDetail({ isValid: false, - text: "", - errorMessage: "", + text: '', + errorMessage: '', }); }; const validate = () => { if (!projectName.text) { setProjectName({ - text: "", + text: '', isValid: false, errorMessage: messages.pleaseEnter, }); @@ -100,9 +85,7 @@ export default function ProjectDialog({ }} > - - {messages.project} - + {messages.project} ( - null - ); + const [editingProject, setEditingProject] = useState(null); const openDialogForCreate = () => { setIsProjectDialogOpen(true); setEditingProject(null); @@ -50,14 +43,8 @@ export default function ProjectsPage({ messages, locale }: Props) { const onSubmit = async (name: string, detail: string) => { if (editingProject) { - const updatedProject = await updateProject( - editingProject.id, - name, - detail - ); - const updatedProjects = projects.map((project) => - project.id === updatedProject.id ? updatedProject : project - ); + const updatedProject = await updateProject(editingProject.id, name, detail); + const updatedProjects = projects.map((project) => (project.id === updatedProject.id ? updatedProject : project)); setProjects(updatedProjects); } else { const newProject = await createProject(name, detail); @@ -76,7 +63,7 @@ export default function ProjectsPage({ messages, locale }: Props) { await deleteProject(projectId); setProjects(projects.filter((project) => project.id !== projectId)); } catch (error: any) { - console.error("Error deleting project:", error); + console.error('Error deleting project:', error); } }; @@ -85,12 +72,7 @@ export default function ProjectsPage({ messages, locale }: Props) {

{messages.projectList}

-
diff --git a/frontend/src/app/[locale]/projects/ProjectsTable.tsx b/frontend/src/app/[locale]/projects/ProjectsTable.tsx index 1a552dd..3c8174d 100644 --- a/frontend/src/app/[locale]/projects/ProjectsTable.tsx +++ b/frontend/src/app/[locale]/projects/ProjectsTable.tsx @@ -1,4 +1,4 @@ -import { useState, useMemo, useCallback } from "react"; +import { useState, useMemo, useCallback } from 'react'; import { Table, TableHeader, @@ -12,11 +12,11 @@ import { DropdownMenu, DropdownItem, SortDescriptor, -} from "@nextui-org/react"; -import { Link, NextUiLinkClasses } from "@/src/navigation"; -import { MoreVertical } from "lucide-react"; -import { ProjectType, ProjectsMessages } from "@/types/project"; -import dayjs from "dayjs"; +} from '@nextui-org/react'; +import { Link, NextUiLinkClasses } from '@/src/navigation'; +import { MoreVertical } from 'lucide-react'; +import { ProjectType, ProjectsMessages } from '@/types/project'; +import dayjs from 'dayjs'; type Props = { projects: ProjectType[]; @@ -26,24 +26,18 @@ type Props = { locale: string; }; -export default function ProjectsTable({ - projects, - onEditProject, - onDeleteProject, - messages, - locale, -}: Props) { +export default function ProjectsTable({ projects, onEditProject, onDeleteProject, messages, locale }: Props) { const headerColumns = [ - { name: messages.id, uid: "id", sortable: true }, - { name: messages.name, uid: "name", sortable: true }, - { name: messages.detail, uid: "detail", sortable: true }, - { name: messages.lastUpdate, uid: "updatedAt", sortable: true }, - { name: messages.actions, uid: "actions" }, + { name: messages.id, uid: 'id', sortable: true }, + { name: messages.name, uid: 'name', sortable: true }, + { name: messages.detail, uid: 'detail', sortable: true }, + { name: messages.lastUpdate, uid: 'updatedAt', sortable: true }, + { name: messages.actions, uid: 'actions' }, ]; const [sortDescriptor, setSortDescriptor] = useState({ - column: "id", - direction: "ascending", + column: 'id', + direction: 'ascending', }); const sortedItems = useMemo(() => { @@ -52,31 +46,27 @@ export default function ProjectsTable({ const second = b[sortDescriptor.column as keyof ProjectType] as number; const cmp = first < second ? -1 : first > second ? 1 : 0; - return sortDescriptor.direction === "descending" ? -cmp : cmp; + return sortDescriptor.direction === 'descending' ? -cmp : cmp; }); }, [sortDescriptor, projects]); const truncateText = (text: string, maxLength: number) => { - return text.length > maxLength ? text.slice(0, maxLength) + "..." : text; + return text.length > maxLength ? text.slice(0, maxLength) + '...' : text; }; const renderCell = useCallback((project: ProjectType, columnKey: Key) => { const cellValue = project[columnKey as keyof ProjectType]; switch (columnKey) { - case "id": + case 'id': return {cellValue}; - case "name": + case 'name': return ( - + {cellValue} ); - case "detail": + case 'detail': const maxLength = 20; const truncatedValue = truncateText(cellValue, maxLength); return ( @@ -84,9 +74,9 @@ export default function ProjectsTable({
{truncatedValue}
); - case "updatedAt": - return {dayjs(cellValue).format("YYYY/MM/DD HH:mm")}; - case "actions": + case 'updatedAt': + return {dayjs(cellValue).format('YYYY/MM/DD HH:mm')}; + case 'actions': return ( @@ -95,13 +85,8 @@ export default function ProjectsTable({ - onEditProject(project)}> - {messages.editProject} - - onDeleteProject(project.id)} - > + onEditProject(project)}>{messages.editProject} + onDeleteProject(project.id)}> {messages.deleteProject} @@ -114,18 +99,18 @@ export default function ProjectsTable({ const classNames = useMemo( () => ({ - wrapper: ["max-w-3xl"], - th: ["bg-transparent", "text-default-500", "border-b", "border-divider"], + wrapper: ['max-w-3xl'], + th: ['bg-transparent', 'text-default-500', 'border-b', 'border-divider'], td: [ // changing the rows border radius // first - "group-data-[first=true]:first:before:rounded-none", - "group-data-[first=true]:last:before:rounded-none", + 'group-data-[first=true]:first:before:rounded-none', + 'group-data-[first=true]:last:before:rounded-none', // middle - "group-data-[middle=true]:before:rounded-none", + 'group-data-[middle=true]:before:rounded-none', // last - "group-data-[last=true]:first:before:rounded-none", - "group-data-[last=true]:last:before:rounded-none", + 'group-data-[last=true]:first:before:rounded-none', + 'group-data-[last=true]:last:before:rounded-none', ], }), [] @@ -144,7 +129,7 @@ export default function ProjectsTable({ {(column) => ( {column.name} @@ -153,11 +138,7 @@ export default function ProjectsTable({ {(item) => ( - - {(columnKey) => ( - {renderCell(item, columnKey)} - )} - + {(columnKey) => {renderCell(item, columnKey)}} )} diff --git a/frontend/src/app/[locale]/projects/[projectId]/Sidebar.tsx b/frontend/src/app/[locale]/projects/[projectId]/Sidebar.tsx index b4b77e1..f72ba37 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/Sidebar.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/Sidebar.tsx @@ -1,10 +1,10 @@ -"use client"; -import { useState, useEffect } from "react"; -import { Listbox, ListboxItem } from "@nextui-org/react"; -import { Home, Files, FlaskConical } from "lucide-react"; -import { usePathname, useRouter } from "@/src/navigation"; -import useGetCurrentIds from "@/utils/useGetCurrentIds"; -import { ProjectMessages } from "@/types/project"; +'use client'; +import { useState, useEffect } from 'react'; +import { Listbox, ListboxItem } from '@nextui-org/react'; +import { Home, Files, FlaskConical } from 'lucide-react'; +import { usePathname, useRouter } from '@/src/navigation'; +import useGetCurrentIds from '@/utils/useGetCurrentIds'; +import { ProjectMessages } from '@/types/project'; export type Props = { messages: ProjectMessages; @@ -16,28 +16,28 @@ export default function Sidebar({ messages, locale }: Props) { const router = useRouter(); const pathname = usePathname(); - const [currentKey, setCurrentTab] = useState("home"); - const baseClass = "p-3"; + const [currentKey, setCurrentTab] = useState('home'); + const baseClass = 'p-3'; const selectedClass = `${baseClass} bg-neutral-200 dark:bg-neutral-700`; const handleTabClick = (key: string) => { - if (key === "home") { + if (key === 'home') { router.push(`/projects/${projectId}/home`, { locale: locale }); - } else if (key === "cases") { + } else if (key === 'cases') { router.push(`/projects/${projectId}/folders`, { locale: locale }); - } else if (key === "runs") { + } else if (key === 'runs') { router.push(`/projects/${projectId}/runs`, { locale: locale }); } }; useEffect(() => { const handleRouteChange = (currentPath: string) => { - if (currentPath.includes("home")) { - setCurrentTab("home"); - } else if (currentPath.includes("folders")) { - setCurrentTab("cases"); - } else if (currentPath.includes("runs")) { - setCurrentTab("runs"); + if (currentPath.includes('home')) { + setCurrentTab('home'); + } else if (currentPath.includes('folders')) { + setCurrentTab('cases'); + } else if (currentPath.includes('runs')) { + setCurrentTab('runs'); } }; @@ -46,17 +46,17 @@ export default function Sidebar({ messages, locale }: Props) { const tabItems = [ { - key: "home", + key: 'home', text: messages.home, startContent: , }, { - key: "cases", + key: 'cases', text: messages.testCases, startContent: , }, { - key: "runs", + key: 'runs', text: messages.testRuns, startContent: , }, diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/FolderDialog.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/FolderDialog.tsx index bbdafad..7320d95 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/FolderDialog.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/FolderDialog.tsx @@ -1,17 +1,8 @@ -"use client"; -import React from "react"; -import { useState, useEffect } from "react"; -import { - Button, - Input, - Textarea, - Modal, - ModalContent, - ModalHeader, - ModalBody, - ModalFooter, -} from "@nextui-org/react"; -import { FolderType, FoldersMessages } from "@/types/folder"; +'use client'; +import React from 'react'; +import { useState, useEffect } from 'react'; +import { Button, Input, Textarea, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@nextui-org/react'; +import { FolderType, FoldersMessages } from '@/types/folder'; type Props = { isOpen: boolean; @@ -21,23 +12,17 @@ type Props = { messages: FoldersMessages; }; -export default function FolderDialog({ - isOpen, - editingFolder, - onCancel, - onSubmit, - messages, -}: Props) { +export default function FolderDialog({ isOpen, editingFolder, onCancel, onSubmit, messages }: Props) { const [folderName, setFolderName] = useState({ - text: editingFolder ? editingFolder.name : "", + text: editingFolder ? editingFolder.name : '', isValid: false, - errorMessage: "", + errorMessage: '', }); const [folderDetail, setFolderDetail] = useState({ - text: editingFolder ? editingFolder.detail : "", + text: editingFolder ? editingFolder.detail : '', isValid: false, - errorMessage: "", + errorMessage: '', }); useEffect(() => { @@ -49,17 +34,17 @@ export default function FolderDialog({ setFolderDetail({ ...folderDetail, - text: editingFolder.detail ? editingFolder.detail : "", + text: editingFolder.detail ? editingFolder.detail : '', }); } else { setFolderName({ ...folderName, - text: "", + text: '', }); setFolderDetail({ ...folderDetail, - text: "", + text: '', }); } }, [editingFolder]); @@ -67,20 +52,20 @@ export default function FolderDialog({ const clear = () => { setFolderName({ isValid: false, - text: "", - errorMessage: "", + text: '', + errorMessage: '', }); setFolderDetail({ isValid: false, - text: "", - errorMessage: "", + text: '', + errorMessage: '', }); }; const validate = () => { if (!folderName.text) { setFolderName({ - text: "", + text: '', isValid: false, errorMessage: messages.pleaseEnter, }); @@ -100,9 +85,7 @@ export default function FolderDialog({ }} > - - {messages.folder} - + {messages.folder} @@ -32,12 +21,7 @@ export default function FolderEditMenu({ onEditClick(folder)}> {messages.editFolder} - onDeleteClick(folder.id)} - > + onDeleteClick(folder.id)}> {messages.deleteFolder} diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/FoldersPane.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/FoldersPane.tsx index c6b147d..94fbe4a 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/FoldersPane.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/FoldersPane.tsx @@ -1,20 +1,15 @@ -"use client"; -import React from "react"; -import { FolderType, FoldersMessages } from "@/types/folder"; -import { useEffect, useState } from "react"; -import { Button, Listbox, ListboxItem } from "@nextui-org/react"; -import { Folder, Plus } from "lucide-react"; -import { usePathname, useRouter } from "@/src/navigation"; -import useGetCurrentIds from "@/utils/useGetCurrentIds"; -import FolderDialog from "./FolderDialog"; -import FolderEditMenu from "./FolderEditMenu"; +'use client'; +import React from 'react'; +import { FolderType, FoldersMessages } from '@/types/folder'; +import { useEffect, useState } from 'react'; +import { Button, Listbox, ListboxItem } from '@nextui-org/react'; +import { Folder, Plus } from 'lucide-react'; +import { usePathname, useRouter } from '@/src/navigation'; +import useGetCurrentIds from '@/utils/useGetCurrentIds'; +import FolderDialog from './FolderDialog'; +import FolderEditMenu from './FolderEditMenu'; -import { - fetchFolders, - createFolder, - updateFolder, - deleteFolder, -} from "./foldersControl"; +import { fetchFolders, createFolder, updateFolder, deleteFolder } from './foldersControl'; type Props = { projectId: string; @@ -45,16 +40,8 @@ export default function FoldersPane({ projectId, messages, locale }: Props) { const onSubmit = async (name: string, detail: string) => { if (editingFolder) { - const updatedProject = await updateFolder( - editingFolder.id, - name, - detail, - projectId, - null - ); - const updatedProjects = folders.map((project) => - project.id === updatedProject.id ? updatedProject : project - ); + const updatedProject = await updateFolder(editingFolder.id, name, detail, projectId, null); + const updatedProjects = folders.map((project) => (project.id === updatedProject.id ? updatedProject : project)); setFolders(updatedProjects); } else { const newProject = await createFolder(name, detail, projectId, null); @@ -79,28 +66,23 @@ export default function FoldersPane({ projectId, messages, locale }: Props) { const data = await fetchFolders(projectId); setFolders(data); - const selectedFolderFromUrl = data.find( - (folder) => folder.id === folderId - ); + const selectedFolderFromUrl = data.find((folder) => folder.id === folderId); setSelectedFolder(selectedFolderFromUrl); // Redirect to the smallest folder ID page if the path is "projects/[projectId]/folders if (pathname === `/projects/${projectId}/folders`) { const smallestFolderId = Math.min(...data.map((folder) => folder.id)); - router.push( - `/projects/${projectId}/folders/${smallestFolderId}/cases`, - { locale: locale } - ); + router.push(`/projects/${projectId}/folders/${smallestFolderId}/cases`, { locale: locale }); } } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } fetchDataEffect(); }, [folderId]); - const baseClass = ""; + const baseClass = ''; const selectedClass = `${baseClass} bg-neutral-200 dark:bg-neutral-700`; return ( @@ -119,18 +101,9 @@ export default function FoldersPane({ projectId, messages, locale }: Props) { {folders.map((folder, index) => ( - router.push( - `/projects/${projectId}/folders/${folder.id}/cases`, - { locale: locale } - ) - } + onClick={() => router.push(`/projects/${projectId}/folders/${folder.id}/cases`, { locale: locale })} startContent={} - className={ - selectedFolder && folder.id === selectedFolder.id - ? selectedClass - : baseClass - } + className={selectedFolder && folder.id === selectedFolder.id ? selectedClass : baseClass} endContent={ { async function fetchDataEffect() { @@ -24,7 +19,7 @@ export default function CasesPane({ const data = await fetchCases(folderId); setCases(data); } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/TestCaseTable.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/TestCaseTable.tsx index 99e2abc..af54e90 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/TestCaseTable.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/TestCaseTable.tsx @@ -1,4 +1,4 @@ -import { useState, useMemo, useCallback } from "react"; +import { useState, useMemo, useCallback } from 'react'; import { Table, TableHeader, @@ -13,11 +13,11 @@ import { DropdownItem, Selection, SortDescriptor, -} from "@nextui-org/react"; -import { Link, NextUiLinkClasses } from "@/src/navigation"; -import { Plus, MoreVertical, Trash, Circle } from "lucide-react"; -import { CasesMessages } from "@/types/case"; -import { priorities } from "@/config/selection"; +} from '@nextui-org/react'; +import { Link, NextUiLinkClasses } from '@/src/navigation'; +import { Plus, MoreVertical, Trash, Circle } from 'lucide-react'; +import { CasesMessages } from '@/types/case'; +import { priorities } from '@/config/selection'; type Case = { id: number; @@ -55,16 +55,16 @@ export default function TestCaseTable({ locale, }: Props) { const headerColumns = [ - { name: messages.id, uid: "id", sortable: true }, - { name: messages.title, uid: "title", sortable: true }, - { name: messages.priority, uid: "priority", sortable: true }, - { name: messages.actions, uid: "actions" }, + { name: messages.id, uid: 'id', sortable: true }, + { name: messages.title, uid: 'title', sortable: true }, + { name: messages.priority, uid: 'priority', sortable: true }, + { name: messages.actions, uid: 'actions' }, ]; const [selectedKeys, setSelectedKeys] = useState(new Set([])); const [sortDescriptor, setSortDescriptor] = useState({ - column: "id", - direction: "ascending", + column: 'id', + direction: 'ascending', }); const sortedItems = useMemo(() => { @@ -73,7 +73,7 @@ export default function TestCaseTable({ const second = b[sortDescriptor.column as keyof Case] as number; const cmp = first < second ? -1 : first > second ? 1 : 0; - return sortDescriptor.direction === "descending" ? -cmp : cmp; + return sortDescriptor.direction === 'descending' ? -cmp : cmp; }); }, [sortDescriptor, cases]); @@ -81,15 +81,11 @@ export default function TestCaseTable({ const cellValue = testCase[columnKey as keyof Case]; switch (columnKey) { - case "id": + case 'id': return {cellValue}; - case "title": + case 'title': return ( - ); - case "priority": + case 'priority': return (
- +
{messages[priorities[cellValue].uid]}
); - case "actions": + case 'actions': return ( @@ -119,10 +111,7 @@ export default function TestCaseTable({ - onDeleteCase(testCase.id)} - > + onDeleteCase(testCase.id)}> {messages.deleteCase} @@ -135,25 +124,25 @@ export default function TestCaseTable({ const classNames = useMemo( () => ({ - wrapper: ["max-w-3xl"], - th: ["bg-transparent", "text-default-500", "border-b", "border-divider"], + wrapper: ['max-w-3xl'], + th: ['bg-transparent', 'text-default-500', 'border-b', 'border-divider'], td: [ // changing the rows border radius // first - "group-data-[first=true]:first:before:rounded-none", - "group-data-[first=true]:last:before:rounded-none", + 'group-data-[first=true]:first:before:rounded-none', + 'group-data-[first=true]:last:before:rounded-none', // middle - "group-data-[middle=true]:before:rounded-none", + 'group-data-[middle=true]:before:rounded-none', // last - "group-data-[last=true]:first:before:rounded-none", - "group-data-[last=true]:last:before:rounded-none", + 'group-data-[last=true]:first:before:rounded-none', + 'group-data-[last=true]:last:before:rounded-none', ], }), [] ); const onDeleteCasesClick = async () => { - if (selectedKeys === "all") { + if (selectedKeys === 'all') { const allKeys = sortedItems.map((item) => item.id); onDeleteCases(allKeys); } else { @@ -167,7 +156,7 @@ export default function TestCaseTable({

{messages.testCaseList}

- {(selectedKeys.size > 0 || selectedKeys === "all") && ( + {(selectedKeys.size > 0 || selectedKeys === 'all') && ( )} -
@@ -204,7 +188,7 @@ export default function TestCaseTable({ {(column) => ( {column.name} @@ -213,11 +197,7 @@ export default function TestCaseTable({ {(item) => ( - - {(columnKey) => ( - {renderCell(item, columnKey)} - )} - + {(columnKey) => {renderCell(item, columnKey)}} )} diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseAttachmentsEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseAttachmentsEditor.tsx index e067a8d..3ad2008 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseAttachmentsEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseAttachmentsEditor.tsx @@ -1,16 +1,13 @@ -import { Image, Button, Tooltip, Card, CardBody } from "@nextui-org/react"; -import { AttachmentType, CaseMessages } from "@/types/case"; -import { Trash, ArrowDownToLine } from "lucide-react"; -import { isImage } from "./isImage"; +import { Image, Button, Tooltip, Card, CardBody } from '@nextui-org/react'; +import { AttachmentType, CaseMessages } from '@/types/case'; +import { Trash, ArrowDownToLine } from 'lucide-react'; +import { isImage } from './isImage'; type Props = { attachments: AttachmentType[]; - onAttachmentDownload: ( - attachmentId: number, - downloadFileName: string - ) => void; + onAttachmentDownload: (attachmentId: number, downloadFileName: string) => void; onAttachmentDelete: (attachmentId: number) => void; - messages: CaseMessages, + messages: CaseMessages; }; export default function CaseAttachmentsEditor({ @@ -35,11 +32,7 @@ export default function CaseAttachmentsEditor({ {images.map((image, index) => ( - {image.title} + {image.title}

{image.title}

diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx index ba95aeb..37bbdae 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx @@ -1,39 +1,27 @@ -"use client"; -import { useEffect, useState } from "react"; -import { - Input, - Textarea, - Select, - SelectItem, - Button, - Divider, - Tooltip, -} from "@nextui-org/react"; -import { useRouter } from "@/src/navigation"; -import { Save, Plus, ArrowLeft, ArrowUpFromLine, Circle } from "lucide-react"; -import { priorities, testTypes, templates } from "@/config/selection"; -import CaseStepsEditor from "./CaseStepsEditor"; -import CaseAttachmentsEditor from "./CaseAttachmentsEditor"; -import { CaseType, AttachmentType, CaseMessages } from "@/types/case"; -import { fetchCase, updateCase } from "../caseControl"; -import { fetchCreateStep, fetchDeleteStep } from "./stepControl"; -import { - fetchCreateAttachments, - fetchDownloadAttachment, - fetchDeleteAttachment, -} from "./attachmentControl"; +'use client'; +import { useEffect, useState } from 'react'; +import { Input, Textarea, Select, SelectItem, Button, Divider, Tooltip } from '@nextui-org/react'; +import { useRouter } from '@/src/navigation'; +import { Save, Plus, ArrowLeft, ArrowUpFromLine, Circle } from 'lucide-react'; +import { priorities, testTypes, templates } from '@/config/selection'; +import CaseStepsEditor from './CaseStepsEditor'; +import CaseAttachmentsEditor from './CaseAttachmentsEditor'; +import { CaseType, AttachmentType, CaseMessages } from '@/types/case'; +import { fetchCase, updateCase } from '../caseControl'; +import { fetchCreateStep, fetchDeleteStep } from './stepControl'; +import { fetchCreateAttachments, fetchDownloadAttachment, fetchDeleteAttachment } from './attachmentControl'; const defaultTestCase = { id: 0, - title: "", + title: '', state: 0, priority: 0, type: 0, automationStatus: 0, - description: "", + description: '', template: 0, - preConditions: "", - expectedResults: "", + preConditions: '', + expectedResults: '', folderId: 0, }; @@ -45,13 +33,7 @@ type Props = { locale: string; }; -export default function CaseEditor({ - projectId, - folderId, - caseId, - messages, - locale, -}: Props) { +export default function CaseEditor({ projectId, folderId, caseId, messages, locale }: Props) { const [testCase, setTestCase] = useState(defaultTestCase); const [isTitleInvalid, setIsTitleInvalid] = useState(false); const [isUpdating, setIsUpdating] = useState(false); @@ -122,10 +104,7 @@ export default function CaseEditor({ handleFetchCreateAttachments(caseId, event.target.files); }; - const handleFetchCreateAttachments = async ( - caseId: number, - files: File[] - ) => { + const handleFetchCreateAttachments = async (caseId: number, files: File[]) => { const newAttachments = await fetchCreateAttachments(caseId, files); if (newAttachments) { @@ -147,9 +126,7 @@ export default function CaseEditor({ const onAttachmentDelete = async (attachmentId: number) => { await fetchDeleteAttachment(attachmentId); - const filteredAttachments = testCase.Attachments.filter( - (attachment) => attachment.id !== attachmentId - ); + const filteredAttachments = testCase.Attachments.filter((attachment) => attachment.id !== attachmentId); setTestCase({ ...testCase, @@ -163,7 +140,7 @@ export default function CaseEditor({ const data = await fetchCase(caseId); setTestCase(data); } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } @@ -179,12 +156,7 @@ export default function CaseEditor({ isIconOnly size="sm" className="rounded-full bg-neutral-50 dark:bg-neutral-600" - onPress={() => - router.push( - `/projects/${projectId}/folders/${folderId}/cases`, - { locale: locale } - ) - } + onPress={() => router.push(`/projects/${projectId}/folders/${folderId}/cases`, { locale: locale })} > @@ -215,7 +187,7 @@ export default function CaseEditor({ label={messages.title} value={testCase.title} isInvalid={isTitleInvalid} - errorMessage={isTitleInvalid ? messages.pleaseEnterTitle : ""} + errorMessage={isTitleInvalid ? messages.pleaseEnterTitle : ''} onChange={(e) => { setTestCase({ ...testCase, title: e.target.value }); }} @@ -241,17 +213,11 @@ export default function CaseEditor({ selectedKeys={[priorities[testCase.priority].uid]} onSelectionChange={(e) => { const selectedUid = e.anchorKey; - const index = priorities.findIndex( - (priority) => priority.uid === selectedUid - ); + const index = priorities.findIndex((priority) => priority.uid === selectedUid); setTestCase({ ...testCase, priority: index }); }} startContent={ - + } label={messages.priority} className="mt-3 max-w-xs" @@ -271,9 +237,7 @@ export default function CaseEditor({ selectedKeys={[testTypes[testCase.type].uid]} onSelectionChange={(e) => { const selectedUid = e.anchorKey; - const index = testTypes.findIndex( - (type) => type.uid === selectedUid - ); + const index = testTypes.findIndex((type) => type.uid === selectedUid); setTestCase({ ...testCase, type: index }); }} label={messages.type} @@ -294,9 +258,7 @@ export default function CaseEditor({ selectedKeys={[templates[testCase.template].uid]} onSelectionChange={(e) => { const selectedUid = e.anchorKey; - const index = templates.findIndex( - (template) => template.uid === selectedUid - ); + const index = templates.findIndex((template) => template.uid === selectedUid); setTestCase({ ...testCase, template: index }); }} label={messages.template} @@ -311,7 +273,7 @@ export default function CaseEditor({
- {templates[testCase.template].uid === "text" ? ( + {templates[testCase.template].uid === 'text' ? (
{messages.testDetail}
@@ -377,10 +339,9 @@ export default function CaseEditor({
{messages.attachments}
fetchDownloadAttachment(attachmentId, downloadFileName)} + onAttachmentDownload={(attachmentId: number, downloadFileName: string) => + fetchDownloadAttachment(attachmentId, downloadFileName) + } onAttachmentDelete={onAttachmentDelete} messages={messages} /> @@ -399,17 +360,9 @@ export default function CaseEditor({ {messages.clickToUpload} {messages.orDragAndDrop}

-

- {messages.maxFileSize}: 50 MB -

+

{messages.maxFileSize}: 50 MB

- +
diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseStepsEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseStepsEditor.tsx index 4db8acf..4f53030 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseStepsEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseStepsEditor.tsx @@ -1,6 +1,6 @@ -import { Textarea, Button, Tooltip } from "@nextui-org/react"; -import { CaseMessages, StepType } from "@/types/case"; -import { Plus, Trash } from "lucide-react"; +import { Textarea, Button, Tooltip } from '@nextui-org/react'; +import { CaseMessages, StepType } from '@/types/case'; +import { Plus, Trash } from 'lucide-react'; type Props = { steps: StepType[]; @@ -10,13 +10,7 @@ type Props = { messages: CaseMessages; }; -export default function StepsEditor({ - steps, - onStepUpdate, - onStepPlus, - onStepDelete, - messages, -}: Props) { +export default function StepsEditor({ steps, onStepUpdate, onStepPlus, onStepDelete, messages }: Props) { // sort steps by junction table's column const sortedSteps = steps.slice().sort((a, b) => { const stepNoA = a.caseSteps.stepNo; diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx index 71a8347..094eba4 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx @@ -1,5 +1,5 @@ -import CaseEditor from "./CaseEditor"; -import { useTranslations } from "next-intl"; +import CaseEditor from './CaseEditor'; +import { useTranslations } from 'next-intl'; export default function Page({ params, @@ -11,53 +11,53 @@ export default function Page({ locale: string; }; }) { - const t = useTranslations("Case"); + const t = useTranslations('Case'); const messages = { - backToCases: t("back_to_cases"), - updating: t("updating"), - update: t("update"), - basic: t("basic"), - title: t("title"), - pleaseEnterTitle: t("please_enter_title"), - description: t("description"), - testCaseDescription: t("test_case_description"), - priority: t("priority"), - critical: t("critical"), - high: t("high"), - medium: t("medium"), - low: t("low"), - type: t("type"), - other: t("other"), - security: t("security"), - performance: t("performance"), - accessibility: t("accessibility"), - functional: t("functional"), - acceptance: t("acceptance"), - usability: t("usability"), - smokeSanity: t("smoke_sanity"), - compatibility: t("compatibility"), - destructive: t("destructive"), - regression: t("regression"), - automated: t("automated"), - manual: t("manual"), - template: t("template"), - testDetail: t("test_detail"), - preconditions: t("preconditions"), - step: t("step"), - text: t("text"), - steps: t("steps"), - newStep: t("new_step"), - detailsOfTheStep: t("details_of_the_step"), - expectedResult: t("expected_result"), - deleteThisStep: t("delete_this_step"), - insertStep: t("insert_step"), - attachments: t("attachments"), - delete: t("delete"), - download: t("download"), - deleteFile: t("delete_file"), - clickToUpload: t("click_to_upload"), - orDragAndDrop: t("or_drag_and_drop"), - maxFileSize: t("max_file_size"), + backToCases: t('back_to_cases'), + updating: t('updating'), + update: t('update'), + basic: t('basic'), + title: t('title'), + pleaseEnterTitle: t('please_enter_title'), + description: t('description'), + testCaseDescription: t('test_case_description'), + priority: t('priority'), + critical: t('critical'), + high: t('high'), + medium: t('medium'), + low: t('low'), + type: t('type'), + other: t('other'), + security: t('security'), + performance: t('performance'), + accessibility: t('accessibility'), + functional: t('functional'), + acceptance: t('acceptance'), + usability: t('usability'), + smokeSanity: t('smoke_sanity'), + compatibility: t('compatibility'), + destructive: t('destructive'), + regression: t('regression'), + automated: t('automated'), + manual: t('manual'), + template: t('template'), + testDetail: t('test_detail'), + preconditions: t('preconditions'), + step: t('step'), + text: t('text'), + steps: t('steps'), + newStep: t('new_step'), + detailsOfTheStep: t('details_of_the_step'), + expectedResult: t('expected_result'), + deleteThisStep: t('delete_this_step'), + insertStep: t('insert_step'), + attachments: t('attachments'), + delete: t('delete'), + download: t('download'), + deleteFile: t('delete_file'), + clickToUpload: t('click_to_upload'), + orDragAndDrop: t('or_drag_and_drop'), + maxFileSize: t('max_file_size'), }; return ( diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/page.tsx index d30b9bc..421c727 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/page.tsx @@ -1,37 +1,28 @@ -import CasesPane from "./CasesPane"; -import { useTranslations } from "next-intl"; +import CasesPane from './CasesPane'; +import { useTranslations } from 'next-intl'; -export default function Page({ - params, -}: { - params: { projectId: string; folderId: string; locale: string }; -}) { - const t = useTranslations("Cases"); +export default function Page({ params }: { params: { projectId: string; folderId: string; locale: string } }) { + const t = useTranslations('Cases'); const messages = { - testCaseList: t("test_case_list"), - id: t("id"), - title: t("title"), - priority: t("priority"), - actions: t("actions"), - deleteCase: t("delete_case"), - delete: t("delete"), - newTestCase: t("new_test_case"), - status: t("status"), - critical: t("critical"), - high: t("high"), - medium: t("medium"), - low: t("low"), - noCasesFound: t("no_cases_found"), + testCaseList: t('test_case_list'), + id: t('id'), + title: t('title'), + priority: t('priority'), + actions: t('actions'), + deleteCase: t('delete_case'), + delete: t('delete'), + newTestCase: t('new_test_case'), + status: t('status'), + critical: t('critical'), + high: t('high'), + medium: t('medium'), + low: t('low'), + noCasesFound: t('no_cases_found'), }; return ( <> - + ); } diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/layout.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/layout.tsx index 890c2a7..5a4e0fa 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/layout.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/layout.tsx @@ -1,5 +1,5 @@ -import FoldersPane from "./FoldersPane"; -import { useTranslations } from "next-intl"; +import FoldersPane from './FoldersPane'; +import { useTranslations } from 'next-intl'; export default function FoldersLayout({ children, @@ -8,27 +8,23 @@ export default function FoldersLayout({ children: React.ReactNode; params: { projectId: string; locale: string }; }) { - const t = useTranslations("Folders"); + const t = useTranslations('Folders'); const messages = { - folder: t("folder"), - newFolder: t("new_folder"), - editFolder: t("edit_folder"), - deleteFolder: t("delete_folder"), - folderName: t("folder_name"), - folderDetail: t("folder_detail"), - close: t("close"), - create: t("create"), - update: t("update"), - pleaseEnter: t("please_enter"), + folder: t('folder'), + newFolder: t('new_folder'), + editFolder: t('edit_folder'), + deleteFolder: t('delete_folder'), + folderName: t('folder_name'), + folderDetail: t('folder_detail'), + close: t('close'), + create: t('create'), + update: t('update'), + pleaseEnter: t('please_enter'), }; return (
- +
{children}
); diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/page.tsx index a51e214..7bc998e 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/page.tsx @@ -1,7 +1,3 @@ export default function Page() { - return ( - <> - This is folders page. - - ); -} \ No newline at end of file + return <>This is folders page.; +} diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx index e099aa7..67330e1 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx @@ -1,10 +1,10 @@ -import React from "react"; -import { useState, useEffect } from "react"; -import dynamic from "next/dynamic"; -import { priorities } from "@/config/selection"; -import { CasePriorityCountType } from "@/types/case"; -import { HomeMessages } from "./page"; -const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); +import React from 'react'; +import { useState, useEffect } from 'react'; +import dynamic from 'next/dynamic'; +import { priorities } from '@/config/selection'; +import { CasePriorityCountType } from '@/types/case'; +import { HomeMessages } from './page'; +const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { priorityCounts: CasePriorityCountType[]; @@ -12,11 +12,7 @@ type Props = { theme: string; }; -export default function TestPriorityDonutChart({ - priorityCounts, - messages, - theme, -}: Props) { +export default function TestPriorityDonutChart({ priorityCounts, messages, theme }: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -38,10 +34,10 @@ export default function TestPriorityDonutChart({ const legend = { labels: { colors: priorities.map((entry) => { - if (theme === "light") { - return "black"; + if (theme === 'light') { + return 'black'; } else { - return "white"; + return 'white'; } }), }, @@ -57,13 +53,5 @@ export default function TestPriorityDonutChart({ updateChartDate(); }, [priorityCounts, theme]); - return ( - - ); + return ; } diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/TestProgressColumnChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/TestProgressColumnChart.tsx index d8e6fcf..ff09202 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/TestProgressColumnChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/TestProgressColumnChart.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useState, useEffect } from "react"; -import dynamic from "next/dynamic"; -import { ProgressSeriesType } from "@/types/run"; -import { testRunCaseStatus } from "@/config/selection"; -const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); +import React from 'react'; +import { useState, useEffect } from 'react'; +import dynamic from 'next/dynamic'; +import { ProgressSeriesType } from '@/types/run'; +import { testRunCaseStatus } from '@/config/selection'; +const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { progressSeries: ProgressSeriesType[]; @@ -11,11 +11,7 @@ type Props = { theme: string; }; -export default function TestProgressBarChart({ - progressSeries, - progressCategories, - theme, -}: Props) { +export default function TestProgressBarChart({ progressSeries, progressCategories, theme }: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -28,14 +24,14 @@ export default function TestProgressBarChart({ const updateChartDate = () => { if (progressSeries) { const legendsLabelColors = testRunCaseStatus.map((itr) => { - if (theme === "light") { - return "black"; + if (theme === 'light') { + return 'black'; } else { - return "white"; + return 'white'; } }); - const xaxisLabelColor = theme === "light" ? "black" : "white"; + const xaxisLabelColor = theme === 'light' ? 'black' : 'white'; setChartData({ series: progressSeries, @@ -47,7 +43,7 @@ export default function TestProgressBarChart({ stacked: true, }, legend: { - position: "right", + position: 'right', labels: { colors: legendsLabelColors, }, @@ -56,7 +52,7 @@ export default function TestProgressBarChart({ return itr.chartColor; }), xaxis: { - type: "datetime", + type: 'datetime', categories: progressCategories, labels: { style: { @@ -75,13 +71,5 @@ export default function TestProgressBarChart({ updateChartDate(); }, [progressSeries, progressCategories, theme]); - return ( - - ); + return ; } diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx index 0b391bd..a520162 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx @@ -1,10 +1,10 @@ -import React from "react"; -import { useState, useEffect } from "react"; -import dynamic from "next/dynamic"; -import { testTypes } from "@/config/selection"; -import { CaseTypeCountType } from "@/types/case"; -import { HomeMessages } from "./page"; -const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); +import React from 'react'; +import { useState, useEffect } from 'react'; +import dynamic from 'next/dynamic'; +import { testTypes } from '@/config/selection'; +import { CaseTypeCountType } from '@/types/case'; +import { HomeMessages } from './page'; +const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { typesCounts: CaseTypeCountType[]; @@ -12,11 +12,7 @@ type Props = { theme: string; }; -export default function TestTypesDonutChart({ - typesCounts, - messages, - theme, -}: Props) { +export default function TestTypesDonutChart({ typesCounts, messages, theme }: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -38,10 +34,10 @@ export default function TestTypesDonutChart({ const legend = { labels: { colors: testTypes.map((entry) => { - if (theme === "light") { - return "black"; + if (theme === 'light') { + return 'black'; } else { - return "white"; + return 'white'; } }), }, @@ -57,13 +53,5 @@ export default function TestTypesDonutChart({ updateChartDate(); }, [typesCounts, theme]); - return ( - - ); + return ; } diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/home.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/home.tsx index 878a9c1..243324c 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/home.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/home.tsx @@ -1,31 +1,26 @@ -"use client"; -import { useState, useEffect } from "react"; -import { Divider } from "@nextui-org/react"; -import { title, subtitle } from "@/components/primitives"; -import { Card, CardBody, Chip } from "@nextui-org/react"; -import { Folder, Clipboard, FlaskConical } from "lucide-react"; -import { CaseTypeCountType, CasePriorityCountType } from "@/types/case"; -import { ProgressSeriesType } from "@/types/run"; -import { HomeMessages } from "./page"; -import { - aggregateBasicInfo, - aggregateTestPriority, - aggregateTestType, - aggregateProgress, -} from "./aggregate"; -import TestTypesChart from "./TestTypesDonutChart"; -import TestPriorityChart from "./TestPriorityDonutChart"; -import TestProgressBarChart from "./TestProgressColumnChart"; -import Config from "@/config/config"; -import { useTheme } from "next-themes"; +'use client'; +import { useState, useEffect } from 'react'; +import { Divider } from '@nextui-org/react'; +import { title, subtitle } from '@/components/primitives'; +import { Card, CardBody, Chip } from '@nextui-org/react'; +import { Folder, Clipboard, FlaskConical } from 'lucide-react'; +import { CaseTypeCountType, CasePriorityCountType } from '@/types/case'; +import { ProgressSeriesType } from '@/types/run'; +import { HomeMessages } from './page'; +import { aggregateBasicInfo, aggregateTestPriority, aggregateTestType, aggregateProgress } from './aggregate'; +import TestTypesChart from './TestTypesDonutChart'; +import TestPriorityChart from './TestPriorityDonutChart'; +import TestProgressBarChart from './TestProgressColumnChart'; +import Config from '@/config/config'; +import { useTheme } from 'next-themes'; const apiServer = Config.apiServer; async function fetchProject(url) { try { const response = await fetch(url, { - method: "GET", + method: 'GET', headers: { - "Content-Type": "application/json", + 'Content-Type': 'application/json', }, }); @@ -36,7 +31,7 @@ async function fetchProject(url) { const data = await response.json(); return data; } catch (error: any) { - console.error("Error fetching data:", error.message); + console.error('Error fetching data:', error.message); } } @@ -48,8 +43,8 @@ type Props = { export function Home({ projectId, messages }: Props) { const { theme, setTheme } = useTheme(); const [project, setProject] = useState({ - name: "", - detail: "", + name: '', + detail: '', Folders: [{ Cases: [] }], Runs: [{ RunCases: [] }], }); @@ -57,8 +52,7 @@ export function Home({ projectId, messages }: Props) { const [caseNum, setCaseNum] = useState(0); const [runNum, setRunNum] = useState(0); const [typesCounts, setTypesCounts] = useState(); - const [priorityCounts, setPriorityCounts] = - useState(); + const [priorityCounts, setPriorityCounts] = useState(); const [progressCategories, setProgressCategories] = useState(); const [progressSeries, setProgressSeries] = useState(); const url = `${apiServer}/home/${projectId}`; @@ -69,7 +63,7 @@ export function Home({ projectId, messages }: Props) { const data = await fetchProject(url); setProject(data); } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } @@ -99,68 +93,41 @@ export function Home({ projectId, messages }: Props) { return (
-

{project.name}

+

{project.name}

- } - className="px-3" - > + } className="px-3"> {folderNum} {messages.folders} - } - className="px-3 ms-2" - > + } className="px-3 ms-2"> {caseNum} {messages.testCases} - } - className="px-3 ms-2" - > + } className="px-3 ms-2"> {runNum} {messages.testRuns}
{project.detail && ( - + {project.detail} )}

{messages.progress}

-
- +
+

{messages.testClassification}

-
+

{messages.byType}

- +
-
+

{messages.byPriority}

- +
diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx index 6af7e18..087a63d 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx @@ -1,5 +1,5 @@ -import { Home } from "./home"; -import { useTranslations } from "next-intl"; +import { Home } from './home'; +import { useTranslations } from 'next-intl'; export type HomeMessages = { folders: string; @@ -35,37 +35,37 @@ export type HomeMessages = { }; export default function Page({ params }: { params: { projectId: string } }) { - const t = useTranslations("Home"); + const t = useTranslations('Home'); const messages = { - folders: t("Folders"), - testCases: t("test_cases"), - testRuns: t("test_runs"), - progress: t("progress"), - untested: t("untested"), - passed: t("passed"), - failed: t("failed"), - retest: t("retest"), - skipped: t("skipped"), - testClassification: t("test_classification"), - byType: t("by_type"), - byPriority: t("by_priority"), - other: t("other"), - security: t("security"), - performance: t("performance"), - accessibility: t("accessibility"), - functional: t("functional"), - acceptance: t("acceptance"), - usability: t("usability"), - smokeSanity: t("smoke_sanity"), - compatibility: t("compatibility"), - destructive: t("destructive"), - regression: t("regression"), - automated: t("automated"), - manual: t("manual"), - critical: t("critical"), - high: t("high"), - medium: t("medium"), - low: t("low"), + folders: t('Folders'), + testCases: t('test_cases'), + testRuns: t('test_runs'), + progress: t('progress'), + untested: t('untested'), + passed: t('passed'), + failed: t('failed'), + retest: t('retest'), + skipped: t('skipped'), + testClassification: t('test_classification'), + byType: t('by_type'), + byPriority: t('by_priority'), + other: t('other'), + security: t('security'), + performance: t('performance'), + accessibility: t('accessibility'), + functional: t('functional'), + acceptance: t('acceptance'), + usability: t('usability'), + smokeSanity: t('smoke_sanity'), + compatibility: t('compatibility'), + destructive: t('destructive'), + regression: t('regression'), + automated: t('automated'), + manual: t('manual'), + critical: t('critical'), + high: t('high'), + medium: t('medium'), + low: t('low'), }; return ( <> diff --git a/frontend/src/app/[locale]/projects/[projectId]/layout.tsx b/frontend/src/app/[locale]/projects/[projectId]/layout.tsx index c702221..7210964 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/layout.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/layout.tsx @@ -1,5 +1,5 @@ -import Sidebar from "./Sidebar"; -import { useTranslations } from "next-intl"; +import Sidebar from './Sidebar'; +import { useTranslations } from 'next-intl'; export default function SidebarLayout({ children, @@ -8,11 +8,11 @@ export default function SidebarLayout({ children: React.ReactNode; params: { locale: string }; }) { - const t = useTranslations("Project"); + const t = useTranslations('Project'); const messages = { - home: t("home"), - testCases: t("test_cases"), - testRuns: t("test_runs"), + home: t('home'), + testCases: t('test_cases'), + testRuns: t('test_runs'), }; return ( diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx index b3c2072..ae978e9 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsPage.tsx @@ -1,10 +1,10 @@ -"use client"; -import { useEffect, useState } from "react"; -import { Button } from "@nextui-org/react"; -import { Plus } from "lucide-react"; -import RunsTable from "./RunsTable"; -import { fetchRuns, createRun, deleteRun } from "./runsControl"; -import { RunsMessages } from "@/types/run"; +'use client'; +import { useEffect, useState } from 'react'; +import { Button } from '@nextui-org/react'; +import { Plus } from 'lucide-react'; +import RunsTable from './RunsTable'; +import { fetchRuns, createRun, deleteRun } from './runsControl'; +import { RunsMessages } from '@/types/run'; type Props = { projectId: string; @@ -21,7 +21,7 @@ export default function RunsPage({ projectId, locale, messages }: Props) { const data = await fetchRuns(projectId); setRuns(data); } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } @@ -35,7 +35,7 @@ export default function RunsPage({ projectId, locale, messages }: Props) { updateRuns.push(newRun); setRuns(updateRuns); } catch (error: any) { - console.error("Error deleting run:", error); + console.error('Error deleting run:', error); } }; @@ -45,7 +45,7 @@ export default function RunsPage({ projectId, locale, messages }: Props) { const data = await fetchRuns(projectId); setRuns(data); } catch (error: any) { - console.error("Error deleting run:", error); + console.error('Error deleting run:', error); } }; @@ -54,24 +54,13 @@ export default function RunsPage({ projectId, locale, messages }: Props) {

{messages.runList}

-
- +
); } diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx index 6b502b1..7fc9cff 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/RunsTable.tsx @@ -1,4 +1,4 @@ -import { useState, useMemo, useCallback } from "react"; +import { useState, useMemo, useCallback } from 'react'; import { Table, TableHeader, @@ -12,11 +12,11 @@ import { DropdownMenu, DropdownItem, SortDescriptor, -} from "@nextui-org/react"; -import { Link, NextUiLinkClasses } from "@/src/navigation"; -import { MoreVertical } from "lucide-react"; -import { RunsMessages, RunType } from "@/types/run"; -import dayjs from "dayjs"; +} from '@nextui-org/react'; +import { Link, NextUiLinkClasses } from '@/src/navigation'; +import { MoreVertical } from 'lucide-react'; +import { RunsMessages, RunType } from '@/types/run'; +import dayjs from 'dayjs'; type Props = { projectId: string; @@ -26,24 +26,18 @@ type Props = { locale: string; }; -export default function RunsTable({ - projectId, - runs, - onDeleteRun, - messages, - locale, -}: Props) { +export default function RunsTable({ projectId, runs, onDeleteRun, messages, locale }: Props) { const headerColumns = [ - { name: messages.id, uid: "id", sortable: true }, - { name: messages.name, uid: "name", sortable: true }, - { name: messages.description, uid: "description", sortable: true }, - { name: messages.lastUpdate, uid: "updatedAt", sortable: true }, - { name: messages.actions, uid: "actions" }, + { name: messages.id, uid: 'id', sortable: true }, + { name: messages.name, uid: 'name', sortable: true }, + { name: messages.description, uid: 'description', sortable: true }, + { name: messages.lastUpdate, uid: 'updatedAt', sortable: true }, + { name: messages.actions, uid: 'actions' }, ]; const [sortDescriptor, setSortDescriptor] = useState({ - column: "id", - direction: "ascending", + column: 'id', + direction: 'ascending', }); const sortedItems = useMemo(() => { @@ -52,31 +46,27 @@ export default function RunsTable({ const second = b[sortDescriptor.column as keyof RunType] as number; const cmp = first < second ? -1 : first > second ? 1 : 0; - return sortDescriptor.direction === "descending" ? -cmp : cmp; + return sortDescriptor.direction === 'descending' ? -cmp : cmp; }); }, [sortDescriptor, runs]); const truncateText = (text: string, maxLength: number) => { - return text.length > maxLength ? text.slice(0, maxLength) + "..." : text; + return text.length > maxLength ? text.slice(0, maxLength) + '...' : text; }; const renderCell = useCallback((run: RunType, columnKey: Key) => { const cellValue = run[columnKey as keyof RunType]; switch (columnKey) { - case "id": + case 'id': return {cellValue}; - case "name": + case 'name': return ( - + {cellValue} ); - case "detail": + case 'detail': const maxLength = 20; const truncatedValue = truncateText(cellValue, maxLength); return ( @@ -84,9 +74,9 @@ export default function RunsTable({
{truncatedValue}
); - case "updatedAt": - return {dayjs(cellValue).format("YYYY/MM/DD HH:mm")}; - case "actions": + case 'updatedAt': + return {dayjs(cellValue).format('YYYY/MM/DD HH:mm')}; + case 'actions': return ( @@ -95,10 +85,7 @@ export default function RunsTable({ - onDeleteRun(run.id)} - > + onDeleteRun(run.id)}> {messages.deleteRun} @@ -111,18 +98,18 @@ export default function RunsTable({ const classNames = useMemo( () => ({ - wrapper: ["max-w-3xl"], - th: ["bg-transparent", "text-default-500", "border-b", "border-divider"], + wrapper: ['max-w-3xl'], + th: ['bg-transparent', 'text-default-500', 'border-b', 'border-divider'], td: [ // changing the rows border radius // first - "group-data-[first=true]:first:before:rounded-none", - "group-data-[first=true]:last:before:rounded-none", + 'group-data-[first=true]:first:before:rounded-none', + 'group-data-[first=true]:last:before:rounded-none', // middle - "group-data-[middle=true]:before:rounded-none", + 'group-data-[middle=true]:before:rounded-none', // last - "group-data-[last=true]:first:before:rounded-none", - "group-data-[last=true]:last:before:rounded-none", + 'group-data-[last=true]:first:before:rounded-none', + 'group-data-[last=true]:last:before:rounded-none', ], }), [] @@ -141,7 +128,7 @@ export default function RunsTable({ {(column) => ( {column.name} @@ -150,11 +137,7 @@ export default function RunsTable({ {(item) => ( - - {(columnKey) => ( - {renderCell(item, columnKey)} - )} - + {(columnKey) => {renderCell(item, columnKey)}} )} diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx index 9689044..28d8fde 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -1,7 +1,7 @@ -"use client"; -import React from "react"; -import { useState, useEffect } from "react"; -import { useRouter } from "@/src/navigation"; +'use client'; +import React from 'react'; +import { useState, useEffect } from 'react'; +import { useRouter } from '@/src/navigation'; import { Button, Input, @@ -17,28 +17,14 @@ import { Dropdown, DropdownMenu, DropdownItem, -} from "@nextui-org/react"; -import { - Save, - ArrowLeft, - Folder, - ChevronDown, - CopyPlus, - CopyMinus, - RotateCw, -} from "lucide-react"; -import RunProgressChart from "./RunPregressDonutChart"; -import TestCaseSelector from "./TestCaseSelector"; -import { testRunStatus } from "@/config/selection"; -import { - RunType, - RunCaseType, - RunCaseInfoType, - RunStatusCountType, - RunMessages, -} from "@/types/run"; -import { CaseType } from "@/types/case"; -import { FolderType } from "@/types/folder"; +} from '@nextui-org/react'; +import { Save, ArrowLeft, Folder, ChevronDown, CopyPlus, CopyMinus, RotateCw } from 'lucide-react'; +import RunProgressChart from './RunPregressDonutChart'; +import TestCaseSelector from './TestCaseSelector'; +import { testRunStatus } from '@/config/selection'; +import { RunType, RunCaseType, RunCaseInfoType, RunStatusCountType, RunMessages } from '@/types/run'; +import { CaseType } from '@/types/case'; +import { FolderType } from '@/types/folder'; import { fetchRun, updateRun, @@ -48,16 +34,16 @@ import { bulkCreateRunCases, deleteRunCase, bulkDeleteRunCases, -} from "../runsControl"; -import { fetchFolders } from "../../folders/foldersControl"; -import { fetchCases } from "../../folders/[folderId]/cases/caseControl"; -import { useTheme } from "next-themes"; +} from '../runsControl'; +import { fetchFolders } from '../../folders/foldersControl'; +import { fetchCases } from '../../folders/[folderId]/cases/caseControl'; +import { useTheme } from 'next-themes'; const defaultTestRun = { id: 0, - name: "", + name: '', configurations: 0, - description: "", + description: '', state: 0, projectId: 0, }; @@ -69,18 +55,12 @@ type Props = { locale: string; }; -export default function RunEditor({ - projectId, - runId, - messages, - locale, -}: Props) { +export default function RunEditor({ projectId, runId, messages, locale }: Props) { const { theme, setTheme } = useTheme(); const [testRun, setTestRun] = useState(defaultTestRun); const [folders, setFolders] = useState([]); const [runCases, setRunCases] = useState([]); - const [runStatusCounts, setRunStatusCounts] = - useState(); + const [runStatusCounts, setRunStatusCounts] = useState(); const [selectedKeys, setSelectedKeys] = useState(new Set([])); const [selectedFolder, setSelectedFolder] = useState({}); const [testcases, setTestCases] = useState([]); @@ -102,7 +82,7 @@ export default function RunEditor({ setFolders(foldersData); setSelectedFolder(foldersData[0]); } catch (error: any) { - console.error("Error in effect:", error.message); + console.error('Error in effect:', error.message); } } @@ -120,9 +100,7 @@ export default function RunEditor({ // Check if each testCase has an association with testRun // and add "isIncluded" property const updatedTestCasesData = testCasesData.map((testCase) => { - const runCase = latestRunCases.find( - (runCase) => runCase.caseId === testCase.id - ); + const runCase = latestRunCases.find((runCase) => runCase.caseId === testCase.id); const isIncluded = runCase ? true : false; const runStatus = runCase ? runCase.status : 0; @@ -135,7 +113,7 @@ export default function RunEditor({ setTestCases(updatedTestCasesData); } catch (error: any) { - console.error("Error fetching cases data:", error.message); + console.error('Error fetching cases data:', error.message); } } } @@ -155,10 +133,7 @@ export default function RunEditor({ }); }; - const handleIncludeExcludeCase = async ( - isInclude: boolean, - clickedTestCaseId: number - ) => { + const handleIncludeExcludeCase = async (isInclude: boolean, clickedTestCaseId: number) => { if (isInclude) { const createdRunCase = await createRunCase(runId, clickedTestCaseId); setRunCases((prevRunCases) => { @@ -167,9 +142,7 @@ export default function RunEditor({ } else { await deleteRunCase(runId, clickedTestCaseId); setRunCases((prevRunCases) => { - return prevRunCases.filter( - (runCase) => runCase.caseId !== clickedTestCaseId - ); + return prevRunCases.filter((runCase) => runCase.caseId !== clickedTestCaseId); }); } @@ -185,7 +158,7 @@ export default function RunEditor({ const handleBulkIncludeExcludeCases = async (isInclude: boolean) => { let keys: number[] = []; - if (selectedKeys === "all") { + if (selectedKeys === 'all') { keys = testcases.map((item) => item.id); } else { keys = Array.from(selectedKeys).map(Number); @@ -218,7 +191,7 @@ export default function RunEditor({ setSelectedKeys(new Set([])); }; - const baseClass = ""; + const baseClass = ''; const selectedClass = `${baseClass} bg-neutral-200 dark:bg-neutral-700`; return ( @@ -230,9 +203,7 @@ export default function RunEditor({ isIconOnly size="sm" className="rounded-full bg-neutral-50 dark:bg-neutral-600" - onPress={() => - router.push(`/projects/${projectId}/runs`, { locale: locale }) - } + onPress={() => router.push(`/projects/${projectId}/runs`, { locale: locale })} > @@ -272,11 +243,7 @@ export default function RunEditor({
- +
@@ -287,7 +254,7 @@ export default function RunEditor({ label={messages.title} value={testRun.name} isInvalid={isNameInvalid} - errorMessage={isNameInvalid ? messages.pleaseEnter : ""} + errorMessage={isNameInvalid ? messages.pleaseEnter : ''} onChange={(e) => { setTestRun({ ...testRun, name: e.target.value }); }} @@ -312,9 +279,7 @@ export default function RunEditor({ selectedKeys={[testRunStatus[testRun.state].uid]} onSelectionChange={(e) => { const selectedUid = e.anchorKey; - const index = testRunStatus.findIndex( - (template) => template.uid === selectedUid - ); + const index = testRunStatus.findIndex((template) => template.uid === selectedUid); setTestRun({ ...testRun, state: index }); }} label={messages.status} @@ -334,14 +299,10 @@ export default function RunEditor({
{messages.selectTestCase}
- {(selectedKeys.size > 0 || selectedKeys === "all") && ( + {(selectedKeys.size > 0 || selectedKeys === 'all') && ( - @@ -371,14 +332,8 @@ export default function RunEditor({ setSelectedFolder(folder)} - startContent={ - - } - className={ - selectedFolder && folder.id === selectedFolder.id - ? selectedClass - : baseClass - } + startContent={} + className={selectedFolder && folder.id === selectedFolder.id ? selectedClass : baseClass} > {folder.name} @@ -391,12 +346,8 @@ export default function RunEditor({ selectedKeys={selectedKeys} onSelectionChange={setSelectedKeys} onStatusChange={handleChangeStatus} - onIncludeCase={(includeTestId) => - handleIncludeExcludeCase(true, includeTestId) - } - onExcludeCase={(excludeCaseId) => - handleIncludeExcludeCase(false, excludeCaseId) - } + onIncludeCase={(includeTestId) => handleIncludeExcludeCase(true, includeTestId)} + onExcludeCase={(excludeCaseId) => handleIncludeExcludeCase(false, excludeCaseId)} messages={messages} />
diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx index 59db96a..3b0e143 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx @@ -1,9 +1,9 @@ -import React from "react"; -import { useState, useEffect } from "react"; -import dynamic from "next/dynamic"; -import { testRunCaseStatus } from "@/config/selection"; -import { RunStatusCountType, RunMessages } from "@/types/run"; -const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); +import React from 'react'; +import { useState, useEffect } from 'react'; +import dynamic from 'next/dynamic'; +import { testRunCaseStatus } from '@/config/selection'; +import { RunStatusCountType, RunMessages } from '@/types/run'; +const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { statusCounts: RunStatusCountType[]; @@ -11,11 +11,7 @@ type Props = { theme: string; }; -export default function RunProgressDounut({ - statusCounts, - messages, - theme, -}: Props) { +export default function RunProgressDounut({ statusCounts, messages, theme }: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -37,10 +33,10 @@ export default function RunProgressDounut({ const legend = { labels: { colors: testRunCaseStatus.map((entry) => { - if (theme === "light") { - return "black"; + if (theme === 'light') { + return 'black'; } else { - return "white"; + return 'white'; } }), }, @@ -56,13 +52,5 @@ export default function RunProgressDounut({ updateChartDate(); }, [statusCounts, theme]); - return ( - - ); + return ; } diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx index dd44a0a..d264add 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx @@ -1,4 +1,4 @@ -import { useState, useMemo } from "react"; +import { useState, useMemo } from 'react'; import { Table, TableHeader, @@ -13,7 +13,7 @@ import { DropdownItem, Selection, SortDescriptor, -} from "@nextui-org/react"; +} from '@nextui-org/react'; import { ChevronDown, MoreVertical, @@ -24,10 +24,10 @@ import { CircleDashed, CircleX, CircleSlash2, -} from "lucide-react"; -import { priorities, testRunCaseStatus } from "@/config/selection"; -import { CaseType } from "@/types/case"; -import { RunsMessages } from "@/types/run"; +} from 'lucide-react'; +import { priorities, testRunCaseStatus } from '@/config/selection'; +import { CaseType } from '@/types/case'; +import { RunsMessages } from '@/types/run'; type Props = { cases: CaseType[]; @@ -49,16 +49,16 @@ export default function TestCaseSelector({ messages, }: Props) { const headerColumns = [ - { name: messages.id, uid: "id", sortable: true }, - { name: messages.title, uid: "title", sortable: true }, - { name: messages.priority, uid: "priority", sortable: true }, - { name: messages.status, uid: "runStatus", sortable: true }, - { name: messages.actions, uid: "actions" }, + { name: messages.id, uid: 'id', sortable: true }, + { name: messages.title, uid: 'title', sortable: true }, + { name: messages.priority, uid: 'priority', sortable: true }, + { name: messages.status, uid: 'runStatus', sortable: true }, + { name: messages.actions, uid: 'actions' }, ]; const [sortDescriptor, setSortDescriptor] = useState({ - column: "id", - direction: "ascending", + column: 'id', + direction: 'ascending', }); const sortedItems = useMemo(() => { @@ -67,23 +67,23 @@ export default function TestCaseSelector({ const second = b[sortDescriptor.column as keyof CaseType] as number; const cmp = first < second ? -1 : first > second ? 1 : 0; - return sortDescriptor.direction === "descending" ? -cmp : cmp; + return sortDescriptor.direction === 'descending' ? -cmp : cmp; }); }, [sortDescriptor, cases]); - const notIncludedCaseClass = "text-neutral-200 dark:text-neutral-600"; - const chipBaseClass = "flex items-center text-default-600"; + const notIncludedCaseClass = 'text-neutral-200 dark:text-neutral-600'; + const chipBaseClass = 'flex items-center text-default-600'; const renderStatusIcon = (uid: string) => { - if (uid === "untested") { + if (uid === 'untested') { return ; - } else if (uid === "passed") { + } else if (uid === 'passed') { return ; - } else if (uid === "retest") { + } else if (uid === 'retest') { return ; - } else if (uid === "failed") { + } else if (uid === 'failed') { return ; - } else if (uid === "skipped") { + } else if (uid === 'skipped') { return ; } }; @@ -93,22 +93,18 @@ export default function TestCaseSelector({ const isIncluded = testCase.isIncluded; switch (columnKey) { - case "priority": + case 'priority': return ( -
+
{messages[priorities[cellValue].uid]}
); - case "runStatus": + case 'runStatus': return ( @@ -116,15 +112,10 @@ export default function TestCaseSelector({ size="sm" variant="light" isDisabled={!isIncluded} - startContent={ - isIncluded && - renderStatusIcon(testRunCaseStatus[cellValue].uid) - } + startContent={isIncluded && renderStatusIcon(testRunCaseStatus[cellValue].uid)} endContent={isIncluded && } > - - {isIncluded && messages[testRunCaseStatus[cellValue].uid]} - + {isIncluded && messages[testRunCaseStatus[cellValue].uid]} @@ -140,7 +131,7 @@ export default function TestCaseSelector({ ); - case "actions": + case 'actions': return ( @@ -173,18 +164,18 @@ export default function TestCaseSelector({ const classNames = useMemo( () => ({ - wrapper: ["min-w-3xl"], - th: ["bg-transparent", "text-default-500", "border-b", "border-divider"], + wrapper: ['min-w-3xl'], + th: ['bg-transparent', 'text-default-500', 'border-b', 'border-divider'], td: [ // changing the rows border radius // first - "group-data-[first=true]:first:before:rounded-none", - "group-data-[first=true]:last:before:rounded-none", + 'group-data-[first=true]:first:before:rounded-none', + 'group-data-[first=true]:last:before:rounded-none', // middle - "group-data-[middle=true]:before:rounded-none", + 'group-data-[middle=true]:before:rounded-none', // last - "group-data-[last=true]:first:before:rounded-none", - "group-data-[last=true]:last:before:rounded-none", + 'group-data-[last=true]:first:before:rounded-none', + 'group-data-[last=true]:last:before:rounded-none', ], }), [] @@ -211,7 +202,7 @@ export default function TestCaseSelector({ {(column) => ( {column.name} @@ -220,13 +211,8 @@ export default function TestCaseSelector({ {(item) => ( - - {(columnKey) => ( - {renderCell(item, columnKey)} - )} + + {(columnKey) => {renderCell(item, columnKey)}} )} diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx index b54e4ec..2151895 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx @@ -1,53 +1,42 @@ -import RunEditor from "./RunEditor"; -import { useTranslations } from "next-intl"; +import RunEditor from './RunEditor'; +import { useTranslations } from 'next-intl'; -export default function Page({ - params, -}: { - params: { projectId: string; runId: string; locale: string }; -}) { - const t = useTranslations("Run"); +export default function Page({ params }: { params: { projectId: string; runId: string; locale: string } }) { + const t = useTranslations('Run'); const messages = { - backToRuns: t("back_to_runs"), - updating: t("updating"), - update: t("update"), - progress: t("progress"), - refresh: t("refresh"), - id: t("id"), - title: t("title"), - pleaseEnter: t("please_enter"), - description: t("description"), - new: t("new"), - inProgress: t("inProgress"), - underReview: t("underReview"), - rejected: t("rejected"), - done: t("done"), - closed: t("closed"), - priority: t("priority"), - actions: t("actions"), - status: t("status"), - critical: t("critical"), - high: t("high"), - medium: t("medium"), - low: t("low"), - untested: t("untested"), - passed: t("passed"), - failed: t("failed"), - retest: t("retest"), - skipped: t("skipped"), - selectTestCase: t("select_test_case"), - testCaseSelection: t("test_case_selection"), - includeInRun: t("include_in_run"), - excludeFromRun: t("exclude_from_run"), - noCasesFound: t("no_cases_found"), + backToRuns: t('back_to_runs'), + updating: t('updating'), + update: t('update'), + progress: t('progress'), + refresh: t('refresh'), + id: t('id'), + title: t('title'), + pleaseEnter: t('please_enter'), + description: t('description'), + new: t('new'), + inProgress: t('inProgress'), + underReview: t('underReview'), + rejected: t('rejected'), + done: t('done'), + closed: t('closed'), + priority: t('priority'), + actions: t('actions'), + status: t('status'), + critical: t('critical'), + high: t('high'), + medium: t('medium'), + low: t('low'), + untested: t('untested'), + passed: t('passed'), + failed: t('failed'), + retest: t('retest'), + skipped: t('skipped'), + selectTestCase: t('select_test_case'), + testCaseSelection: t('test_case_selection'), + includeInRun: t('include_in_run'), + excludeFromRun: t('exclude_from_run'), + noCasesFound: t('no_cases_found'), }; - return ( - - ); + return ; } diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/page.tsx index 7e082de..e60ca87 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/page.tsx @@ -1,31 +1,23 @@ -import RunsPage from "./RunsPage"; -import { useTranslations } from "next-intl"; +import RunsPage from './RunsPage'; +import { useTranslations } from 'next-intl'; -export default function Page({ - params, -}: { - params: { projectId: string; locale: string }; -}) { - const t = useTranslations("Runs"); +export default function Page({ params }: { params: { projectId: string; locale: string } }) { + const t = useTranslations('Runs'); const messages = { - runList: t("run_list"), - id: t("id"), - name: t("name"), - description: t("description"), - lastUpdate: t("last_update"), - actions: t("actions"), - newRun: t("new_run"), - deleteRun: t("delete_run"), - noRunsFound: t("no_runs_found"), + runList: t('run_list'), + id: t('id'), + name: t('name'), + description: t('description'), + lastUpdate: t('last_update'), + actions: t('actions'), + newRun: t('new_run'), + deleteRun: t('delete_run'), + noRunsFound: t('no_runs_found'), }; return ( <> - + ); } diff --git a/frontend/src/app/[locale]/projects/layout.tsx b/frontend/src/app/[locale]/projects/layout.tsx index 7259ddf..9ed1a3f 100644 --- a/frontend/src/app/[locale]/projects/layout.tsx +++ b/frontend/src/app/[locale]/projects/layout.tsx @@ -1,7 +1,3 @@ -export default function ProjectsLayout({ - children, -}: { - children: React.ReactNode; -}) { +export default function ProjectsLayout({ children }: { children: React.ReactNode }) { return <>{children}; } diff --git a/frontend/src/app/[locale]/projects/page.tsx b/frontend/src/app/[locale]/projects/page.tsx index d6c0da0..4e30027 100644 --- a/frontend/src/app/[locale]/projects/page.tsx +++ b/frontend/src/app/[locale]/projects/page.tsx @@ -1,26 +1,26 @@ -import ProjectsPage from "./ProjectsPage"; -import { useTranslations } from "next-intl"; +import ProjectsPage from './ProjectsPage'; +import { useTranslations } from 'next-intl'; export default function Page(params: { locale: string }) { - const t = useTranslations("Projects"); + const t = useTranslations('Projects'); const messages = { - projectList: t("projectList"), - project: t("project"), - newProject: t("new_project"), - editProject: t("edit_project"), - deleteProject: t("delete_project"), - id: t("id"), - name: t("name"), - detail: t("detail"), - lastUpdate: t("last_update"), - actions: t("actions"), - projectName: t("project_name"), - projectDetail: t("project_detail"), - close: t("close"), - create: t("create"), - update: t("update"), - pleaseEnter: t("please_enter"), - noProjectsFound: t("no_projects_found"), + projectList: t('projectList'), + project: t('project'), + newProject: t('new_project'), + editProject: t('edit_project'), + deleteProject: t('delete_project'), + id: t('id'), + name: t('name'), + detail: t('detail'), + lastUpdate: t('last_update'), + actions: t('actions'), + projectName: t('project_name'), + projectDetail: t('project_detail'), + close: t('close'), + create: t('create'), + update: t('update'), + pleaseEnter: t('please_enter'), + noProjectsFound: t('no_projects_found'), }; return ( <> diff --git a/frontend/src/app/[locale]/providers.tsx b/frontend/src/app/[locale]/providers.tsx index 5202799..34d4c3f 100644 --- a/frontend/src/app/[locale]/providers.tsx +++ b/frontend/src/app/[locale]/providers.tsx @@ -1,13 +1,13 @@ -"use client"; +'use client'; -import * as React from "react"; -import { NextUIProvider } from "@nextui-org/react"; -import { useRouter } from "next/navigation"; -import { ThemeProvider as NextThemesProvider } from "next-themes"; -import { ThemeProviderProps } from "next-themes/dist/types"; +import * as React from 'react'; +import { NextUIProvider } from '@nextui-org/react'; +import { useRouter } from 'next/navigation'; +import { ThemeProvider as NextThemesProvider } from 'next-themes'; +import { ThemeProviderProps } from 'next-themes/dist/types'; -import TokenProvider from "./TokenProvider"; -import { TokenProps } from "@/types/user"; +import TokenProvider from './TokenProvider'; +import { TokenProps } from '@/types/user'; export interface ProvidersProps { children: React.ReactNode; diff --git a/package.json b/package.json index 74aee1f..a4f59f6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "private": true, "scripts": { - "format": "prettier --write frontend/**/*.{js,ts,json} backend/**/*.{js,ts,json}", + "format": "prettier --write frontend/**/*.{js,ts,jsx,tsx,json} backend/**/*.{js,ts,json}", "test": "vitest", "coverage": "vitest run --coverage" },