chore: update app version and enhance UI components
- Bumped NEXT_PUBLIC_APP_VERSION to 2.0.3 for the latest release. - Improved Cypress test for customer feedback page to handle delayed route transitions. - Refactored CompanyDetailsPage to enhance layout and added new components for better structure. - Updated TenderDetails to conditionally render location and currency information based on validity checks. - Added data-cy attributes to various form elements and tables for improved testing capabilities.
This commit is contained in:
@@ -30,6 +30,7 @@ const CompanyCategoryListFilters = ({
|
||||
return (
|
||||
<form
|
||||
className="grid !min-w-full grid-cols-1 gap-4 xl:grid-cols-2"
|
||||
data-cy="company-categories-filter-form"
|
||||
onSubmit={handleFilterSubmit(search)}
|
||||
>
|
||||
<InputGroup
|
||||
@@ -38,6 +39,7 @@ const CompanyCategoryListFilters = ({
|
||||
label="search"
|
||||
placeholder="Search"
|
||||
type="search"
|
||||
dataCy="company-categories-filter-search-input"
|
||||
/>
|
||||
<Select
|
||||
{...filterRegister("published")}
|
||||
@@ -51,11 +53,13 @@ const CompanyCategoryListFilters = ({
|
||||
clearable
|
||||
value={watch("published")}
|
||||
onClear={() => setValue("published", undefined)}
|
||||
dataCy="company-categories-filter-published-select"
|
||||
/>
|
||||
|
||||
<div className="flex gap-4">
|
||||
<button
|
||||
type="submit"
|
||||
data-cy="company-categories-filter-submit-button"
|
||||
className="mt-6 flex w-fit justify-center rounded-lg bg-primary p-[13px] font-medium capitalize text-white hover:bg-opacity-90"
|
||||
>
|
||||
{isMutating ? (
|
||||
@@ -66,6 +70,7 @@ const CompanyCategoryListFilters = ({
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-cy="company-categories-filter-close-button"
|
||||
className="mt-6 flex w-fit justify-center rounded-lg bg-error p-[13px] font-medium capitalize text-white hover:bg-opacity-90"
|
||||
onClick={() => setIsFilterModalOpen(false)}
|
||||
>
|
||||
|
||||
@@ -47,12 +47,13 @@ const CompanyCategoriesTable = () => {
|
||||
} = useCompanyCategoriesPresenter();
|
||||
|
||||
return (
|
||||
<ListWrapper>
|
||||
<ListWrapper data-cy="company-categories-page">
|
||||
<ListHeader
|
||||
onFilter={() => setIsFilterModalOpen(true)}
|
||||
createButtonText="Create Category"
|
||||
dataCyPrefix="company-categories"
|
||||
/>
|
||||
<Table>
|
||||
<Table data-cy="company-categories-table">
|
||||
<TableHeader>
|
||||
<TableRow className="border-none uppercase [&>th]:text-start">
|
||||
<TableHead colSpan={100}>Row</TableHead>
|
||||
@@ -73,6 +74,7 @@ const CompanyCategoriesTable = () => {
|
||||
{optimisticCategories.map((category, index) => (
|
||||
<TableRow
|
||||
key={category.id}
|
||||
data-cy={`company-categories-table-row-${category.id}`}
|
||||
className="odd:bg-gray-2 dark:odd:bg-gray-7"
|
||||
>
|
||||
<TableCell colSpan={100}>
|
||||
@@ -84,8 +86,10 @@ const CompanyCategoriesTable = () => {
|
||||
{unixToDate({ unix: category.created_at, hasTime: true })}
|
||||
</TableCell>
|
||||
<TableCell colSpan={100}>
|
||||
{/* Published: flip UI immediately via useOptimistic; if togglePublished rejects, React rolls the optimistic row back. */}
|
||||
<Switch
|
||||
withIcon
|
||||
dataCy={`company-categories-published-toggle-${category.id}`}
|
||||
onToggle={() => {}}
|
||||
onChange={() => {
|
||||
const nextPublished = !category.published;
|
||||
@@ -94,7 +98,11 @@ const CompanyCategoriesTable = () => {
|
||||
id: category.id,
|
||||
published: nextPublished,
|
||||
});
|
||||
await togglePublished(category.id);
|
||||
try {
|
||||
await togglePublished(category.id);
|
||||
} catch {
|
||||
// useOptimistic automatically reverts when the transition ends
|
||||
}
|
||||
});
|
||||
}}
|
||||
checked={category.published}
|
||||
@@ -103,6 +111,8 @@ const CompanyCategoriesTable = () => {
|
||||
<TableCell className="text-start xl:pr-7.5">
|
||||
<div className="flex items-center justify-start gap-x-3.5">
|
||||
<button
|
||||
type="button"
|
||||
data-cy={`company-categories-row-delete-${category.id}`}
|
||||
data-tooltip-id="delete"
|
||||
data-tooltip-content="Delete"
|
||||
data-tooltip-place="top"
|
||||
@@ -117,6 +127,8 @@ const CompanyCategoriesTable = () => {
|
||||
<TrashIcon />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-cy={`company-categories-row-edit-${category.id}`}
|
||||
data-tooltip-id="edit"
|
||||
data-tooltip-content="Edit"
|
||||
data-tooltip-place="top"
|
||||
|
||||
@@ -87,6 +87,12 @@ const TendersTable = () => {
|
||||
<TableCell className="text-start" colSpan={100}>
|
||||
{item.country_code}
|
||||
</TableCell>
|
||||
<TableCell className="text-start" colSpan={100}>
|
||||
{unixToDate({
|
||||
unix: item.publication_date,
|
||||
hasTime: true,
|
||||
})}
|
||||
</TableCell>
|
||||
<TableCell className="text-start" colSpan={100}>
|
||||
{unixToDate({
|
||||
unix: item.submission_deadline,
|
||||
|
||||
@@ -57,6 +57,7 @@ const useTenderListPresenter = () => {
|
||||
"row",
|
||||
"title",
|
||||
"country code",
|
||||
"publication date",
|
||||
"submission deadline",
|
||||
"tender deadline",
|
||||
"created at",
|
||||
|
||||
Reference in New Issue
Block a user