forked from github/plane
* feat: manual ordering for issues in kanban * refactor: issues folder structure * refactor: modules and states folder structure * refactor: datepicker code * fix: create issue modal bug * feat: custom progress bar added * refactor: created global component for kanban board * refactor: update cycle and module issue create * refactor: return modules created * refactor: integrated global kanban view everywhere * refactor: integrated global list view everywhere * refactor: removed unnecessary api calls * refactor: update nomenclature for consistency * refactor: global select component for issue view * refactor: track cycles and modules for issue * fix: tracking new cycles and modules in activities * feat: segregate api token workspace * fix: workpsace id during token creation * refactor: update model association to cascade on delete * feat: sentry integrated (#235) * feat: sentry integrated * fix: removed unnecessary env variable * fix: update remirror description to save empty string and empty paragraph (#237) * Update README.md * fix: description and comment_json default value to remove warnings * feat: link option in remirror (#240) * feat: link option in remirror * fix: removed link import from remirror toolbar * feat: module and cycle settings under project * fix: module issue assignment * fix: module issue updation and activity logging * fix: typo while creating module issues * fix: string comparison for update operation * fix: ui fixes (#246) * style: shortcut command label bg color change * sidebar shortcut ui fix --------- Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia1001@gmail.com> * fix: update empty passwords to hashed string and add hashing for magic sign in * refactor: remove print logs from back migrations * build(deps): bump django in /apiserver/requirements Bumps [django](https://github.com/django/django) from 3.2.16 to 3.2.17. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/3.2.16...3.2.17) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * feat: cycles and modules toggle in settings, refactor: folder structure (#247) * feat: link option in remirror * fix: removed link import from remirror toolbar * refactor: constants folder * refactor: layouts folder structure * fix: issue view context * feat: cycles and modules toggle in settings --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia1001@gmail.com> Co-authored-by: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Co-authored-by: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Co-authored-by: sphynxux <122926002+sphynxux@users.noreply.github.com> Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
142 lines
4.7 KiB
TypeScript
142 lines
4.7 KiB
TypeScript
import { useState, useRef, FC } from "react";
|
|
import { Transition } from "@headlessui/react";
|
|
import Link from "next/link";
|
|
// icons
|
|
import { ArrowLongLeftIcon } from "@heroicons/react/24/outline";
|
|
import {
|
|
QuestionMarkCircleIcon,
|
|
BoltIcon,
|
|
DocumentIcon,
|
|
DiscordIcon,
|
|
GithubIcon,
|
|
CommentIcon,
|
|
} from "components/icons";
|
|
// hooks
|
|
import useTheme from "hooks/use-theme";
|
|
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
|
|
|
const helpOptions = [
|
|
{
|
|
name: "Documentation",
|
|
href: "https://docs.plane.so/",
|
|
Icon: DocumentIcon,
|
|
},
|
|
{
|
|
name: "Join our Discord",
|
|
href: "https://discord.com/invite/A92xrEGCge",
|
|
Icon: DiscordIcon,
|
|
},
|
|
{
|
|
name: "Report a bug",
|
|
href: "https://github.com/makeplane/plane/issues/new/choose",
|
|
Icon: GithubIcon,
|
|
},
|
|
{
|
|
name: "Chat with us",
|
|
href: "mailto:hello@plane.so",
|
|
Icon: CommentIcon,
|
|
},
|
|
];
|
|
|
|
export interface WorkspaceHelpSectionProps {
|
|
setSidebarActive: React.Dispatch<React.SetStateAction<boolean>>;
|
|
}
|
|
|
|
export const WorkspaceHelpSection: FC<WorkspaceHelpSectionProps> = (props) => {
|
|
const { setSidebarActive } = props;
|
|
// theme
|
|
const { collapsed: sidebarCollapse, toggleCollapsed } = useTheme();
|
|
// states
|
|
const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false);
|
|
// refs
|
|
const helpOptionsRef = useRef<HTMLDivElement | null>(null);
|
|
// hooks
|
|
useOutsideClickDetector(helpOptionsRef, () => setIsNeedHelpOpen(false));
|
|
|
|
const helpOptionMode = sidebarCollapse ? "left-full" : "left-[-75px]";
|
|
|
|
return (
|
|
<div
|
|
className={`flex w-full items-center justify-between self-baseline bg-primary px-2 py-2 ${
|
|
sidebarCollapse ? "flex-col-reverse" : ""
|
|
}`}
|
|
>
|
|
<button
|
|
type="button"
|
|
className={`hidden items-center gap-3 rounded-md px-2 py-2 text-xs font-medium text-gray-500 outline-none hover:bg-gray-100 hover:text-gray-900 md:flex ${
|
|
sidebarCollapse ? "w-full justify-center" : ""
|
|
}`}
|
|
onClick={() => toggleCollapsed()}
|
|
>
|
|
<ArrowLongLeftIcon
|
|
className={`h-4 w-4 flex-shrink-0 text-gray-500 duration-300 group-hover:text-gray-900 ${
|
|
sidebarCollapse ? "rotate-180" : ""
|
|
}`}
|
|
/>
|
|
</button>
|
|
<button
|
|
type="button"
|
|
className="flex items-center gap-3 rounded-md px-2 py-2 text-xs font-medium text-gray-500 outline-none hover:bg-gray-100 hover:text-gray-900 md:hidden"
|
|
onClick={() => setSidebarActive(false)}
|
|
>
|
|
<ArrowLongLeftIcon className="h-4 w-4 flex-shrink-0 text-gray-500 group-hover:text-gray-900" />
|
|
</button>
|
|
<button
|
|
type="button"
|
|
className={`flex items-center gap-x-1 rounded-md px-2 py-2 text-xs font-medium text-gray-500 outline-none hover:bg-gray-100 hover:text-gray-900 ${
|
|
sidebarCollapse ? "w-full justify-center" : ""
|
|
}`}
|
|
onClick={() => {
|
|
const e = new KeyboardEvent("keydown", {
|
|
key: "h",
|
|
});
|
|
document.dispatchEvent(e);
|
|
}}
|
|
title="Shortcuts"
|
|
>
|
|
<BoltIcon className="h-4 w-4 text-gray-500" />
|
|
{!sidebarCollapse && <span>Shortcuts</span>}
|
|
</button>
|
|
<div className="relative">
|
|
<Transition
|
|
show={isNeedHelpOpen}
|
|
enter="transition ease-out duration-100"
|
|
enterFrom="transform opacity-0 scale-95"
|
|
enterTo="transform opacity-100 scale-100"
|
|
leave="transition ease-in duration-75"
|
|
leaveFrom="transform opacity-100 scale-100"
|
|
leaveTo="transform opacity-0 scale-95"
|
|
>
|
|
<div
|
|
className={`absolute bottom-2 ${helpOptionMode} space-y-2 rounded-sm bg-white py-3 shadow-md`}
|
|
ref={helpOptionsRef}
|
|
>
|
|
{helpOptions.map(({ name, Icon, href }) => (
|
|
<Link href={href} key={name}>
|
|
<a
|
|
target="_blank"
|
|
className="mx-3 flex items-center gap-x-2 rounded-md whitespace-nowrap px-2 py-2 text-xs hover:bg-gray-100"
|
|
>
|
|
<Icon className="h-5 w-5 text-gray-500" />
|
|
<span className="text-sm">{name}</span>
|
|
</a>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</Transition>
|
|
<button
|
|
type="button"
|
|
className={`flex items-center gap-x-1 rounded-md px-2 py-2 text-xs font-medium text-gray-500 outline-none hover:bg-gray-100 hover:text-gray-900 ${
|
|
sidebarCollapse ? "w-full justify-center" : ""
|
|
}`}
|
|
onClick={() => setIsNeedHelpOpen((prev) => !prev)}
|
|
title="Help"
|
|
>
|
|
<QuestionMarkCircleIcon className="h-4 w-4 text-gray-500" />
|
|
{!sidebarCollapse && <span>Help?</span>}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|