From d767a683631ad00a7450c5a55b39eff36a6db724 Mon Sep 17 00:00:00 2001 From: Rachel Braverman Date: Mon, 26 Feb 2024 17:49:30 +0200 Subject: [PATCH] change reload to restart --- .../assets/icons/toolbar/reloadOpen.svg | 8 ----- .../icons/toolbar/{reload.svg => restart.svg} | 0 .../{reloadDisable.svg => restartDisable.svg} | 0 .../{reloadHover.svg => restartHover.svg} | 0 library/math/numbersLine/src/App.tsx | 4 +-- .../numbersLine/src/components/Reload.tsx | 34 ------------------- .../numbersLine/src/components/Restart.tsx | 32 +++++++++++++++++ .../src/components/toolbar/IconsToolbar.tsx | 10 +++--- .../src/components/toolbar/LineDefinition.tsx | 4 +-- .../numbersLine/src/consts/elementConsts.ts | 4 +-- .../src/context/numbersLineContext.tsx | 14 ++++---- .../math/numbersLine/src/lib/stylesUtils.ts | 5 --- library/math/numbersLine/src/type/elements.ts | 2 +- 13 files changed, 51 insertions(+), 66 deletions(-) delete mode 100644 library/math/numbersLine/public/assets/icons/toolbar/reloadOpen.svg rename library/math/numbersLine/public/assets/icons/toolbar/{reload.svg => restart.svg} (100%) rename library/math/numbersLine/public/assets/icons/toolbar/{reloadDisable.svg => restartDisable.svg} (100%) rename library/math/numbersLine/public/assets/icons/toolbar/{reloadHover.svg => restartHover.svg} (100%) delete mode 100644 library/math/numbersLine/src/components/Reload.tsx create mode 100644 library/math/numbersLine/src/components/Restart.tsx delete mode 100644 library/math/numbersLine/src/lib/stylesUtils.ts diff --git a/library/math/numbersLine/public/assets/icons/toolbar/reloadOpen.svg b/library/math/numbersLine/public/assets/icons/toolbar/reloadOpen.svg deleted file mode 100644 index 6354e89..0000000 --- a/library/math/numbersLine/public/assets/icons/toolbar/reloadOpen.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/library/math/numbersLine/public/assets/icons/toolbar/reload.svg b/library/math/numbersLine/public/assets/icons/toolbar/restart.svg similarity index 100% rename from library/math/numbersLine/public/assets/icons/toolbar/reload.svg rename to library/math/numbersLine/public/assets/icons/toolbar/restart.svg diff --git a/library/math/numbersLine/public/assets/icons/toolbar/reloadDisable.svg b/library/math/numbersLine/public/assets/icons/toolbar/restartDisable.svg similarity index 100% rename from library/math/numbersLine/public/assets/icons/toolbar/reloadDisable.svg rename to library/math/numbersLine/public/assets/icons/toolbar/restartDisable.svg diff --git a/library/math/numbersLine/public/assets/icons/toolbar/reloadHover.svg b/library/math/numbersLine/public/assets/icons/toolbar/restartHover.svg similarity index 100% rename from library/math/numbersLine/public/assets/icons/toolbar/reloadHover.svg rename to library/math/numbersLine/public/assets/icons/toolbar/restartHover.svg diff --git a/library/math/numbersLine/src/App.tsx b/library/math/numbersLine/src/App.tsx index b78d265..2faca0c 100644 --- a/library/math/numbersLine/src/App.tsx +++ b/library/math/numbersLine/src/App.tsx @@ -5,7 +5,7 @@ import Toolbar from "./components/Toolbar"; import ShowElements from "./components/ShowElements"; import { useNumbersLineContext } from "./context/numbersLineContext"; import { useEffect } from "react"; -import Reload from "./components/Reload"; +import Restart from "./components/Restart"; const App = () => { const { setIdDraggElementClick } = useNumbersLineContext(); @@ -24,7 +24,7 @@ const App = () => { return ( <> - +
diff --git a/library/math/numbersLine/src/components/Reload.tsx b/library/math/numbersLine/src/components/Reload.tsx deleted file mode 100644 index 5fceaff..0000000 --- a/library/math/numbersLine/src/components/Reload.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from "../components/ui/alert-dialog"; -import { useNumbersLineContext } from "../context/numbersLineContext"; -import { useAction } from "../hooks/useAction"; - -const Reload = () => { - const { typeRuler, openReloadDialog, setOpenReloadDialog, setTypeRulerChange } = useNumbersLineContext(); - const { initialization } = useAction(); - - return ( - <> - - - - ?אתם רוצים להתחיל מחדש - - - setTypeRulerChange(typeRuler)}>הישארו - מחק הכל - - - - - ); -}; - -export default Reload; diff --git a/library/math/numbersLine/src/components/Restart.tsx b/library/math/numbersLine/src/components/Restart.tsx new file mode 100644 index 0000000..ceaa395 --- /dev/null +++ b/library/math/numbersLine/src/components/Restart.tsx @@ -0,0 +1,32 @@ +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from "./ui/alert-dialog"; +import { useNumbersLineContext } from "../context/numbersLineContext"; +import { useAction } from "../hooks/useAction"; + +const Restart = () => { + const { typeRuler, openRestartDialog, setOpenRestartDialog, setTypeRulerChange } = useNumbersLineContext(); + const { initialization } = useAction(); + + return ( + + + + ?אתם רוצים להתחיל מחדש + + + setTypeRulerChange(typeRuler)}>הישארו + מחק הכל + + + + ); +}; + +export default Restart; diff --git a/library/math/numbersLine/src/components/toolbar/IconsToolbar.tsx b/library/math/numbersLine/src/components/toolbar/IconsToolbar.tsx index b652a06..de4055c 100644 --- a/library/math/numbersLine/src/components/toolbar/IconsToolbar.tsx +++ b/library/math/numbersLine/src/components/toolbar/IconsToolbar.tsx @@ -23,8 +23,8 @@ const IconsToolbar = ({ typeAction, iconUrl, isDragged }: IProps) => { dragElements, setDragElements, idDraggElementClick, - openReloadDialog, - setOpenReloadDialog, + openRestartDialog, + setOpenRestartDialog, visitableDisplayButton, } = useNumbersLineContext(); const wrapperRef = useRef(null); @@ -45,8 +45,8 @@ const IconsToolbar = ({ typeAction, iconUrl, isDragged }: IProps) => { }, [idDraggElementClick]); const getSrc = () => { - const isClicked = typeAction === ActionTypes.reload ? openReloadDialog : isOpen; - const isDisabled = typeAction === ActionTypes.reload && dragElements.length == 0 && visitableDisplayButton == TypeCover.allDiscover; + const isClicked = typeAction === ActionTypes.restart ? openRestartDialog : isOpen; + const isDisabled = typeAction === ActionTypes.restart && dragElements.length == 0 && visitableDisplayButton == TypeCover.allDiscover; const dotIndex = iconUrl.indexOf("."); const beforeDot = iconUrl.substring(0, dotIndex); return isClicked ? beforeDot + "Open.svg" : isHovered ? beforeDot + "Hover.svg" : isDisabled ? beforeDot + "Disable.svg" : iconUrl; @@ -80,7 +80,7 @@ const IconsToolbar = ({ typeAction, iconUrl, isDragged }: IProps) => { addDraggableElement(); return; } - typeAction == ActionTypes.reload ? setOpenReloadDialog(true) : setIsOpen((prevOpen) => !prevOpen); + typeAction == ActionTypes.restart ? setOpenRestartDialog(true) : setIsOpen((prevOpen) => !prevOpen); }; return ( diff --git a/library/math/numbersLine/src/components/toolbar/LineDefinition.tsx b/library/math/numbersLine/src/components/toolbar/LineDefinition.tsx index 3424d9f..71bbe0b 100644 --- a/library/math/numbersLine/src/components/toolbar/LineDefinition.tsx +++ b/library/math/numbersLine/src/components/toolbar/LineDefinition.tsx @@ -17,7 +17,7 @@ const LineDefinition = () => { setLeftPosition, dragElements, visitableDisplayButton, - setOpenReloadDialog, + setOpenRestartDialog, setTypeRulerChange, } = useNumbersLineContext(); const wrapperRef = useRef(null); @@ -48,7 +48,7 @@ const LineDefinition = () => { setLeftPosition(0); } else { setTypeRulerChange(type); - setOpenReloadDialog(true); + setOpenRestartDialog(true); } }; diff --git a/library/math/numbersLine/src/consts/elementConsts.ts b/library/math/numbersLine/src/consts/elementConsts.ts index 444b343..4930554 100644 --- a/library/math/numbersLine/src/consts/elementConsts.ts +++ b/library/math/numbersLine/src/consts/elementConsts.ts @@ -4,13 +4,13 @@ import text from "/assets/icons/toolbar/text.svg"; import writing from "/assets/icons/toolbar/writing.svg"; import eye from "/assets/icons/toolbar/eye.svg"; import naviAndKani from "/assets/icons/toolbar/naviAndKani.svg"; -import reload from "/assets/icons/toolbar/reload.svg"; +import restart from "/assets/icons/toolbar/restart.svg"; import { LineRange } from "@/type/ruler"; export const actionIconsDetials: IActionIcon[] = [ { type: ActionTypes.naviAndKani, url: naviAndKani, isDragged: true }, { type: ActionTypes.displayNumbersLine, url: eye }, - { type: ActionTypes.reload, url: reload }, + { type: ActionTypes.restart, url: restart }, { type: ActionTypes.writing, url: writing }, { type: ActionTypes.text, url: text, isDragged: true }, { type: ActionTypes.jump, url: jump, isDragged: true }, diff --git a/library/math/numbersLine/src/context/numbersLineContext.tsx b/library/math/numbersLine/src/context/numbersLineContext.tsx index 4a40419..3f1eaf7 100644 --- a/library/math/numbersLine/src/context/numbersLineContext.tsx +++ b/library/math/numbersLine/src/context/numbersLineContext.tsx @@ -21,8 +21,8 @@ interface INumbersLineContextProps { setCoverSituation: (v: TypeCover) => void; visitableDisplayButton: TypeCover; setVisitableDisplayButton: (v: TypeCover) => void; - openReloadDialog: boolean; - setOpenReloadDialog: (v: boolean) => void; + openRestartDialog: boolean; + setOpenRestartDialog: (v: boolean) => void; } export const NumbersLineContext = React.createContext({ @@ -43,8 +43,8 @@ export const NumbersLineContext = React.createContext({ setCoverSituation: () => null, visitableDisplayButton: {} as TypeCover, setVisitableDisplayButton: () => null, - openReloadDialog: {} as boolean, - setOpenReloadDialog: () => null, + openRestartDialog: {} as boolean, + setOpenRestartDialog: () => null, } as INumbersLineContextProps); export const NumbersLineContexProvider = (props: any) => { @@ -56,7 +56,7 @@ export const NumbersLineContexProvider = (props: any) => { const [idDraggElementClick, setIdDraggElementClick] = useState(""); const [coverSituation, setCoverSituation] = useState(TypeCover.allDiscover); const [visitableDisplayButton, setVisitableDisplayButton] = useState(TypeCover.allDiscover); - const [openReloadDialog, setOpenReloadDialog] = useState(false); + const [openRestartDialog, setOpenRestartDialog] = useState(false); const [rulerPaddingSides, setRulerPaddingSides] = useState(RulerPaddingSides); const Resize = () => { @@ -91,8 +91,8 @@ export const NumbersLineContexProvider = (props: any) => { setCoverSituation, visitableDisplayButton, setVisitableDisplayButton, - openReloadDialog, - setOpenReloadDialog, + openRestartDialog, + setOpenRestartDialog, }} > {props.children} diff --git a/library/math/numbersLine/src/lib/stylesUtils.ts b/library/math/numbersLine/src/lib/stylesUtils.ts deleted file mode 100644 index fff8ec8..0000000 --- a/library/math/numbersLine/src/lib/stylesUtils.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { baseJumpClassName } from "../styles/jump"; - -export const MatchBaseJumpClassName = (underRuler: boolean) => { - return underRuler ? baseJumpClassName + " bg-[#F48460] mb-[1rem]" : baseJumpClassName + " bg-[#009FDE] mt-[1rem]"; -}; diff --git a/library/math/numbersLine/src/type/elements.ts b/library/math/numbersLine/src/type/elements.ts index 0661a3b..88c14f3 100644 --- a/library/math/numbersLine/src/type/elements.ts +++ b/library/math/numbersLine/src/type/elements.ts @@ -15,7 +15,7 @@ export enum ActionTypes { writing = "writing", displayNumbersLine = "displayNumbersLine", naviAndKani = "naviAndKani", - reload = "reload", + restart = "restart", } export interface IActionIcon {