Skip to content

Commit

Permalink
refactor(input, buttons and host-directories): 🎉 update inputs cf-but…
Browse files Browse the repository at this point in the history
…tons, upgrade host directories component
  • Loading branch information
gokhangunduz committed Nov 8, 2023
1 parent 85efb27 commit 6327d9e
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 27 deletions.
18 changes: 18 additions & 0 deletions src/components/CFDellButton/CFDellButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { ReactElement } from "react";
import { IoTrashBinOutline } from "react-icons/io5";

interface ICFDellButton {
disabled?: boolean;
onClick: () => void;
}

export default function CFDellButton({
disabled,
onClick,
}: ICFDellButton): ReactElement {
return (
<button disabled={disabled} onClick={onClick}>
<IoTrashBinOutline color={disabled ? "gray" : "red"} size={18} />
</button>
);
}
13 changes: 5 additions & 8 deletions src/components/CFHostDirectoriesInput/CFHostDirectoriesInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement } from "react";
import FormInputText from "../FormInputText/FormInputText";
import { IDetails } from "../../interfaces/robotInterfaces";
import { FormikProps } from "formik/dist/types";
import CreateRobotFormDeleteButton from "../CreateRobotFormDeleteButton/CreateRobotFormDeleteButton";
import CFDellButton from "../CFDellButton/CFDellButton";

interface ICFHostDirectoriesInput {
index: number;
Expand All @@ -15,10 +15,8 @@ export default function CFHostDirectoriesInput({
formik,
disabled,
}: ICFHostDirectoriesInput): ReactElement {
console.log("formik.getFieldProps", formik.values.hostDirectories);

return (
<div className="flex w-full rounded-md border border-layer-light-100 p-4">
<div className="flex w-full gap-3 rounded-md border border-layer-light-100 p-4">
<FormInputText
labelName="Host Directory:"
labelInfoTip="Type a host directory."
Expand All @@ -45,15 +43,14 @@ export default function CFHostDirectoriesInput({
inputTouched={formik.touched.hostDirectories?.[index]?.mountPath}
/>

<div className="flex items-center justify-center text-sm text-layer-light-800">
<CreateRobotFormDeleteButton
text="Delete"
<div className="flex items-center justify-center pt-2.5 text-sm text-layer-light-800">
<CFDellButton
disabled={disabled}
onClick={() => {
const hostDirectories = [...formik.values.hostDirectories];
hostDirectories.splice(index, 1);
formik.setFieldValue("hostDirectories", hostDirectories);
}}
disabled={disabled}
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CardLayout from "../../layouts/CardLayout";
import { FullScreen, useFullScreenHandle } from "react-full-screen";
import { useAppSelector } from "../../hooks/redux";
import useRobot from "../../hooks/useRobot";
import RestartService from "../RestartService/RestartService";
import RestartService from "../RestartServiceButton/RestartServiceButton";
import FullScreenButton from "../FullScreenButton/FullScreenButton";

export default function CodeEditor(): ReactElement {
Expand Down
6 changes: 1 addition & 5 deletions src/components/Connections/Connections.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, useEffect } from "react";
import React, { ReactElement } from "react";
import useRobot from "../../hooks/useRobot";
import StateCell from "../TableInformationCells/StateCell";
import ConnectionLabel from "../ConnectionLabel/ConnectionLabel";
Expand All @@ -8,10 +8,6 @@ export default function Connections(): ReactElement {
const { responseRobot, isSettedCookie } = useRobot();
const { keycloak } = useKeycloak();

useEffect(() => {
console.log("isSettedCookie", isSettedCookie);
}, [isSettedCookie]);

return (
<div className="flex gap-4">
<div className="flex gap-1" id="ide">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function CreateRobotFormAddButton({
<BsPlusCircle
title={description}
onClick={disabled ? () => {} : onClick}
size={22}
size={18}
className={`animate__animated animate__fadeIn mx-auto mt-4 cursor-pointer transition-all duration-500 ${
disabled
? "text-layer-light-600 hover:cursor-not-allowed"
Expand Down
6 changes: 3 additions & 3 deletions src/components/FullScreenButton/FullScreenButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default function FullScreenButton({
handleFullScreen,
}: IFullScreenButton) {
return (
<div
className="flex cursor-pointer flex-col items-center text-layer-light-700 transition-all duration-200 hover:scale-90 hover:text-layer-primary-400"
<button
className="flex cursor-pointer flex-col items-center gap-1 text-layer-light-700 transition-all duration-200 hover:scale-90 hover:text-layer-primary-400"
onClick={handleFullScreen}
>
{isFullScreen ? (
Expand All @@ -26,6 +26,6 @@ export default function FullScreenButton({
/>
)}
<p className="text-[0.66rem]">Full Screen</p>
</div>
</button>
);
}
2 changes: 1 addition & 1 deletion src/components/InputText/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function InputText({
<input
autoComplete="off"
disabled={disabled}
className={`h-10 w-full rounded-md border border-layer-light-300 p-3
className={`h-9 w-full rounded-md border border-layer-light-300 p-3
text-sm outline-none
transition-all duration-500 focus:ring-2 focus:ring-primary disabled:cursor-not-allowed ${className}`}
type={type || "text"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ interface IMarketplaceSingleİtemHeader {
export default function MarketplaceSingleİtemHeader({
responseItem,
}: IMarketplaceSingleİtemHeader): ReactElement {
console.log(responseItem);

return (
<CardLayout className="col-span-1 h-52 p-4">
<div className="flex h-full items-center gap-6">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IoIosArrowUp, IoIosArrowDown } from "react-icons/io";
import RestartService from "../RestartService/RestartService";
import RestartService from "../RestartServiceButton/RestartServiceButton";
import VolumeControl from "../VolumeControl/VolumeControl";
import { ReactElement, useState } from "react";
import { useKeycloak } from "@react-keycloak/web";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export default function RestartService({ type }: IRestartService) {
const [isOpenedModal, setIsOpenedModal] = useState<boolean>(false);

return (
<div className="flex cursor-pointer flex-col items-center text-layer-light-700 transition-all duration-200 hover:scale-90 hover:text-layer-primary-400">
<IoReloadOutline size={26} onClick={() => setIsOpenedModal(true)} />
<button className="flex cursor-pointer flex-col items-center gap-1 text-layer-light-700 transition-all duration-200 hover:scale-90 hover:text-layer-primary-400">
<IoReloadOutline size={24} onClick={() => setIsOpenedModal(true)} />
<p className="text-[0.66rem]">{type === "soft-vdi" && "Soft"} Restart </p>
{isOpenedModal && (
<RestartServiceModal
type={type}
handleCloseModal={() => setIsOpenedModal(false)}
/>
)}
</div>
</button>
);
}
4 changes: 2 additions & 2 deletions src/contexts/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default ({ children }: any) => {
const url = useLocation();

const [sidebarState, setSidebarState] = useState<ISidebarState>({
isOpen: true,
isCreateMode: true,
isOpen: false,
isCreateMode: false,
page: undefined,
instanceTab: "Cloud Instances",
});
Expand Down

0 comments on commit 6327d9e

Please sign in to comment.