diff --git a/apps/app/components/command-palette/command-pallette.tsx b/apps/app/components/command-palette/command-pallette.tsx index 3feca33f6..101ae25fd 100644 --- a/apps/app/components/command-palette/command-pallette.tsx +++ b/apps/app/components/command-palette/command-pallette.tsx @@ -45,6 +45,7 @@ import { ChangeIssuePriority, ChangeIssueAssignee, ChangeInterfaceTheme, + ProductUpdatesModal, } from "components/command-palette"; import { BulkDeleteIssuesModal } from "components/core"; import { CreateUpdateCycleModal } from "components/cycles"; @@ -74,6 +75,7 @@ export const CommandPalette: React.FC = () => { const [isIssueModalOpen, setIsIssueModalOpen] = useState(false); const [isProjectModalOpen, setIsProjectModalOpen] = useState(false); const [isShortcutsModalOpen, setIsShortcutsModalOpen] = useState(false); + const [isProductUpdatesModalOpen, setIsProductUpdatesModalOpen] = useState(false); const [isCreateCycleModalOpen, setIsCreateCycleModalOpen] = useState(false); const [isCreateViewModalOpen, setIsCreateViewModalOpen] = useState(false); const [isCreateModuleModalOpen, setIsCreateModuleModalOpen] = useState(false); @@ -221,6 +223,8 @@ export const CommandPalette: React.FC = () => { setIsCreateCycleModalOpen(true); } else if (keyPressed === "m") { setIsCreateModuleModalOpen(true); + } else if (keyPressed === "u") { + setIsProductUpdatesModalOpen(true); } } }, @@ -324,6 +328,10 @@ export const CommandPalette: React.FC = () => { return ( <> + {workspaceSlug && ( )} @@ -393,7 +401,7 @@ export const CommandPalette: React.FC = () => { leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - + { if (value.toLowerCase().includes(search.toLowerCase())) return 1; diff --git a/apps/app/components/command-palette/index.ts b/apps/app/components/command-palette/index.ts index 858aba401..27bad1357 100644 --- a/apps/app/components/command-palette/index.ts +++ b/apps/app/components/command-palette/index.ts @@ -4,3 +4,4 @@ export * from "./change-issue-state"; export * from "./change-issue-priority"; export * from "./change-issue-assignee"; export * from "./change-interface-theme"; +export * from "./product-updates-modal"; diff --git a/apps/app/components/command-palette/product-updates-modal.tsx b/apps/app/components/command-palette/product-updates-modal.tsx new file mode 100644 index 000000000..c099cf505 --- /dev/null +++ b/apps/app/components/command-palette/product-updates-modal.tsx @@ -0,0 +1,76 @@ +import React from "react"; +import useSWR from "swr"; + +// headless ui +import { Dialog, Transition } from "@headlessui/react"; +// icons +import { XMarkIcon } from "@heroicons/react/20/solid"; +import workspaceService from "services/workspace.service"; +import { MarkdownRenderer } from "components/ui"; + +type Props = { + isOpen: boolean; + setIsOpen: React.Dispatch>; +}; + +export const ProductUpdatesModal: React.FC = ({ isOpen, setIsOpen }) => { + const { data: updates } = useSWR("PRODUCT_UPDATES", () => workspaceService.getProductUpdates()); + console.log("updates:", updates); + return ( + + + + + + + + + + + + + + + Product Updates + + setIsOpen(false)}> + + + + + {updates && + updates.length > 0 && + updates.map((item: any) => )} + + + + + + + + + + ); +}; diff --git a/apps/app/components/ui/index.ts b/apps/app/components/ui/index.ts index 855655062..5c23ecdf5 100644 --- a/apps/app/components/ui/index.ts +++ b/apps/app/components/ui/index.ts @@ -20,3 +20,4 @@ export * from "./progress-bar"; export * from "./spinner"; export * from "./tooltip"; export * from "./toggle-switch"; +export * from "./markdown-to-component"; diff --git a/apps/app/components/ui/markdown-to-component.tsx b/apps/app/components/ui/markdown-to-component.tsx new file mode 100644 index 000000000..cb716bc22 --- /dev/null +++ b/apps/app/components/ui/markdown-to-component.tsx @@ -0,0 +1,77 @@ +import React from "react"; +import ReactMarkdown from "react-markdown"; + +interface CustomComponentProps { + href: string; + children: React.ReactNode; +} + +type CustomComponent = React.ComponentType; + +interface Props { + markdown: string; + components?: { + a?: CustomComponent; + blockquote?: CustomComponent; + code?: CustomComponent; + del?: CustomComponent; + em?: CustomComponent; + heading?: CustomComponent; + hr?: CustomComponent; + image?: CustomComponent; + inlineCode?: CustomComponent; + link?: CustomComponent; + list?: CustomComponent; + listItem?: CustomComponent; + paragraph?: CustomComponent; + strong?: CustomComponent; + table?: CustomComponent; + tableCell?: CustomComponent; + tableHead?: CustomComponent; + tableRow?: CustomComponent; + }; + options?: any; +} + +const HeadingPrimary: CustomComponent = ({ children }) => ( + {children} +); + +const HeadingSecondary: CustomComponent = ({ children }) => ( + {children} +); + +const Paragraph: CustomComponent = ({ children }) => ( + {children} +); + +const OrderedList: CustomComponent = ({ children }) => ( + {children} +); + +const UnorderedList: CustomComponent = ({ children }) => ( + {children} +); + +const Link: CustomComponent = ({ href, children }) => ( + + {children} + +); + +export const MarkdownRenderer: React.FC = ({ markdown, options = {} }) => { + const customComponents = { + h1: HeadingPrimary, + h3: HeadingSecondary, + p: Paragraph, + ol: OrderedList, + ul: UnorderedList, + a: Link, + }; + + return ( + + {markdown} + + ); +}; diff --git a/apps/app/package.json b/apps/app/package.json index 6911625b2..d3c414210 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -36,6 +36,7 @@ "react-dom": "18.2.0", "react-dropzone": "^14.2.3", "react-hook-form": "^7.38.0", + "react-markdown": "^8.0.7", "recharts": "^2.3.2", "remirror": "^2.0.23", "swr": "^1.3.0",
{children}