Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import { observer } from "mobx-react";
|
|
import { useParams } from "next/navigation";
|
|
|
|
// plane imports
|
|
import { useTranslation } from "@plane/i18n";
|
|
import { AddOutline } from "@makeplane/propel/icons";
|
|
// hooks
|
|
import { useSticky } from "@/hooks/use-stickies";
|
|
// local imports
|
|
import { StickiesTruncated } from "./layout/stickies-truncated";
|
|
import { StickySearch } from "./modal/search";
|
|
import { useStickyOperations } from "./sticky/use-operations";
|
|
|
|
export const StickiesWidget = observer(function StickiesWidget() {
|
|
// params
|
|
const { workspaceSlug } = useParams();
|
|
// store hooks
|
|
const { creatingSticky, toggleShowNewSticky } = useSticky();
|
|
const { t } = useTranslation();
|
|
// sticky operations
|
|
const { stickyOperations } = useStickyOperations({
|
|
workspaceSlug: workspaceSlug?.toString() ?? "",
|
|
});
|
|
|
|
return (
|
|
<div>
|
|
<div className="mb-4 flex items-center justify-between">
|
|
<div className="text-14 font-semibold text-tertiary">{t("stickies.title")}</div>
|
|
{/* actions */}
|
|
<div className="flex gap-2">
|
|
<StickySearch />
|
|
<button
|
|
onClick={() => {
|
|
toggleShowNewSticky(true);
|
|
stickyOperations.create();
|
|
}}
|
|
className="my-auto flex gap-1 text-13 font-medium text-accent-primary"
|
|
disabled={creatingSticky}
|
|
>
|
|
<AddOutline className="my-auto size-4" />
|
|
<span>{t("stickies.add")}</span>
|
|
{creatingSticky && (
|
|
<div
|
|
className="size-4 animate-spin rounded-full border-2 border-accent-strong border-t-transparent"
|
|
role="status"
|
|
aria-label="loading"
|
|
/>
|
|
)}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div className="-mx-2">
|
|
<StickiesTruncated />
|
|
</div>
|
|
</div>
|
|
);
|
|
});
|