chore: community edition product updates link (#6132)
* chore: community edition product updates link * fix: iframe embed for changelog --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
2768f560ad
commit
849d9891d2
4 changed files with 23 additions and 61 deletions
1
packages/types/src/instance/base.d.ts
vendored
1
packages/types/src/instance/base.d.ts
vendored
|
|
@ -57,6 +57,7 @@ export interface IInstanceConfig {
|
||||||
// intercom
|
// intercom
|
||||||
is_intercom_enabled: boolean;
|
is_intercom_enabled: boolean;
|
||||||
intercom_app_id: string | undefined;
|
intercom_app_id: string | undefined;
|
||||||
|
instance_changelog_url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IInstanceAdmin {
|
export interface IInstanceAdmin {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
// emoji-picker-react
|
|
||||||
import { Emoji } from "emoji-picker-react";
|
import { Emoji } from "emoji-picker-react";
|
||||||
import { TLogoProps } from "@plane/types";
|
|
||||||
// helpers
|
|
||||||
import { LUCIDE_ICONS_LIST } from "@plane/ui";
|
|
||||||
import { emojiCodeToUnicode } from "@/helpers/emoji.helper";
|
|
||||||
// import { icons } from "lucide-react";
|
|
||||||
import useFontFaceObserver from "use-font-face-observer";
|
import useFontFaceObserver from "use-font-face-observer";
|
||||||
|
// types
|
||||||
|
import { TLogoProps } from "@plane/types";
|
||||||
|
// ui
|
||||||
|
import { LUCIDE_ICONS_LIST } from "@plane/ui";
|
||||||
|
// helpers
|
||||||
|
import { emojiCodeToUnicode } from "@/helpers/emoji.helper";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
logo: TLogoProps;
|
logo: TLogoProps;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,13 @@
|
||||||
import { FC, useRef } from "react";
|
import { FC } from "react";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import useSWR from "swr";
|
|
||||||
// editor
|
|
||||||
import { DocumentReadOnlyEditorWithRef, EditorRefApi } from "@plane/editor";
|
|
||||||
// ui
|
// ui
|
||||||
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";
|
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";
|
||||||
// helpers
|
// components
|
||||||
import { LogoSpinner } from "@/components/common";
|
|
||||||
import { ProductUpdatesFooter } from "@/components/global";
|
import { ProductUpdatesFooter } from "@/components/global";
|
||||||
|
// hooks
|
||||||
|
import { useInstance } from "@/hooks/store";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { ProductUpdatesHeader } from "@/plane-web/components/global";
|
import { ProductUpdatesHeader } from "@/plane-web/components/global";
|
||||||
// services
|
|
||||||
import { InstanceService } from "@/services/instance.service";
|
|
||||||
|
|
||||||
const instanceService = new InstanceService();
|
|
||||||
|
|
||||||
export type ProductUpdatesModalProps = {
|
export type ProductUpdatesModalProps = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
|
|
@ -22,20 +16,16 @@ export type ProductUpdatesModalProps = {
|
||||||
|
|
||||||
export const ProductUpdatesModal: FC<ProductUpdatesModalProps> = observer((props) => {
|
export const ProductUpdatesModal: FC<ProductUpdatesModalProps> = observer((props) => {
|
||||||
const { isOpen, handleClose } = props;
|
const { isOpen, handleClose } = props;
|
||||||
// refs
|
|
||||||
const editorRef = useRef<EditorRefApi>(null);
|
const { config } = useInstance();
|
||||||
// swr
|
|
||||||
const { data, isLoading, error } = useSWR(`INSTANCE_CHANGELOG`, () => instanceService.getInstanceChangeLog(), {
|
|
||||||
shouldRetryOnError: false,
|
|
||||||
revalidateIfStale: false,
|
|
||||||
revalidateOnFocus: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.CENTER} width={EModalWidth.XXL}>
|
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.CENTER} width={EModalWidth.XXL}>
|
||||||
<ProductUpdatesHeader />
|
<ProductUpdatesHeader />
|
||||||
<div className="flex flex-col h-[60vh] vertical-scrollbar scrollbar-xs overflow-hidden overflow-y-scroll px-6 mx-0.5">
|
<div className="flex flex-col h-[60vh] vertical-scrollbar scrollbar-xs overflow-hidden overflow-y-scroll px-6 mx-0.5">
|
||||||
{!isLoading && !!error ? (
|
{config?.instance_changelog_url && config?.instance_changelog_url !== "" ? (
|
||||||
|
<iframe src={config?.instance_changelog_url} className="w-full h-full" />
|
||||||
|
) : (
|
||||||
<div className="flex flex-col items-center justify-center w-full h-full mb-8">
|
<div className="flex flex-col items-center justify-center w-full h-full mb-8">
|
||||||
<div className="text-lg font-medium">We are having trouble fetching the updates.</div>
|
<div className="text-lg font-medium">We are having trouble fetching the updates.</div>
|
||||||
<div className="text-sm text-custom-text-200">
|
<div className="text-sm text-custom-text-200">
|
||||||
|
|
@ -50,33 +40,6 @@ export const ProductUpdatesModal: FC<ProductUpdatesModalProps> = observer((props
|
||||||
for the latest updates.
|
for the latest updates.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : isLoading ? (
|
|
||||||
<div className="flex items-center justify-center w-full h-full">
|
|
||||||
<LogoSpinner />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="ml-5">
|
|
||||||
{data?.id && (
|
|
||||||
<DocumentReadOnlyEditorWithRef
|
|
||||||
ref={editorRef}
|
|
||||||
disabledExtensions={[]}
|
|
||||||
id={data.id}
|
|
||||||
initialValue={data.description_html ?? "<p></p>"}
|
|
||||||
containerClassName="p-0 border-none"
|
|
||||||
mentionHandler={{
|
|
||||||
highlights: () => Promise.resolve([]),
|
|
||||||
}}
|
|
||||||
embedHandler={{
|
|
||||||
issue: {
|
|
||||||
widgetCallback: () => <></>,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
fileHandler={{
|
|
||||||
getAssetSrc: () => Promise.resolve(""),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ProductUpdatesFooter />
|
<ProductUpdatesFooter />
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
|
||||||
const { canUseLocalDB, toggleLocalDB } = useUserSettings();
|
const { canUseLocalDB, toggleLocalDB } = useUserSettings();
|
||||||
// states
|
// states
|
||||||
const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false);
|
const [isNeedHelpOpen, setIsNeedHelpOpen] = useState(false);
|
||||||
const [isChangeLogOpen, setIsChangeLogOpen] = useState(false);
|
const [isProductUpdatesModalOpen, setProductUpdatesModalOpen] = useState(false);
|
||||||
|
|
||||||
const handleCrispWindowShow = () => {
|
const handleCrispWindowShow = () => {
|
||||||
toggleIntercom(!isIntercomToggle);
|
toggleIntercom(!isIntercomToggle);
|
||||||
|
|
@ -42,7 +42,7 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProductUpdatesModal isOpen={isChangeLogOpen} handleClose={() => setIsChangeLogOpen(false)} />
|
<ProductUpdatesModal isOpen={isProductUpdatesModalOpen} handleClose={() => setProductUpdatesModalOpen(false)} />
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex w-full items-center justify-between px-2 self-baseline border-t border-custom-border-200 bg-custom-sidebar-background-100 h-12 flex-shrink-0",
|
"flex w-full items-center justify-between px-2 self-baseline border-t border-custom-border-200 bg-custom-sidebar-background-100 h-12 flex-shrink-0",
|
||||||
|
|
@ -56,8 +56,7 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
|
||||||
>
|
>
|
||||||
<CustomMenu
|
<CustomMenu
|
||||||
customButton={
|
customButton={
|
||||||
<button
|
<div
|
||||||
type="button"
|
|
||||||
className={cn(
|
className={cn(
|
||||||
"grid place-items-center rounded-md p-1 outline-none text-custom-text-200 hover:text-custom-text-100 hover:bg-custom-background-90",
|
"grid place-items-center rounded-md p-1 outline-none text-custom-text-200 hover:text-custom-text-100 hover:bg-custom-background-90",
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +67,7 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
|
||||||
<Tooltip tooltipContent="Help" isMobile={isMobile} disabled={isNeedHelpOpen}>
|
<Tooltip tooltipContent="Help" isMobile={isMobile} disabled={isNeedHelpOpen}>
|
||||||
<HelpCircle className="h-[18px] w-[18px] outline-none" />
|
<HelpCircle className="h-[18px] w-[18px] outline-none" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</button>
|
</div>
|
||||||
}
|
}
|
||||||
customButtonClassName={`relative grid place-items-center rounded-md p-1.5 outline-none ${isCollapsed ? "w-full" : ""}`}
|
customButtonClassName={`relative grid place-items-center rounded-md p-1.5 outline-none ${isCollapsed ? "w-full" : ""}`}
|
||||||
menuButtonOnClick={() => !isNeedHelpOpen && setIsNeedHelpOpen(true)}
|
menuButtonOnClick={() => !isNeedHelpOpen && setIsNeedHelpOpen(true)}
|
||||||
|
|
@ -135,14 +134,13 @@ export const SidebarHelpSection: React.FC<WorkspaceHelpSectionProps> = observer(
|
||||||
</button>
|
</button>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
<CustomMenu.MenuItem>
|
<CustomMenu.MenuItem>
|
||||||
<a
|
<button
|
||||||
target="_blank"
|
|
||||||
type="button"
|
type="button"
|
||||||
href="https://plane.so/changelog/community"
|
onClick={() => setProductUpdatesModalOpen(true)}
|
||||||
className="flex w-full items-center justify-start text-xs hover:bg-custom-background-80"
|
className="flex w-full items-center justify-start text-xs hover:bg-custom-background-80"
|
||||||
>
|
>
|
||||||
<span className="text-xs">What's new</span>
|
<span className="text-xs">What's new</span>
|
||||||
</a>
|
</button>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
<CustomMenu.MenuItem>
|
<CustomMenu.MenuItem>
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue