|
|
|
@ -4,6 +4,7 @@ import { useAppSelector } from "../store";
|
|
|
|
|
import * as utils from "../helpers/utils";
|
|
|
|
|
import useToggle from "../hooks/useToggle";
|
|
|
|
|
import useLoading from "../hooks/useLoading";
|
|
|
|
|
import Only from "./common/OnlyWhen";
|
|
|
|
|
import toastHelper from "./Toast";
|
|
|
|
|
import showCreateShortcutDialog from "./CreateShortcutDialog";
|
|
|
|
|
import "../less/shortcut-list.less";
|
|
|
|
@ -38,11 +39,11 @@ const ShortcutList: React.FC<Props> = () => {
|
|
|
|
|
<div className="shortcuts-wrapper">
|
|
|
|
|
<p className="title-text">
|
|
|
|
|
<span className="normal-text">Shortcuts</span>
|
|
|
|
|
{userService.isNotVisitor() && (
|
|
|
|
|
<Only when={!userService.isVisitorMode()}>
|
|
|
|
|
<span className="btn" onClick={() => showCreateShortcutDialog()}>
|
|
|
|
|
<img src="/icons/add.svg" alt="add shortcut" />
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</Only>
|
|
|
|
|
</p>
|
|
|
|
|
<div className="shortcuts-container">
|
|
|
|
|
{sortedShortcuts.map((s) => {
|
|
|
|
@ -66,9 +67,6 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
|
|
|
|
|
if (isActive) {
|
|
|
|
|
locationService.setMemoShortcut(undefined);
|
|
|
|
|
} else {
|
|
|
|
|
if (!["/"].includes(locationService.getState().pathname)) {
|
|
|
|
|
locationService.setPathname("/");
|
|
|
|
|
}
|
|
|
|
|
locationService.setMemoShortcut(shortcut.id);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -116,30 +114,28 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
|
|
|
|
|
<div className="shortcut-text-container">
|
|
|
|
|
<span className="shortcut-text">{shortcut.title}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{userService.isNotVisitor() && (
|
|
|
|
|
<div className="btns-container">
|
|
|
|
|
<span className="action-btn toggle-btn">
|
|
|
|
|
<img className="icon-img" src="/icons/more.svg" />
|
|
|
|
|
</span>
|
|
|
|
|
<div className="action-btns-wrapper">
|
|
|
|
|
<div className="action-btns-container">
|
|
|
|
|
<span className="btn" onClick={handlePinShortcutBtnClick}>
|
|
|
|
|
{shortcut.rowStatus === "ARCHIVED" ? "Unpin" : "Pin"}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="btn" onClick={handleEditShortcutBtnClick}>
|
|
|
|
|
Edit
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
className={`btn delete-btn ${showConfirmDeleteBtn ? "final-confirm" : ""}`}
|
|
|
|
|
onClick={handleDeleteMemoClick}
|
|
|
|
|
onMouseLeave={handleDeleteBtnMouseLeave}
|
|
|
|
|
>
|
|
|
|
|
{showConfirmDeleteBtn ? "Delete!" : "Delete"}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className={`btns-container ${userService.isVisitorMode() ? "!hidden" : ""}`}>
|
|
|
|
|
<span className="action-btn toggle-btn">
|
|
|
|
|
<img className="icon-img" src="/icons/more.svg" />
|
|
|
|
|
</span>
|
|
|
|
|
<div className="action-btns-wrapper">
|
|
|
|
|
<div className="action-btns-container">
|
|
|
|
|
<span className="btn" onClick={handlePinShortcutBtnClick}>
|
|
|
|
|
{shortcut.rowStatus === "ARCHIVED" ? "Unpin" : "Pin"}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="btn" onClick={handleEditShortcutBtnClick}>
|
|
|
|
|
Edit
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
className={`btn delete-btn ${showConfirmDeleteBtn ? "final-confirm" : ""}`}
|
|
|
|
|
onClick={handleDeleteMemoClick}
|
|
|
|
|
onMouseLeave={handleDeleteBtnMouseLeave}
|
|
|
|
|
>
|
|
|
|
|
{showConfirmDeleteBtn ? "Delete!" : "Delete"}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|