This commit is contained in:
karimalden 2024-07-29 14:45:08 +03:00
parent 1d113ad047
commit 6977912c7f
2 changed files with 10 additions and 4 deletions

View File

@ -11,7 +11,7 @@ export const getInitialValues = (objectToEdit: any | null = null): any => {
key: objectToEdit?.key ,
type: objectToEdit?.type ,
value: objectToEdit?.value ,
value_type: objectToEdit?.key === "home_main_image" ? "image" : "text" ,
value_type: objectToEdit?.key === "home_main_image" || objectToEdit?.key === "portfolio" ? "image" : "text" ,
};

View File

@ -5,6 +5,8 @@ import Actions from "../../Components/Ui/tables/Actions";
import { useNavigate } from "react-router-dom";
import { useDeleteKey } from "../../api/Key";
import ColumnsImage from "../../Components/Columns/ColumnsImage";
import { FaFile } from "react-icons/fa";
import { ImageBaseURL } from "../../api/config";
const useTableColumns :any = () => {
@ -39,10 +41,14 @@ const useTableColumns :any = () => {
sortable: false,
center: true,
cell: (row:any) => {
if (row?.value.startsWith("/")) {
if (row?.key === "portfolio") {
let src = row?.value;
return <a target="_blank" rel="noreferrer" href={ImageBaseURL + src}> <FaFile /> </a>
} else if(row?.value.startsWith("/")){
let src = row?.value;
return <ColumnsImage src={src} />
} else {
} else{
return <div className="single-line-div">{row?.value} </div> ;
}
}