Skip to content

Commit

Permalink
Deployment issues #2
Browse files Browse the repository at this point in the history
  • Loading branch information
david emioma committed May 7, 2024
1 parent b38f355 commit 49786b8
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 434 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ const ProductContent = ({ product }: Props) => {
)}
</div>

<div
className="text-sm mt-2 mb-3"
dangerouslySetInnerHTML={{ __html: product.description }}
/>
<p className="my-2">{product.description}</p>

<div className="text-lg">
{curProductItem?.discount ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useState, useEffect } from "react";
import React from "react";
import AddBtn from "./AddBtn";
import { toast } from "sonner";
import axios, { AxiosError } from "axios";
Expand All @@ -11,7 +11,6 @@ import { Available, Size } from "@prisma/client";
import { useMutation } from "@tanstack/react-query";
import SizeModal from "@/components/modal/SizeModal";
import { ProductValidator } from "@/lib/validators/product";
import TooltipContainer from "@/components/TooltipContainer";
import { UseFormReturn, useFieldArray, Controller } from "react-hook-form";
import {
Select,
Expand Down Expand Up @@ -48,8 +47,6 @@ const AvailableForm = ({
}: Props) => {
const params = useParams();

const [mounted, setMounted] = useState(false);

const { fields, append, remove } = useFieldArray({
control: form.control,
name: `productItems.${index}.availableItems`,
Expand Down Expand Up @@ -78,32 +75,24 @@ const AvailableForm = ({
},
});

useEffect(() => {
setMounted(true);
}, []);

if (!mounted) return null;

return (
<div className="space-y-2">
<div className="flex items-center gap-2">
<h4 className="text-lg font-bold">Add Size</h4>

<TooltipContainer message="Add sizes for product items with unique prices">
<AddBtn
onClick={() =>
append({
id: "",
sizeId: "",
price: 0,
numInStocks: 0,
})
}
testId="add-new-size"
cypressTestId={`${testId}-add`}
disabled={disabled || isPending}
/>
</TooltipContainer>
<AddBtn
onClick={() =>
append({
id: "",
sizeId: "",
price: 0,
numInStocks: 0,
})
}
testId="add-new-size"
cypressTestId={`${testId}-add`}
disabled={disabled || isPending}
/>
</div>

<div className="space-y-6">
Expand All @@ -123,9 +112,7 @@ const AvailableForm = ({
<span>Size</span>

<SizeModal>
<TooltipContainer message="Add a new size">
<AddBtn disabled={disabled || isPending} />
</TooltipContainer>
<AddBtn disabled={disabled || isPending} />
</SizeModal>
</FormLabel>

Expand Down
Loading

0 comments on commit 49786b8

Please sign in to comment.